Don't Touch That Dial!

  • JSGuru 2013-08-07 06:22
    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!'
  • JimmyCrackedCorn 2013-08-07 06:24
    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.
  • Douglas 2013-08-07 06:28
    3333, not 2500.


    1/(1-(9998./9999)**3) = 3333.3334
  • ANON 2013-08-07 06:30
    JimmyCrackedCorn:
    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.


    Why are radio buttons a WTF? Just because there are people not capable to use them properly?

    Then boolean and regex are also WTFs.
  • Will 2013-08-07 06:31
    Of course it is a WTF, they should of used a GUID.
  • Racemaniac 2013-08-07 06:45
    Douglas:
    3333, not 2500.


    1/(1-(9998./9999)**3) = 3333.3334

    it's 1/(1-((9998./9999)*(9997/9999)*(9996/9999))) = 1666
  • Migala 2013-08-07 06:46
    Douglas:
    3333, not 2500.

    1/(1-(9998./9999)**3) = 3333.3334


    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).
  • MathMagic 2013-08-07 06:46
    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.
  • MathMagic 2013-08-07 06:47
    Bugger, used 10000 instead of 9999 and other guys were faster ;-)
  • QJo 2013-08-07 06:49
    JimmyCrackedCorn:
    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.


    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.
  • ABBA 2013-08-07 06:51
    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.
  • JimmyCrackedCorn 2013-08-07 06:52
    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.
  • CodyMonkey 2013-08-07 07:00
    The real wtf is not spend 4 minutes looking into the code when people keep complaining about faults..
  • Mike 2013-08-07 07:02
    TRWTF is trying to find a bug without access to the code!

  • Sunil Sdlavrot 2013-08-07 07:09
    TRWTF is using JS for this.
  • ZoomST 2013-08-07 07:09
    CodyMonkey:
    The real wtf is not spend 4 minutes looking into the code when people keep complaining about faults..
    So do you have enough knowledge about the size of the code base and how convoluted (as in fucked) it is to estimate 4 minutes, or are you making it up like the Marketing department?
    I bet it's the second choice.
  • eViLegion 2013-08-07 07:13
    int HashFunction(void* pObjectToHash)
    {
    return rand();
    }
  • Björn 2013-08-07 07:14
    The real WTF is using numbers at the beginning of ids.
  • JimmyCrackedCorn 2013-08-07 07:16
    QJo:
    JimmyCrackedCorn:
    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.


    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.


    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.
  • eViLegion 2013-08-07 07:19
    JimmyCrackedCorn:
    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.


    <pedantry>Then it's not a design issue, it's an engineering issue.</pedantry>
  • Ronald 2013-08-07 07:26
    QJo:
    JimmyCrackedCorn:
    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.


    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.


    Here is a good blog post that explains why radio buttons are a better choice than dropdown lists.
  • faoileag 2013-08-07 07:29
    Dan Adams-Jacobson:

    (Bjørn) also never had a chance to look at a certain script used by the application: the mysterious custom.js

    And why not? Is the script run through an obfuscator before being served to the general public? Or is Bjørn simply not capable of cutting & pasting together the right url to request only that script through his browser?
    And why is it that the person tasked with maintaining a web-application does not have access to the files with the javascript driving that web-application?

    captcha: ideo. I have no ideo why custom.js should remain a mystery.
  • Oliver 2013-08-07 07:40
    Don't tell him about Ethernet...
  • faoileag 2013-08-07 07:45
    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...
  • faoileag 2013-08-07 07:49
    And finally... that's regular expressions that's stored in the values:
    ^something$
    Nothing wrong with that, of course, but still... weird.
  • xaade 2013-08-07 07:50
    JimmyCrackedCorn:
    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.

    If you only have a few options, it's less trouble to have all the options displayed.
    I hate comboboxes that say credit card type, only to have Visa and Other as options.

    You're really just trying to avoid page-scroll with comboboxes. It takes an additional click to make an entry in a combobox.
  • xaade 2013-08-07 07:54
    JimmyCrackedCorn:
    QJo:
    JimmyCrackedCorn:
    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.


    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.


    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.

    What, having shared group names?
    I suppose you could put them in a div and somehow work out that's a group. However, do you really need a groupbox around every set of radio buttons?
  • The MAZZTer 2013-08-07 08:08
    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.
  • Krunt 2013-08-07 08:30
    faoileag:
    Dan Adams-Jacobson:

    (Bjørn) also never had a chance to look at a certain script used by the application: the mysterious custom.js

    And why not? Is the script run through an obfuscator before being served to the general public?


    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.
  • XXI 2013-08-07 08:33
    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
  • EvilSnack 2013-08-07 08:38
    I'd have to grant this WTF about three stars out of five:

    1. Yes, this algorithm/code/technology choice is WTFery, but only in this circumstance; in other places it could have been the best choice.

    2. This code is WTFery, but you have to be an expert to see why.

    3. The original coder was trying to be clever, but failed.

    4. The reasons this will not work should have been obvious to anyone capable of finding the keys to type this code.

    5. Kill it with fire!

    CAPTCH nisl: "I'm hopin nisl only take a moment."
  • QJo 2013-08-07 08:39
    JimmyCrackedCorn:
    QJo:
    JimmyCrackedCorn:
    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.


    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.


    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.


    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.
  • QJo 2013-08-07 08:49
    JimmyCrackedCorn:
    QJo:
    JimmyCrackedCorn:
    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.


    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.


    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.


    Oh, and while I'm about it, grammar fail:

    1. 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".

    2. 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.

    3. 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.
  • Pock Suppet 2013-08-07 09:01
    ABBA:
    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.

    You, sir, have discovered the secret to the internets, to politics, and to life! I expect to see you running for office next fall.
  • Krunt 2013-08-07 09:03
    Oh snap! Better get Jimmy some ice for his BURRRRRN AM I RIGHT?
  • Smug Unix User 2013-08-07 09:06
    Could have just used a custom javascript GUID solution. Did anyone win the coding competition?
  • JayGee 2013-08-07 09:17
    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.
  • xaade 2013-08-07 09:29
    JayGee:
    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.


    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.
  • Jeremy 2013-08-07 09:35
    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?

  • Dragnslcr 2013-08-07 09:42
    faoileag:
    Dan Adams-Jacobson:

    (Bjørn) also never had a chance to look at a certain script used by the application: the mysterious custom.js

    And why not? Is the script run through an obfuscator before being served to the general public? Or is Bjørn simply not capable of cutting & pasting together the right url to request only that script through his browser?
    And why is it that the person tasked with maintaining a web-application does not have access to the files with the javascript driving that web-application?

    captcha: ideo. I have no ideo why custom.js should remain a mystery.


    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.
  • LoztInSpace 2013-08-07 09:43
    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.
  • faoileag 2013-08-07 09:44
    Krunt:
    faoileag:
    Dan Adams-Jacobson:

    (Bjørn) also never had a chance to look at a certain script used by the application: the mysterious custom.js

    And why not? Is the script run through an obfuscator before being served to the general public?


    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.

    Ever seen what some people do with C++? Not to mention C. You can create a messy pile of spaghetti code in most, if not all, languages if you don't give 1 cent for maintainability.

    Krunt:
    I guess the general point I'm trying to convey is that javascript is a crap language.

    Care to highlight just why you think it is?

    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.
  • JimmyCrackedCorn 2013-08-07 09:54
    QJo:
    JimmyCrackedCorn:
    QJo:
    JimmyCrackedCorn:
    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.


    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.


    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.


    Oh, and while I'm about it, grammar fail:

    1. 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".

    2. 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.

    3. 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.

    Ok, mea culpa on the grammar - thanks for the lesson.

    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.

    * I didn't consult a guru site for this hard won opinion - just 15 years of slogging through poorly designed sites.
    * I wasn't trying to raise your ire, just trying to provoke thoughtful dialog.
  • Captain Oblivious 2013-08-07 09:58
    QJo:
    JimmyCrackedCorn:
    QJo:
    JimmyCrackedCorn:
    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.


    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.


    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.


    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.


    Loops should be avoided for those reasons. Recursion over an algebraic data type should be preferred instead.
  • belzebub 2013-08-07 10:18
    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!
  • Anonymous Paranoiac 2013-08-07 10:18
    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.
  • Harrow 2013-08-07 10:23
    QJo:
    3. Finally, it should be "pontification" not "potification"...
    Are you sure? I thought "potification" means explaining something complicated while under the influence of marijuana.

    -Harrow.
  • eViLegion 2013-08-07 10:32
    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.
  • Paul Neumann 2013-08-07 10:38
    JimmyCrackedCorn:
    * I wasn't trying to raise your ire, just trying to provoke thoughtful dialog.
    Orly? It seemed there was a thoughtful dialog attempting occur. It appears this is an attempt to block dialog through a back handed rhetorical statement about fostering a dialog.

    Ladies and gentlemen: I believe we have found the father of the president's daughter (and my ex-wife).
  • faoileag 2013-08-07 10:56
    eViLegion:
    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

    You do that once with a complainant that has enough clout (like the most valuable customer your company has, like the vice president's daughter, like the side-affair of your boss...) and you might find out that that policy of yours can make your life far more miserable than the one of the complainant.

    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!
  • stew 2013-08-07 10:58
    value="^' + aData[i] + '$"

    Ummmm ... so it's submitting regular expression patterns to the server?! "Who knows what evils lurks beneath the javascripts?"
  • faoileag 2013-08-07 11:01
    Paul Neumann:
    I believe we have found the father of the president's daughter (and my ex-wife).

    You must be more precise in your language. Your sentence can be read as:

    ( ) the president's daugher is your ex-wife
    ( ) we have found two people, including your ex-wife
    ( ) the father of the president's daugher is your ex-wife

    Please click the appropriate radio button.
  • Paul Neumann 2013-08-07 11:01
    To put this snippet in a form which more visitors of this site will understand:
    public string fnCreateRadioButtons(string[] aData)
    
    {
    const string template =
    @"<div class=""radio-filter"">
    <input name=""{0}"" type=""radio"" value=""^{2}$"" id=""{0}-{1}"">
    <label for=""{0}-{1}"">{3}</label>
    </div>";

    var r = new System.Text.StringBuilder();
    var prefix = Math.Ceiling(new Random().NextDouble() * 9999);
    var iLen = aData.Length;

    r.AppendFormat(template, prefix, "all", "", Constants.Window.lbAll);
    for (var i = 0; i < iLen; i++)
    {
    r.AppendFormat(template, prefix, i, aData[i], aData[i]);
    }
    return r.ToString();
    }
  • not an expert 2013-08-07 11:02
    EvilSnack:
    2. This code is WTFery, but you have to be an expert to see why.
    Are you teasing us? Don't tease us. WHY ARE YOU TEASING US?
  • faoileag 2013-08-07 11:02
    stew:
    value="^' + aData[i] + '$"

    Ummmm ... so it's submitting regular expression patterns to the server?!

    Not necessarily. All action can take place client-side.

    And with client-side generated random ids and names for the radio buttons the server wouldn't know waht to to with the data anyway :-)
  • Paul Neumann 2013-08-07 11:05
    faoileag:
    You must be more precise in your language. Your sentence can be read as:

    () the president's daugher is your ex-wife
    () we have found two people, including your ex-wife
    () the father of the president's daugher is your ex-wife

    Please click the appropriate radio button.
    Ain't DOM manipulation by the client a b****?
  • Nmare 2013-08-07 11:06
    faoileag:

    Krunt:
    I guess the general point I'm trying to convey is that javascript is a crap language.

    Care to highlight just why you think it is?

    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.


    js is much better now then 10 year ago where each browser had his own little piece of code for everything. But even now, this is very unstable... look the amount of website with js error and bugs.

    And how dare you talk again GW BASIC! Its like hitting your grand father in the face!
  • Grandpa 2013-08-07 11:16
    [quote user="Krunt"]I guess the general point I'm trying to convey is that javascript is a crap language.[/quote]
    Care to highlight just why you think it is?

    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.[/quote]

    How dare you disregard the good ole line-number-based BASIC-dialects of the early-70s? Not to mention the line-number-based FORTRAN dialects, where the line numbers didn't even need to be in order?
  • eViLegion 2013-08-07 11:27
    faoileag:
    ...stuff...

    Sheesh, some people!


    I'm not saying you should tell them to fuck off... just that they can fuck off.

    If you've got a pile of important work to do, and some of that work is made excruciating because of terrible bug reports, that work is going to get done after all the other stuff. The quicker a decent description comes in for that bug, the quicker it will get fixed... for reasons related both to the ease of fixing properly described bugs, and human nature.
  • DrPepper 2013-08-07 11:46
    The MAZZTer:
    including a drag-and-drop module that attempts to poorly partly recreate the DOM hierarchy for drag and drop

    There are javascript libraries that do this sort of thing for you out of the box; Dojo for example. Sounds like you're busy re-inventing a lot of dom-manipulation code that is already a core part of many javascript libraries. Please spend some time learning them, and you'll save yourself a lot of headaches.
  • DrPepper 2013-08-07 11:51

    js is much better now then 10 year ago where each browser had his own little piece of code for everything.
    [/quote]
    That's a browser issue, not a JAVASCRIPT issue. Please try not to confuse the language with the environment it is running in.
  • cellocgw 2013-08-07 11:56
    Douglas:
    3333, not 2500.


    1/(1-(9998./9999)**3) = 3333.3334


    Sig Figs, man!
  • Andrew 2013-08-07 11:58
    Björn:
    The real WTF is using numbers at the beginning of ids.


    The real WTF is nobody else here caught that. As I was looking at the code I was thinking the same thing but your the only one who caught it.
  • no laughing matter 2013-08-07 12:14
    Andrew:
    Björn:
    The real WTF is using numbers at the beginning of ids.


    The real WTF is nobody else here caught that. As I was looking at the code I was thinking the same thing but your the only one who caught it.
    So your==you're and Andrew==Björn?
  • D-Coder 2013-08-07 12:14
    not an expert:
    EvilSnack:
    2. This code is WTFery, but you have to be an expert to see why.
    Are you teasing us? Don't tease us. WHY ARE YOU TEASING US?
    Don't tease us, bro!
  • herby 2013-08-07 12:16
    Simple solution:

    s/9999/999999/

    That ought to make it better. Problem solved.
  • Coyne 2013-08-07 12:17
    This article is about one of the most persistent anti-patterns I've seen. I can't even guess how many times I've seen algorithms built around random numbers or fractional parts of system time, or similar, and an assumption that somehow there will magically never be a collision.

    A goodie from my current code base, repeated in multiple components: DB2 SQL offers timestamp resolution to the microsecond. So some lameoid takes that microsecond and turns it into a key; "After all, there's no chance that someone else will get the same microsecond value again...it's one in a million. Right?"
  • Nagesh 2013-08-07 12:32
    No idea why some comets are coming down heavily on radio buttons. I think rado buttons have a purpose like all UI element and it is important to know when to use what element.

    Some time check box will do work sometime you need radio button.
    Just do some clear thinking on requirement and accomplish your goal.

  • eViLegion 2013-08-07 12:43
    Nagesh:
    No idea why some comets are coming down heavily on radio buttons.


    I think you mean 'meteorites'.
  • Sarcasto 2013-08-07 13:09
    Re: "the way radio-button sets work, only one option from each set can be selected at any time" -- thanks for the tip! as a professional software GUI and Web developer for the past 14 years I had yet to figure out how radio buttons work! /sarcasm
  • n+1 2013-08-07 13:10
    "replaced the prefix generator with a page-global counter"

    Surely that means a per-page counter.
  • Anomaly 2013-08-07 13:16
    eViLegion:
    Nagesh:
    No idea why some comets are coming down heavily on radio buttons.


    I think you mean 'meteorites'.


    I think he means comments.
  • dynedain 2013-08-07 13:31
    faoileag:
    eViLegion:
    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

    You do that once with a complainant that has enough clout (like the most valuable customer your company has, like the vice president's daughter, like the side-affair of your boss...) and you might find out that that policy of yours can make your life far more miserable than the one of the complainant.

    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!


    And how do you plan to fix it when you get a poor description, and are unable to reproduce?
  • chubertdev 2013-08-07 13:42
    EvilSnack:
    1. Yes, this algorithm/code/technology choice is WTFery, but only in this circumstance; in other places it could have been the best choice.

    2. This code is WTFery, but you have to be an expert to see why.


    Really?
  • chubertdev 2013-08-07 13:45
    Anomaly:
    eViLegion:
    Nagesh:
    No idea why some comets are coming down heavily on radio buttons.


    I think you mean 'meteorites'.


    I think he means comments.


    I think he means plutoids
  • eViLegion 2013-08-07 14:11
    Anomaly:
    eViLegion:
    Nagesh:
    No idea why some comets are coming down heavily on radio buttons.


    I think you mean 'meteorites'.


    I think he means comments.
    What on earth gave you such a silly idea?
  • Nagesh 2013-08-07 14:16
    eViLegion:
    Anomaly:
    eViLegion:
    Nagesh:
    No idea why some comets are coming down heavily on radio buttons.


    I think you mean 'meteorites'.


    I think he means comments.
    What on earth gave you such a silly idea?


    He has brain and he used it. Don't need too much brain cell to figure this out. More brain cell required for making pun like you are doing.
  • PotatoEngineer 2013-08-07 14:22
    cellocgw:
    Douglas:
    3333, not 2500.


    1/(1-(9998./9999)**3) = 3333.3334


    Sig Figs, man!
    Sig figs are for when you have *measurements* of a particular precision. In this case, the numbers involved (1, 9999, 9998, etc.) have an infinite number of significant digits, because there's no uncertainty: no chance that the number might actually be 9999.01.

    If this were really something where sigfigs mattered, and every number was in its correct precision, then the answer would be 3000: the "1" would only have 1 sigfig.
  • pezpunk 2013-08-07 14:39
    personally I like to generate two GUIDS and concatenate them, that way my identifiers are twice as unique.
  • Pock Suppet 2013-08-07 14:42
    Anonymous Paranoiac:
    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.

    I prefer the following system:
    * 'z' = form element
    * 'v' = variable
    * 'a' = array
    * 'o' = object
    * 'do' = function, as in "doValidateCrapOnPage"

    It's simple, there's no room for confusion, and it works well with the mostly-typeless languages and mostly-clueless code I suffer through at work. Advanced users will appreciate the convention of having "Foo" functions which are secretly called by their "doFoo" brethren.
  • Silfax 2013-08-07 14:46
    xaade:

    I hate comboboxes that say credit card type, only to have Visa and Other as options.


    You don't even need a combo box - the first few digits of the card number will tell you the card type.

  • Anonypony 2013-08-07 15:17
    Silfax:
    xaade:

    I hate comboboxes that say credit card type, only to have Visa and Other as options.


    You don't even need a combo box - the first few digits of the card number will tell you the card type.



    So much this.

    I've long suspected that there might be something in the credit card merchant agreement that says "THOU MUST INCLUDE THE NAME OF $CC_COMPANY IN YOUR PROCESSING FORM" as a subtle form of advertising/brand recognition to remind people what card company they use (and therefore trust and like).
  • chubertdev 2013-08-07 15:49
    Silfax:
    xaade:

    I hate comboboxes that say credit card type, only to have Visa and Other as options.


    You don't even need a combo box - the first few digits of the card number will tell you the card type.



    4111 1111 1111 1111
    5555 5555 5555 4444
    3782 8224 6310 005
    6011 1111 1111 1117
  • da Doctah 2013-08-07 16:46
    Coyne:
    This article is about one of the most persistent anti-patterns I've seen. I can't even guess how many times I've seen algorithms built around random numbers or fractional parts of system time, or similar, and an assumption that somehow there will magically never be a collision.

    A goodie from my current code base, repeated in multiple components: DB2 SQL offers timestamp resolution to the microsecond. So some lameoid takes that microsecond and turns it into a key; "After all, there's no chance that someone else will get the same microsecond value again...it's one in a million. Right?"


    It's a more profound error in reasoning than that. So many people have somehow acquired the idea that "unique values" and "random values" are synonymous. Because they never bother to check this theory, all else flows from this, in an Aristotelean cascade of wrongheadedness.
  • Matt Westwood 2013-08-07 16:53
    da Doctah:
    Coyne:
    This article is about one of the most persistent anti-patterns I've seen. I can't even guess how many times I've seen algorithms built around random numbers or fractional parts of system time, or similar, and an assumption that somehow there will magically never be a collision.

    A goodie from my current code base, repeated in multiple components: DB2 SQL offers timestamp resolution to the microsecond. So some lameoid takes that microsecond and turns it into a key; "After all, there's no chance that someone else will get the same microsecond value again...it's one in a million. Right?"


    It's a more profound error in reasoning than that. So many people have somehow acquired the idea that "unique values" and "random values" are synonymous. Because they never bother to check this theory, all else flows from this, in an Aristotelean cascade of wrongheadedness.


    Most people are shit at mathematics. The same applies to computer program designers, although the ratio of shit to competent is marginally lower. So it goes.

    The good news is that shit mathematicians program shit programs. The plan is therefore that people don't like shit programs and will use programs written by competent mathematicians. The latter programs will get the respect. To cut a long story short the shit mathematicians will die of starvation. Good riddance to them.
  • Worf 2013-08-07 16:54
    chubertdev:
    Silfax:
    xaade:

    I hate comboboxes that say credit card type, only to have Visa and Other as options.


    You don't even need a combo box - the first few digits of the card number will tell you the card type.



    4111 1111 1111 1111
    5555 5555 5555 4444
    3782 8224 6310 005
    6011 1111 1111 1117


    It's called Issue Identifier Numbers which are the first 6 digits of a card. And that link has a list of common ones.
  • DarrenC 2013-08-07 17:08
    faoileag:
    Paul Neumann:
    I believe we have found the father of the president's daughter (and my ex-wife).

    You must be more precise in your language. Your sentence can be read as:

    ( ) the president's daugher is your ex-wife
    ( ) we have found two people, including your ex-wife
    ( ) the father of the president's daugher is your ex-wife



    You forgot one:

    () The father of the president's daughter is also the father of your wife.
  • Friedrice The Great 2013-08-07 18:33
    Harrow:
    QJo:
    3. Finally, it should be "pontification" not "potification"...
    Are you sure? I thought "potification" means explaining something complicated while under the influence of marijuana while sitting on the toilet.

    -Harrow.

    FTFY.
  • Anonymous Aggie 2013-08-07 19:02
    Make this featured, please.
  • chubertdev 2013-08-07 19:09
    Matt Westwood:
    Most people are shit at mathematics. The same applies to computer program designers, although the ratio of shit to competent is marginally lower. So it goes.

    The good news is that shit mathematicians program shit programs. The plan is therefore that people don't like shit programs and will use programs written by competent mathematicians. The latter programs will get the respect. To cut a long story short the shit mathematicians will die of starvation. Good riddance to them.


    Who died?
  • Jim 2013-08-07 19:45
    faoileag:
    eViLegion:
    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

    You do that once with a complainant that has enough clout (like the most valuable customer your company has, like the vice president's daughter, like the side-affair of your boss...) and you might find out that that policy of yours can make your life far more miserable than the one of the complainant.

    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!
    I sort of agree with this. The one thing worse than "it doesn't work" descriptions, is "it doesn't work because...."

    Users who think they understand stuff are far more dangerous than users who know their limitations.

    HINT: When deleting Grand Prix, don't touch the file Drivers.ini in the Windows directory. It has nothing to do with your game.
  • do people seriousl not get it 2013-08-07 19:51
    Anomaly:
    eViLegion:
    Nagesh:
    No idea why some comets are coming down heavily on radio buttons.


    I think you mean 'meteorites'.


    I think he means comments.
    I think he means cars.
  • Hank 2013-08-07 19:53
    Pock Suppet:
    Anonymous Paranoiac:
    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.

    I prefer the following system:
    * 'z' = form element
    * 'v' = variable
    * 'a' = array
    * 'o' = object
    * 'do' = function, as in "doValidateCrapOnPage"

    It's simple, there's no room for confusion, and it works well with the mostly-typeless languages and mostly-clueless code I suffer through at work. Advanced users will appreciate the convention of having "Foo" functions which are secretly called by their "doFoo" brethren.
    doGetUserID
  • mitchell 2013-08-07 19:57
    da Doctah:
    Coyne:
    This article is about one of the most persistent anti-patterns I've seen. I can't even guess how many times I've seen algorithms built around random numbers or fractional parts of system time, or similar, and an assumption that somehow there will magically never be a collision.

    A goodie from my current code base, repeated in multiple components: DB2 SQL offers timestamp resolution to the microsecond. So some lameoid takes that microsecond and turns it into a key; "After all, there's no chance that someone else will get the same microsecond value again...it's one in a million. Right?"


    It's a more profound error in reasoning than that. So many people have somehow acquired the idea that "unique values" and "random values" are synonymous. Because they never bother to check this theory, all else flows from this, in an Aristotelean cascade of wrongheadedness.
    You're being unfair.

    I generated 1,000 pairs of random numbers and none of the pairs matched. Therefore, random numbers are never the same.

    Excerpt:

    ...
    410841 331973
    447467 560932
    174327 934266
    264407 706924
    935638 373619
    348430 870572
    697496 58394
    541261 421188
    565430 591973
    558070 495402
    701441 617296
    349567 131257
    663316 749970
    162565 28954
    496642 906491
    894895 856550
    873266 853063
    102620 116176
    414838 163105
    920017 278195
    770862 497605
    538445 59203
    ...
  • Nyktos 2013-08-07 20:22
    It's not really a pun; radio buttons really do have that name because they resemble buttons found on radios.
  • abico 2013-08-07 22:51
    Nyktos:
    It's not really a pun; radio buttons really do have that name because they resemble buttons found on radios.

    What buttons?! All my radios always had dials. Hey maybe that's what HTML needs, a <dial> tag. Then we can bring back the paddle controls from the Atari 2600, aka potentiometers or "pots" for short. "Potification", indeed.
  • Bill C. 2013-08-07 23:44
    The best form has two radio buttons and one combo box, and you press all of them.
  • lolatu 2013-08-08 00:56
    Radio buttons and drop downs suck. You should be using jQuery UI and drag and drop all options. Just create a 'tag cloud' of options with a drop target. But for the sake of a clean design the tag cloud should be hidden from view and be available via edge actions.
  • Coyne 2013-08-08 01:11
    mitchell:
    da Doctah:
    Coyne:
    This article is about one of the most persistent anti-patterns I've seen. I can't even guess how many times I've seen algorithms built around random numbers or fractional parts of system time, or similar, and an assumption that somehow there will magically never be a collision.

    A goodie from my current code base, repeated in multiple components: DB2 SQL offers timestamp resolution to the microsecond. So some lameoid takes that microsecond and turns it into a key; "After all, there's no chance that someone else will get the same microsecond value again...it's one in a million. Right?"


    It's a more profound error in reasoning than that. So many people have somehow acquired the idea that "unique values" and "random values" are synonymous. Because they never bother to check this theory, all else flows from this, in an Aristotelean cascade of wrongheadedness.
    You're being unfair.

    I generated 1,000 pairs of random numbers and none of the pairs matched. Therefore, random numbers are never the same.

    Excerpt:

    ...
    410841 331973
    [snip]
    538445 59203
    ...


    It isn't a matter of pairs, necessarily. In the system I was taking as my primary example, it is 20 transactions per second, 2-4 minutes per transaction.

    Assuming even flow, at any given time, the temporary table has around 60 active numbers. The probability of a collision is therefore 60/100000 every time a number is generated; 1 in 1667. My probability is not up to snuff, but I would expect 5 to 6 collisions per 8 hour day assuming (big if!) the numbers are evenly distributed. (I am very sure they are not, though I can't characterize it: It is clear that, for some reason, some microsecond values are much more common than others.)

    The facility in question was protecting itself by locking; when a collision occurred one transaction would stop and wait for the other to finish. That was not deliberate design; that was an accident; that is, the algorithm, which was broken, worked by accident due to another consideration. So when someone inadvertently broke the locking strategy for the algorithm...Wham!...multiple failures (40+) during the next 5 hours of operation.
  • Matt Westwood 2013-08-08 01:16
    Coyne:
    mitchell:
    da Doctah:
    Coyne:
    This article is about one of the most persistent anti-patterns I've seen. I can't even guess how many times I've seen algorithms built around random numbers or fractional parts of system time, or similar, and an assumption that somehow there will magically never be a collision.

    A goodie from my current code base, repeated in multiple components: DB2 SQL offers timestamp resolution to the microsecond. So some lameoid takes that microsecond and turns it into a key; "After all, there's no chance that someone else will get the same microsecond value again...it's one in a million. Right?"


    It's a more profound error in reasoning than that. So many people have somehow acquired the idea that "unique values" and "random values" are synonymous. Because they never bother to check this theory, all else flows from this, in an Aristotelean cascade of wrongheadedness.
    You're being unfair.

    I generated 1,000 pairs of random numbers and none of the pairs matched. Therefore, random numbers are never the same.

    Excerpt:

    ...
    410841 331973
    [snip]
    538445 59203
    ...


    It isn't a matter of pairs, necessarily. In the system I was taking as my primary example, it is 20 transactions per second, 2-4 minutes per transaction.

    Assuming even flow, at any given time, the temporary table has around 60 active numbers. The probability of a collision is therefore 60/100000 every time a number is generated; 1 in 1667. My probability is not up to snuff, but I would expect 5 to 6 collisions per 8 hour day assuming (big if!) the numbers are evenly distributed. (I am very sure they are not, though I can't characterize it: It is clear that, for some reason, some microsecond values are much more common than others.)

    The facility in question was protecting itself by locking; when a collision occurred one transaction would stop and wait for the other to finish. That was not deliberate design; that was an accident; that is, the algorithm, which was broken, worked by accident due to another consideration. So when someone inadvertently broke the locking strategy for the algorithm...Wham!...multiple failures (40+) during the next 5 hours of operation.


    So the real WTF is that the programmer, having generated a random number for the ID of a radio button, didn't check to see he hadn't used that random number before?
  • fleg 2013-08-08 01:42
    Coyne:
    mitchell:
    da Doctah:
    Coyne:
    This article is about one of the most persistent anti-patterns I've seen. I can't even guess how many times I've seen algorithms built around random numbers or fractional parts of system time, or similar, and an assumption that somehow there will magically never be a collision.

    A goodie from my current code base, repeated in multiple components: DB2 SQL offers timestamp resolution to the microsecond. So some lameoid takes that microsecond and turns it into a key; "After all, there's no chance that someone else will get the same microsecond value again...it's one in a million. Right?"


    It's a more profound error in reasoning than that. So many people have somehow acquired the idea that "unique values" and "random values" are synonymous. Because they never bother to check this theory, all else flows from this, in an Aristotelean cascade of wrongheadedness.
    You're being unfair.

    I generated 1,000 pairs of random numbers and none of the pairs matched. Therefore, random numbers are never the same.

    Excerpt:

    ...
    410841 331973
    [snip]
    538445 59203
    ...


    It isn't a matter of pairs, necessarily. In the system I was taking as my primary example, it is 20 transactions per second, 2-4 minutes per transaction.

    Assuming even flow, at any given time, the temporary table has around 60 active numbers. The probability of a collision is therefore 60/100000 every time a number is generated; 1 in 1667. My probability is not up to snuff, but I would expect 5 to 6 collisions per 8 hour day assuming (big if!) the numbers are evenly distributed. (I am very sure they are not, though I can't characterize it: It is clear that, for some reason, some microsecond values are much more common than others.)

    The facility in question was protecting itself by locking; when a collision occurred one transaction would stop and wait for the other to finish. That was not deliberate design; that was an accident; that is, the algorithm, which was broken, worked by accident due to another consideration. So when someone inadvertently broke the locking strategy for the algorithm...Wham!...multiple failures (40+) during the next 5 hours of operation.
    Lucky you're not one to respond to trolls....
  • Steve The Cynic 2013-08-08 03:18
    Coyne:
    This article is about one of the most persistent anti-patterns I've seen. I can't even guess how many times I've seen algorithms built around random numbers or fractional parts of system time, or similar, and an assumption that somehow there will magically never be a collision.

    A goodie from my current code base, repeated in multiple components: DB2 SQL offers timestamp resolution to the microsecond. So some lameoid takes that microsecond and turns it into a key; "After all, there's no chance that someone else will get the same microsecond value again...it's one in a million. Right?"

    I'm disappointed nobody's said something like this, "And one in a million chances happen nine times out of ten."

    Sheesh!
  • da Doctah 2013-08-08 05:41
    Steve The Cynic:
    I'm disappointed nobody's said something like this, "And one in a million chances happen nine times out of ten."

    Sheesh!
    Ninety percent of people have never taken a formal class in probability or statistics. And the other fifty percent have forgotten everything they learned.
  • tin 2013-08-08 05:44
    faoileag:
    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?


    Failure to communicate in a sane way is nothing to do with lack of understanding of a technology. I would actually expect a sensible mechanic to open the bonnet and listen if someone made that statement...
    However when it comes to computers and internet, people seem to be utterly retarded. "It doesn't work" does not even begin to explain the problem. Rather frustratingly, most people who use that description then follow up with "I'm not good with computers" as an excuse for their shitty descriptions.

    If you walk into a doctors office and say "I think I have a medical condition" and then refuse to answer any further questions because "I'm not good with medicine", then you can't expect the doctor to even know what part to start looking at.

    Failure to communicate observations has nothing to do with jargon or terminology. It's pure stupidity, and the internet is growing it like mould on an old piece of toast.
  • Matt Westwood 2013-08-08 07:13
    Steve The Cynic:
    Coyne:
    This article is about one of the most persistent anti-patterns I've seen. I can't even guess how many times I've seen algorithms built around random numbers or fractional parts of system time, or similar, and an assumption that somehow there will magically never be a collision.

    A goodie from my current code base, repeated in multiple components: DB2 SQL offers timestamp resolution to the microsecond. So some lameoid takes that microsecond and turns it into a key; "After all, there's no chance that someone else will get the same microsecond value again...it's one in a million. Right?"

    I'm disappointed nobody's said something like this, "And one in a million chances happen nine times out of ten."

    Sheesh!


    Oh just shoot him in his voonerables.
  • faoileag 2013-08-08 07:32
    tin:
    faoileag:
    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?

    I would actually expect a sensible mechanic to open the bonnet and listen if someone made that statement...

    Same here, I was using that car-related error description as a metaphor. I would expect a sensible developer to look at the problem the complainants are complaining about.

    tin:
    However when it comes to computers and internet, people seem to be utterly retarded. "It doesn't work" does not even begin to explain the problem.

    But the complainants coming to Bjørn were far better than that - to quote from the article "Bjørn was always baffled by the occasional complaints he'd receive from users, [b]reporting that the filtering and categorization functions on many of the application's pages were broken[b]"
    That's a pretty precise problem description for a non-techie.
  • Steve The Cynic 2013-08-08 08:22
    Matt Westwood:
    Steve The Cynic:
    I'm disappointed nobody's said something like this, "And one in a million chances happen nine times out of ten."

    Sheesh!


    Oh just shoot him in his voonerables.

    Thank goodness someone recognised the reference. I was a little worried by the other post, some blither about statistics...
  • CigarDoug 2013-08-08 11:39
    QJo:
    JimmyCrackedCorn:
    QJo:
    JimmyCrackedCorn:
    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.


    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.


    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.


    Oh, and while I'm about it, grammar fail:

    1. 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".

    2. 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.

    3. 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.


    Behold, the Col. Hans Landa of Grammar Nazis! Most impressive, sir.
  • Old 30-year veteran 2013-08-08 13:05
    JimmyCrackedCorn:
    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.


    I just want to thank you.

    Folks like you who obviously do not grasp the fundamentals of User Interface Design are what have kept food on my family for this entire century (and the decade before that).

    For the newbs who don't already know everything: if the number of choices is ~=< 5, use radio buttons. Avoid combo boxes (or "dropdown lists", which are the same thing) when the number of choices is small as they are harder to use on mobile and by older/inexperienced folks.

    If the list is very long, using a filterable combobox (example) will make your users' lives easier.
  • Jay 2013-08-08 14:16
    JimmyCrackedCorn:
    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.


    What a bizarre statement. You say that radio buttons should be used "sparingly", which means that you acknowledge that there are at least some times when they are appropriate. Then, with zero information about what choices he was showing as radio buttons, the layout of the page, or anything else about the application, you conclude that radio buttons were inappropriate in this instance. How could you possibly know?
  • Jay 2013-08-08 14:18
    ABBA:
    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.


    A good general rule that many people follow: Never allow complete ignorance of a subject to prevent you from having strong opinions about it.
  • Norman Diamond 2013-08-08 19:23
    tin:
    faoileag:
    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?
    I would actually expect a sensible mechanic to open the bonnet and listen if someone made that statement...

    If you walk into a doctors office and say "I think I have a medical condition" and then refuse to answer any further questions because "I'm not good with medicine", then you can't expect the doctor to even know what part to start looking at.
    If you walk into a veterinarian's office and say "I think my cat has a medical condition" then I would expect the vet to look at the cat.

    We have to think of our customers as cars or cats. The user doesn't know what's wrong with them, and we have to tell them to bring their computer or car or cat to us so we can look at it.
  • nomdeplume 2013-08-09 05:41
    Norman Diamond:
    If you walk into a veterinarian's office and say "I think my cat has a medical condition" then I would expect the vet to look at the cat.


    ? LOOK AT CAT
    It looks like a regular house cat.

    ? LOOK AT CATS EYES
    The cat meets your gaze with its green eyes for a moment, but then looks away shyly.

    ? LOOK AT CATS TAIL
    The cat's tail flickers back and forth slowly.

    ? LOOK AT CATS BODY
    It looks like a regular cat. It has fur, and it's not too fat. It's just a regular cat.

    ? LOOK AT CATS FEET
    You look at the cats paws. The cat uses them to walk, and to climb, and sometimes to shred its owners furniture. Its claws are currently retracted.

    ? LOOK AT CATS ANUS
    What are you, some kind of sicko?

    ? ASK OWNER ABOUT MEDICAL CONDITION
    Ask the owner? What the hell? You're a vet -- just look at the damned cat and fix it!

    ? LOOK AT CAT
    It looks like a regular house cat.

    Your assistant enters the office and asks if you'll be long -- you're running over time for your next appointment.

    ? TELL ASSISTANT I'LL BE DONE IN A MOMENT
    What?

    ? LOOK AT ASSISTANT
    You don't see an assistant here.

    The cat's owner is getting impatient.

    ? LOOK AT CAT
    It looks like a regular house cat.

    ? ASK OWNER IF CAT HAS BEEN VOMITING
    Ask the owner? What the hell? You're a vet -- just look at the damned cat and fix it!

    ? LOOK AT CATS TONGUE
    The cat doesn't enjoy that, but you do manage to ascertain that it does indeed have a tongue, and it appears to be like a normal cat's tongue.

    ? ASK CAT WHAT IS WRONG
    The cat does not seem interested in conversation at the moment.

    The owner looks at you incredulously.

    ? PET CAT ON THE HEAD
    You pet the cat on the head. It is furry and pleasant to the touch. The cat purrs.

    The owner is making an obvious show of looking at their watch.

    Your assistant comes in and asks how much longer you'll be.

    ...
  • duis 2013-08-09 10:02
    indeed, lol at u.

    Let's say you need to have your form be the interface a desk human needs to use to process a very long line of, let's say, attendees of some sort. Congratulations! you have no reasonable keyboard interface, so you've made everyone wait some factor longer. However, I will concede that drag and drop is, uh, drag and drop-ier.

    Or let's say you have some manual QA happening, Congratulations! the QA person will curse your name for forcing them to mouse around every time they get to your tots not teh suck page which uses drag and drop exclusively.
  • Norman Diamond 2013-08-10 01:31
    nomdeplume:
    Norman Diamond:
    If you walk into a veterinarian's office and say "I think my cat has a medical condition" then I would expect the vet to look at the cat.
    ? LOOK AT CAT
    It looks like a regular house cat.

    ? LOOK AT CATS EYES
    The cat meets your gaze with its green eyes for a moment, but then looks away shyly.

    ? LOOK AT CATS TAIL
    The cat's tail flickers back and forth slowly.

    ? ASK OWNER ABOUT MEDICAL CONDITION
    Ask the owner? What the hell? You're a vet -- just look at the damned cat and fix it!
    Sorry to be pedantic, but in fact that was the case. We knew the cat was weak but we didn't know why. The vet diagnosed pneumonia.

    This reminds me though, Dungeon version 2.6 or something like that was spread all over the net, but I got Dungeon 3.0 working under NT around 1999 or so. I should put it somewhere where it can be downloaded by other old fogies who know real adventurers use text consoles.
  • Norman Diamond 2013-08-10 01:36
    P.S. Some time before we got the cat, the animal shelter took the cat to a veterinarian and said...

    "It ain't broke. Fix it."
  • lolatu 2013-08-12 16:12
    duis:
    indeed, lol at u.

    Let's say you need to have your form be the interface a desk human needs to use to process a very long line of, let's say, attendees of some sort. Congratulations! you have no reasonable keyboard interface, so you've made everyone wait some factor longer. However, I will concede that drag and drop is, uh, drag and drop-ier.

    Or let's say you have some manual QA happening, Congratulations! the QA person will curse your name for forcing them to mouse around every time they get to your tots not teh suck page which uses drag and drop exclusively.


    Dude get with the times. No one uses a mouse anymore. This is the optimal experience in the post-PC touchscreen world we live in.

    [CAPTCHA damnum -- damnum to hell!]
  • foxyshadis 2013-08-21 14:39
    The MAZZTer:
    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.

    Get ye to the sidebar!
  • foxyshadis 2013-08-21 14:48
    Nagesh:
    No idea why some comets are coming down heavily on radio buttons. I think rado buttons have a purpose like all UI element and it is important to know when to use what element.

    Some time check box will do work sometime you need radio button.
    Just do some clear thinking on requirement and accomplish your goal.

    But not multi-select list boxes. Those are a horrifying accident and have no place whatsoever in any context, no matter how much you try to highlight your "hold control to make multiple selections" tip.

    Single-select list boxes are OK and more compact than radio buttons without the click-me annoyance of a drop down. Then it's down to designer preference.
  • foxyshadis 2013-08-21 14:58
    Old 30-year veteran:
    JimmyCrackedCorn:
    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.


    I just want to thank you.

    Folks like you who obviously do not grasp the fundamentals of User Interface Design are what have kept food on my family for this entire century (and the decade before that).

    For the newbs who don't already know everything: if the number of choices is ~=< 5, use radio buttons. Avoid combo boxes (or "dropdown lists", which are the same thing) when the number of choices is small as they are harder to use on mobile and by older/inexperienced folks.

    If the list is very long, using a filterable combobox (example) will make your users' lives easier.
    This reminds me of a particular anti-pattern I see occasionally: Filterable comboboxes that round-trip to the server for every single letter typed. If the server is slow, you're never going to see your cute list as you type, just that eternally spinning throbber.

    Obviously, that's required for search and other big data operations, but many operations have a small enough set of possibilities that they can be easily downloaded and stored for local filtering.
  • blarsen 2013-08-26 05:13
    faoileag:
    Not necessarily. All action can take place client-side.

    And with client-side generated random ids and names for the radio buttons the server wouldn't know waht to to with the data anyway :-)

    You're correct, the values of the radio buttons are used for jQuery DataTable filtering.
  • blarsen 2013-08-26 05:30
    Björn:
    The real WTF is using numbers at the beginning of ids.

    Yes, that is a WTF. And I fixed that in this function once I was in there to do something with the ID generation. Sadly, numeric IDs are rife in the application and can be found in Javascript code, in Java code, in JavaScript code generated by Java code and probably elsewhere as well.

    Bjørn
  • urza9814 2013-08-27 21:28
    Norman Diamond:
    tin:
    faoileag:
    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?
    I would actually expect a sensible mechanic to open the bonnet and listen if someone made that statement...

    If you walk into a doctors office and say "I think I have a medical condition" and then refuse to answer any further questions because "I'm not good with medicine", then you can't expect the doctor to even know what part to start looking at.
    If you walk into a veterinarian's office and say "I think my cat has a medical condition" then I would expect the vet to look at the cat.

    We have to think of our customers as cars or cats. The user doesn't know what's wrong with them, and we have to tell them to bring their computer or car or cat to us so we can look at it.


    See, I would expect the vet to respond by asking "What makes you think that?" If your vet doesn't, I suggest you seek one who actually knows what the heck he's doing.

    Again, you don't tell the vet "I think my cat has a medical condition" -- you tell the vet "My cat isn't eating as much as usual" or "my cat limps" or "my cat keeps coughing".

    And if the vet can't find a cause and nothing seems obviously wrong, he'll tell you nothing is wrong with you cat and give it back to you -- which is the vet's way of saying "CLOSED: Could not reproduce"
  • urza9814 2013-08-27 21:28
    xaade:
    JimmyCrackedCorn:
    QJo:
    JimmyCrackedCorn:
    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.


    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.


    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.

    What, having shared group names?
    I suppose you could put them in a div and somehow work out that's a group. However, do you really need a groupbox around every set of radio buttons?


    Yes, you do. It's an integral part of how they function.

    Of course, you need a <select> box around any set of combobox elements, so it's basically the same thing...
  • Alsee 2013-09-09 13:45
    Easy fix, works fine now:
    var prefix = Math.floor((Math.random() * 19999) + 1)