Lambda and web programming.

Lambda, as in the halflife meaning of the word, you know, radioactive decay, plutonium, nuclear waste, little things that make big booms and websdesign? I have GOT to lay of the Mt Dew!

I created a nice little poll for my website yesterday. I published it, responded a few times and sent it on it’s merry little way. I come back this morning, 44 responses. GREAT! I can take mine out now. I go and look at the responses, and the same IP address voted 14 times in a matter of a few minutes. Ballot stuffers – wonderful.

How do you address this little problem?

What do you do with people who have NO dignity and have the compulsion to skew the results of a informal web poll?

The best I can figure is to let them. They obviously need to vent some frustrations. And if letting them stab at a “vote” button a few times keeps them from coming in and stabbing me, all the better.

So I let them vote early and often. I empower them to impact a meaningless little poll on my website the way that they want to. I give them the satisfaction of skewing the results – they can see that every time they click, the little percentage bar moves in the direction that they want it to. When they moved it what they feel is far enough, they stop. They may check back in bit, they may check back in an hour. In today’s day of TV attentions spans, I wouldn’t expect them to check back any further out then that. If they come back in an hour, and see that their bar isn’t where they want it, they vote a few more times, and it’s right back to where their obsesive-compulsive little hearts desire it to be. They feel empowered, they feel good, I have another happy website user.

They never met a geek like me – even if I am only running on 1 Mt Dew for the day.

I devised a duplicate vote decay system that slowly removes the duplicate votes. First I roll all duplicate votes into 10 minute blocks. This means that at most, a person can have 6 votes an answer for any given hour. A fairly lenient allowance that acknowleges the possibility of multiple people sitting behind a single IP address.

Then I calculate the 1 hour lagged decayed count based off of a 1 hour halflife. Mom, a 1 hour half life means that after an hour, half of the total has “decayed away” – I only have half the original duplicate answers, after a second hour, half of the remaining duplicate votes has decayed away, so only 1/4 of the original, after the 3rd hour another half of the remaining duplicate answers goes away, so I have 1/8 of the original left. By lagging this process by an hour, I have a full hour to display the full duplicate answer count before this process starts to whittle that number down.

I sum up the results of this lagged-decayed count of votes. I then use this to calculate percentage of responses and display a fancy little bargraph using CSS instead of images.

I caught myself another case of the clevers and decay my office IP down to 0 while decaying everybody else down to 1. I can now comfortably “pre-vote” a poll up on it’s initial release so it doesn’t LOOK like its empty, and after a couple of hours, when other people have voted, my initial padding has decayed away.

The best part of this system is that if somebody really wanted to skew the results, they can do it on the short term, and when they come back an hour later, they don’t need to submit near as many responses to keep the results skewed. This reinforces the impression that they are drastically impacting the results. As they keep coming back every 20 minutes, an hour, or whenever, they have to keep voting to keep the results skewed. After a couple of hours, their initial manipulations are decaying away at a rapid rate, so they have to keep hammering on that vote button to keep the results skewed. They start to deduce that I get a LOT of votes (I never give a vote count, so they never know for sure) and give up in hoplessness to ever heavily swaying the results of the poll. A day later all their hard work has decayed away.

If a person is REALLY stubbern, I will see a LOT of duplicate activity in my raw results, and I will then make a change, and decay their duplicate votes down to 0. They are now unknowlingly dealing with an excersize in futility. Revenge is sweet!

Feel free to check out the poll page. You can also check out the results of the first public poll. Go ahead, vote for what you truly feel. Express yourself. Do it several times. Did you see the results percentage bars move in the direction that you want it to? Gratifying, isn’t it. Submit a few more responses. I don’t care, in a few hours its all going to count as a single response anyhow.

Build an idiot proof computer system, and they will build a better idiot.

Happy Coding!.

Leave a Reply