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.
1
vote
2answers
38 views
functional javascript - how could I generalize this code that correlates parallel async requests with their results?
/**
* takes a list of componentIDs to load, relative to componentRoot
* returns a promise to the map of (ComponentID -> componentCfg)
*/
function asyncLoadComponents (componentRoot, components) ...
0
votes
0answers
41 views
WCF using TAP without worrying about timeouts
I am really liking using the new TAP pattern in .net 4.5. And am updating some of my older projects to use it.
One of the old patterns I used to use was to use EAP with WCF so I could have functions ...
3
votes
2answers
210 views
TCP async socket server client communication feedback and review
I develop my first asyn tcp socket server and client program in c# and would like to review the first parts of it. I like to get some information’s about smelly code that I missed and what I could ...
0
votes
1answer
87 views
Asynchronous version of AutoResetEvent
This is my second attempt to create asynchronous version of AutoResetEvent.
At first I tried to make it completely lock-less, but it turned out to be impossible.
This implementation contains a lock ...
6
votes
1answer
104 views
AutoResetEventAsync, am I missing something?
So I wrote an asynchronous version of AutoResetEvent:
public sealed class AutoResetEventAsync {
private readonly Task<bool> falseResult = Task.FromResult(false);
private readonly ...
1
vote
0answers
168 views
Simple Telnet Chat Server nodejs (correct way to write programs in node.js (asynchronous programming model))
I am new to node.js and asynchronous programming and this is my first small project to learn it. I have written a small Telnet Chat server and the program works but I want to know if this is the ...
2
votes
1answer
87 views
Am I using async C# correctly?
I have the following bit of code the calls out to two different command line components (each wrapped in their own Task)
public async Task<FileInfo> RasterizeAllPdfs(IEnumerable<Uri> ...
1
vote
1answer
198 views
Use and Understanding of async/await in .NET 4.5 +
All, please take the following example code
CancellationTokenSource cancelSource;
// Mark the event handler with async so you can use await in it.
private async void StartButton_Click(object ...
1
vote
1answer
231 views
TPL Thread Leak and Memory Leak
I'm trying to track down what I suppose to be memory/thread leak in one of my programs.
My program uses a function to upload a file to a Windows Azure Storage Blob. In order to make this function ...
0
votes
1answer
70 views
Perfomance and Other Improvements
I am trying to wrap my arms around all the digital files we have, so I thought I would organize all of our pictures and videos into folders named after dates. I'm learning F#, and this felt like a ...
1
vote
1answer
74 views
Putting called delegate into AsyncState parameter - Pros/cons?
I have the following interface:
public interface ILogger
{
void Log(string message, string title, StatusType type, DateTime timestamp);
IAsyncResult LogAsync(string message, string title, ...
2
votes
1answer
568 views
Correct approach to wait for multiple async methods to complete
I have an IWorkflow interface defined as follows:
public interface IWorkflow
{
Task ConfigureAsync();
Task StartAsync();
Task StopAsync();
}
And I have an Engine class:
public sealed ...
2
votes
3answers
127 views
(async) Task “Keeper” for keeping the “fresh” data - How do I improve this?
Background
I retrieve data from a 3rd party API, over HTTP. It's often slow, and sometimes just fails.
I needed a class that would keep getting data from that source, and keep it in memory.
So, ...
1
vote
0answers
72 views
MixpanelAPI - my first open source project
I would love to hear feedback on my first open source project (a very simple async API for Mixpanel)
It implements a REST client for this REST HTTP API
Review requested on the following aspects:
...
2
votes
3answers
127 views
Polling a email using async / await
I've created a create a console app that would:
Call a method to check an email account (I've done this step)
Convert the attachment to pdf (I've done this step)
Then once the conversion is complete ...
3
votes
1answer
166 views
Interview example [closed]
Recently I participated in an interview for a Russian company in Moskow and could not answer some of the simple questions. One of them I would like to ask here.
List all problems which you can see in ...
6
votes
2answers
972 views
Real World Async and Await Code Example
I have been looking everywhere to find good real world examples of the new Async and Await features in .net 4.5. I have come up with the following code to download a list of files and limit the number ...
1
vote
1answer
115 views
Calling a function when all asynchronous calls complete
Below is a simplified version of some code I am using to execute a function after all asynchronous calls complete. Is this a reasonable piece of code? It seems to work. Nothing would break if ...
4
votes
1answer
378 views
A blocking buffer manager to provide segments of a byte array
Since asynchronous operations (like Socket's Begin*-End* pairs and *Async methods) that use IOCP under the hood cause the byte array that you use as buffer to be pinned in the memory.
So if you ...
0
votes
1answer
36 views
Processing a collection of objects, one at a time, with an asynchronous method.
I currently use setInterval and a wait flag to process this collection. Is there a cleaner way?
var wait = false;
var processInterval = setInterval(function(){
if(!wait){
var currentVideo ...
8
votes
4answers
430 views
Code works but memory usage is erratic
I have the following class which is a tool for retrieving MD5 hashes of files that are input into it. They can potentially be very large files and I require cancellation and progress report, hence why ...
3
votes
2answers
437 views
“Singleton” task running - using Tasks/await - peer review/challenge
My app saves data to a file - I obviously don't want the app to write to the file from multiple locations on disk. What I want is a generic "utility" class that will know how to run a piece of code ...
2
votes
0answers
389 views
Async TCP Socket server and MSMQ write memory of exe grows rapidly
Added the following code .
if (iRx < 1) {
m_workerSocketList[socketData.m_clientNumber - 1] =null;
...
3
votes
1answer
73 views
Please review this implementation of a custom function extending jQuery.Deferred
I couldn't find an example on how to have a custom function inherit jQuery's functions while leaving the original jQuery function I'm inheriting from unchanged (I wanted my function to have a read but ...
2
votes
2answers
210 views
simple stupid F# async telnet client
Did I write this code to correctly be tail call optimized? Am I forcing computations more than I need with !? Did I generally write this asynchronously correctly to allow sends and receives to occur ...
3
votes
1answer
114 views
Code Review of AsyncPages in ASP.NET 2.0
Could somebody code-review the implementation of Async in ASP.NET 2.0 web form page below and let me know If I am missing something in implementing in a correct way?
AsyncPagesASPNET20.aspx
<%@ ...
1
vote
0answers
279 views
Cancelling Local WebClient ASync Operation
I had previously asked this question on SO. The answer pointed me towards using the task parallel library for multiple parallel downloads. I'm not actually utilizing this exact code, but it got me ...
1
vote
1answer
231 views
Node.js Nested Callbacks, multiple requests
I'm making requests to Parse.com to 3 different objects that are needed to render a View.
I'd like to know what's the general/best approach in cases like these in which there are multiple requests ...
1
vote
0answers
173 views
Node.js asynchronous code design
I am writing a lightweight JSON api, and I come from a PHP background, so I have some questions/reviews about async node.js code.
This is my code so far:
main.js
var http = require('http');
var api ...
1
vote
0answers
172 views
Amazon s3 pass through controller
Some background, I am building a website that uses amazon s3 to host its image (and other) files.
I required that images displayed on the website look like they come from my site and not from amazon ...
1
vote
2answers
103 views
A server response written in node/express/mongodb: does this look right?
This is my very very very first attempt to write anything meaningful in node. The client side is a simple form that has login, workspace, and simply saves them onto the database. It would have been a ...
3
votes
1answer
717 views
File Async writer using Tasks or new features of .Net 4.5?
This code was posted as answer to Async file writer in .Net 3.5,
My question is how would it be done better using Tasks or new features in .Net 4.5?
public sealed class Logger : IDisposable
{
...
2
votes
1answer
892 views
Async file writer in .Net 3.5
I'm curious what people think about this little bit of logging code. It seems to work ok, is there anything I'm missing?
public static class Logger
{
private static readonly object Locker = new ...
3
votes
1answer
369 views
Efficient Album Cover loading for ListView
I have a list view which display in each view a Album's name, the associated Artist and the album art.
Here is the code of my ListFragment which display this list:
public class AlbumsFragment ...
1
vote
0answers
329 views
Datagrid not refreshing correctly with Async Ping VB .Net
I have an application coded in VB.NET that has a bunch of servers in a DataGridView and does a continuous asynchronous ping. If all the servers are up it refreshes great, but if one goes down and ...
2
votes
1answer
202 views
Asynchronous Programming Code Review
I did a load test for an ASP.NET MVC application. It was basically for 2 different pages which are doing the same thing but one was synchronous and the other was asynchronous. The result was shocking. ...
2
votes
0answers
324 views
MVC Async Action Invoking Workflow
I've just started working with Workflow (WF4) and have been playing with an idea of using it in MVC3.0 controller actions to see if it improves the maintainability of complex actions; also potentially ...
2
votes
1answer
1k views
Old-way of asynchronous programming in ASP.NET MVC 3
On ASP.NET MVC, I try to write an async Controller action with the old asynchronous programming model (actually, it is the current one, new one is still a CTP).
Here, I am trying to run 4 operations ...
2
votes
2answers
2k views
Is this implementation of an Asynchronous TCP/UDP Server correct
I am trying to implement a TCP/UDP server so all I have to do is something like this:
var server = new Server(Type.UDP, "127.0.0.1", 8888);
server.OnDataRecieved += Datahandler;
server.Start();
I ...
2
votes
1answer
3k views
Loading your Javascript files asynchronous, jQuery defered vs native javascript
I need to get some script from the different social networking site, and I want to cache them. Not I want the function to be asynchronous, and non-blocking.
I have settled with a script, but I am not ...
4
votes
2answers
715 views
Async, callbacks, and closures — am I doing it right?
After having spent a month or two trying to learn JavaScript, especially functional programming, async, and closures, I finally get it. But I don't know if I'm writing elegant code... Specifically, ...
1
vote
1answer
205 views
Is this a safe/correct way to make a python LogHandler asynchronous?
I'm using some slow-ish emit() methods in Python (2.7) logging (email, http POST, etc.) and having them done synchronously in the calling thread is delaying web requests. I put together this function ...
1
vote
0answers
141 views
Using Delegates and BeginInvoke with .NET 2.0 WebServices
I'm attempting to implement a simple long-polling/comet/reverse AJAX solution, and came across the concept of delegates, specifically with the BeginInvoke and EndInvoke methods. I've built a Web ...
3
votes
1answer
1k views
Asynchronous task runner: How can it be improved?
This is my personal project. This class is responsible for running jobs asynchronously that are registered using dependency injection.
All improvement suggestions are welcome. It can be as small as ...
14
votes
1answer
4k views
What is better for Lazy-Loading Navigation Properties of detached Self-Tracking Entities through a WCF service?
I have a WCF client which passes Self-Tracking Entities to a WPF application built with MVVM. The application itself has a dynamic interface. Users can select which objects they want visible in their ...
3
votes
4answers
969 views
Asynchronous website monitor
I have a class which is responsible for checking whether a website is up or down. I've made it to run asynchronously, but I would like critique if this is a good/bad way or if there is another better ...
8
votes
2answers
701 views
Am I overlooking anything with this asynchronous read/write loop?
Here's my code:
public static void CopyStream(Stream input, Stream output)
{
var size = 8192;
var inBuffer = new byte[size];
var outBuffer = new byte[size];
IAsyncResult writeAsync ...