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

Give a look to the following article published just a couple of days ago by Dustin Diaz, Twitter Engineer on @anywhere: Asynchronous method queue chaining in JavaScript He talks about a really nice technique that allows you to implement a fluent interface on asynchronous methods, basically methods chained together independent of a callback, using a … Read more

Can PHP asynchronously use sockets?

Yup, that’s what socket_set_nonblock() is for. Your socket interaction code will need to be written differently, taking into account the special meanings that error codes 11, EWOULDBLOCK, and 115, EINPROGRESS, assume. Here’s some somewhat-fictionalized sample code from a PHP sync socket polling loop, as requested: $buf=””; $done = false; do { $chunk = socket_read($sock, 4096); … Read more

Dart Future.wait for multiple futures and get back results of different types

You need to adapt each of your Future<T>s to a common type of Future. You could use Future<void> and assign the results instead of relying on return values: late List<Foo> foos; late List<Bar> bars; late List<FooBars> foobars; await Future.wait<void>([ downloader.getFoos().then((result) => foos = result), downloader.getBars().then((result) => bars = result), downloader.getFooBars().then((result) => foobars = result), ]); … Read more

AspNetSynchronizationContext

Am I correct that It does guarantee your continuations will get the same HttpContext.Current as original callers? It does not guarantee the continuations will execute on the same thread as the callers? Yes, HttpContext.Current is preserved, and yes, the continuations may execute on a different thread. I mean principal/culture associated with the thread and thread … Read more