• (cs)
    Alex Papadimoulis:

    Scott Stanchfield was tasked with optimizing memory usage in a Java application and found a way to shave a few bytes left in by an intern with a sense of humor ...

    public class ValidationMessage
    {
      //internal members
      string messageId;
      string messageText;
      string helpLink;
      /* ... */
      double cheeseburger;
      char broiled;
      long time;
    

    //helper functions /* ... */ }

    <FONT face=Arial>Nice...</FONT>

  • (cs)
    public class ValidationMessage
    {
    //internal members
    string messageId;
    string messageText;
    string helpLink;
    /* ... */
    double cheeseburger;
    char broiled;
    long time;

    //helper functions
    /* ... */
    }


    LOL

    That is a good one!
  • (cs)

    And while we're picking on the VS Tools for Office, following is the code required to call Excel's Dialog Show from C# ...

    if(xlApp.Dialogs[Excel.XlBuiltInDialog.xlDialogOpen].Show(sTextName,
      Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
      Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
      Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
      Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
      Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
      Type.Missing, Type.Missing, Type.Missing, Type.Missing) == true) { ... }
     
    Welcome to Office Interop for .NET.  This joyous thing is in .NET 2003, too.
    'M I first?
  • NiggerFromNiger (unregistered) in reply to Eric Shinn

    n1 roflskates

  • (cs)
    Alex Papadimoulis:

    Scott Stanchfield was tasked with optimizing memory usage in a Java application and found a way to shave a few bytes left in by an intern with a sense of humor ...

    public class ValidationMessage
    {
      //internal members
      string messageId;
      string messageText;
      string helpLink;
      /* ... */
      double cheeseburger;
      char broiled;
      long time;
    

    //helper functions /* ... */ }



    Burger King fan?

    Alex Papadimoulis:

    Buried inside of a large ACH validation routine, Stefanie found this line ...

    if (i == 892)  syscall_beep();


    Alex forgot to mention that Stefanie was brought in to figure out why their server was constantly beeping at odd intervals ;-P

    Alex Papadimoulis:

    The following variable names (submitted by A and O, respectively) are best enjoyed with a maturity age of fourteen years or less ...

    float CumRate;  // Cumulative pass rate
    

    ...

    string ass = Request.Form["associated_skill_"+selId]; if (ass.IndexOf(",") > -1) { ass = ass.Split(',')[0]; } row.ID = int.Parse(ass)



    All an essential part of the PrisonCellMate class ;-)
    <p>

    Alex Papadimoulis:

    Matt Spicer understands that this following function is called like "EnableDisable(true);" but still wondered exactly what would happen ...

    //Enable or disable controls in the form
    private void EnableDisable(bool blnEnable) { ... }



    Actually, after trying to find something funny to say about this function, it becomes quite obvious what it does.
    The function doesn't return a value, and the parameter is not a boolean. Therefore, we can assume that the value
    passed is what we want to be done. The name of the parameter is Enable. So, if Enable is true, it enables the
    controls. If it is false, it disables it.


  • cynic (unregistered)
    Alex Papadimoulis:
    public class ValidationMessage
    {
      //internal members
      string messageId;
      string messageText;
      string helpLink;
      /* ... */
      double cheeseburger;
      char broiled;
      long time;
    

    //helper functions /* ... */ }


    If the above is supposed to be written in Java, then it should be String, not string.

  • Erick (unregistered)

    public class haveit {}

    haveit yourway;

  • kwan3217 (unregistered)

    Buried inside of a large ACH validation routine, Stefanie found this line ...

    if (i == 892)  syscall_beep();

    I've done stuff like this in a lot of programs. It's obviously there for debugging, and probably he set a breakpoint on syscall_beep(). There obviously was a problem with thing 892, and in an effort to debug, and not have to trace through the previous 891 things, you put in a line of code with no effect, inside of an if, and break on it.

    <obligatory>The real WTF is that they forgot to take it out.</obligatory>
  • bob (unregistered)

    >if(xlApp.Dialogs[Excel.XlBuiltInDialog.xlDialogOpen].Show(sTextName,
    >  Type.Missing

    NOW do we understand why optional params are a bad idea?? Over f'ing load the method, people, I think even VB.NET can handle that. Suppose this was just a COM wrapper though...

  • (cs) in reply to cynic
    Anonymous:
    If the above is supposed to be written in Java, then it should be String, not string.


    While it may have the wrong case there for Java, it is, in fact, perfectly correct C++.

  • (cs) in reply to Otto
    Otto:
    Anonymous:
    If the above is supposed to be written in Java, then it should be String, not string.


    While it may have the wrong case there for Java, it is, in fact, perfectly correct C++.


    ..... assuming that string was defined as a type.... otherwise all fingers point to C# ;-)
  • (cs)
    Alex Papadimoulis:
      ass = ass.Split(',')[0];



    Best. Line of code. Ever.

  • (cs)
    Alex Papadimoulis:

    The following variable names (submitted by A and O, respectively) are best enjoyed with a maturity age of fourteen years or less ...

    float CumRate;  // Cumulative pass rate
    

    ...

    string ass = Request.Form["associated_skill_"+selId]; if (ass.IndexOf(",") > -1) { ass = ass.Split(',')[0]; } row.ID = int.Parse(ass)



    One of my favorite pieces of code that is similar to this is in the system at my company.  Written by yours truly, it looks a little something like this:

    <font face="Courier New" size="2">Assessment ass = </font><font color="#0000ff" face="Courier New" size="2">new </font><font face="Courier New" size="2">Assessment(...);
    ...
    </font><font color="#0000ff" face="Courier New" size="2">if</font><font face="Courier New" size="2">(ass.Dirty)
    {
        ...
    }</font>
  • (cs) in reply to cconroy
    cconroy:
    Alex Papadimoulis:
      ass = ass.Split(',')[0];



    Best. Line of code. Ever.



    I swear, I would have used a pipe delimiter and an x variable for the smooch.

    ass = ass.Split('|')[x]
  • (cs) in reply to Ytram
    Ytram:


    One of my favorite pieces of code that is similar to this is in the system at my company.  Written by yours truly, it looks a little something like this:

    <font face="Courier New" size="2">Assessment ass = </font><font color="#0000ff" face="Courier New" size="2">new </font><font face="Courier New" size="2">Assessment(...);
    ...
    </font><font color="#0000ff" face="Courier New" size="2">if</font><font face="Courier New" size="2">(ass.Dirty)
    {
        ...
    }</font>


    I like to come up with creative sub-classes of exception so that I can write things like

    <font face="Courier New">catch(BranchOperationRequiredException bare)

    and

    catch(DuplicateOperationPreventedException dope)
    </font>
  • Bradlegar the Hobbit (unregistered)

    God is real, unless declared integer.

    Captcha: Pizza.  And I just finished my lunch ...

  • (cs)
    Alex Papadimoulis:

    We've all seen the "const ONE=1" plenty of times, so here's a fun variation that Matthew Farwell found in cost estimating software. To be fair to the original programmer, no one could have possibly anticipated that someone, somewhere, sometime might want to increase prices ...

    public final static int V_125 = 155;
    public final static int V_165 = 195;
    public final static int V_195 = 225;
    public final static int V_225 = 255;
    public final static int V_255 = 285;
    public final static int V_285 = 315;
    public final static int V_345 = 375;
    public final static int V_405 = 375;
    public final static int V_435 = 435;
    public final static int V_495 = 495;
    public final static int V_555 = 555;
    public final static int V_615 = 615;


    public class Winston
    {
        public static final int TWO_PLUS_TWO = 5;
    }

    Alex Papadimoulis:
    The following variable names (submitted by A and O, respectively) are best enjoyed with a maturity age of fourteen years or less ...

    float CumRate;  // Cumulative pass rate
     


    In all fairness, I see "cum" used as an abbreviation for "cumulative" rather often.  I guess I just tune it out after a while.  Though I personally have a strict policy of avoiding abbrevations as much as possible, except for very common ones like "XML".

  • (cs) in reply to John Bigboote

    John Bigboote:
    Ytram:

    One of my favorite pieces of code that is similar to this is in the system at my company.  Written by yours truly, it looks a little something like this:

    <FONT face="Courier New" size=2>Assessment ass = </FONT><FONT face="Courier New" color=#0000ff size=2>new </FONT><FONT face="Courier New" size=2>Assessment(...);
    ...
    </FONT><FONT face="Courier New" color=#0000ff size=2>if</FONT><FONT face="Courier New" size=2>(ass.Dirty){ ... }</FONT>


    I like to come up with creative sub-classes of exception so that I can write things like
    <FONT face="Courier New">catch(BranchOperationRequiredException bare)
    and
    catch(DuplicateOperationPreventedException dope)
    </FONT>

    Or the ever popular:

    catch (WhenTrueFalse wtf) {
         // not FileNotFound
    }
    
  • foxyshadis (unregistered) in reply to bob
    Anonymous:

    >if(xlApp.Dialogs[Excel.XlBuiltInDialog.xlDialogOpen].Show(sTextName,
    >  Type.Missing

    NOW do we understand why optional params are a bad idea?? Over f'ing load the method, people, I think even VB.NET can handle that. Suppose this was just a COM wrapper though...


    Yeah, COM is that chunk of Win16 that stubbornly refuses to die, giving up a steady stream of WTF from 1992 to present.

    On a vague tangent, I really wish I could find a compiler/preprocessor that supported named arguments in C,  C++, C#, or Java. Everytime I touch win32 code after a month or two elsewhere I come back and end up clueless as to what arguments are doing, especially surrounded by a random number of NULLs.
  • Matt the Greater (unregistered) in reply to John Bigboote
    John Bigboote:


    I like to come up with creative sub-classes of exception so that I can write things like

    <font face="Courier New">catch(BranchOperationRequiredException bare)

    and

    catch(DuplicateOperationPreventedException dope)
    </font>


    or maybe:
    catch(PriceUnitHolderSelectionException puhse)
  • (cs) in reply to juvenile

    Several years ago, we worked on a system that wreaked of buzzword bingo. We had to add a new db table to hold transaction log records, locally called record-of-diary, but all the good acronyms (relevant to the system) were already used. My boss, in a fit of frustration, told the dba to just name the table 'asshole'. He did. Two days later, we started getting nasty e-mails from the operations group complaining about log entries that looked like this:

    inserting ROD into asshole ...

    *sigh*

  • Matt the Greater (unregistered) in reply to Matt the Greater
    Anonymous:
    John Bigboote:


    I like to come up with creative sub-classes of exception so that I can write things like

    <font face="Courier New">catch(BranchOperationRequiredException bare)

    and

    catch(DuplicateOperationPreventedException dope)
    </font>


    or maybe:
    catch(PriceUnitHolderSelectionException puhse)


    That's real by the way :)
  • (cs) in reply to Matt the Greater

    Anonymous:
    Anonymous:
    John Bigboote:


    I like to come up with creative sub-classes of exception so that I can write things like

    <FONT face="Courier New">catch(BranchOperationRequiredException bare)

    and

    catch(DuplicateOperationPreventedException dope)
    </FONT>


    or maybe:
    catch(PriceUnitHolderSelectionException puhse)


    That's real by the way :)

    I get the abbreviation with initials, but what else does puhse stand for?

  • (cs)
    Alex:

      double cheeseburger;
      char broiled;
      long time;

     byte me;

    Alex:

    The following variable names (submitted by A and O, respectively) are best enjoyed with a maturity age of fourteen years or less ...

    float CumRate;  // Cumulative pass rate
    

    ...

    string ass = Request.Form["associated_skill_"+selId]; if (ass.IndexOf(",") > -1) { ass = ass.Split(',')[0]; } row.ID = int.Parse(ass)

    Butthead:

    He said 'Cum' ..... ha ha ha

    Beavis:

    Yeah 'Cum' ..... ha ha ha

    Alex:

    Matt Spicer understands that this following function is called like "EnableDisable(true);" but still wondered exactly what would happen ...

    //Enable or disable controls in the form
    private void EnableDisable(bool blnEnable) { ... }

    This is simply a toggle ... no WTF there, except to name it 'private void ToggleControl'

  • Philbert Desanex (unregistered) in reply to juvenile
    juvenile:

    I get the abbreviation with initials, but what else does puhse stand for?

    Two syllables...pronounce it.

  • Dude (unregistered) in reply to juvenile
    juvenile:

    Anonymous:
    Anonymous:
    John Bigboote:


    I like to come up with creative sub-classes of exception so that I can write things like

    <font face="Courier New">catch(BranchOperationRequiredException bare)

    and

    catch(DuplicateOperationPreventedException dope)
    </font>


    or maybe:
    catch(PriceUnitHolderSelectionException puhse)


    That's real by the way :)

    I get the abbreviation with initials, but what else does puhse stand for?



    A cat
  • (cs)
    Alex Papadimoulis:

    Scott Stanchfield was tasked with optimizing memory usage in a Java application and found a way to shave a few bytes left in by an intern with a sense of humor ...

    public class ValidationMessage
    {
      //internal members
      string messageId;
      string messageText;
      string helpLink;
      /* ... */
      double cheeseburger;
      char broiled;
      long time;
    

    //helper functions /* ... */ }

    What a whopper that is!

    Alex Papadimoulis:

    The following variable names (submitted by A and O, respectively) are best enjoyed with a maturity age of fourteen years or less ...

    float CumRate;  // Cumulative pass rate
    

    ...

    string ass = Request.Form["associated_skill_"+selId]; if (ass.IndexOf(",") > -1) { ass = ass.Split(',')[0]; } row.ID = int.Parse(ass)

    This cracks me up!  ;)

  • (cs) in reply to Philbert Desanex
    Anonymous:
    juvenile:

    I get the abbreviation with initials, but what else does puhse stand for?

    Two syllables...pronounce it.

    Man, I gotta start thinking with multiple syllables? It's Friday for God sakes!

  • Dude (unregistered)
    Alex Papadimoulis:

    Scott Stanchfield was tasked with optimizing memory usage in a Java application and found a way to shave a few bytes left in by an intern with a sense of humor ...

    public class ValidationMessage
    {
      //internal members
      string messageId;
      string messageText;
      string helpLink;
      /* ... */
      double cheeseburger;
      char broiled;
      long time;
    

    //helper functions /* ... */ }



    I guess we know where that guy is going to be working
  • pete23 (unregistered) in reply to kwan3217

    the real WTF then is that they're not using a debugger with conditional f-breakpoints! come on, this technology has been in debuggers for at least the last ten years...

  • (cs)
    Alex Papadimoulis:
    And while we're picking on the VS Tools for Office, following is the code required to call Excel's Dialog Show from C# ...

    if(xlApp.Dialogs[Excel.XlBuiltInDialog.xlDialogOpen].Show(sTextName,
      Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
      Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
      Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
      Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
      Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
      Type.Missing, Type.Missing, Type.Missing, Type.Missing) == true) { ... }

    Ah, score one for VB.Net, which supports optional arguments.

    Take that, C# !!!

  • pete23 (unregistered) in reply to John Bigboote
    John Bigboote:
    Ytram:


    One of my favorite pieces of code that is similar to this is in the system at my company.  Written by yours truly, it looks a little something like this:

    <font face="Courier New" size="2">Assessment ass = </font><font color="#0000ff" face="Courier New" size="2">new </font><font face="Courier New" size="2">Assessment(...);
    ...
    </font><font color="#0000ff" face="Courier New" size="2">if</font><font face="Courier New" size="2">(ass.Dirty)
    {
        ...
    }</font>


    I like to come up with creative sub-classes of exception so that I can write things like

    <font face="Courier New">catch(BranchOperationRequiredException bare)

    and

    catch(DuplicateOperationPreventedException dope)
    </font>

    i've seen the MetaData Mapping Application and the Load Save Delete module... a blast when combined.

  • (cs)

    I've come up with a sweet alternative to privatizing the constructor in a class with static object creation methods.

    <font face="Courier New">public class Monkey
    {
        public Monkey()
        {
           PrivateObjectOperationPreventedException poope = new </font><font face="Courier New">PrivateObjectOperationPreventedException("akk akk akk");
           throw poope;
    </font><font face="Courier New">    }
    }
    </font>

  • (cs) in reply to pete23
    Anonymous:

    i've seen the MetaData Mapping Application and the Load Save Delete module... a blast when combined.



    Mix it up with the Public Collaborative Presentation layer, and you will give the user the belief that they can do just about anything.

  • Jonathan Pryor (unregistered) in reply to foxyshadis
    On a vague tangent, I really wish I could find a compiler/preprocessor that supported named arguments in C,  C++, C#, or Java. Everytime I touch win32 code after a month or two elsewhere I come back and end up clueless as to what arguments are doing, especially surrounded by a random number of NULLs.

    This is actually fairly easy to do within the C++, C#, and Java languages.  Stroustrup gave an example in The Design and Evolution of C++, showing that named arguments weren't necessary.

    The solution is to introduce a new type with methods which return itself.  For C++:
    class window_args {
    public:
        window_args& color (Color c) {/* ... */ return *this;}
        window_args& border (Border b) {/* ... */ return *this;}
        window_args& title (const std::string& s) {/* ... */ return *this;}
        /* ... */
    };
    void* CreateWindow (window_args args);
    Usage thus becomes:
    void* p = CreateWindow (
        window_args().color (Color::Blue).title ("insert title here));
    This pattern is readily extended to C# and Java.
  • hehe (unregistered) in reply to cconroy
    cconroy:
    Alex Papadimoulis:
      ass = ass.Split(',')[0];



    Best. Line of code. Ever.




    dont forget this one:
    assOLE = chop($ass)
  • Jonathan Allen (unregistered) in reply to bob

    >if(xlApp.Dialogs[Excel.XlBuiltInDialog.xlDialogOpen].Show(sTextName,
    >  Type.Missing

    > NOW do we understand why optional params are a bad idea?? Over f'ing load the method, people, I think even VB.NET can handle that. Suppose this was just a COM wrapper though...

    Lets see, I can either have 2^30 overloads to account for all the cases or I can just make one function with optionals. I think I'll stick with optionals for awhile longer.

     

  • (cs) in reply to pete23

    Anonymous:
    the real WTF then is that they're not using a debugger with conditional f-breakpoints! come on, this technology has been in debuggers for at least the last ten years...

    Alas, VS2005 cannot support conditional breakpoints in C# however!

  • SadBugKiller (unregistered) in reply to pete23

    3

    Anonymous:
    the real WTF then is that they're not using a debugger with conditional f-breakpoints! come on, this technology has been in debuggers for at least the last ten years...

    Right, it's there and completely unusable - just set a conditional breakpoint somewhere to enjoy 10x decrease in performance. Unconditional breakpoint inside an if operator behaves much better (I'm talking about Visual Studio up to 2005, I haven't tried that one; and C++ code - I haven't touched C# for a long time but as far as I remember it was the same story)

  • Adam (unregistered) in reply to juvenile
    juvenile:

    Anonymous:
    Anonymous:
    John Bigboote:


    I like to come up with creative sub-classes of exception so that I can write things like

    <font face="Courier New">catch(BranchOperationRequiredException bare)

    and

    catch(DuplicateOperationPreventedException dope)
    </font>


    or maybe:
    catch(PriceUnitHolderSelectionException puhse)


    That's real by the way :)

    I get the abbreviation with initials, but what else does puhse stand for?



    You don't get puhse? I guess if you don't understand what it is you never will. Oh well, more for me I guess.

    Captcha: batman. A man that probably understands the meaning of puhse very well.
  • (cs) in reply to Otto

    "public class" is not valid C++. So it's neither valid Java nor C++. Hoax?

  • SomeCoder (unregistered) in reply to bob
    Anonymous:

    >if(xlApp.Dialogs[Excel.XlBuiltInDialog.xlDialogOpen].Show(sTextName,
    >  Type.Missing

    NOW do we understand why optional params are a bad idea?? Over f'ing load the method, people, I think even VB.NET can handle that. Suppose this was just a COM wrapper though...

    There's no problem with optional params.  The real WTF lies in the fact that C# can't freaking handle optional params.

    GoatCheez:

    ..... assuming that string was defined as a type.... otherwise all fingers point to C# ;-)

    A bit of a nitpick, but string is defined as a type if you're using the STL.

    captcha: chocobot - Should be chocobo :)

  • (cs) in reply to smxlong

    smxlong:
    "public class" is not valid C++. So it's neither valid Java nor C++. Hoax?

    It is perfectly valid c# though.

  • Me (unregistered) in reply to Philbert Desanex
    Anonymous:
    juvenile:

    I get the abbreviation with initials, but what else does puhse stand for?

    Two syllables...pronounce it.



    OK, let's see;
    Two syllables: puh-se
    • puh, as in Winne the Pooh?
    • se, as in Standard Edition?
    Pronounced: [pu:se]

    Not funny at all.
  • (cs) in reply to Me
    Anonymous:
    Anonymous:
    juvenile:

    I get the abbreviation with initials, but what else does puhse stand for?

    Two syllables...pronounce it.



    OK, let's see;
    Two syllables: puh-se
    • puh, as in Winne the Pooh?
    • se, as in Standard Edition?

    Pronounced: [pu:se]

    Not funny at all.

    When I first read it, I read it aloud with a long 'u', silent 'h', soft 's' and silent 'e' - sorta like 'piews' - had no clue - been a long f*g week - tgif! Gotta go home to wife/kids and not get me some.

     

  • (cs) in reply to juvenile

    A better name might be:

    catch (ProblemUndoingShortSaleYesterday pussy)

  • (cs) in reply to juvenile

    The worst (?) one I ever saw was from this person who was extremely intelligent, who created a project acronym that, for obvious reasons, never got used:

    Common Library Internals Tying Original Real Income Server

  • (cs) in reply to juvenile
    juvenile:

    A better name might be:

    catch (ProblemUndoingShortSaleYesterday pussy)



    If I caught more of that type of exception in college, I might not be a programmer today. It's a pretty rare scenario for most coders.
  • Philbert Desanex (unregistered) in reply to juvenile
    juvenile:

    A better name might be:

    catch (ProblemUndoingShortSaleYesterday pussy)

    Beautifully unambiguous.

    When asked for a project estimate, I tell folks that I use the Millenial Year Application Software System to pull my numbers from.

  • (cs)
    Alex Papadimoulis:

    David learned a new thing about C++ when trying to create an instance of COrderSummary ...

    /* ***
    * XMLParse - returns an instance of COrderSummary or NULL on error
    * ***
    * Note: This should probably be a static method. Since it isn't,
    * you will need to reference it will a null object:
    * COrderSummary *obj = NULL;
    * obj = obj->XMLParse(someXMLString);
    * ***/
    COrderSummary::XMLParse(const char *xml) { ... }



    Ah, I love "solutions" that will probably work 99% of the time but if you shift to exactly the wrong compiler will break...

    I'm not sure how I like this to be honest. It's certainly an imaginitive way to call a conceptually static function. (You could always do (static_cast<COrderSummary*> NULL)->XMLParse(someXMLString)...)

Leave a comment on “Another Friday Smorgasbord ”

Log In or post as a guest

Replying to comment #81749:

« Return to Article