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 > 2001 > 03 > Programming with Perl  

Online Polling, Simplified

By Randal L. Schwartz

I heard about the "Am I Hot or Not?" site a while back. If you're one of the few people who haven't been there yet, check out www.AmIHOTorNOT.com. This site, combined with the bitterness of last November's presidential election, made me decide that it's time to talk about how tough (or easy) it is to write a fair polling script.

Using the DBI module, I quickly hacked up a voting scheme that has a mechanism for rejecting duplicate votes. (Well, at the least, it keeps someone from immediately reloading the page in order to stuff the ballot box.) I also wrote the script in such a way that it's possible to run under mod_perl's Apache::Registry module.

But what to vote on?

Well, let's imagine that you came across a large database of images—500 of them, in fact. And let's imagine that these images just happened to be available in five different sizes, each with regular names like, Disk1/Small/005.jpg, for the fifth image on the first disk in its small size. It's not very likely, but let's say you found this repository of images on an arbitrary site like www.forgetmenots.com. How hard would it be to create an "Am I a Forget-me-Not?" poll, using a generic voting scheme?

Pretty durn easy.

Do Not Disturb

We can do this without disturbing the owners of the Forget Me Nots site, as we're just generating the URLs. This all breaks down if the owners move things around, but that's the nature of deep linking.




  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