When writing Ajax, you can sometimes get into situations where sending two Ajax calls close together will return results out of order. In other words, the first Ajax call will receive the second Ajax calls’ results. This seems to be a particular problem in IE and Windows Sidebar Gadgets that use IE to display.
Windows Sidebar gadgets are particularly vulnerable in that different instances of gadgets can get each others Ajax data. That’s becasue all gadgets run in the same process, namely sidebar.exe. Argggg! Sometimes I just want to strangle Microsoft. I mean come guys, no one ever thought that two Ajax calls might occur at the same time. LAME!
OK, enough flames. The first step is to at least cut down on the opportunity of “crosstalk” by queuing the Ajax calls within a gadget. I found a several, “Queued Ajax Plugins” for JQuery. Oddly, I could not get any of them to work in JQuery 1.3. The problem appears to be due to a change in the JQuery.queue() method. Apparently, in JQuery 1.2, queue automatically started a dequeue when the first item was added.
I took the simplest of these plugins and modified it to start a dequeue when the first item is added.
Updated: My earlier code was flawed. The code below appears to work much better
var currentAjaxRequest = null;
jQuery.ajaxQueue = function(ajaxOptions)
{
var success = ajaxOptions.success;
var error = ajaxOptions.error;
var complete = ajaxOptions.complete;
ajaxOptions.success = function()
{
if (success) { try { success.apply(this, arguments); } catch (e) { } }
};
ajaxOptions.error = function()
{
if (error) { try { error.apply(this, arguments); } catch (e) { } }
};
ajaxOptions.complete = function()
{
if (complete) { try { complete.apply(this, arguments); } catch (e) { } }
currentAjaxRequest = null;
$(window).dequeue("ajax");
};
$(window).queue("ajax", function()
{
currentAjaxRequest = jQuery.ajax(ajaxOptions);
});
if (currentAjaxRequest === null) { $(window).dequeue("ajax"); }
};
This works just like the JQuery.ajax and uses the same syntax. It’s not perfect, but it’s a start.
It’s interesting to see who visits the site and what they use to browse with. The market stills belong to IE but visitors to this site seem to prefer Firefox with IE not far behind.
The other surprise is how much overseas traffic I get (relatively speaking). Clearly, localizing Desk Drive (the top page in terms of hits) has been a very good thing for this site.
For the moment, I’m popular with Germany but Japan often tops the list. Living here in the States it’s easy to forget that’s a big world. Clearly, paying attention to overseas market is important in this day and age.
IE8 has this annoying habit on my wife’s computer of not working with some Web sites. Same computer, same Web site using Opera or Firefox works fine. She prefers IE8 so after a few moments of poking around I discovered that I had to enable session cookies. Here’s how:
Open the IE Options dialog, click on the privacy tab and then Advanced.
and then enable session cookies.
This cleared up the problems although I don’t know why. Maybe someone can explain what’s happening and what the risks are if any?
Programming Computers
InfoQ: .NET 4 Beta 1 Now Supports Software Transactional Memory - Microsoft has released a new version of .NET 4.0 Beta 1, one that incorporates STM.NET, the Software Transactional Memory. STM is an alternative mechanism to lock-based synchronization used to control the concurrent access to shared memory.
Misunderstanding Markup: XHTML 2/HTML 5 Comic Strip | How-To | Smashing Magazine – The comic book style presentation (similar to Google’s Chrome rollout) works quite well. Very informative.
Using your Personal Computer
Xobni - Outlook Plugin to Search People, Email, and Attachments Instantly - The free Outlook plugin that makes searching and finding people and email faster and easier.
XML Aficionado: Portable 1TB drive from WD - Western Digital announced a portable 1TB drive today – the highest capacity portable drive so far. The My Passport Essential SE 1TB drive comes with USB 2.0 and built-in synchronization and encryption software (for Windows). They also have a model that can be built into laptops as an internal 1TB drive.
Microsoft reveals upgrade paths for Windows 7 - Windows XP and below users are out of luck. You must have Windows Vista SP1 or newer to upgrade to Windows 7.
PostSharp 1.5 Released - Aspect-Oriented Programming ( AOP ) Framework for .NET - PostSharp brings Aspect-Oriented Programming (AOP) to the Microsoft .NET Framework. Better: PostSharp makes AOP pragmatic and goes to the point.
Arora is a Lightweight, Cross-Platform, WebKit Browser - Lightweight web browser Arora uses the same rendering engine as Google Chrome and Safari, but works on almost any platform.
Science and the Environment
Scientists Worry Machines May Outsmart Man - NYTimes.com - Impressed and alarmed by advances in artificial intelligence, a group of computer scientists is debating whether there should be limits on research that might lead to loss of human control over computer-based systems that carry a growing share of society’s workload, from waging war to chatting with customers on the phone.
New Optical Forces Revealed - The University of Ghent (UGent) and the nanoelectronics research center IMEC demonstrated repulsive and attractive nanophotonic forces, depending on the spatial distribution of the light used. These fundamental research results might have major consequences for telecommunication and optical signal processing.
Transparent Aluminum Is ‘New State Of Matter’ - Oxford scientists have created a transparent form of aluminium by bombarding the metal with the world’s most powerful soft X-ray laser. ‘Transparent aluminium’ previously only existed in science fiction, featuring in the movie Star Trek IV, but the real material is an exotic new state of matter with implications for planetary science and nuclear fusion.
BBC NEWS | Health | Organic 'has no health benefits' - Organic food is no healthier than ordinary food, a large independent review has concluded. Perhaps, but there still are the pesticide effects to deal with IMHO.
On the Web
Plastic Logic e-book reader will connect to AT Apple tablet computer reported - Plastic Logic, the new e-book reader expected to debut in early 2010, announced that AT&T will provide mobile wireless connectivity for the device, which boasts a touch screen—which neither the Kindle 2 norKindle DX have.
Leaked: prototypes and concepts of the Microsoft Store - Ars Technica - Even though Microsoft's retail stores have been confirmed by Redmond a few times over, we still don't know very much about them. We now know more than Microsoft probably wants, thanks to a 140-slide PowerPoint document leaked to Gizmodo.
Themes support now lets you reskin Chrome | Business Tech - CNET News - The latest developer version of Chrome can easily be reskinned. Too bad the skins are ugly as sin.
Firefox Hits 1 Billion Downloads - PC World - As forecast, Firefox reached its landmark download at 15:00 UTC, at which point the browser was being downloaded at a rate of 24 times per second.
Stuff I just Dig
A Water-Powered Jetpack | Popular Science - The Jetlev-Flyer propels itself using a torrent of water. Cool pictures.
DARPA Readies an Ultra-Fast Mini-Sub | Popular Science - Currently, the Navy's fastest submarine can only travel at 25 to 30 knots while submerged. But if everything goes according to plan, the Underwater Express will speed along at 100 knots, allowing the delivery of men and materiel faster than ever.
Laser-Powered Lightcraft "At the Cusp of Commercial Reality" | Popular Science - The design uses a ground-based laser to beam the Lightcraft skyward on a series of blast waves. A parabolic mirror on the back of the craft would capture and focus the pulsing laser beam so that it heats air to 5 times the sun's temperature, creating mini-explosions that propel human passengers or cargo to any point on the planet in under an hour, or into orbit.
Space vehicle unveiled at EAA – JSOnline - Virgin Galactic exhibited its launch plane Tuesday at the EAA AirVenture in Oshkosh. Called Eve, the craft lifts commercial spaceships into the sky for blastoff into space.
Pick of the Week
Consolas Font Pack – A much nicer font for Visual Studio programming.
Posted
Saturday, August 01, 2009 |
1
Comments
Tags
.Net,
Browsers,
Freebies,
Life,
Links,
Online Applications,
PC Tips,
Programming,
Science,
Technology
previous | next
powered by Bloget™