I'm writing my first application in nodeJS. I'm writing a telegram bot, and i was wondering how to control the flow of the application given it asynchronous nature. I come from a php background where everything was simple, procedural, one after the o
My code is something like this: for(let query of array1){ request.get(query, function(err, res, body){ var array2 = body for (let query2 of array2){ request.get(query, function(err, res, body){ var variable1 = body updateDB(query, query2 , variable1)
I have some data stored in a database. In this case the users of an application. I want to retrieve all their information and put on a layout of my application so I need that the data will be retrieved at onCreate function of my layout class to displ
I need to wait for response.response?.allHeaderFields data before executing function. I've searched the net and didn't quite get how to add "completion handler" to alamofire request. Or if there are any other ways to make the function wait. @IBA
I'm trying to execute 3 'http requests'. The problem is, because of the nature of asynchronous mode, it doesn't execute in order. All requests are to internal apis. Here's the sample code :- setInterval(function () { // First request request({}, func
I want to request a website for 40 times. I want this to be synchronously, like 10 requests 4 times. This is My code for 1 request - 40 times: 'use strict'; var request = require('request'); var co = require('co'); function callUrl(url) { return new
I have an array x[] containing data. Also there is an array of "system states" c[]. The process: for(i = 1; i < N; i++) { a = f1(x[i] + c[i-1]); b = f2(x[i] + c[i-1]); c[i] = a + b; } Is there any efficient way to find the values of f1 and f2
I actually use a php script for an advertising network, but the code that publisher will use is synchronous. Now, I want that the script will load asynchronous. Do I need to change all the PHP/Javascript code ? OR there is a trick to use (javascript
<?php $list_years = getYears(); require_once 'view.php'; ?> Here, getYears() is in another file. It's having fetching query. I'm using $list_years in view.php here, it is synchronized or asynchronized?This piece of code is procedural, so getYears()
I've started learning ios development a while back and I've reached the part where I'm trying to send and receive data from a server. I've ran into an issue where for example if I wanted to sign a user in or sign him up using an Asynchronous connecti
At the .run() I am trying to fetch data from URL to be used later as a part of header for every request. So at the .run() function, I am using the $http.get to fetch that data (generate token) and assigned to global value. The problem the $http.get w
I am currently going through the nodeschool.io tutorial on Javascript. This is a sample code from one of the solutions. module.exports = function (dir, filterStr, callback) { fs.readdir(dir, function (err, list) { if (err) return callback(err) list =
I'm currently learning C# coming from a java background. To get my feet wet I decided to make a simple SMTP mail application. And I learned very quickly that C# offers support for both Synchronous and Asynchronous sockets. From what I can see, there
I have a question about how to perform an asynchronous task in a while-loop until some condition is met. This is more of a theoretical question but I can see how this could be an issue in some scenarios. I'll try demonstrate the problem at an example
So I've been going over Beej's networking guide. On an earlier question, I was told that to remove a lot of the freezing happening due to blocking I/O I needed to use select to check file descriptors and such before receiving so I only received when
I like to avoid resetting data registers that don't need to be reset. For example, when streaming data through pipeline stages, if each stage has a valid bit, there is no need to reset the data registers. (I believe this eases routing and timing on t
I am currently using AFNetworking in one of my iPhone app. It's really a handy library to make asynchronous calls. However, I ran into situations in my application where I need to get the data from the server to move forward. So I figured this way of
I'm busy with a windows phone application that of course uses silverlight. This means that calling any webservices has to be done asynchronously, and since this is all good and well in regards to best practice in preventing your entire app in hanging
I have some synchronous code that looks like this: function bulk_upload(files, callback) { for (file in files) { sync_upload(file); // blocks till file uploads } print('Done uploading files'); callback(); } I now have to use an asynchronous API async
What is the correct way to write a unit test for a synchronous method calling async methods. Right now my unit test are passing, but when I try to open the page, it never returns. Why isn't my unit test failing? How can I make it fail? I replicated m
I'm integrating with a PIN device with an api containing asynchronous methods. For example one of them is called GetStatus and it raises a DeviceStateChangedEvent with the state passed into it as a parameter. I'd like to have an interface that is not
In my access database I have TABLE1 which is a linked table to a SQL 2005 server table. I have a query QUERY1 which selects a subset of TABLE1, manipulates / formats some of its data, and places that data into temporary table TMP_TABLE1 (ie. SELECT *
I am trying to do a Bonjour resolution of a service name synchronously, so I am trying to figure out how to properly wait for the netServiceDidResolveAddress() call of NSNetService. My code looks like this: service = [[NSNetService alloc] initWithDom
I have an strange behavior, which looks lika an problem with (a)synchronous method calls?!? I'm not sure! An function receives data using getJSON, post process those data, add them to an table, which is sortable by the table-sorter plugin (http://tab
I have a toolkit that I need to work with (to interface with a remote service). This toolkit queries the remote service and asks for results. It does this asynchronously, which in most cases is good, but not for creating concise methods. I want to ma
I've recently taken over a project that uses COMET to perform some collaborative work and handle a simple chat room. The guys who originally wrote this thing made up some classes on top of STOMP and Oribited to handle all the actual chatting and mess
hi i'm going to set up a rails-website where, after some initial user input, some heavy calculations are done (via c-extension to ruby, will use multithreading). as these calculations are going to consume almost all cpu-time (memory too), there shoul
Most of my daily programming work in Windows is nowadays around I/O operations of all kind (pipes, consoles, files, sockets, ...). I am well aware of different methods of reading and writing from/to different kinds of handles (Synchronous, asynchrono
the question is.... The application maybe in Silverligth. It's possible to implement SYNChonous WebService call? I try to realize any application RIA, with Grids, Edits and using WebServices in SL, but I do not understand how to make it's possible wi
I am making a jQuery synchronous call to ajax -- with the return type set to "json" -- however the return data is coming back as a string. Is there something I'm doing wrong, or is there away to convert the string to an object? var ajax_response