magazine resources subscribe about advertising

New Architect Daily
Commentary and updates on current events and technologies

CMP Media E-Book

Download your copy today.

Research
Search for reports and white papers from industry vendors and analysts.

This Week at NewArchitect.com Subscribe now to our free email newsletter and get notified when the site is updated with new articles







Day of Defeat Online Gaming

 New Architect > Archives > 1997 > 12 > Programming with Perl  

Your Search is in Process

Suppose you've got a search engine attached to a Web-page form that takes a little while to come up with a result. You could just tie up the user's browser with a r-e-a-l-l-y l-o-n-g response time, but most people are into instant gratification, and will probably just abort the query.

It would be nice if you could return a message right away that says "Hey, I'm working on it. Gimme a second." Well, that's actually pretty easy to do with the technique shown in this month's column.

Put simply, the CGI request will be split into two separate paths: The first returns a redirect to a URL that initially says "search in progress...reload this page to check the status." The user sees this page quickly after making the query. The second path actually performs the search in the background. When the search is complete, the page the user is reloading is updated to contain the results of the search.

This keeps the communication between the browser and the server to a minimum. To see if the results are in, the user simply hits reload. Or, on browsers that support client-pull, you can even make it autoreload every five or ten seconds, quitting when the result is complete.

Some would suggest using server-push, but I don't because not all browsers support it, and it ties up communication resources during the calculation time. However, I'm not ruling out that technique entirely -- it depends on the application (and maybe a future column will speak to that).<>




  Day of Defeat Online Gaming

home | daily | current issue | archives | features | critical decisions | case studies | expert opinion | reviews | access | industry events | newsletter | research | careers | info centers | advertising | subscribe | subscriber service | editorial calendar | press | contacts


Copyright © 2006 CMP Media, LLC Read our privacy policy, your California privacy rights, terms of service.
SDMG Web sites: BYTE.com, C/C++ Users Journal, Developer Pipeline, Dr. Dobb's Journal, DotNetJunkies, MSDN Magazine, Sys Admin,
SD Expo, SD Magazine, SqlJunkies, The Perl Journal, Unixreview, Windows Developer Network, New Architect

web2