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.
5
votes
2answers
63 views
Using Task.Run(..) in a .NET property
Summary
I have a normal class which has a normal property but that property has access to an async backing field.
I'm not sure if this is the best/acceptable way to access the asyc method for this ...
2
votes
1answer
112 views
Reading multiple CSV files and asynchronously update SQLite
My console app needs to read several big CSV files to update its data, which are stored in a SQLite database. I am new to C# and would like to know if there are ways to improve this sample code I ...
2
votes
0answers
43 views
TCP async client with connection lost detection and autoreconnecting [migrated]
Here is my many-years many times modified code for TCP asynchronous client.
It is able to detect connection loss (thanks to using keep alive values).
But now, I need to reconnect it to server ...
3
votes
0answers
39 views
Implementing Async Objects/Collections in C#
I think that in terms of just general C# programming, I'm a pretty decent programmer, but am trying to develop my skills in the asynchronous/parallel area. I can get by using the TPL, but am ...
9
votes
3answers
105 views
Node.js module using Promises (client for KeePassHttp)
This is my first Node module, as well as the first time using Promises in Javascript. It is a client for the KeePass plugin "KeePassHTTP" to expose passwords securely, which I am planning on using to ...
3
votes
2answers
37 views
Multithreaded search for solutions to an inequality
This question is related to my previous question on the brute-force search
for a solution to an unsolved mathematical inequality:
$$3^{k}-2^{k}\left\lfloor \left({\tfrac {3}{2}}\right)^{k}\right\...
10
votes
1answer
112 views
Lightweight asynchronous event library in C - Threadpool module
I have finished writing a C library whose purpose is to provide a simple API for asynchronously executing functions, waiting for events on file descriptors and waiting for timeouts. The whole library ...
1
vote
0answers
34 views
Collecting a user's Stripe information
I am new to both asynchronous programming and Android development. I am allowing the user to sign in with either their email/password or their Google account. Upon successfully signing in, the user's ...
3
votes
1answer
68 views
Calculating average stock prices using producer/consumer with async
Task: calculate average price for each stock, using input data, which consists of stock id (int) and its price (float). It's important to detect jumps in prices, therefore need to keep correct ...
3
votes
1answer
47 views
jQuery wait for all paginations
I want to download data for all of my repos from the Github API.
Github paginates their responses and includes a header Link type:"next" when there's another page ...
2
votes
0answers
32 views
Asynchronous service that publishes a possibly infinite amount of events
I want to implement a service that fetches eyetracking events and publishes them to all subscribers of the stream. The whole thing is supposed to run asynchronously, so it doesn't block the UI thread. ...
3
votes
1answer
49 views
TCP retarder for network delay simulation
I would like to simulate delay over network, for that I have implemented a simple retarder (=introduce random delay while maintaining order of messages) using Boost to handle sending itself. It ...
0
votes
0answers
41 views
Open and read a large number of files from folder [duplicate]
Is this the fastest way to open a large number of files and read their contents? (The folder may contain lakhs of files.)
...
4
votes
2answers
143 views
C++ Wrapper for cURL: Multithreading and serializing asynchronous ops
I did this library to help me from one of my projects and decided to publish it on GitHub hoping people might find it useful, convenient and easy to use in their projects too.
It's a header-only ...
5
votes
1answer
81 views
Creating new async tasks
In the past, I have used AsyncTasks to perform network requests for my Android app. I recently switched to RxJava to be able to cancel the requests when the user exits an activity. I have created a ...
2
votes
2answers
84 views
Property value from an asynchronous operation
I have an app which has a session mechanism. When a user creates an account in the app initially, the API returns an access token, the expiry date of that access token and a refresh token which can be ...
5
votes
1answer
462 views
Asynchronous TCP server
After some investigation, I implemented an asynchronous TCP server as per the following example. During my investigation I was unable to find an example that cleanly shuts down the server; after some ...
2
votes
0answers
40 views
Multithreaded Monte Carlo pi approximation with own pseudorandom number generator - follow up
This is a follow up of the question I posted previously here.
I made some changes, based in the answer by MikeMB, making use of asynchronous calls (with std::async ...
6
votes
2answers
235 views
Using SendAsync to send multiple emails
My method for sending emails with Send() is getting very slow when I send more than ten messages.
Sample
1 (1 sec)
2 (2 sec)
3 (4 sec)
4 (8 sec) ...
0
votes
0answers
47 views
2
votes
1answer
14 views
Making the basic accumulator in Real World OCaml use Async
I was going through Real World OCaml and wanted to make the program in "A Complete Program" use Async. It works now, but I'm wondering how idiomatic it is, and if I'...
1
vote
0answers
44 views
Indefinite loop in a coroutine vs. re-scheduling a coroutine
I recently started working with asyncio and coroutines. I have a coroutine that runs every 0.25 seconds to print "running ..." on screen indefinitely. When the script receives a SIGTERM or SIGINT it ...
5
votes
1answer
239 views
HTTP downloader using Beast
I have written a small HTTP downloader using
boost::asio
Beast library (proposed to be included in Boost)
network::uri library ...
2
votes
1answer
215 views
Simple multi-client echo server
I've been looking at some async comms in C#. As a proof of concept, I've written a simple multi-client echo server. The server allows multiple TCP clients to connect and listens for input from the ...
2
votes
1answer
49 views
Threaded and asyncio API library
In Python I am trying to create an API for a connected device. I want to be available for both threaded (using request) and async applications (using aiohttp).
What I've come up with is wrapping the ...
3
votes
0answers
70 views
Converting MongoDB's IAsyncCursor(Source) into an Rx Observable Sequence
I've been toying with this idea for quite a while.
Needless to say that this really enables a lot of possibilities,
Especially when combined with a SignalR Backend.
Added below is what I came up with....
2
votes
2answers
95 views
Calculating Pi with Android
I'm kind of new to Java but I am writing an Android app. Right now I'm working on an async task to calculate Pi but when I run it the memory usage increases alarmingly (+5MB per second). This one ...
0
votes
1answer
40 views
Async TCP connection that handles reading and writing
My situation is as such:
I must connect to a server via TCP, at the end of the session (several hours), they will close the connection - throwing an exception that should be gracefully handled
I need ...
3
votes
0answers
71 views
Daemonizing shell scripts - MqSH
This is an mqtt driven, interactive, and asynchronous remote shell daemon written in bash. I call it "MqSH" or simply "mq". It works with bash, the busybox ash shell, and perhaps other Bourne-like ...
3
votes
0answers
43 views
Reading log file of subprocess
I run subprocesses with lot of output (compilation of Unity 3D projects).
I use log parsers to find known issues.
...
0
votes
1answer
139 views
Simple PacketHandler class
I can recently coded an emulation system and in this project I have a PacketHandler for each player connected to a socket server, and each player receives packets (data) from the client application.
...
2
votes
0answers
64 views
Waiting for all task to complete while catching exceptions early
I'm working on simulating a number of processing elements (nodes) which do some work in parallel and communicate by exchanging messages. The message exchange is not in the scope of this post, but it ...
1
vote
1answer
64 views
A Simple Async Task in Clojure
Purpose of Code: To simulate scraping the web and updating a db, by, presently, adding randomly generated numbers to a "database".
Have I wired up the followin async code properly? Is there a simpler,...
0
votes
1answer
144 views
HttpRequest class using AsyncTask for Android application
I am using the following class to retrieve a http response, which contains data for my Android App. Everything works fine, but there is a performance issue. I get the following warning when requesting ...
2
votes
0answers
45 views
Timeline request function for Twitter bot
I'm writing a Twitter™ bot for the Retrocomputing Stack Exchange site using JavaScript. To ensure that it doesn't tweet about the same question twice in a row, I request the account's timeline. ...
3
votes
1answer
151 views
General Retry Strategy #2
Previous version
Now supports async operations and cancellation.
Let’s say we copy some file using retry strategy (it might be blocked, etc.). App code comes bellow:
...
2
votes
0answers
74 views
Handling async in Clojure
I've defined myself a function for caching requests and their responses in a browser environment; I'm using ClojureScript.
...
4
votes
1answer
146 views
Asynchronous database query system using futures-rs in Rust
Background
I've been working on an algorithmic trading platform in Rust and utilizing the newly released futures-rs library to keep everything asynchronous and non-blocking.
One issue I've come ...
0
votes
0answers
106 views
Download of files in Async task for Android
I am using AsyncTask in Android to download files from the server. Is there a way by which I can improve the process? Can the download happen any faster? Is there a ...
3
votes
1answer
49 views
Make one greenlet tell another to shutdown
I am building a commandline app to check proxies, which has a daemon flag (running forever or just once).
There are producers, checkers and storers. I want them to run in parallel and be able to ...
2
votes
1answer
79 views
99 simple asynchronous bottles on the wall
I have some basic code which registers functions, with given variables, to be executed after a certain time has elapsed. I will roll this code into my software project when it is ready. If it works it ...
0
votes
0answers
36 views
Factory for ListenableFutureCallbak
I'm developing a Rest API, and at the moment i have a bunch of controllers like this one:
...
2
votes
0answers
713 views
Handling Firebase's asynchronous calls Android
I have written a helper class to manage callbacks from Firebase's asynchronous calls. Can this be implemented in a better way?
...
4
votes
1answer
68 views
Asynchronous task execution using actor based concurrency
I have a program where I need to implement asynchronous tasks (writing a directory to a file following any change to the directory). There is existing documentation within my organization for ...
3
votes
1answer
76 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 ...
2
votes
1answer
131 views
WPF Mvvm async function ViewModel
I worried about this code in a ViewModel. ViewModel should not contain any code except binding's. But without async update the ui would freeze. How do I improve it? I'm restricted to using .net 3.5 or ...
5
votes
1answer
59 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
67 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
160 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
114 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:
...