asynchronous

WCF troubleshooting - async and zero results

How do you troubleshoot a WCF Service consumption from the client side (silverlight) when from the server you can tell that you service works (stepping through) and the client gets an ObservableCollection with nothing in it? void client_GetAddressesCompleted(object sender, GetAddressesCompletedEventArgs e) { var x = e.Re...

Mixing synchronous and asynchronous socket calls.

Is it considered bad practice to combine synchronous and asynchronous socket calls on the same server? For example (modified from the msdn): // Initalize everything up here while (true) { // Set the event to nonsignaled state. allDone.Reset(); //allDone is a manual reset event // Start an asynchronous socket to listen ...

AS3: Run methods in an ordered sequence

Hi: I have a class with several methods I must run in an specific order. So, I created a kind of chain where each one calls the next in its last sentence (sometimes with calls, sometimes dispatching events): internal function a(evt:SwapEvent):void { //started from custom event ... b(); } private function b():void { ... bTime...

WebRequest.BeingGetResponse and IAsyncResult.AsyncWaitHandle not working

WebRequest.BeginGetResponse returns IAsyncResult, which has a member AsyncWaitHandle. Initially, I thought that I could just wait on that in the initiating code. But it turns out that the event is signaled as soon as the request is made and before and not after EndGetResponse is called. This seems unintuitive for me but whatever. So, ...

Java asynchronous method call

I have already one thread that has to do following work: public class DetectionHandler extends TimerTask { @Override public void run() { bluetoothAddresses = BluetoothModule.scanAddresses(); wiFiAddresses = WiFiModule.scanAddresses(); ...//when scanning is finished, continue work } I would like that scanning to be parallel. So I assu...

Why is the pattern to update UI from a different thread not built into the .NET framework?

I know "why is my this framework like/not like xyz?" questions are a bit dangerous but I want to see what I'm missing. In WinForms, you can't update the UI from another thread. Most people use this pattern: private void EventHandler(object sender, DirtyEventArgs e) { if (myControl.InvokeRequired) myControl.Invoke(new Method...

Badges system using asynchronous php call

I'd like to implement a badge/reputation system on one of my site. When a user performs an action an event will be raised (ex: QUESTION_PUBLISHED) so that the system can check if a new badge can be awarded to the user. The logic for some of the badges is quite complex and would require slow sql queries. Instead of using cron jobs I was ...

Async socket programming and F#

I have a WCF service, which works with sockets async, I have some performance issue so I decided to refactor the code, I read some articles about the ease of use of F# for async and multi threading and so on, but i want to know I'll gain a better performance to use F# parallelism? and its easy compatible with WCF service, I have a large ...

Asynchronous use of webclient to transfer files

I have an objective to transfer some files which can be pdf, jpg and xml from one location to another. I am creating a handler based API for that. What could be the best approach for doing it? Should i return a byte array so that the client can pick the byte array and convert it back to file? Also the max file size I need to handle is 18...

about asynchronous draw method

Please teach the method to draw in 2D image by the asynchronous (each method of Windows API and DirectX). ...

WebClient.DownloadFileAsync downloading the file on server

I am downloading a file from a remote location to my local machine. The paths I am using are saved in web.config and are in following format: <add key="FileFolder" value="Files/"/> <add key="LocalFileFolder" value="D:\REAL\" /> the code I am using to download is: CreateDirectoryIfDoesNotExist(); WebClient webClient = new WebClien...

Ruby concurrency/asynchronous processing (with simple use case)

I was looking into ruby's parallel/asynchronous processing capabilities and read many articles and blog posts. I looked through EventMachine, Fibers, Revactor, Reia, etc, etc. Unfortunately, I wasn't able to find a simple, effective (and non-IO-blocking) solution for this very simple use case: File.open('somelogfile.txt') do |file| wh...

WPF binding isAsync Get State

I am using Binding IsAsync property to keep UI responsive and loading data from the get accessor of the property and proved to be a good option while using MVVM. This approach is great and doesn't need any manual code for async operations. There are few instances where my dataload is taking few seconds and during this time it is very dif...

closing a socket channel asynchronously

I have a single-threaded non-blocking socket IO server written in Java using nio. When I have finished writing to a connection, I want to close it. Does the closing of the channel mean blocking until all buffered writes have been acknowledged by the recipient? It would be useful to know if, when asynchronously closing, it succeeded or...

Threads vs. Async

I have been reading up on the threaded model of programming versus the asynchronous model from this really good article. http://krondo.com/blog/?p=1209 However, the article mentions the following points. An async program will simply outperform a sync program by switching between tasks whenever there is a I/O. Threads are managed by th...

Asynchronous architecture : Error handling

Hi , what is the most elegant way to handle errors in an Asynchronous arch. assuming I have the following workflow : I have a web application that creates new files (bussines configuration files) from that point the following steps are copying the new files to a network shared file system . dispatching refresh commands to several app...

How to async add elements to Queue<T> in C#?

public void EnqueueTask(int[] task) { lock (_locker) { _taskQ.Enqueue(task); Monitor.PulseAll(_locker); } } So, here I'm adding elements to my queue and than threads do some work with them.How can I add items to my queue asynchronously? ...

Why is there a need for Twisted?

I have been playing around with the twisted framework for about a week now(more because of curiosity rather than having to use it) and its been a lot of fun doing event driven asynchronous network programming. However, there is something that I fail to understand. The twisted documentation starts off with Twisted is a framework desig...

Can twisted be implemented in Java?

I remember reading that the following features lead to the development of interesting frameworks/libraries in Python:- (I read the article from http://www.python.org/workshops/2002-02/papers/09/index.htm) A simple class model, which facilitates inheritance. Dynamic typing, which means that the code needs to assume less. Built-in memory...

Android asynchronus HTTP client problem

Hi guys, I am trying to implement asynchronus http client for Android and I am haveing a trouble with type mismatch: The method execute(HttpUriRequest) in the type HttpClient is not applicable for the arguments (HttpRequest) I am doing all based on this tutorial: http://blog.androgames.net/12/retrieving-data-asynchronously/ Hav...