Questions tagged [asynchronous]

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.

Filter by
Sorted by
Tagged with
0 votes
1 answer
280 views

Typewriter animation, implemented using recursive asynchronous function [closed]

In this animation, I am wondering if it's a good idea using async/await with recursive calls and the effect may be caused to the javascript event loop. Core function: ...
solimanware's user avatar
39 votes
2 answers
13k views

A new approach to multithreading in Excel

Intro Multithreading tools exist in Excel - often to run macros in multiple instances of Excel, or to convert macros to vbscripts that can run independently. However I've often come across projects ...
Greedo's user avatar
  • 2,345
1 vote
0 answers
3k views

Async test client for TCP socket

I've made some modifications to the async client example found on MSDN for the purpose of testing a server application. It works entirely as I expect and/or want, even running multiple clients, but ...
En'gai's user avatar
  • 43
4 votes
1 answer
370 views

Send data synchronously or asynchronously

I am using below class to send data to our messaging queue by using socket either in a synchronous way or asynchronous way as ...
david's user avatar
  • 1,647
6 votes
2 answers
8k views

SemaphoreSlim limit tasks

I find myself having to loop through a lot of async calls all over the place in my code base. The current pattern we are using is to declare SemaphoreSlim(maxcount) and then await sem.WaitAsync(), ...
Gary Smith's user avatar
3 votes
1 answer
3k views

Handling exceptions from async call in synchronous caller

I am using this pattern to easily handle exceptions from async code in a non-async caller. Is this a reasonable thing to do, or am I missing something? In this relatively simply case, I have a ...
BlueMonkMN's user avatar
2 votes
0 answers
432 views

TaskQueue implementation

To overview async tasks as "Loading configuration", "Saving configuration" and "Discarding configuration" I created a TaskQueue type. I want to be able to schedule ...
NtFreX's user avatar
  • 213
3 votes
0 answers
2k views

Cancel running Task on Dispose and race condition

I'm building a wrapper around NamedPipeServerStream and NamedPipeClientStream. Currently my ...
cogumel0's user avatar
  • 181
3 votes
1 answer
4k views

Nested loop with synchronous and asynchronous behavior

The problem is as follows. I have an array of objects like so: ...
Priyath Gregory's user avatar
1 vote
1 answer
342 views

Vert.x application quickstart

I have created this repository that implements this OAuth2 flow. I wanted to use Java and create a minimal implementation of this flow with these goals in mind: Develop unit and integration tests in ...
Thomas Hirsch's user avatar
6 votes
2 answers
152 views

Starship Comparison App with ES6 Generators and the Star Wars API

Assignment Description: Make a web application that compares starships based upon the Star Wars API. There shall be: A label "Select two Starships from the dropdown lists to compare". Two dropdown-...
michael.zech's user avatar
  • 4,232
3 votes
0 answers
1k views

Asynchronous sockets with begin/end and a state machine loop

Disclaimer: I am a C++ guy, so my C# is not even close. Therefore some review might be helpful. Here is my 4th attempt at a client using asynchronous sockets. Please give feedback. The hardest part ...
Christopher Pisz's user avatar
7 votes
1 answer
115 views

Asynchronous recorder

A recorder to asynchronously record both scalar data and images and then synchronize them. The images should be cut with dynamics ROI. Here's my attempt on it. Please feel free to comment upon it and ...
magu_'s user avatar
  • 948
-1 votes
1 answer
5k views

Retry cancelled tasks

I wrote an extension method for retrying tasks when cancelled. Can speed, versatility, readability, or elegance be improved at all? ...
Owen's user avatar
  • 1,484
0 votes
1 answer
60 views

Construct URLs out of filenames of zero-byte images and open them in Firefox for re-downloading

It's a problem with FlashGot: it sometimes download zero-byte files. I think it's because I didn't use something like DownThemAll! to limit the number of concurrent downloads, but I wrote this script ...
Gao's user avatar
  • 935
0 votes
2 answers
6k views

Set Label content and make it disappear after 5 seconds

Let's say I have a label and a button. If I click the button, the label is set to some text, say "hello, world!", and after 5 seconds, it should disappear. Easy enough, right? I have the following ...
adyavanapalli's user avatar
2 votes
0 answers
361 views

AsyncLock implementation for JS

I made an AsyncLock implementation due to a comment on Hacker News saying JavaScript was missing such a necessary idea. I honestly am not terribly familiar with Threaded programming and the concept of ...
John's user avatar
  • 384
3 votes
0 answers
63 views

Runs View Model data through concurrent service calls to get data for Entity Type [closed]

I have a few issues with the following code... private async Task<EntityType> FillEntityDataAsync(ViewModel viewModel) { First, I'm thinking I need some ...
Maxwell's user avatar
  • 31
2 votes
0 answers
265 views

asyncio with live update and abort capabilities

This is my first shot at asyncio. I'm looking for any pointers you might have. Especially: Are there any race conditions? This code doesn't scale as expected. In ...
magu_'s user avatar
  • 948
8 votes
1 answer
3k views

C# Async Socket Wrapper

I'd like to get a little feedback on this async socket wrapper. My goal is to merge socket Begin/End methods into a single async call. I also wanted to wrap exceptions so they are easier to handle in ...
Walt Byers's user avatar
0 votes
1 answer
172 views

Dagger 2 test application

I have a complicated Dagger 2 use case on Android, where I have a lot of dependencies, but some of them are really slow to construct. Like 2-3 seconds slow. My solution was to create an RX ...
milosmns's user avatar
  • 103
3 votes
2 answers
6k views

Javascript progress bar in succession

In the below code snippet, on click of a button, progress bars are added one by one. The bar shows up for 3 seconds. If you continuously click on the button, it will keep adding progress bars. The ...
Rahul Arora's user avatar
1 vote
1 answer
278 views

Perform n mongodb updates at a time using SemaphoreSlim

I have a queue of jobs, and I want to process 20 at a time using asynchronous concurrency. When processing a job, some updates in MongoDb are made an a file gets uploaded to a server, that's up to ...
Dimitri's user avatar
  • 221
5 votes
2 answers
252 views

Asynchronous JavaScript to fetch remote JSON data with promises and generators

I am trying to figure out how to do async calls using promises and generators (without 3rd party libraries). Most of the examples I found on the Internet are either incomplete or confusing (at least ...
ArminMeth's user avatar
  • 155
3 votes
1 answer
1k views

Python unittest.mock.patch.object context manager

I want to test my core of handler, so I wrote this: ...
Denny's user avatar
  • 141
1 vote
0 answers
441 views

Scraping web data using asynchronous request

I've written a script using python to grab different categories from a webpage. I used "grequests" in my scraper to perform the activity. My intention here was to perform the action swiftly making ...
SIM's user avatar
  • 2,471
4 votes
0 answers
809 views

Update UI once all API calls are done

I'm learning Swift at the moment but I would like to produce well-organised code. The goal of my little app is to display the weather of my current location. I use : the API of Darksky : https://...
Adrien G's user avatar
3 votes
1 answer
60 views

Depleting certain data from a webpage asynchronously

I've written a scraper in python using asyncio library to exhaust the name, address and phone number of all category from a webpage. Few days back, when I created a scraper to parse a webpage ...
SIM's user avatar
  • 2,471
3 votes
1 answer
641 views

Process array with x parallel executions

I wanted to create a function in JavaScript using jQuery's Deferred which executes a given function for each element in an array. The function is intended for ...
cramopy's user avatar
  • 203
3 votes
1 answer
616 views

Returning the results of four $resource calls as a JSON array in AngularJS

Title pretty much says it. I need a way to elegantly handle multiple $resource calls in AngularJS. Right now, I just calling each other call on the ...
Jimenemex's user avatar
  • 185
14 votes
2 answers
6k views

Implementation of Asynchronous Cache

I have been attempting to implement a cache which caches the results of an asynchronous method, with the restriction that I only want that method to run once for any particular item in the cache. Many ...
bornfromanegg's user avatar
2 votes
2 answers
5k views

Async ASP.NET MVC 5 controller method

I'm attempting to correctly convert a synchronous controller method to asynchronous, given that the operation it performs is CPU-intensive. ...
Sinjai's user avatar
  • 227
4 votes
2 answers
700 views

Pausing and resuming a concurrent database update queue

I have a class DatabaseQueue which asynchronously runs SQLite updates that it takes from a LinkedBlockingQueue. I implemented a ...
kmecpp's user avatar
  • 143
2 votes
1 answer
35 views

Logging entries into a website form

I am logging entries into a website form using Spring4 and Java 8 (originally Java 7). I was using the slf4j logging framework firstly to write to file as a PoC and then directly to db as a mistaken ...
gringogordo's user avatar
1 vote
0 answers
746 views

Handling MongoDB data for EJS file

I'd like to render mainly mongoDB data and an array. What I want to do is allow my EJS file to use the components inside the database. ...
Michael Gee's user avatar
2 votes
1 answer
5k views

Limiting the maximum amount of goroutines run simultaneously

Here is my code which helps me to contol the maximum amount of goroutines run simultaneously. In example below maximum is 5. ...
Dmitriy.Sh.'s user avatar
1 vote
2 answers
190 views

Fire same Task after 1 minute

I am storing incoming data into SQL server database In storing process assigning group Id for 3000 records I have written windows application that check new data is incoming into the database. first ...
Shridhar's user avatar
  • 139
6 votes
2 answers
152 views

GameServer SocketListener + PlayerManagement

Today I was posting a question to get a bit of information on how to optimize my code for maximum performance. I'm a beginner to C# (in a sense) and I don't really know as much as all of you other ...
Seriosk's user avatar
  • 61
3 votes
1 answer
3k views

Running async tasks and cancelling after a timeout if necessary - follow up (1)

The previous question was a really bad design where I had all the logic in the Main method. The only way to test it was to look at the output in the console. I now ...
t3chb0t's user avatar
  • 44.2k
3 votes
1 answer
328 views

Fetch nearby chat users using Firebase and nested completion handlers

I have a method that calls three functions that each make a request to Firebase and pass back data in a completion handler. Once the data from 2 of the completion handlers is sent back, I call another ...
AnonProgrammer's user avatar
3 votes
1 answer
333 views

An async_group class to gather futures and clean them periodically

Here the short story. I have a listener on a queue which sends me several jobs. Each job is launched in a thread and takes different times to finish. I have two main constraints : I want to retrieve ...
coincoin's user avatar
  • 183
1 vote
1 answer
59 views

Asynchronous task on every element of an array

Here is some synchronous code: ...
snowfrogdev's user avatar
1 vote
1 answer
946 views

C# Multiple ASYNC requests single response (Promise like)

I'm no too good with async processes in C#. I need to implement method, that can be called multiple times by async requests, but request data and serve response once. I've created this method, ...
Kindzoku's user avatar
  • 218
0 votes
1 answer
129 views

Ensure every element in array passes asynchronous test

I've written a function which ensures all objects in the items array belong to the user. This involves a database check, which ...
Sports's user avatar
  • 21
0 votes
1 answer
274 views

AsyncTask for subscribing to current location

I made the below CurrentLocationTask as a way of reducing code duplication, as my application currently has 2 different Activity...
Bassie's user avatar
  • 559
2 votes
1 answer
9k views

Awaiting multiple HTTP Requests

Scenario : Sending a POST to 2 different endpoints (not related to or dependent on each other). I'm really just not sure if I went about this correctly, and ...
Mark's user avatar
  • 269
5 votes
1 answer
2k views

Checking HTTP headers with asyncio and aiohttp

This is one of my first attempts to do something practical with asyncio. The task is simple: Given a list of URLs, determine if the content type is HTML for ...
alecxe's user avatar
  • 17.2k
4 votes
2 answers
5k 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 ...
Pure.Krome's user avatar
2 votes
1 answer
1k 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 ...
nico9T's user avatar
  • 225
8 votes
3 answers
677 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 ...
michoel's user avatar
  • 133

1
3 4
5
6 7
11