• (cs)
    Alex Papadimoulis:

    Talk about customer service! Josh's company really makes sure that Customer #7742's order date is ... well ... Customer #7742's order date ...

    If .Fields("CUST_NUM") = "7742" Then
    dtmOrderPlaced = dtmOrderPlaced
    End If

     

    This one is called "poor man's conditional breakpoint".

  • Anonymous (unregistered) in reply to ammoQ

    great idea - though this does take away some sidebar fodder.

  • (cs)

    yayyyyy!!

    code WTFs -- lots of them!

    i guess i'll have to stop complaining. what am i going to do with my time now?

     

     

  • Bradlegar the Hobbit (unregistered)
    Alex Papadimoulis:
    private final static String twentyspaces = "                         ";

    Shouldn't that be twentySomethingSpaces?

     

    captcha: awesomeness. Just like today's WTF!

  • Yuriy (unregistered) in reply to Bradlegar the Hobbit
    Anonymous:
    Alex Papadimoulis:
    private final static String twentyspaces = "                         ";

    Shouldn't that be twentySomethingSpaces?

     

    captcha: awesomeness. Just like today's WTF!

     

    twentyFiveSpaces.  I'm guessing the requirements changed to require more spaces, but they didn't feel like changing the variable name everywhere it's used.

  • (cs) in reply to Bradlegar the Hobbit

    Ah, brillant. It's been a while since we've had a delightful smorgasbord of code snippets. These are all fortunately more hillarious than horrid.

    I particularly like how Sunday is Admin day. I suppose they decided that it would be more empowering than Casual Fridays.

  • Karl von L. (unregistered)
    Alex Papadimoulis:
    If .Fields("CUST_NUM") = "7742" Then
    dtmOrderPlaced = dtmOrderPlaced
    End If

    This looks to me like the developer just needed a place to stick a breakpoint so he could start stepping through the code when it got to customer #7742, so he could figure out why it was failing for that customer. At least, that's why *I've* written code like this.
     

  • (cs)
    Alex Papadimoulis:

    I'm sure a lot of you would have mocked Josh's collegue for having a constant named COMMA. Ha! Who's laughing now?

    #define COMMA "|"

    Beautiful in its simple WTF'ery.

    Probably this should be something like

    #define DELIMITER "|"

  • (cs)

    Alex Papadimoulis:
    lSend = IIf(lSend = True, True, False)

    In a loosely typed language, this could actually have an effect similar to

    ISend = (bool) ISend

    no? e.g., if ISend is actually (int)14, the 'wtf' line of code would convert it to a (bool)true, correct?

     
  • el jaybird (unregistered)
    Alex Papadimoulis:
    // This instance of OPParcelObj is owned by an instance of 
    // OPParcelArray that is associated with an instance of 
    // OPCustThread which owns an instance of the parcel 
    // processor which is the processor needed to process 
    // this parcel.

     ... which is part of the house that Jack built?

    (Captcha: Chocobot. Mmmm....)

  • (cs)

    MakeCum reminds me of one of my earlier efforts, when I had to work on a fund accrual generation system, or the FAG system, which consisted of FAG customers, FAG products, FAG rates, etc...

  • (cs)

    My Favorite:

     if (cust = "Wal-Mart")

    order date := dateFromEDI

    ship date := dateFromEDI - (dayof week(today)) + day of week

    end if

    so when you get to day 1, usually monday what happens?

  • (cs)
    Alex Papadimoulis:

    F.S. noticed that Australian airline JetStar is very careful about ensuring visitors are sent to the proper page ...

    if ((version=="NS") || (version=="IE")) 
    {
    if (version=="NS")
    /* NS URL */
    window.location="/skylights/cgi-bin/skylights.cgi";
    else
    /* IE URL */
    window.location="/skylights/cgi-bin/skylights.cgi";
    }
    else
    /* OTHER URL */
    window.location="/skylights/cgi-bin/skylights.cgi";

    Let's be kind and assume the missing comment is something like:

      /* I'll get back to this later - in a hurry! */
     

  • Anonymous (unregistered)
    Alex Papadimoulis:
    Matt Spicer was in the middle of a VB6 to C# conversion projection and stumbled across this next snippet. He decided to not bring this line of code to the new project ...
    lSend = IIf(lSend = True, True, False)
    Now, now, that's perfectly explainable.  You've got to account for if ISend == FileNotFound when you're converting from "robust" Boolean to "boring" Boolean values.
  • Wyatt Earp (unregistered) in reply to ammoQ
    ammoQ:
    Alex Papadimoulis:

    Talk about customer service! Josh's company really makes sure that Customer #7742's order date is ... well ... Customer #7742's order date ...

    If .Fields("CUST_NUM") = "7742" Then
    dtmOrderPlaced = dtmOrderPlaced
    End If

     

    This one is called "poor man's conditional breakpoint".

     Placing a non-conditional breakpoint under the if is significantly faster than placing a conditional breakpoint in the code if this is in a loop that gets executed a bunch of times (at least this was true in VS.NET 2003).

  • (cs) in reply to Anonymous
    Anonymous:
    Alex Papadimoulis:
    Matt Spicer was in the middle of a VB6 to C# conversion projection and stumbled across this next snippet. He decided to not bring this line of code to the new project ...
    lSend = IIf(lSend = True, True, False)
    Now, now, that's perfectly explainable. You've got to account for if ISend == FileNotFound when you're converting from "robust" Boolean to "boring" Boolean values.

    Nice!

  • (cs) in reply to BradC
    BradC:
    Alex Papadimoulis:

    I'm sure a lot of you would have mocked Josh's collegue for having a constant named COMMA. Ha! Who's laughing now?

    #define COMMA "|"

    Beautiful in its simple WTF'ery.

    Probably this should be something like

    #define DELIMITER "|"

    A few projects back I worked with a girl 3 months out of school. We had some coding style rules, one of which was 'descriptive variable names'. Instead of, as you suggest, "DELIMITER", she used something like: "THE_CHARACTER_THAT_SEPARATES_FIELDS_IN_THE_PARAMETER_STRING".

  • anonymous (unregistered)

    Sunday is admin day is pure genius.

    I can't believe I haven't seen that anywhere, before; you can bet I'm going to start using it.

  • Andreas (unregistered)
    Please try to keep Coded Smorgasbord submissions small and no more than eight lines of readable code.
    So as long as the code is not readable, any length is ok... 
  • (cs) in reply to Volmarias

    Volmarias:
    I particularly like how Sunday is Admin day. I suppose they decided that it would be more empowering than Casual Fridays.

    I guess no regular users will use the application on Sundays, so it is safe to assume that anyone using the application on a Sunday is an admin. At least until some user figures out if he changes the date of the PC clock to Sunday then you will get full admin privileges.

  • science_gone_bad (unregistered) in reply to Colin McGuigan

    Or even better, the system I worked on named by the Marketing Wonks:

    CRP

     Had us laughing for an hour since we definitely had the fastest CRP around

     

  • Jan (unregistered)
    Alex Papadimoulis:
    lSend = IIf(lSend = True, True, False) 

    Of course, this is useful.

    Imagine what would happen if the value of lSend equals FileNotFound!
     

  • Dark (unregistered) in reply to merreborn
    merreborn:

    Alex Papadimoulis:
    lSend = IIf(lSend = True, True, False)

    In a loosely typed language, this could actually have an effect similar to

    ISend = (bool) ISend

    no? e.g., if ISend is actually (int)14, the 'wtf' line of code would convert it to a (bool)true, correct?

    See, this is *why* such code is wtf :)

    If ISend is actually (int) 14, then that line of code would convert it to a (bool)false. Because it compares ISend = True, instead of just using ISend as a conditional. And they're not going to be equal.

     

  • (cs) in reply to Bradlegar the Hobbit
    Anonymous:
    Alex Papadimoulis:
    private final static String twentyspaces = "                         ";

    Shouldn't that be twentySomethingSpaces?

     

    I'm guessing that the extra spaces were from Alex's anonymisation.  We wouldn't want top-secret company info leaking out.
     

  • rgs (unregistered)
    Alex Papadimoulis:

    I'm sure a lot of you would have mocked Josh's collegue for having a constant named COMMA. Ha! Who's laughing now?

    #define COMMA "|" 

     

    Hmmm That's not soooo bad, I mean:

       Boss: Write a module that handles .csv files (comma separated values)

       Programmer:  Ok

       [A few days later]

       Boss: Ok, here is a .csv file to try your module:

       File: data;moredata;another data; etc

       Programmer: .....

       [More days later]

       Boss: the client sent this file, almost like the ones we'll use in production

       Second File: data-moredata-another data- etc.

    And so on... 

    The easiest solution is to #define COMMA

     Now I dare all of you to tellme that this never ever happened to you...

     

    Captcha: captcha: captcha: captcha.............
     

  • (cs)
    Alex Papadimoulis:

    F.S. noticed that Australian airline JetStar is very careful about ensuring visitors are sent to the proper page ...

    if ((version=="NS") || (version=="IE")) 
    { 
      if (version=="NS") 
        /* NS URL */ 
        window.location="/skylights/cgi-bin/skylights.cgi"; 
      else 
        /* IE URL */ 
        window.location="/skylights/cgi-bin/skylights.cgi"; 
    } 
      else 
      /* OTHER URL */ 
      window.location="/skylights/cgi-bin/skylights.cgi"; 
    I'm outraged. What about Opera? You can't have Opera browsers going to 
    /skylights/cgi-bin/skylights.cgi! Clearly you have to direct them to 
    /skylights/cgi-bin/skylights.cgi! This is browser discrimination!
    --Rank
  • Botia (unregistered)

    How many of you counted the spaces?  :)

  • (cs)
    Alex Papadimoulis:

    For those of you with a maturity level greater than "14 years old", this next snippet probably won't be for you. Thankfully, Brian Samson isn't one of those people ..

    public class MakeCum {

    public static void main(String[] args) {
    ...
    CLArgParser clap = new CLArgParser(clargs);

    boolean err = clap.doStdArgs(args);

    if (err) {
    System.out.println("Usage: MakeCum ");
    System.out.println(clap.getStdArgsDescription());
    return;
    }
    ...}

    Ah yes, that class has it all: MakeCum, STD Arguments, and even the Clap makes an appearance! And who would have thought a class that did nothing but "convert a set of binned counts to cumulative counts" could be so fun.

    Can... hardly... keep... a... straight... face...  (All that's missing is a "catch (ValueTransitionException valTrEx) {}" block; then I would have lost it.)

    I used to try to avoid the "cum" abbreviation whenever possible, but app I'm currently working on has "cumQty" variables all over the place, so I've gotten pretty desensitized to it.  Now I have much more stamina tolerance for its usage.

  • anonymous (unregistered) in reply to pjsson
    pjsson:

    Volmarias:
    I particularly like how Sunday is Admin day. I suppose they decided that it would be more empowering than Casual Fridays.

    I guess no regular users will use the application on Sundays, so it is safe to assume that anyone using the application on a Sunday is an admin. At least until some user figures out if he changes the date of the PC clock to Sunday then you will get full admin privileges.

     I interpret it as, anyone working on Sunday must need to get work done, and doesn't have time to screw around with potential permission issues, or getting hold of an admin to grant him permissions. 

    (Our non-admin users do not have the privilege to change the clock, so, we don't have to worry about the problem you describe.  We only have to worry about them coming in on Sundays.)

  • Botia (unregistered) in reply to Botia

    Man, it's good to see some nice code WTF's!  This is the stuff that just makes your day.

  • Reed (unregistered) in reply to BradC

    On a really basic intellectual level, programming is about coming up with elegant ways to describe things that happen.  Remember, always name it what it's *for*, and *why it exists* not what exactly it does! Otherwise, why bother with any kind of structured high-level programming?
     

    Reed 

     

    BradC:
    Alex Papadimoulis:

    I'm sure a lot of you would have mocked Josh's collegue for having a constant named COMMA. Ha! Who's laughing now?

    #define COMMA "|"

    Beautiful in its simple WTF'ery.

    Probably this should be something like

    #define DELIMITER "|"

    Pro

  • Rob (unregistered) in reply to science_gone_bad

    I always wanted to create a help desk system called "My Pants". 

    Support: "Hmm, I've never heard of that. Let me search my pants and see what I can find."

    Support:  "I'm sorry, My Pants is down, so I can't answer your question."

    Support:  "I seem to recall seeing something about that in My Pants."

     The 14 year old humor possibilities are endless!

  • (cs) in reply to anonymous
    Anonymous:

    Sunday is admin day is pure genius.

    I can't believe I haven't seen that anywhere, before; you can bet I'm going to start using it.

    Don't forget what the Bible says ... "On the 7th day, the hackers shall rest."

    Bravo, Alex!  Best post in a long, long time .... thanks for giving me some good laughs on a busy Friday afternoon ! 

     

  • (cs)
    Alex Papadimoulis:
    int doctrackId = Convert.ToInt32("0");  //wtf!!


    Maybe the programmer was concerned the int would be initialized with 64 bits, so he used this to try to specify a 32 bit integer, thus conserving memory.

    How many comments the last few months have speculated The Daily WTF was running out of material?  Ha!

  • (cs) in reply to Dark
    Anonymous:
    merreborn:

    Alex Papadimoulis:
    lSend = IIf(lSend = True, True, False)

    In a loosely typed language, this could actually have an effect similar to

    ISend = (bool) ISend

    no? e.g., if ISend is actually (int)14, the 'wtf' line of code would convert it to a (bool)true, correct?

    See, this is *why* such code is wtf :)

    If ISend is actually (int) 14, then that line of code would convert it to a (bool)false. Because it compares ISend = True, instead of just using ISend as a conditional. And they're not going to be equal.

     This is all language dependant, in VB6 some very strange things happen with implicit conversions:

        Dim i As Integer
        i = 14
        Dim x1, x2, x3 As Boolean
        x1 = (i = True)
        x2 = (True = i)
        x3 = i

    x1 and x2 will be false, but x3 is true?

    but that really is the WTF because that iif is stil useless, could have just been

    lSend = (lSend = True)

        Dim i As Integer
        i = 14
        i = (i = True)

    i will be 0 in VB6, so it can be passed to a function taht only excepts 0 or -1, at least that's my guess to the reason

  • (cs)

    "Sunday is admin day" reminds me of when I worked for a large Geographic Information System company.  We had a password backdoor for the benefit of the "specialists" that we'd send out to customer sites to help them with their setup and customization.  Originally, the secret password was the day of the week spelt backwards (ie "yadnus").  But our specialists couldn't get that right even if they wrote the rule on their hands, so we had to change it to a single asterisk.    The specialists actually managed to remember that.  Unfortunately they taught it to all the customers, so in 6 years of working there I never saw a customer using a real password.

  • (cs) in reply to cconroy
    cconroy:

    I used to try to avoid the "cum" abbreviation whenever possible, but app I'm currently working on has "cumQty" variables all over the place, so I've gotten pretty desensitized to it.  Now I have much more stamina tolerance for its usage.

     

    According to a lot of spam I get, there is help available if your cumQty isn't high enough. 

  • foobish (unregistered)

    "The Pilot Episode" - Is that a reference to the first ever episode of The X Files?

    captcha: poprocks - The first ever candy that rocked.
     

  • Chaz (unregistered)

    14 year old humour - I work with a database called "MasterData". Not that funny if you are Kiwi like my colleagues, as they pronounce data the American way (First syllable rhymes with bar). However, I'm from the UK and for me it rhymes with day. Try saying it my way, out loud...

  • (cs)

    What?

    No XML ?!

    <g>

  • (cs) in reply to Chaz
    Anonymous:

    14 year old humour - I work with a database called "MasterData". Not that funny if you are Kiwi like my colleagues, as they pronounce data the American way (First syllable rhymes with bar). However, I'm from the UK and for me it rhymes with day. Try saying it my way, out loud...

    I imagine it could be worse.

    Someone from New England who often adds nonexistent "r" to any word ending in a vowel sound (like idear for idea) !

  • a.non (unregistered) in reply to drdamour
    drdamour:
    Anonymous:
    merreborn:

    Alex Papadimoulis:
    lSend = IIf(lSend = True, True, False)

    In a loosely typed language, this could actually have an effect similar to

    ISend = (bool) ISend

    no? e.g., if ISend is actually (int)14, the 'wtf' line of code would convert it to a (bool)true, correct?

    See, this is *why* such code is wtf :)

    If ISend is actually (int) 14, then that line of code would convert it to a (bool)false. Because it compares ISend = True, instead of just using ISend as a conditional. And they're not going to be equal.

     This is all language dependant, in VB6 some very strange things happen with implicit conversions:

        Dim i As Integer
        i = 14
        Dim x1, x2, x3 As Boolean
        x1 = (i = True)
        x2 = (True = i)
        x3 = i

    x1 and x2 will be false, but x3 is true?

    but that really is the WTF because that iif is stil useless, could have just been

    lSend = (lSend = True)

        Dim i As Integer
        i = 14
        i = (i = True)

    i will be 0 in VB6, so it can be passed to a function taht only excepts 0 or -1, at least that's my guess to the reason

     

    lucky you assigned in he order you id, seeing as you declared 2 variants and 1 boolean:


        x1 = (i = True)
        x3 = (True = i)
        x2 = i

    x2 would have been 14
  • Matt S (unregistered) in reply to merreborn

    This was actually a boolean variable, which defaults to false in VB6.  I think the original intent was to change it to true if it wasn't already, but lSend = True would have actually worked.

  • (cs) in reply to Chaz
    Anonymous:

    14 year old humour - I work with a database called "MasterData". Not that funny if you are Kiwi like my colleagues, as they pronounce data the American way (First syllable rhymes with bar). However, I'm from the UK and for me it rhymes with day. Try saying it my way, out loud...

     What Americans are you talking about? I've always pronounced it "day tuh". 
     

  • (cs) in reply to Rob
    Anonymous:

    I always wanted to create a help desk system called "My Pants". 

    Support: "Hmm, I've never heard of that. Let me search my pants and see what I can find."

    Support:  "I'm sorry, My Pants is down, so I can't answer your question."

    Support:  "I seem to recall seeing something about that in My Pants."

     The 14 year old humor possibilities are endless!

    Lol, nice.

    Support: "Please hold. Sysadmin Julia currently has My Pants down for servicing."

    Support: "I'm sorry, My Pants is a little slow today..."

    Support: "I'm sorry, I can't seem to find that in My Pants."

     

     

  • phsiii (unregistered)

    Re the JetStar example: I don't have a problem with that -- it's expandable/updatable for the future.  Harmless at worst; MIPS are cheap.  Still funny, though...

    Captcha: stfu
     

  • Solo (unregistered) in reply to Karl von L.
    Anonymous:
    Alex Papadimoulis:
    If .Fields("CUST_NUM") = "7742" Then
    dtmOrderPlaced = dtmOrderPlaced
    End If

    This looks to me like the developer just needed a place to stick a breakpoint so he could start stepping through the code when it got to customer #7742, so he could figure out why it was failing for that customer. At least, that's why *I've* written code like this.
     

    I do it too, but I don't let anyone know. I clean up after myself. The next thing you know, another drone is poking through the files checked in with my name on it looking for that kind of thing :)

    captcha: random. As in random code generation.
     

  • Solo (unregistered) in reply to BradC
    BradC:
    Alex Papadimoulis:

    I'm sure a lot of you would have mocked Josh's collegue for having a constant named COMMA. Ha! Who's laughing now?

    #define COMMA "|"

    Beautiful in its simple WTF'ery.

    Probably this should be something like

    #define DELIMITER "|"

    #define PIPE ","
     

  • Anonymous (unregistered) in reply to BradC

    BradC:
    Support: "Please hold. Sysadmin Julia currently has My Pants down for servicing."

    That's almost /too/ good.  Of course, it'd be just the opposite if the following were to happen:

    "I'm sorry, there seems to be a problem with My Pants today.  We had to bring it down, we've been having almost non-stop core dumps this moring."

  • John Meikenson (unregistered) in reply to ammoQ

    That is exactly what that is. It should have been removed during a peer review (HA!), but it's definitely not a WTF.

Leave a comment on “Coded Smorgasbord: The Pilot Episode”

Log In or post as a guest

Replying to comment #:

« Return to Article