asynchronous

What is a simple way to add a timer to a method

The following is in C#. I'm trying to do something very simple (I think). I have a method that loads an XML document XDocument doc = XDocument.Load(uri); , but I don't want to tie up pc resources if there are issues (connectivity, document size, etc.). So I'd like to be able to add a timeout variable that will cut the method off af...

loading js files and other dependent js files asynchronously

I'm looking for a clean way to asynchronously load the following types of javascript files: a "core" js file (hmm, let's just call it, oh i don't know, "jquery!" haha), x number of js files that are dependent on the "core" js file being loaded, and y number of other unrelated js files. I have a couple ideas of how to go about it, but not...

Force timer's tick (including async behavior)

On my application I have a timer that checks for configuration updates from the server in a few minutes intervals. The configuration retrieval is a pretty time consuming process, so I want to force the timer's "Tick" event, but I cannot just call the timer_tick(bla,bla,bla) because it will execute synchronously. Is there a simple way t...

Does BeginReceive() get everything sent by BeginSend()?

I'm writing a program that will have both a server side and a client side, and the client side will connect to a server hosted by the same program (but by another instance of it, and usually on another machine). So basically, I have control over both aspects of the protocol. I am using BeginReceive() and BeginSend() on both sides to sen...

ItemsControl that loads items one by one asynchronously.

Hey Guys, I am creating a custom DataGrid by deriving the traditional tookit based WPF DataGrid. I want a functionality in the grid to load items one by one asynchronously, wherein as soon as ItemsSource is changed i.e. a new collection is Set to the ItemsSource property or the bound collection is Changed dues to items that rae added, m...

Asynchronous event loop design and issues.

Hello, I'm designing event loop for asynchronous socket IO using epoll/devpoll/kqueue/poll/select (including windows-select). I have two options of performing, IO operation: Non-blocking mode, poll on EAGAIN Set socket to non-blocking mode. Read/Write to socket. If operation succeeds, post completion notification to event loop. If ...

Problems with reading into buffer using boost::asio::async_read

Good day. I have a Types.hpp file in my project. And within it i have: .... namespace RC { ..... ..... struct ViewSettings { .... }; ..... } In the Server.cpp file I'm including this Types.hpp file, and i have there: class Session { ..... RC::ViewSettings tmp; boost::asio::async_read(socket_, boost::asio::buffer(&...

Continuously reading from a stream?

I have a Stream object that occasionally gets some data on it, but at unpredictable intervals. Messages that appear on the Stream are well-defined and declare the size of their payload in advance (the size is a 16-bit integer contained in the first two bytes of each message). I'd like to have a StreamWatcher class which detects when the...

Typesafe fire-and-forget asynchronous delegate invocation in C#

I recently found myself needing a typesafe "fire-and-forget" mechanism for running code asynchronously. Ideally, what I would want to do is something like: var myAction = (Action)(() => Console.WriteLine("yada yada")); myAction.FireAndForget(); // async invocation Unfortunately, the obvious choice of calling BeginInvoke() without a ...

Real time ruby apps: CRAMP vs NODE.JS

Hi folks, i was wondering if any of you had insights about which one is better, and what factors should be taken into consideration when using one of these ...

jquery two ajax call asynchrounsly in asp.net not working...

Hi all, I am developed an web application in asp.net. In this application I have used jquery ajax for some pages. In this application, when I make two ajax call asynchrounoulsy that would not do as I expceted. what is happening is even the second ajax call finishes i can see the result when the maximum time out ajax call finished. I mean...

How to send large objects using boost::asio

Good day. I'm receiving a large objects via the net using boost::asio. And I have a code: for (int i = 1; i <= num_packets; i++) boost::asio::async_read(socket_, boost::asio::buffer(Obj + packet_size * (i - 1), packet_size), boost::bind(...)); Where My_Class * Obj. I'm in doubt if that approach possible (because i have a pointer t...

Async F# vs. CCR framework

After reading about CCR : http://www.infoq.com/news/2008/12/CCR I get the impression that it does pretty much exactly the same as F# async blocks? You yield port.Receive and port.Test in order to do the same as "let!". Is this correct? And are there any benefits in CCR that you don't get with F# async? ...

How to asynchronously read to std::string using Boost::asio?

Hello. I'm learning Boost::asio and all that async stuff. How can I asynchronously read to variable user_ of type std::string? Boost::asio::buffer(user_) works only with async_write(), but not with async_read(). It works with vector, so what is the reason for it not to work with string? Is there another way to do that besides declaring c...

How to process database writes asynchronously (maybe with a message queue) from Django?

After a user submitted data to my app, I'd like to write to the database asynchronously, possibly through a message queue. How do I set up such a system? Are there any pluggable Django apps that do such message queue-based database writes? Also how do i handle errors that happens during the async processing? Would really appreciate an...

Odd performance with C# Asynchronous server socket

I'm working on a web server in C# and I have it running on Asynchronous socket calls. The weird thing is that for some reason, when you start loading pages, the 3rd request is where the browser won't connect. It just keeps saying "Connecting..." and doesn't ever stop. If I hit stop. and then refresh, it will load again, but if I try anot...

Linux and I/O completion ports?

Using winsock, you can configure sockets or seperate I/O operations to "overlap". This means that calls to perform I/O are returned immediately, while the actual operations are completed asynchronously by separate worker threads. Winsock also provides "completion ports". From what I understand, a completion port acts as a multiplexer of...

Designing a fluent Javascript interface to abstract away the asynchronous nature of AJAX

How would I design an API to hide the asynchronous nature of AJAX and HTTP requests, or basically delay it to provide a fluent interface. To show an example from Twitter's new Anywhere API: // get @ded's first 20 statuses, filter only the tweets that // mention photography, and render each into an HTML element T.User.find('ded').timelin...

Making an Extension Method Asynchronous

Is there some way I can make an Extension Method asynchronous? I have looked around for a while now, but haven't yet found anything related. Will keep looking though... ...

How can I delay running some JS code until ALL of my asynchronous JS files downloaded?

UPDATE: I have the following code: <script type="text/javascript"> function addScript(url) { var script = document.createElement('script'); script.src = url; document.getElementsByTagName('head')[0].appendChild(script); } addScript('http://google.com/google-maps.js'); addScript('http://jquery.com/jquery.js'); ... // ru...