- 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
Associated the radio group with the name of the variable it gets assigned would have helped. Or worse case, sequentially numbering the radio groups via a counter.
'Analysis? We don't need no stinkin' analysis!'
Admin
TRWTF is the use of radio button groups as a design choice. In HTML they should be used sparingly. Dropdown lists or combo boxes would have been a better choice.
Admin
3333, not 2500.
1/(1-(9998./9999)**3) = 3333.3334
Admin
Why are radio buttons a WTF? Just because there are people not capable to use them properly?
Then boolean and regex are also WTFs.
Admin
Of course it is a WTF, they should of used a GUID.
Admin
Admin
Actually closer to 1666
The total number of possible number combinations is 9999 ^ 4. The number of combinations that do not cause problems is 9999 * 9998 * 9997 * 9996. For the first radio button set all choices are valid, for the second one all except the first, for the third all except the first two, etc.
The chance a combination does cause a problem is thus: 1 - 9999 * 9998 * 9997 * 9996 / 9999 ^ 4 = 0.00059995, or about 1 in 1666.
This is an instance of the birthday problem (http://en.wikipedia.org/wiki/Birthday_problem).
Admin
1667, not 3333, not 2500.
Chance of not using any number twice: P_good = (10000 / 10000) * (9999 / 10000) * (9998 / 10000) * (9997 / 10000) = 0.99940011
Chance of using at least one number twice or more often: P_bad = 1 - P_good = 0.00059989 = 1 / 1666.9722615785
TRWTF is statistics.
Admin
Bugger, used 10000 instead of 9999 and other guys were faster ;-)
Admin
From which fount of wisdom gushes this invigorating cup of advice? Is it a similar place to "don't use tabs, use spaces"?
The real WTF is paying attention to so-called guru sites which pontificate on best practices without expounding as to why. If a reason is provided, then one is able to glean some understanding of whether the advice is relevant and appropriate to the page in question.
Admin
I don't even read the stories anymore. I just come straight to the comments. If there's one thing I've learnt from the internet is that reading and/or understanding something just hinders your ability to effectively criticise it.
Admin
The use of radio buttons are ok as a visual choice, but it is their implementation in HTML that suck, as well as making it harder for developers to make them work correctly.
Admin
The real wtf is not spend 4 minutes looking into the code when people keep complaining about faults..
Admin
TRWTF is trying to find a bug without access to the code!
Admin
TRWTF is using JS for this.
Admin
Admin
int HashFunction(void* pObjectToHash) { return rand(); }
Admin
The real WTF is using numbers at the beginning of ids.
Admin
The use of radio buttons are ok as a visual choice, but it is their implementation in HTML that suck, as well as making it harder for developers to make them work correctly. There, potification with explanation.
Admin
<pedantry>Then it's not a design issue, it's an engineering issue.</pedantry>
Admin
Here is a good blog post that explains why radio buttons are a better choice than dropdown lists.
Admin
captcha: ideo. I have no ideo why custom.js should remain a mystery.
Admin
Don't tell him about Ethernet...
Admin
Looking at that generator code again... radio buttons are nice, but if you can't retrieve the value that's stored in their state, they are just a complete waste of browser window real estate.
You could probably try to get the buttons via the labels immediately trailing them, but that would make for rather brittle logik, I think (not to mention bad performance).
I would really like to see the web-app that's driven by that code...
Admin
And finally... that's regular expressions that's stored in the values:
Nothing wrong with that, of course, but still... weird.Admin
You're really just trying to avoid page-scroll with comboboxes. It takes an additional click to make an entry in a combobox.
Admin
Admin
I have a similar issue with a web app we develop that might have to, in theory (if it was flexible enough), generate the same HTML code multiple times on the same page. Of course IDs are hard coded and the code uses .innerHTML to generate the code and .getElementById to retrieve references to elements. Once you generate a second copy of the HTML everything breaks.
My own code uses classes for all CSS-styling, uses DOM-style generation and retains references to critical nodes it'll need later, and uses a UID generator to generate any IDs I DO need.
That web app has all sorts of WTFs that would be good for this site, including a drag-and-drop module that attempts to poorly partly recreate the DOM hierarchy for drag and drop (by having coders manually declare all drop regions as HTML elements and bounding regions), all so that it can put a "dragging this thing" image under the cursor and figure out what's behind it based on X/Y coords (since e.target only returns the image). Has to support IE so no pointer-events: none;
I personally would have just generated a custom .cur for each image they wanted in front of the cursor. But that would have been far easier.
Admin
It's javascript, its obfuscated the moment it's written.
See because javascript is a messy pile of sh!t to look at, even if it's "well written", which it seldom ever is.
I guess the general point I'm trying to convey is that javascript is a crap language.
Admin
The collision will actually happen every 1666 pages, and not 2500
http://en.wikipedia.org/wiki/Birthday_problem
With every button you add, there is a lot more chance of collision. For instance, with only 20 buttons you'd have a collision every 48 pages
Captcha tristique: This is a typical problem in probability and statristique
Admin
I'd have to grant this WTF about three stars out of five:
Yes, this algorithm/code/technology choice is WTFery, but only in this circumstance; in other places it could have been the best choice.
This code is WTFery, but you have to be an expert to see why.
The original coder was trying to be clever, but failed.
The reasons this will not work should have been obvious to anyone capable of finding the keys to type this code.
Kill it with fire!
CAPTCH nisl: "I'm hopin nisl only take a moment."
Admin
By that logic, because of the processing overheads and danger of implementing an off-by-one error, the use of loops for iteration should be avoided, and instead the instructions to be executed should be written sequentially in the program.
Admin
Oh, and while I'm about it, grammar fail:
It should be "The use (of radio buttons) is ok" - the number of the verb must agree with its subject, not just the noun which happens to be closest, which in this case is the word "buttons" in the qualifying clause (emphasised by me as being a separate linguistic entity by parenthesising it) "of radio buttons".
It should be "it is their implementation in HTML that sucks", a similar mistake but in the opposite direction. The subject of the verb "sucks" is in this case "(their) implementation", not "their". Compare: "The children are crying because their ball are lost", which exhibits the same error but in a more obviously incorrect context.
Finally, it should be "pontification" not "potification", but I will allow that this mistake may well be just a typo caused by carelessness rather than a genuine spelling mistake caused by ignorance.
Admin
Admin
Oh snap! Better get Jimmy some ice for his BURRRRRN AM I RIGHT?
Admin
Could have just used a custom javascript GUID solution. Did anyone win the coding competition?
Admin
I can't believe that no one else has criticized the stories use of the radio as if it has anything to do with radio buttons. It's not funny, not even slightly. It annoys me more than the code.
Admin
I suppose after finally figuring out what the hell kind of pun that was; if I were to reread, I'd have to mentally overlook the pun or it would burn.
Admin
So, he debugged it a few times, but never looked at the javascript that made a healthy portion of the page? He also didn't notice that those groups were named with random numbers?
Admin
You misunderstood the phrase "had a chance to". In this case, it doesn't mean "had the ability to". Instead, it means "had a reason to". He could have looked at the file whenever he wanted, but he never looked at it because there was no reason for him to look at it.
Admin
TRWTF is not even bothering to look at the code when investigating a bug report. Trying to reproduce a problem is certainly a valid approach but by no means exhaustive. You can always try to think. Very poor.
Admin
I actually enjoy programming with it. Some bits annoy me, true, but some bits also delight me and the overall comfort-factor ist definitely higher than with C. Or the good ole line-number-based BASIC-dialects of the mid-80s.
Admin
On the radio buttons - I still think their use produce way too many buggy web sites, and many developers resort to them when they could or should be using dropdown lists or combo boxes.
Admin
Loops should be avoided for those reasons. Recursion over an algebraic data type should be preferred instead.
Admin
Bjorne is probably typical lazy a**hole who'd never do anything more than exactly minimum required for not being fired yet. If he'd checked the code first time the issue was reported, it would be solved immediately.
I say: fire Bjorne!
Admin
TRWTF is Systems Hungarian Notation in the function name. I would have never figured out that "fnCreateRadioButtons" was a function or that iLen was an integer without that extra bit of help. But what really annoys me is when the developer can't think of a meaningful prefix, but knows he must use something and just picks a random character, such as, say 'z' or 'x', even when they impart no meaning, which is worse than imparting clearly obvious meaning. For the record, I have no problem with judicious use of Application Hungarian Notation.
Admin
-Harrow.
Admin
belzebub...
If a complaint comes in every month or so, which says "Your website is broken... the pages don't work", then the complainant can fuck off, and not expect the bug to ever get fixed, until they describe it properly.
Admin
Ladies and gentlemen: I believe we have found the father of the president's daughter (and my ex-wife).
Admin
Or to put it another way: complainants are customers and usually don't know heck about the terminology/jargon of (web)developers. They might use a browser without knowing what a browser is, is what I'm saying.
Or how would you feel if the garage attendant sends you away because "funny sounds from under the bonnet" is not a proper description of the problem your car is having?
You should take pride in being able to diagnose and fix a problem even without a proper problem description.
Sheesh, some people!