• (cs)

    if ($Post == 'First') { $Post.delete(); } elseif ( $Post == 'Fist!') { $Post.delete(); } elseif { $Post == 'Brillant' ) { ...snip 1,234,877,980,998,234,999,564,090,000 lines of code }

  • Federico (unregistered)

    #!/bin/sh

    for char in W T F '!'; do if "$char" == 'W'; then echo 'W' elif "$char" == 'T'; then echo 'T' elif "$char" == 'F'; then echo 'F' elif "$char" == '!'; then echo '!' fi done

    CAPTCHA: pecus: pecus bill?

  • AussieMan (unregistered)
    "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.
  • (cs)
    <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?
  • eViLegion (unregistered)

    I particularly like the maintainability of this example.

  • (cs)

    He should be grateful that they didn't have a drop-down to select the country you live in.

  • Ville (unregistered)

    I don't understand why the bigger problem wasn't fixed at the same time. It would've taken maybe 2 minutes to fix it, after all.

  • eViLegion (unregistered) in reply to ounos

    Because Texas is full of empty space?

  • (cs) 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?
    Because everything's bigger in Texas.
  • @Deprecated (unregistered)

    Obviously the WTF is that the coder created an input to select a province, and then filled it with 55 US states.

  • Yazeran (unregistered)

    Oh My God!!!

    Initially I was thinking that they did some regexp or something after creating that 'select' string and somehow bungled that (not so hard when doing regexps), but then I scrolled down and saw the second if statment (My brain likely glossed over the first one to save my sanity) and then I understood....

    Yours Yazeran

    Plan: To go to Mars one day with a hammer

  • Federico (unregistered)

    The RWTF is Server Guys: didn't they notice that the application contained far too many lines of code?

  • Bri (unregistered) in reply to ounos

    You are incorrectly assuming the state selector was created via copy-paste. It was hand-written. This is the kind of code you get if you pay bonuses based on LOC.

  • ugh (unregistered)

    I was sick in my mouth.

  • (cs)

    Shouldn't Mr. Zimmer forget about playing with code and get busy running The Men's Wearhouse?

  • (cs) in reply to ounos

    -- Re: The Utlimate State Selector 2009-09-09 09:11 • by 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?

    copy paste programming

    copy paste the previous block of options, remove selected="selected" and leave the space that was there without caring too much

  • highphilosopher (unregistered) in reply to Bri

    I disagree, this looks like copy-paste disease to me.

  • Anon (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?

    WTF? Real The What The Fuck? That's TRWTF.

  • (cs) in reply to Anon
    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".
  • Wulf (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.

    Imagine if this were to go multi-national,LOC bonus anyone?

  • JP (unregistered)

    The real WTF is the 'Utlimate' in the title of this article. A little proof reading before posting perhaps?

  • (cs)

    If it's in Perl, I'd do it like:

    %statesel = ();
    $statesel{$state} = " selected='selected'";
    $states = "<select name='usr_state'>
        <option value='AL'$statesel{'AL'}>AL - Alabama</option>
        <option value='AK'$statesel{'AK'}>AK - Alaska</option>
    

    [snip rest of states] </select>";

    (note that I use "value" attributes so that the variable gets set to the state code without the descriptive text; more useful for database storage and address printing this way; and I call a state a state instead of a province; damn Canadians!)

  • freibooter (unregistered) in reply to JP
    JP:
    The real WTF is the 'Utlimate' in the title of this article.

    Really? I think the current title is quite brillant!

  • Mott555 (unregistered)

    Wow, it hurts to read....really really bad.

  • Brain (unregistered) in reply to JP
    JP:
    The real WTF is the 'Utlimate' in the title of this article. A little proof reading before posting perhaps?
    Ultimate properly describes this on this site. I'm looking forward to 5 years from now seeing one even worse and going into a gran mal seizure.
  • Mark Jonson (unregistered)

    TRWTF is that Arkansas (AK) is listed before Arizona (AZ) every time.

  • Rocco (unregistered) in reply to Mott555

    else if ($province == "AR - Arkansas") { $provinces = "<select name='usr_province'> <option>AL - Alabama</option> <option>AK - Alaska</option> <option selected='selected'>AZ - Arizona</option>

    So if I move to Arkansas, should I send my stuff to Arizona?

  • Mark Jonson (unregistered) in reply to Mark Jonson

    Sorry, made a few errors. AK is Alaska, AR is Arkansas. And TRTRWTF is that AZ was actually listed before AR.

  • SR (unregistered) in reply to Brain
    freibooter:
    JP:
    The real WTF is the 'Utlimate' in the title of this article.

    Really? I think the current title is quite brillant!

    Brain:
    Ultimate properly describes this on this site. I'm looking forward to 5 years from now seeing one even worse and going into a gran mal seizure.

    I think "ultimate" is a great description. "Utlimate" is not so good.

  • Anonymous (unregistered)

    Oh come on, you're bullshitting us!! Aren't you? Please? How do you screw up something so simple so badly? There really is only one explanation: this was an equal opportunities employee on work placement as part of their "CS for the Mentally Handicapped" course. It just has to be.

    [Post attempt #3]

  • SR (unregistered) in reply to Mark Jonson
    Mark Jonson:
    And TRTRWTF is that AZ was actually listed before AR.

    I'm no American but isn't Arizona (AZ) supposed to come before Arkansas (AR)?

    CAPTCHA: had a really nice pink and green background.

  • (cs) in reply to Anonymous
    Anonymous:
    There really is only one explanation

    Apart from Paula Bean, you mean.

  • Niels (unregistered) in reply to 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?

    That's the space they need to keep the Bush family in.
  • Steve Syfuhs (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.

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

  • (cs) in reply to SR
    SR:
    I'm no American but isn't Arizona (AZ) supposed to come before Arkansas (AR)?
    Depends on whether you're sorting by state name or state code, silly.

    (BTW, did the author of this code ever stop to look at it and think "there must be a better way"? It's even possible to improve it without using a loop, for goodness' sake!)

  • Rodnas (unregistered)

    Maybe this code was written by the son or daugther of Paula Bean. He or she should be the right age now to produce this code.

    Good title for a horror movie too: "Son of Paula Bean"

  • MadtM (unregistered) in reply to highphilosopher
    highphilosopher:
    I disagree, this looks like copy-paste disease to me.

    Oh the humanity...

  • SR (unregistered) in reply to dkf
    dkf:
    Depends on whether you're sorting by state name or state code, silly.

    Exactly. You can argue it either way - hardly a WTF (especially not in that code sample.

    dkf:
    (BTW, did the author of this code ever stop to look at it and think "there must be a better way"? It's even possible to improve it without using a loop, for goodness' sake!)

    I reckon the original coder did, but only after the Emperor of Canada (yesterday's WTF) fired him.

  • Pauldy (unregistered)

    ZOMG so many WTFs head asplodes with "The Utlimate State Selector", state provinces states alphabetized by the code instead of the name and writting one module of 30,000 lines and taking the week off. I'm anxious now to see the module that takes the return value from the form and converts it into something that is stored in the database.

  • Rebecca (unregistered)

    This makes my brain hurt in so many ways.

    I read the intro paragraph, totally missed the first 'if', read the first state list.... couldn't find the wtf.... reread it... still didn't see it.... scrolled down... and then it hit me.

    My jaw literally dropped.

    captcha: vulputate. Teehee, that sounds dirty.

  • SlapNut (unregistered)

    So North Dakota is no longer a state?

  • SlapNut (unregistered)

    So North Dakota is no longer a state?

  • (cs) in reply to Pauldy
    Pauldy:
    I'm anxious now to see the module that takes the return value from the form and converts it into something that is stored in the database.

    Database? It probably submits via mailto to a group of people who hand edit an Excel spreadsheet stored on a shared drive somewhere.

  • (cs) in reply to dkf
    dkf:
    SR:
    I'm no American but isn't Arizona (AZ) supposed to come before Arkansas (AR)?
    Depends on whether you're sorting by state name or state code, silly.

    (BTW, did the author of this code ever stop to look at it and think "there must be a better way"? It's even possible to improve it without using a loop, for goodness' sake!)

    I've actually met "code typists" (can't bring myself to call them developers or coders) who are actually incapable of stopping and reflect on the crap they are typing.

    I've never seen anything that bad (in number of LOC), but I've seen vulgarities just as viscerally bad that makes you wanna claw your eyes out and curl into a ball under a running shower. And they look at that type of code and they don't think anything about it.

    They just don't get it, and I still can't get how the hell they graduate from college, get a job... and stay on that job producing that type of crap.

  • (cs) in reply to Niels
    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.
  • monkey (unregistered)

    A great way to work if you get paid by the line!

  • (cs) in reply to dtobias
    dtobias:
    If it's in Perl, I'd do it like:

    Why wouldn't you just set use, I dunno, a loop? (I ask because you seem quasiserious and your code's not really bad enough to be funny.) Or if you want good perl...

    %states = (AL => 'Alabama', ...);
    $selector = join "\n",
      "<select>", 
      (map { sprintf ('<option value="%s"%s>%s - %s</option>',
                 $_, 
                 $_ eq $selected ? ' selected' : '',
                 $_, 
                 $states{$_},
      )} sort keys %states),
      "</select>";
    

    See? Perl is a pretty language! (assuming you can get past a few $%_s without OMGing too much).

  • (cs)

    TRWTF is that Northern Mariana Islands is missing.

    And North Dakota.

  • (cs)

    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
  • SR (unregistered) in reply to Gieron
    Gieron:
    TRWTF is that Northern Mariana Islands is missing.

    And North Dakota.

    Given the effort of updating this trainwreck, they'd stay missing til someone was kind enough to rewrite it

Leave a comment on “The Ultimate State Selector”

Log In or post as a guest

Replying to comment #:

« Return to Article