asynchronous

Handling multiple calls to BeginExecuteNonQuery in SQL Server 2008

Hi all, I have an application that is receiving a high volume of data that I want to store in a database. My current strategy is to fire off an asynchronous call (BeginExecuteNonQuery) with each record when it's ready. I'm using the asynchronous call to ensure that the rest of the application runs smoothly. The problem I have is that...

.NET: Do I need to keep a reference to WebClient while downloading asynchronously?

I use the following method in a piece of production code: private void DownloadData(Uri uri) { WebClient webClient = new WebClient(); DownloadDataCompletedEventHandler eh = null; eh = delegate(object sender, DownloadDataCompletedEventArgs e) { webClient.DownloadDataCompleted -= eh; ...

Obviously this is not the correct way to read with SerialPort

Hi, Let's say I want to have a function which reads data from the SerialPort and returns a byte[]. public byte[] RequestData(byte[] data) { //See code below } Something as simple as this really doesn't work/perform well and isn't very reliable: byte[] response = new byte[port.ReadBufferSize]; port.Open(); port.Write(data, 0...

Handling asynchronous edits of documents on the web

I am writing a Web application that has a user interface for editing data. The idea is something similar to a wiki where there are edits to chunks of text. What is the best way to handle asynchronous edits from multiple users? The situation I am considering is this: There is a document that is version 0. User A is editing it when it...

How to chain ajax requests?

I have to interact with a remote api that forces me to chain requests. Thats a callback-hell in asynchronous mode: // pseudocode: ajax(request_object, callback) ajax(a, function() { ajax(b(a.somedata), function() { ajax(c(b.somedata), function() { c.finish() } }) }) It would be much more readable in sync mode: sjax...

How to buffer data for send() and select()?

While a send() succeeds with all data being sent most of the time, it is not always the case. Thus people are advised to use the write-fdset for select() and poll() to check when the socket is writeable. How do usual mechanisms look like to actually buffer the data to send while still maintaining a well comprehensible sourcecode? ...

Trade-offs implementing versioning of services accessed by reliable async messaging?

Clients of HTTP services can specify the version (and format) they understand by requesting or posting data with a specific content type. The HTTP protocol defines error codes for reporting that the content type is not understood. Messaging systems (e.g. JMS, MQ Series and the like) do not have a standard way of describing message proto...

Are Event Handlers processed Asynchronously?

In VB .NET, when you call RaiseEvent X(), is the function that handles the event X processed asynchronously or synchronously. I was under the impression that RaiseEvent and the processing of the event were Synchronous unless created explictly on another thread. I've been told otherwise though. ...

Options for a message passing system for a game

I'm working on an RTS game in C++ targeted at handheld hardware (Pandora). For reference, the Pandora has a single ARM processor at ~600Mhz and runs Linux. We're trying to settle on a good message passing system (both internal and external), and this is new territory for me. It may help to give an example of a message we'd like to pas...

Multiple Asynchronous SqlClient Operations - Looking for a good example

I have been using Asynchronous operations in my WinForms client since the beginning, but only for some operations. When the ExecuteReader or the ExecuteNonQuery completes, the callback delegate fires and everything works just fine. I've basically got two issues: 1) What is the best structure for dealing with this in a real-life system...

Problems with starling/workling in production mode

Hi All, I have a rails app that has asynchronous processing, and I'm having trouble getting it to work in production mode. i start starling from the root of the application like so: starling -d -P tmp/pids/starling.pid -q log/ then i start workling like this ./script/workling_client start -t the first time i ran this, it complain...

Asynchronous method appears to not be fully executing

I have a process where an incoming user request to our system is being handled. I also want to add some metadata about the request to a database table without impacting the responsiveness of the main process. To achieve this I added a call to an asynchronous method like this: public static ReturnObject ResponsiveMethod(string ip, stri...

Does App WAIT for -initWithContentsOfURL: to retrieve web-data?

I am trying retrieve data from a .php file on a server from within an iPhone OS app. In one method, I employ the following code: NSString *aString = [[NSString alloc] initWithContentsOfURL:aURL encoding:anEncoding error:nil]; //See what I got NSLog(aString); When I run the App it seems like the App runs through the code so fast I dou...

what is the difference of calling a Web Services using Asynchronous Call vs. Asynchronous Task

What is the difference between Web Services Asynchronous Call and Asynchronous Task's. We are working an a ASP.NET application that requires to make a call to a Web Service Method that will process thousand rows of data. This process usually takes between 2 to 3 minutes (maybe more maybe less it depends of the amount of Data). So we ru...

ActionScript: When are event handlers executed?

When, in ActionScript, an event is dispatched: foo.addEventListener("some event", someHandler); foo.dispatchEvent(new Event("some event")); At what point are the event handlers executed? I ask because I caught this at the end of an Adobe developer guide: Notice that some properties are assigned to the [AsyncToken] after the call ...

What would be a good naming guideline to use in Asynchronous Programming Model?

Hello all, I am doing some refactoring on a piece of code to transform all blocking operations to their async counterparts. My code is in C# and is doing an UPnP query followed by an HTTP query. For this, I use the APM methods of UdpClient and WebClient (BeginReceive, and so on). My single method is now a succession of Call_1 -> Callba...

php script gets two ajax requests, only returns one?

I'll start from the beginning. I'm building a wordpress plugin that does double duty, in that it can be inserted in to a post via a shortcode, or added as a sidebar widget. All it does is output some js to make jquery.post requests to a local php file. The local php file makes a request to a webservice for some data. (I had to do it thi...

Making a Webservice Method Asynchronous in C#/Winforms

Lets say I am calling some web service method that I do not control. This method takes a long time to run, and whoever developed the web service did not think to include a asynchronous version. What is the best way to create an asynchronous wrapper for such a method in C#/winforms? At the moment I am using a ThreadPool to run the webs...

Python's asyncore to periodically send data using a variable timeout. Is there a better way?

I wanted to write a server that a client could connect to and receive periodic updates without having to poll. The problem I have experienced with asyncore is that if you do not return true when dispatcher.writable() is called, you have to wait until after the asyncore.loop has timed out (default is 30s). The two ways I have tried to w...

Make multiple asynchronous calls and do something when they are completed

I have run into this problem across multiple programming languages and I was just wondering what the best way to handle it is. I have three method calls that fire off asynchronously. Each one has a callback. I want to do something only when all three callbacks have completed. What is the best way to code this? I usually end up with ...