- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
This guy clearly had a vision. I bet he still has.
Admin
FIFTY-SECOND!!!
dôh
Admin
I think he/she was trying to delay the triggering the button click event. This could have more easily been accomplished by using a script block at the bottom of the page or by using "window.setTimeout(string object,int milliseconds)". Use the API, Luke!
Admin
Ah-hah!!! It's a radio buttton.
Admin
You do realize you could actually replace it with:
if(VideoSources[0])
{
//Do something
}
the i < 1 portion of the for loop means that i = 0 is only ever evaluated (unless it's a typo ;) )
Admin
Bah...the last part is suppose to say:
the i ;< 1 part of the for loop causes i = 0 to only ever be evaluated
Admin
Your code blows up if x is too big. The old code does not.
Admin
Nope, the delay this would create would likely be a fraction of a second, even on a 56k connection. The line:
var intCount = 0;
is hardcoded in the ASP/JSP/HTML/whatever to initialize the value to 0. The remainder of the code, up to and including intCount = 15, is generated. I think it's obvious that this person is iterating over something on the server to generate these lines, with the value incremented with every iteration. Rather than print out the final value, they print all of them. Kind of goofy but I woulnd't say "WTF!" if I encountered it.
Admin
Doesn't make a lot of sense. It seems he was looking at its source, not output HTML.
Admin
How can you make that determination?
Admin
Did you make a typeo entering this? x is used uninitialized, therefore, the results are undefined.
Admin
So, there was this like bug, see? Where if the user clicks on the button too quickly sometimes the script crashes? So we were like telling users to "count to 15 before you click anything." So Guru guy tells me to fix the bug. Says it's a race conditioner. Whatever. Anyway, I think, well, why not have the computer count to 15 for the user? Bingo. Like, fear my m4d sk177z.
--Rank
Admin
Auto generate and automagically run the code. Boom!
Admin
Uh, i know, i know.
It was like: Boss talking to his trainee: "Make a loop which counts to 15, and then push the button".
Trainee was like: "Er, what's a loop sir?"
Boss said: "Dumb*ss, its counting from 0 to 15 or sumthin!"
Trainee thought: "Oh, cool, I can do that, I just do it manually!"
Admin
Nah, he's taking medication for that now...
Admin
Admin
Jeeez Hexar......
Why must there always be one chop that has to correct the problem on the forum ?
We all know how to fix it Hexar...........
Admin
in that case why not use form.submit()
no this really has me stumped - why would something called headerInit() need to click a button in the page? I've done a ton of javascript in my time and can't ever recall having to do this.
Admin
kahnman wrote: "and a range-checked index x set elsewhere"
Phillip Susi wrote " x is used uninitialized, therefore, the results are undefined"
I think we know who just failed his reading skills roll.
Admin
Admin
He was just doing typing excercise.
Admin
I don’t understand this at all it seems strange that someone would use the onload event of the page to simulate a button click which I would assume calls a function of some sort, even if it was server side code that wrote this (which I doubt) it is truly pointless, surely the easiest way would be to write the function call in the onload event if it was needed and remove the button totally. As to it being a delay that too is not possible unless the delay is less than a millisecond
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>
Someone suggested that s/he was showing off by counting to fifteen that I doubt also as it would have required s/he to remove one of their shoes and I am sure that they would have trouble tying the bow again or replacing their sock without mommies assistance
Admin
Why, to click on the pop-up add you obviously wanted to see because Firefox (more or less) only opens the popups you click on.
Admin
Yes, I really missed that one in this thread.
Admin
In that case, it really, really needs a comment saying so. Personally, I go with the generated HTML explanation - that can produce some really weird-looking stuff on the client side even without notable WTFery.
Pete
Admin
I agree. He may have had two reasons to output the count.
But if I had to generate a click, I would have moved the if-test to the server, and generated the click-event myself
Admin
Has a problem with null object and found that pausing during de-bug caused it to work then light bulb came on and said "If I could only pause for a few seconds while the objects were created"
Only a guess
Admin
No no no.
Here's what's going on;
Admin
actually, with some HTTP servers (certainly with Apache) you can define how to handle files of any extension. You can have it send .wtf files to be parsed by PHP if you really wanted to... Hmm.. that gives me an idea!
Admin
This was done for job security reasons. The original version looked like this:
intCount=1
intCount=2
intCount=3
intCount=4
intCount=5
...
intCount=9997
intCount=9998
intCount=9999
intCount=10000
but when the customers kept complaining that it was too slow, he would go back and remove some of the lines. As you can see, there's still room for further optimization.
Admin
there have been 2-3 people who have mentioned if x is out of range, or the fact that x is undefined - but if you read his description in there it says 'a range-checked index x set elsewhere'. the definition of x is included so you know its type....
Admin
I think you'r right!
There are obviously very good for loops that generate such code.
So there.
Admin
The repeating incremental value assignments may be the result of a misfired editor macro. My 2c.