• (cs) in reply to David
    David:
    TRWTF is that entering states using a drop-down is an annoyance to the user, and poor usability:
    Jakob Nielsen:
    Making users suffer a drop-down menu to enter state abbreviations is one of many small annoyances that add up to a less efficient, less pleasant user experience. It's worth fixing as many of these usability irritants as you can.
    Link: (BBCode URL Tag failed?) http://www.useit.com/alertbox/annoyances.html
    Not sure what the problem is. I live in Texas. The steps to select it from a dropdown are:
    1. Give the dropdown focus (how you do this is your choice)
    2. Press the "t" key
    3. Press the down arrow key (because Tenessee comes first)
    4. Hit Enter

    Where's the irritant?

  • (cs) in reply to NutDriverLefty
    NutDriverLefty:
    Loopy:
    Last time I looked, there were only 50 states.

    50 states, one district, and four territories.

    Lest ye forget the mother-of-all-states: TRUE, FALSE, FILE_NOT_FOUND

  • Georg Zimmer (unregistered) in reply to dew|frost

    FYI, it is true. Every select on the site is done that way. I posted the largest one.

  • (cs) in reply to Code Dependent
    Code Dependent:
    David:
    TRWTF is that entering states using a drop-down is an annoyance to the user, and poor usability:
    Jakob Nielsen:
    Making users suffer a drop-down menu to enter state abbreviations is one of many small annoyances that add up to a less efficient, less pleasant user experience. It's worth fixing as many of these usability irritants as you can.
    Link: (BBCode URL Tag failed?) http://www.useit.com/alertbox/annoyances.html
    Not sure what the problem is. I live in Texas. The steps to select it from a dropdown are:
    1. Give the dropdown focus (how you do this is your choice)
    2. Press the "t" key
    3. Press the down arrow key (because Tenessee comes first)
    4. Hit Enter

    Where's the irritant?

    Unless the programmer misorders the states, in your case - puts TX before TE, and you do that on auto-pilot -- been burned by that one a few times (NJ)

  • David (unregistered) in reply to Code Dependent
    Code Dependent:
    Where's the irritant?

    I linked the full article with details by Mr. Nielsen in my post. Again, the URL is: http://www.useit.com/alertbox/annoyances.html

  • Bim Job (unregistered) in reply to Code Dependent
    Code Dependent:
    Bim Job:
    Code Dependent:
    Niels:
    <option>TN - Tennessee</option> <option >TX - Texas</option> <option>VI - U.S. Virgin Islands</option> <option>UT - Utah</option>
    That's the RTWTF. Texas' option got an extra space. WHY?
    That's the space they need to keep the Bush family in.
    No, the space we plan to keep Dubya in is the Walls Unit in Huntsville.
    Is it mean of me to hope that the Walls Unit is where they put the Nazis who weren't very good at rocket science?

    Or should I just stick to my erotic dreams about Nurse Ratched and the peculiar use of cattle-prods with respect to feeble Yalie boys who can't even be bothered to sign up and defend their country?

    Here you go.

    Look, Alex, just because my entire post is a url, that doesn't make it spam. Try to get a grasp of the term "filter".

    Um ... are you accusing me of being Alex? Or are you accusing me of being the sort of scum who thinks that "hanging, drawing, and quartering is too good for 'em -- use a blowtorch on their nipples frist!"

    Just a small comment about Huntsville, which is in general quite a decent place. Nazis, psycho nurses, whatever.

    Or then again, you might have just edited that one-urler ... in which case, whoops. For no good reason, anonymous posters are verboten bei dem edit-button.

    I suppose I should Do The Papadimoulis and backspace over myself. You know what? I'm getting tired of cretinous attempts to prevent spamming. You're right. Following the herd, and insisting that humans hit the "submit" button three or thirteen times over, is brain-damaged.

    Just use a proper Bayesian filter, for god's sake. Otherwise, moderate the farking thing.

    It's interesting to me that illiterate gibbering morons still seem to get through the Fences set up by Them Wot Know.

  • (cs) in reply to SlapNut
    SlapNut:
    So North Dakota is no longer a state?

    These kind of errors (as well as the AR==>AZ thing) occur in long sequences like this that are created by cut and paste (as this one obviously was).

    Even assuming you have to use a language so lame this atrocity is the only solution, cut and paste is still the worst possible way to build the code.

    It would have been better to build a simple generator in some kind of scripting language (or even in Excel) to make it, rather than assuming that you can get 3300+ lines of source of this type exactly right.

    But I see this a lot: People I work with who don't look beyond the immediate problem at hand for a better solution or even a way to make the immediate (or repetitive) problem easier to solve.

    It's like they're wearing horse blinders and can only see straight ahead.

  • bored (unregistered) in reply to Federico
    Federico:
    The RWTF is Server Guys: didn't they notice that the application contained far too many lines of code?

    Brilliant!

  • (cs) in reply to snoofle

    "Last time I looked, there were only 50 states" "50 states, one district, and four territories"

    Plus the military codes: AE, AA, and AP.

    http://www.usps.com/ncsc/lookups/usps_abbreviations.html

  • yeah (unregistered)

    My god. That is really ,really bad code. Never seen anything worse.

    [post attempt #3]

  • Gary (unregistered)

    Whoever wrote this code should be ashamed to call him or herself a programmer.

    In fact, I condemn this guilty programmer to hell right now.

  • Anony Mouse (unregistered) in reply to JP

    Everyone shoule have a Mate that is a little Utli!!!!!

  • My Name (unregistered) in reply to ounos
    ounos:
    That's the RTWTF. Texas' option got an extra space. WHY?
    Everything is bigger in Texas
  • (cs) in reply to Bim Job
    Bim Job:
    Or then again, you might have just edited that one-urler ... in which case, whoops.
    Post a comment that's all URL, and you get this: [image]
  • (cs)

    All these people with their loops and databases. Wouldn't it be much easier with:

    Enter your state: <input type="text" maxlength="2" size="2" name="statecode" />
    
    Valid state codes

    There. Three lines, and done.

  • EngleBart (unregistered) in reply to Gieron
    Gieron:
    And North Dakota.
    Silly rabbit, North Dakota is part of Canada. /en/ca This is the United States module! /en/us
  • kittyfark (unregistered)

    I've been lurking for a long time on tdwtf and this abomination is truly the thing I have to comment on and say it's bad. And I didn't even comment on Paula Bean... sigh How come people like this even get employed, then manage to keep their jobs and then get paid?

    Captcha: luctus - how appropriate.

  • Anon (unregistered) in reply to Migala
    Migala:
    ubersoldat:
    It would be funny to see the face of the reviewer of this code when submiting to [cvs|svn|git] and getting the email with the diff
    • 5000 loc
    • 10 loc

    It's funny how you think an organization with code like this has a code reviewer.

    It's funny how he thinks they even have source control.

  • (cs) in reply to Federico
    Federico:
    CAPTCHA: pecus: pecus bill?

    No. pecus, as in "My pecus is bigger than yours."

  • Rob (unregistered)

    Eh - seems fine to me. It works, doesn't it? Minus the typo that resulted in the bug.

  • TimG (unregistered) in reply to Jay
    Jay:
    TimG:
    Steve Syfuhs:
    Same in Canada. Code looks similar to another app I've seen... Except we spell our variables with an 'ou' than 'o'.
    Don't be ridiculous. There's no 'o' in 'variables'.

    He's referring to the "ou" in "OUr variables". Apparently he thinks that Yankees spell it "or variables".

    Oh! My apologies to or northern neighbor then. He's right, or variables all are missing a 'u'. I grew up sort-of close to Canada myself and it's still disconcerting to see those missing 'u's all over or code arond here.

  • Bim Job (unregistered) in reply to Code Dependent
    Code Dependent:
    Bim Job:
    Or then again, you might have just edited that one-urler ... in which case, whoops.
    Post a comment that's all URL, and you get this:

    [image]

    Maybe Ayatollah Khomeini is right. Maybe he isn't.

    But, y'know, anybody who thinks Jews are a bad thing -- I'll take their word for it. Try again!

    A cursory examination via Google suggests that one or more kismets are, in fact, not awfully good. A decent spam filter would qualify at, say, 98%. As far as I can see, Akismet manages something nearer to 50%.

    Well, that's all right, then. Splendid. Particularly when it's applied to a site that actively facilitates urls, and then it complains about them.

    Jolly good. Carry on, boys.

  • (cs) in reply to Bim Job
    Bim Job:
    A cursory examination via Google suggests that one or more kismets are, in fact, not awfully good.
    Particularly as part of an Elvis movie. [image]
  • xeno (unregistered) in reply to takatori
    takatori:
    Worst. Code. Ever.

    I sat here stupified, mouth agape, and mind blank for about a minute before I could think to find the Add Comment link.

    The site has earned its name with this one.

    WHAT THE FRAK!?

    Oh come now, it could be so much worse. The variable names could have had all the vowels removed, and then reinserted at random in random case. They not storing variables names in a variable, and manipulating it rather than using an array. They not using a five-branch if-else statement to make a basic binary descision. The code isn't even justified.

    I'm not inventing these.

  • Bim Job (unregistered) in reply to Code Dependent
    Code Dependent:
    Bim Job:
    A cursory examination via Google suggests that one or more kismets are, in fact, not awfully good.
    Particularly as part of an Elvis movie.

    [image]

    I'm confused here.

    Are you saying that Elvis couldn't cut and paste? I'm sure Colonel Parker could refute you. The man was a genius. Even John Wayne totally failed as a towel-head: the best he could manage was an airport.

    Which is quite impressive, I think you'll agree. Unless, of course, this infernal spam-a-lot software catches the fact that I've just posted a URL...

  • Itay Maman (unregistered)

    Insane. This is just like writing a factorial function as follows:

    switch(n) {
      case 1: return 1;
      case 2: return 2;
      case 3: return 6;
      case 4: return 24;
      case 5: return 120;
      ...
    }
    

    -Itay twitter.com/pembleton

  • harry (unregistered) in reply to Itay Maman
    Itay Maman:
    Insane. This is just like writing a factorial function as follows:
    switch(n) {
      case 1: return 1;
      case 2: return 2;
      case 3: return 6;
      case 4: return 24;
      case 5: return 120;
      ...
    }
    

    -Itay twitter.com/pembleton

    its not really though is it?

  • drobnox (unregistered) in reply to snoofle
    Re: The Utlimate State Selector 2009-09-09 11:12 • by snoofle
    SlapNut:
    So North Dakota is no longer a state?
    

    What about East Dakota?

    East Dakota is abbreviated "MN"
  • the beholder (unregistered) in reply to Itay Maman
    Itay Maman:
    Insane. This is just like writing a factorial function as follows:
    switch(n) {
      case 1: return 1;
      case 2: return 2;
      case 3: return 6;
      case 4: return 24;
      case 5: return 120;
      ...
    }
    

    -Itay twitter.com/pembleton

    More like this:

    switch(n) {
      case 1: 
        $value = 1;
        return $value;
      case 2:
        $value = 1 * 2;
        return $value;
      case 3:
        $value = 1 * 2 * 3;
        return $value;
      ...
    }
    
  • AussieMan (unregistered) in reply to Jay
    Jay:
    AussieMan:
    "It was an easy fix... but it certainly didn't solve the bigger problem."
    The problem is America has too many states. Australia is easier to maintain.

    I agree. I think we should take immediate steps to solve this problem by expelling Massachusetts, New York, Illinois, and California from the union. Let them unite with France. Then we'd all be happier.

    Bingo! I hoped somebody would reply with this suggestion -- I'm not a yank so I couldn't say this myself without annoying Joe American (or Deval Patrick or David Paterson or Pat Quinn or Arnie)

  • Xythar (unregistered) in reply to Bim Job

    Oh sure, that problem was simple to fix, but they're sure going to have a lot of fun when they fix the "North Dakota is missing entirely" problem and related issues.

    Bim Job:
    Um ... are you accusing me of being Alex? Or are you accusing me of being the sort of scum who thinks that "hanging, drawing, and quartering is too good for 'em -- use a blowtorch on their nipples frist!"

    Just a small comment about Huntsville, which is in general quite a decent place. Nazis, psycho nurses, whatever.

    Or then again, you might have just edited that one-urler ... in which case, whoops. For no good reason, anonymous posters are verboten bei dem edit-button.

    I suppose I should Do The Papadimoulis and backspace over myself. You know what? I'm getting tired of cretinous attempts to prevent spamming. You're right. Following the herd, and insisting that humans hit the "submit" button three or thirteen times over, is brain-damaged.

    Just use a proper Bayesian filter, for god's sake. Otherwise, moderate the farking thing.

    It's interesting to me that illiterate gibbering morons still seem to get through the Fences set up by Them Wot Know.

    I'm pretty sure he was posting an aside directed as Alex, I assume originally he tried to just post the link and it wouldn't let him so he added in that extra comment to get past the spam filter. I've had to do the same before, it's not particularly unusual or worthy of quite as long and bizarre a rant as that.

  • Ike (unregistered) in reply to TimG
    TimG:
    Steve Syfuhs:
    Same in Canada. Code looks similar to another app I've seen... Except we spell our variables with an 'ou' than 'o'.
    Don't be ridiculous. There's no 'o' in 'variables'.

    Does that mean Canadians spell it 'ouur variables'? Or does that mean for you 'or variables' and 'our variables' appear indistinguishable? (Mighty Confusing if you ask me)

  • James (unregistered) in reply to Brendan
    Brendan:
    Hi,
    lolwtf:
    Post attempt 4. This comment system ever going to be fixed?

    What makes you think the code from the article came from the comment system? :-)

    Capcha: damnum - an injury suffered by male bicyclists.

    Because the comment system works really well too...

    (I've found if you let the page load before you submit then most times things are ok. Also, sometimes doing a 'preview' first works too).

    That being said.... x2

  • Anonymous (unregistered) in reply to Bim Job
    Bim Job:
    Code Dependent:
    Bim Job:
    Code Dependent:
    Niels:
    <option>TN - Tennessee</option> <option >TX - Texas</option> <option>VI - U.S. Virgin Islands</option> <option>UT - Utah</option>
    That's the RTWTF. Texas' option got an extra space. WHY?
    That's the space they need to keep the Bush family in.
    No, the space we plan to keep Dubya in is the Walls Unit in Huntsville.
    Is it mean of me to hope that the Walls Unit is where they put the Nazis who weren't very good at rocket science?

    Or should I just stick to my erotic dreams about Nurse Ratched and the peculiar use of cattle-prods with respect to feeble Yalie boys who can't even be bothered to sign up and defend their country?

    Here you go.

    Look, Alex, just because my entire post is a url, that doesn't make it spam. Try to get a grasp of the term "filter".

    Um ... are you accusing me of being Alex? Or are you accusing me of being the sort of scum who thinks that "hanging, drawing, and quartering is too good for 'em -- use a blowtorch on their nipples frist!"

    Just a small comment about Huntsville, which is in general quite a decent place. Nazis, psycho nurses, whatever.

    Or then again, you might have just edited that one-urler ... in which case, whoops. For no good reason, anonymous posters are verboten bei dem edit-button.

    I suppose I should Do The Papadimoulis and backspace over myself. You know what? I'm getting tired of cretinous attempts to prevent spamming. You're right. Following the herd, and insisting that humans hit the "submit" button three or thirteen times over, is brain-damaged.

    Just use a proper Bayesian filter, for god's sake. Otherwise, moderate the farking thing.

    It's interesting to me that illiterate gibbering morons still seem to get through the Fences set up by Them Wot Know.

    Banning anonymous posters from posting links would fix part of the problme (most of us are not too bad on the [ctrl][c], [ctrl][v] combination (and my mouse skills are fast improving).

    In fact (hypocritically speaking), banning anonymous posters would eradicate almost all spamming. Frankly, though, I think letting anon people post is good and encourages comment. Giving them only the most basic abilities (ie take away their bbcode) gives them an incentive to join if they are repeat posters.

  • Buzzard (unregistered) in reply to AussieMan
    AussieMan:
    "It was an easy fix... but it certainly didn't solve the bigger problem."
    The problem is America has too many states. Australia is easier to maintain.

    New Zealand, moreso....

  • Dunc (unregistered) in reply to AussieMan
    Jay:
    AussieMan:
    "It was an easy fix... but it certainly didn't solve the bigger problem."
    The problem is America has too many states. Australia is easier to maintain.

    I agree. I think we should take immediate steps to solve this problem by expelling Massachusetts, New York, Illinois, and California from the union. Let them unite with France. Then we'd all be happier.

    And of course, that would have stopped a major war - France would never have invaded Iraq after 9/11. And if they did, history says they would have lost.

  • airdrummer (unregistered) in reply to SR

    1/2 doz t'other: either you sort on the full state name or the abreviation...both are valid.

  • (cs) in reply to Anon
    Anon:
    I thinking it's stored in a database table with 50+ columns
    No, no, I'm sure with such an inspired design it's spread across 50+ tables each with one column.
  • Xythar (unregistered) in reply to Anonymous
    Anonymous:
    In fact (hypocritically speaking), banning anonymous posters would eradicate almost all spamming. Frankly, though, I think letting anon people post is good and encourages comment. Giving them only the most basic abilities (ie take away their bbcode) gives them an incentive to join if they are repeat posters.

    Unlikely, bots are just as capable of registering accounts as they are of posting spam. If this hypothetical was actually true then forum spam would not be an issue, where it actually plagues forums all over the Internet (even though most require registration to post).

  • cite (unregistered)

    form_for(@order) do |f| ... f.collection_select(:state, State.all, :id, :shortname) ... end

    TRWTF is that he mentions there were even bigger problems. I guess that's the real nightmare stuff.

    Captcha: genitus - singelton male genitalia?

  • (cs) in reply to Xythar
    Xythar:
    [B]ots are just as capable of registering accounts as they are of posting spam.
    That's why you allow some anonymous posting, but only in a restricted way. That helps keep the bot authors from putting a lot of effort in to targeting you, and yet it also provides an incentive to real users to register.

    And admins have to have the ability to ban spammy accounts, or rather to set a flag on the account that means that the account silently can't commit changes to the database, so spam just gets black-holed. And it will just make the site look a bit broken to the spammers (goodness knows there's enough sites like that about) instead of actively hostile.

  • k1 (unregistered) in reply to @Deprecated
    @Deprecated:
    Obviously the WTF is that the coder created an input to select a province, and then filled it with 55 US states.
    You don't think in American Empire way... :D

    CYA

  • k1 (unregistered) in reply to Code Dependent
    Code Dependent:
    Anon:
    ounos:
    That's the RTWTF. Texas' option got an extra space. WHY?
    WTF? Real The What The Fuck? That's TRWTF.
    No, look, he put "the" in front of it. It's "Real True WTF".
    I think it's the "Really Trully WTF"

    CYA (typo on purpose :D)

  • poo (unregistered) in reply to Itay Maman
    Itay Maman:
    Insane. This is just like writing a factorial function as follows:
    switch(n) {
      case 1: return 1;
      case 2: return 2;
      case 3: return 6;
      case 4: return 24;
      case 5: return 120;
      ...
    }
    

    -Itay twitter.com/pembleton

    Except writing a lookup table for factorials is not even slightly insane. Although that's not exactly the syntax I'd use, what you have suggested is essentially the fastest factorial function that can be written.

  • ex-vb6-dev (unregistered) in reply to Steve Syfuhs
    Steve Syfuhs:
    AussieMan:
    "It was an easy fix... but it certainly didn't solve the bigger problem."
    The problem is America has too many states. Australia is easier to maintain.

    Same in Canada. Code looks similar to another app I've seen... Except we spell our variables with an 'ou' than 'o'.

    Same in the Netherlands. But who exactly do you think spells 'or variables'?????

  • (cs) in reply to ex-vb6-dev
    ex-vb6-dev:
    Same in the Netherlands. But who exactly do you think spells 'or variables'?????
    In the Netherlands, it'd be 'or varijables'?
  • Herby (unregistered)

    This reminds me of the code I saw for finding a value based upon five measurements. The object was to discard the high and low values, and average the other three. The guy who wrote the code used Basic and without the use of arrays (arrays, what are those?) took over three pages (60 lines per) to do the calculation. The whole thing was full of if statements and even more variables to calculate the whole thing. Yes, it did the job, but OH! was it UGLY!

    p.s. Also difficult. Think ASR33 as a printer.

  • Chris (unregistered) in reply to Bellinghman
    Bellinghman:
    ex-vb6-dev:
    Same in the Netherlands. But who exactly do you think spells 'or variables'?????
    In the Netherlands, it'd be 'or varijables'?

    Nope, it would be "onze variabelen"...

  • genitus (unregistered) in reply to ounos
    ounos:
    <option>TN - Tennessee</option> <option >TX - Texas</option> <option>VI - U.S. Virgin Islands</option> <option>UT - Utah</option>
    That's the RTWTF. Texas' option got an extra space. WHY?
    They've got space to spare.
  • n00b (unregistered)

    I once wrote a php code that generated a long html form (13k lines). Basically it looked something like this:

    for (~150x) print name for (~75x) if x=y print option selected else print option

    Back then I though that maybe it would be better to use JS because the options where same for all the 150 names and the generated html/js would be at least 70x smaller but I never got around doing so..

    Now I can't imagine how long the php code would have to be if instead of the loops I would have used the same approach as in this article... (Original php code was about 50 lines.)

Leave a comment on “The Ultimate State Selector”

Log In or post as a guest

Replying to comment #:

« Return to Article