Asynchronous programming is simply allowing some portions of code to be executed on separate threads. It makes your applications perform better, be more responsive, and use the resources of the system they are running on to the fullest extent.

learn more… | top users | synonyms (1)

3
votes
1answer
45 views

A Switch for async function invocations

I have implemented a simple "switch" function - that switches and invokes an alternate function, if the function that is to be invoked fails or timesout. This code will be later employed as part of ...
1
vote
1answer
50 views

WPF Mvvm async function ViewModel

I worried about this code in a ViewModel. ViewModel shoud not contain any code exept binding's. But without async update ui should stuck. How to improve it? The main problem that this is need to be ...
4
votes
0answers
30 views

Async.sequence implementation

I have a simple implementation for "Async.sequence" (the name came from here), but I would like someone to review it for performance, tail call optimization, and ...
2
votes
2answers
54 views

Reading genetic data in VCF and Tabix formats using an asynchronous library

I'm working with an open-source library for processing and parsing genetic data in VCF and Tabix formats. It contains functions and classes that make it easy to read an index file (a Tabix) and load ...
7
votes
1answer
108 views

Make Simultaneous HTTP Requests That Resolve Into a Single Return

This week, in an ongoing job search, I was tasked with the following pre-screening question: Make two simultaneous http requests. Use the language and library of your choice. Make sure the results ...
2
votes
1answer
51 views

Android network API request

I often use a similar scheme work with an API project. Can it be made easier, or is there a standard approach? This class creates an API request: ...
-1
votes
1answer
35 views

Synchronous loop with internal asynchronous calls

Below I've written a simple version of what I'm attempting to accomplish. I'm new to asynchronous functions, so it's difficult to wrap my head around this. My goal is to wait for the loop to finish ...
2
votes
1answer
118 views

Retrieving the lotto numbers - Node.js

I'm looking for feedback as to how I've structured the async calls, and If anything should be written differently. endpoints.js ...
1
vote
1answer
34 views

Using promises to GET and process data

I'm working on a Meteor application which integrates a user's contacts from external sources (Google in the case of this example). I'm currently writing the server side code to retrieve this data and ...
0
votes
0answers
54 views

Register a node-client code through an API call efficiently?

I've got a node_module that reads ArcValues for a user and updates the config of the node client at user's local (root). Like so: ...
1
vote
0answers
31 views

API design for loading OpenGL textures asynchronously

What do you think about this API for loading OpenGL textures asynchronously? My main concern is that the loader class executes code on the client io_service. This takes away some control from the ...
3
votes
1answer
32 views

Retrieving the Currently Logged in User's Department

I hope this is the right place for this. I basically wrote the below script for a SharePoint 2013 where I needed to get the department of the currently logged in user. I was finally able to get it ...
2
votes
2answers
46 views

Async Implementation

I'm seeking code review comments for the following implementation. jsFiddle ...
0
votes
1answer
45 views

Composing IO and Async in haskell

Whether based on MVar or TVar, async implementation are always based on operation on some underlying monad IO and STM. Making Async a monad on its own, as in F# async computation builder, if done in ...
4
votes
1answer
111 views

TryRetry - Try, Catch, then Retry

I have created a class to try, catch and retry N times. My class also supports retrying asynchronously. I'm wondering if there are better ways to implement this. I'm most concerned with the ...
1
vote
1answer
126 views

Implementation of API to create a company account in a database

I'm working on an API that has a lot of controller functions like this: ...
6
votes
1answer
497 views

Login UI for an Android app

This code starts a new thread for login and reacts according to the JSON result returned by the server. I think this code has too many conditionals, exception handlers, and nested functions. ...
3
votes
0answers
73 views

Golang Tour Web Crawler Exercise

In the last few days I've played around with Go a little and took the language tour. The last exercise (text here) requires you to crawl a graph that simulates a set of Web pages with links, using ...
4
votes
2answers
125 views

Calculating pi by adding areas of thin rectangles

I wrote a small program for fun to try to prove Pi by taking a certain precision and radius and using it to calculate the area of the circle. My method should be giving me an area that is just ...
5
votes
0answers
56 views

Prevent multiple async calls from all attempting to refresh an expired OAuth token

I have some code that needs to access an API that requires OAuth authorization in the form of a token, and every time the token expires, it needs to be refreshed. I made a function called ...
-1
votes
1answer
158 views

async tcp server using async/await

Here is an async Tcp server using async/await I have written. I would be very appreciate if anyone can help to improve my code. Thank you! ...
1
vote
2answers
57 views

Spawning futures as an alternative to multithreading

I was trying to do a sample threading program, where the spawning of thread is in a while loop. I DO NOT want to generate multiple number of threads. The while loop should keep on running, ...
1
vote
1answer
223 views

Custom HttpClient Wrapper

I need to wrap httpClient because I'm using a custom token provider. I will use this code with asp.net mvc to communicate with our webApi2 server. ( Using webApi2 with directly from ui with angularjs ...
2
votes
1answer
56 views

XCTestCase#waitFalseExpectationUntilTimeout implementation

I am working on an iOS project and I'm in charge of testing most parts of it. As I write some tests, I often have the need to wait for an asynchronous method to finish, and then test that something ...
0
votes
1answer
44 views
3
votes
2answers
132 views

Queuing e-mail notifications in a background thread

I'm new to parallel programming concepts. I'm trying to implement fire-and-forgot kind of method in my project. Somebody please evaluate the below code & let me whether this is thread safe or not. ...
6
votes
0answers
159 views

Node.js parallel file download, the ES6 way

I wrote a script that downloads all PDFs found on the web page of a particular government agency. I would have chosen bash for such a task, but I want the script to ...
1
vote
1answer
43 views

Callback of setTimeout function when performing synchronous actions

Inside a function I'm calling playgame service. Once I've obtained the needed data (gameBeingPlayed), I need to show a 3..2..1 counter and then start a game. ...
1
vote
1answer
43 views

Iterations with asynchronous functions

I haven't really worked much with asynchronous code so I'm wondering if I am doing something wrong/something could go wrong. Right now of all the test cases that I have done, my code has worked but I'...
2
votes
0answers
35 views

Execute coroutines in pool

I want to run all the coroutines from the list in a pool of constant size and would like to ask if this is the right way how to achieve it. Is there any built in solution for this problem? I have not ...
2
votes
1answer
57 views

An asynchronous service to produce a results cache for a list of items

What I've created is a CacheBuilder service that will be passed in a list of items, and will build a results cache. The results are produced by making calls to ...
2
votes
1answer
149 views

User registration factory for AngularJS + Firebase app

The goal for this code is to provide a semi-secure and privileged method of user registration via a secret code that is stored as a key in the Firebase database. Subscribers to a mailing list were ...
3
votes
1answer
138 views

Closing SQL connection for async operations

The following code executes asynchron on the SQL database. Is the closing of the connection implemented in the right way? Are there any missing features regarding connection handling which need to be ...
3
votes
0answers
54 views

Basic Server/Client Model built around ASIO

For this project, I'm using the non-Boost version of the ASIO library. The basic idea is that it is a relatively simple stand-alone class capable of functioning either as a server or client depending ...
5
votes
3answers
113 views

ToPaginatedListAsync<T>

I'm using this method and I would likely have a code review. Also, I have one concern and is that source.Count() is executing synchronously and I don't know how to ...
4
votes
1answer
57 views

Controller for a vehicle servicing AJAX app

I am working on a codebase that operates in the following manner: ...
2
votes
1answer
90 views

A redundant data service

I've got a service that loads data from a databasr and it performs almost the same operations in all methods. ...
0
votes
0answers
35 views

Async boolean expression evaluator in ES6

This is a pretty simple Node package designed to accept a "boolean expression" and evaluate it asynchronously. The full project is on GitHub. Essentially, an expression like ...
2
votes
3answers
124 views

Task with feedback dialog helper class

I'm currently working in a Windows.Forms project where its very common that I need to show a responsive feedback form while a task runs. These tasks take typically ...
1
vote
1answer
52 views

Reading text from the web and writing to a JSON file

This code reads text from the web using a WebDriver element and writes data to a JSON file. I had to use if-...
2
votes
1answer
54 views

Loading images in the background for a table view

I have fetchData method which fills my imagesArray: ...
1
vote
3answers
274 views

Implementing an asynchronous mutex in C#

I wrote a simple synchronization primitive that I can use with async operations on an external REST service so that I don't call it twice from different threads and have one call fail due to not ...
1
vote
0answers
222 views

Are there pitfalls to this solution to read messages from a queue in parallel?

I've posted a question on stackoverflow: How can I consequently read messages from a queue in parallel? I would like my own answer to be reviewed. Situation We have one message queue. We would like ...
4
votes
1answer
92 views

Asynchronous start/stop state transitions

I have a third-party object with asynchronous start and stop methods. Each start and stop may fail with exception. The object is not re-entrant, i.e. I can only call its start or stop method after the ...
6
votes
1answer
138 views

Async telnet connection over StreamSocket

My team and I have a very poor understanding of best practices in relation to telnet. We have Task.Delay and Task.Wait in the ...
7
votes
1answer
134 views

Refactoring of a client API to avoid duplicated code and unclear passage of parameters

I need to develop an API. The functions of the API are requests that call the services exposed by a server. Initially the API worked like this: ...
18
votes
3answers
503 views

Synchronous / asynchronous REST client

I have working code with original design, and now I had a slight design change so trying to code review that as well. I already had code review on my original design here. Original Design: I am ...
4
votes
1answer
69 views

Angular using defer and services

I have wrote some service in AngularJS that use defer, can you check my code and tell me if I getting it right? Service (I dont really like name: ...
7
votes
1answer
280 views

Generic asynchronous SQLite search builder

I am writing a database manager that reads and writes to a local SQLite database on a mobile device. It works pretty well for the most part, but read access is somewhat slow - it takes about 2-5 ...
0
votes
1answer
61 views

Getting data async

I need to handle concurrent requests by waiting for the result of an already running operation. Is this code safe or does it contain bugs? ...