I'm out of my sister's house. Got a roommate. Still at the new job - not so "new" anymore. Haven't posted in a while. I've been lazy. I'm going to try and shift the focus of the blog (this site) away from me and more to tech stuff. So let's do that...
I added an extra little feature to the comments a couple nights ago to combat bot spam. There's a new field on the 'Add Comment' form that should be ignored. The tip even says to leave it blank. Somewhat confusing, I know but hopefully it will help prevent the bot posts. There's another new security measure, but I'll keep that a secret ;)
Next is a fun JavaScript problem(?) I ran into today that has to do with variable scope and for loops. Basically, the browser is getting confused between two separate for loops in two separate functions that use the same iterator variable.
Confuse Your Browser! (you have to click a button to cause the crash, it won't bomb on load)
That demo will lock up Firefox 2 and IE7. It will probably kill Safari, IE6, and all the others too (only tested IE7 and FF2). If the first loop (the 'for' in loopOne) has less iterations than the second loop (the 'for' in loopTwo) the first 'for' will only get executed once, while the second 'for' executes completely (all 10 times, but only once). If the first loop has more iterations than the second loop, the browser will crash and steadily eat memory until the process is killed (in my experience).
The solution is to simply the iteration variable in one of the for loops. It doesn't matter which you change, just as long as the variables aren't the same. Now either I am terribly confused about variable scope in Javascript (or programming in general) or this is broken. Looking now, the solution may be to change the for loops like "for(var i = 0; i < 20; i++)" but I really don't feel like trying it.