The Daily WTF: Curious Perversions in Information Technology
Welcome to TDWTF Forums Sign in | Join | Help
in Search

$inputFD[2] = "The neighborhood bycicle"

Last post 05-13-2008 10:21 PM by shadowman. 15 replies.
Page 1 of 1 (16 items)
Sort Posts: Previous Next
  • 05-13-2008 10:33 AM

    $inputFD[2] = "The neighborhood bycicle"

    I'm working with some pretty attrocious code. Every line contains at least one wtf. I've become kind of numb to them by now. But this one was a perfect argument for coding correctly, and not coming up with "clever tricks". You should never have to "trick" the computer into doing what you want. Coding should be intentional, not magical.

    So anyways, I'm working with a script that takes a radius and inserts all of the zip codes within that radius into a database. The new radius is passed through the header as "inputFD[2]", instead of "newRadius" (or something logical like that). Well, the same page (consisting of 10 different files ranging from 300-1200 lines of mostly uncommented code) used in a different context, unbeknownst to me, also passes a list of zipcodes to be inserted into a different DB table through, you guessed it, a header variable called "inputFD[2]" instead of something logical like "zipList".

    Shortly after testing (quickly) and launching an update to this page we started getting jobs that would be assigned every zipcode in the entire USA. We were confused at first. I wrote the code that did the assignment, but I had very little knowledge of the insane spaghetti code that I was inserting this code into. I assumed that inputFD[2] was only ever a zipcode radius, and also assumed that the place I was putting the code to do the insert was only ever run when they were actually working with zipcode radii. These are the sort of assumption one has to make when your boss wants something done NOW.

    By now you may have realized what happened. There is another view of the page that I had no knowledge of where the user can enter a list of zips and it will be passed through the inputFD[2] variable and parsed by my script as if it were a radius, resulting in the script thinking the job has a radius of "27943,23817,23481,23492,..."(etc, etc, up to 500 zips) and therefor in some cases encompasing the entire universe.

    sigh.

    Please give your variables a clear name and one purpose. PLEASE.

    Oh, and this is the from the same PHP page that was the topic of this post. I could probably fine 100 other gems like this in the code in that page...

  • 05-13-2008 10:36 AM In reply to

    Re: $inputFD[2] = "The neighborhood bycicle"

    cmcculloh:
    (etc, etc, up to 500 zips) and therefor in some cases encompasing the entire universe.

    I was unaware we had assigned ZIP codes to the entire universe. Is that what the four-digit extension is for?

  • 05-13-2008 10:40 AM In reply to

    Re: $inputFD[2] = "The neighborhood bycicle"

    bstorer:
    cmcculloh:
    (etc, etc, up to 500 zips) and therefor in some cases encompasing the entire universe.

    I was unaware we had assigned ZIP codes to the entire universe. Is that what the four-digit extension is for?

     

     

    Yeah, but no, there's actually an extra nine-digit extension you can use for intergalactic zips. It only works for the milky way though, after that they start using greek lettering preceeding the zip...

  • 05-13-2008 10:59 AM In reply to

    Re: $inputFD[2] = "The neighborhood bycicle"

    I'll tell you a little secret about zip codes: they're meaningless. Mwahahaha!

  • 05-13-2008 11:07 AM In reply to

    • DeLos
    • Not Ranked
    • Joined on 11-07-2007
    • Posts 36

    Re: $inputFD[2] = "The neighborhood bycicle"

    The Zip codes ... They Do Nothing! 

  • 05-13-2008 11:07 AM In reply to

    Re: $inputFD[2] = "The neighborhood bycicle"

    brianmcculloh:

    I'll tell you a little secret about zip codes: they're meaningless. Mwahahaha!

     

    Did you forget your username and just register a new one?

    WTF?

    Yes, I have been banned. Thanks to all for a good time.

    Tired of incompetent moderation?
    Wondering where all the clever discussion went?
    Try irc.slashnet.org #TDWTFMafia.
    We don't ban or kick and everyone is welcome.*

    *Stupid people will be mocked mercilessly and encouraged to commit suicide, however.
    Filed under:
  • 05-13-2008 11:21 AM In reply to

    Re: $inputFD[2] = "The neighborhood bycicle"

    No, that was my first post. Did I do something wrong? 

  • 05-13-2008 11:27 AM In reply to

    Re: $inputFD[2] = "The neighborhood bycicle"

    brianmcculloh:

    No, that was my first post. Did I do something wrong? 

     

    No but on your second post, quoting who you were referring to would help.

    Yes, I have been banned. Thanks to all for a good time.

    Tired of incompetent moderation?
    Wondering where all the clever discussion went?
    Try irc.slashnet.org #TDWTFMafia.
    We don't ban or kick and everyone is welcome.*

    *Stupid people will be mocked mercilessly and encouraged to commit suicide, however.
    Filed under:
  • 05-13-2008 11:28 AM In reply to

    Re: $inputFD[2] = "The neighborhood bycicle"

    brianmcculloh:

    No, that was my first post. Did I do something wrong? 

     

    I think he is confused because we have the same last name. Probably thought I forgot my password or something and reregistered as "brianmcculloh"... 

  • 05-13-2008 11:31 AM In reply to

    Re: $inputFD[2] = "The neighborhood bycicle"

    MasterPlanSoftware:

    brianmcculloh:

    No, that was my first post. Did I do something wrong? 

     

    No but on your second post, quoting who you were referring to would help.

     

     

    LOL, this is my third and final post. I apologize to tdwtf for any inconvenience. Goodbye. 

  • 05-13-2008 1:45 PM In reply to

    Re: $inputFD[2] = "The neighborhood bycicle"

     No Brian! Don't leave us!

    Message encrypted to secure copyrighted data. Any attempt to break the encryption is in violation of the Digital Millenium Copyright Act of the USA (and similar laws worldwide), and is punishable by fines and/or imprisonment.
  • 05-13-2008 4:13 PM In reply to

    Re: $inputFD[2] = "The neighborhood bycicle"

     

    superjer:
     No Brian! Don't leave us!

    At this rate, we'll have another 5 McCulloughs signed up before he'll even get a chance to see that post.. 

  • 05-13-2008 4:18 PM In reply to

    Re: $inputFD[2] = "The neighborhood bycicle"

    I'm so glad we have MasterPlanSoftware here to tell newbies how to post.

  • 05-13-2008 5:15 PM In reply to

    Re: $inputFD[2] = "The neighborhood bycicle"

    merreborn:

    I'm so glad we have MasterPlanSoftware here to tell newbies how to post.

     

    If he couldn't take the 'brutality' of someone mentioning the quote button, he wasn't going to last here long anyway. You would have a valid complaint if I flamed him for it, but I didn't.

    Stop being an asshole and trying to stir shit up.

    Yes, I have been banned. Thanks to all for a good time.

    Tired of incompetent moderation?
    Wondering where all the clever discussion went?
    Try irc.slashnet.org #TDWTFMafia.
    We don't ban or kick and everyone is welcome.*

    *Stupid people will be mocked mercilessly and encouraged to commit suicide, however.
  • 05-13-2008 7:28 PM In reply to

    Re: $inputFD[2] = "The neighborhood bycicle"

    merreborn:
    I'm so glad we have MasterPlanSoftware here to tell newbies how to post.
    MPS did not tell anyone how to post in this thread, but merely noted the confusion caused by the similar usernames.  I wish newbies didn't need to be told how to post and that people would not post sarcastic flamebait disguised as seemingly-innocent comments.

    Legendary Thread
    Yes my avatar is a fictional character, get over it. (Before she chokes you with her mind.)
  • 05-13-2008 10:21 PM In reply to

    Re: $inputFD[2] = "The neighborhood bycicle"

    MasterPlanSoftware:

    brianmcculloh:

    No, that was my first post. Did I do something wrong? 

     

    No but on your second post, quoting who you were referring to would help.

     

    LOL!  He was quoting Newman.

Page 1 of 1 (16 items)
Powered by Community Server (Non-Commercial Edition), by Telligent Systems