Comment On Holiday Smorgasbord

It's been a while since I've done a smorgasbord post, so here goes ... [expand full text]
« PrevPage 1 | Page 2Next »

Re: Holiday Smorgasbord

2005-12-23 14:07 • by BiggBru
Alex Papadimoulis:

It's been a while since I've done a smorgasbord post, so here goes ...




DM discovered the source of some rather ... unprofessional ... error messages in the log files ...


try

{
/* SNIP: 15 lines */
}
catch
{
//How did this happen??
log.fatal("Aaaaarrrgghhhh");
}


Finally, production code that produces an error message recreating part of my reaction when some Java or C++ code fails to compile. I usually throw in a few obscenities, though, just for the heck of it.

You know what? I think I can make this better...

try
{
  /* SNIP: 15 lines */
}
catch
{
  //How did this happen??
  log.fatal("WTF???????????????????????????");
}

Re: Holiday Smorgasbord

2005-12-23 14:10 • by mlathe
Alex Papadimoulis:

Shayne Studdard chuckled at the original authors comment while porting the old ASP code into the ASP.NET ...


var aLeapYears = 
new Array(1900,1904,1908,1912,1916,1920,1924,1928,1932,1936,
1940,1944,1948,1952,1956,1960,1964,1968,1972,1976,
1980,1984,1988,1992,1996,2000,2004,2008,2012,2016,
2020,2024,2028,2032,2036,2040,2044,2048,2052,2056,
2060) //please god let this be far enough??



the real WTF is that 1900 is not even a leap year. dork!


http://www.dpbsmith.com/leapyearfaq.txt

Re: Holiday Smorgasbord

2005-12-23 14:19 • by Manni

I'm ashamed to admit that I've done the zero-padding code before, but in my defense it would only pad one or two zeros to the front of a number string. Then I learned about


Do Until Len(myNumStr) >= 5
   myNumStr = "0" & myNumStr
Loop


I can't believe it's not butter.

Re: Holiday Smorgasbord

2005-12-23 14:22 • by RevMike
Alex Papadimoulis:

Shayne Studdard chuckled at the original authors comment while porting the old ASP code into the ASP.NET ...


var aLeapYears = 
new Array(1900,1904,1908,1912,1916,1920,1924,1928,1932,1936,
1940,1944,1948,1952,1956,1960,1964,1968,1972,1976,
1980,1984,1988,1992,1996,2000,2004,2008,2012,2016,
2020,2024,2028,2032,2036,2040,2044,2048,2052,2056,
2060) //please god let this be far enough??


And he got it wrong!  The formula isn't tough...

In no particular language (Year%400 == 0) OR ((Year%4 == 0) AND NOT (Year%100 == 0))

And I suppose I'll wrap it up with this bit from TomA, who shows us yet another way to zero-pad a number


$limit = 9999;

for($i=1000;$i<$limit;$i++)
{
$number = "$i";
if ($i<10) $number = "0".$number;
if ($i<100) $number = "0".$number;
if ($i<1000) $number = "0".$number;
if ($i<10000) $number = "0".$number;
if ($i<100000) $number = "0".$number;
[ ... snip ...]
}


Nice use of fall through.  It is almost 'case' like.  If it isn't someplace where I care about performance or memory management, I'd leave it just for its aesthetic qualities.

Re: Holiday Smorgasbord

2005-12-23 14:24 • by RevMike
Alex Papadimoulis:

DM discovered the source of some rather ... unprofessional ... error messages in the log files ...


try

{
/* SNIP: 15 lines */
}
catch
{
//How did this happen??
log.fatal("Aaaaarrrgghhhh");
}


For this coder, it is always September 19th.

Re: Holiday Smorgasbord

2005-12-23 14:33 • by mlathe
54540 in reply to 54536
Anonymous:

I'm ashamed to admit that I've done the zero-padding code before, but in my defense it would only pad one or two zeros to the front of a number string. Then I learned about


Do Until Len(myNumStr) >= 5
   myNumStr = "0" & myNumStr
Loop


I can't believe it's not butter.



or 
int myNum=12345;
System.out.println(("0000000000"+myNum).substring((myNum+"").length()));

Re: Holiday Smorgasbord

2005-12-23 14:33 • by boohiss
Support : I'm telling you, nothing changed!!! The only difference between the old version and the new version is that the old version was in COBOL, and the new one is in C!!!


Why doesn't anyone stick up for support? That's only 4 letters difference!

Re: Holiday Smorgasbord

2005-12-23 14:38 • by cconroy
54542 in reply to 54541
He misspelled "Aaaaaarrrgghhhh".

Re: Holiday Smorgasbord

2005-12-23 14:39 • by BiggBru
Alex Papadimoulis:

Chris Reigrut recalls a conversation with a technical support guy years back when he had a problem with one of their products ...


Chris : We're having problems with the new version of your software.
Support : That can't be. We didn't change anything.
Chris : Well, I uninstalled the new version and put the old one back on, and the problem went away. I then reinstalled the new version, and the problem came back.
Support : No, it can't be our software. We didn't change anything!
( ... Lots of back and forth about my analysis of the problem ...)
Chris : So you're telling me that you sent out an update, but you didn't change anything. If that's the case, what's the point of the update?
( ... More back and forth, Support getting more and more exasperated ...)
Support : I'm telling you, nothing changed!!! The only difference between the old version and the new version is that the old version was in COBOL, and the new one is in C!!!



I think Alex forgot to post the rest of this conversation. I'm sure it goes something like this...

Support: What do you mean C and COBOL are different "languages"? They're both in English, I think.

Chris: *&$#@*%#

Support: So you mean C is not short for COBOL?

Chris: *$&#@*$#

Re: Holiday Smorgasbord

2005-12-23 14:42 • by -L
Alex Papadimoulis:


try

{
/* SNIP: 15 lines */
}
catch
{
//How did this happen??
log.fatal("Aaaaarrrgghhhh");
}

I occasionally use errors like this, especially when debugging an application. Provided that every 'unprofessional' error message is unique, such expressions are very easy to search for in the source code. A search for 'error' might give you 100 matches, but 'Aaaaarrrgghhhh' is most likely to give just one match.

From production these are of course removed, since they are unprofessional.

Re: Holiday Smorgasbord

2005-12-23 14:48 • by Mikademus
Alex Papadimoulis:
The customer service at Jason Harmon's
had been telling clients that the bad data coming seen in their system
was a configuraiton problem, not a code problem. A client finally
complained enough to get the problem pushed back to development where
Jason learned that this just might be a coding problem after all ...


private bool IsValid() 
{
return true;
}




This is neither a configuration nor a code problem, it is a
philosophical problem. Or rather, a non-problem, because IsValid is of
course trivially true.

Re: Holiday Smorgasbord

2005-12-23 14:51 • by lucky
Alex Papadimoulis:

Shayne Studdard chuckled at the original authors comment while porting the old ASP code into the ASP.NET ...


var aLeapYears = 
new Array(1900,1904,1908,1912,1916,1920,1924,1928,1932,1936,
1940,1944,1948,1952,1956,1960,1964,1968,1972,1976,
1980,1984,1988,1992,1996,2000,2004,2008,2012,2016,
2020,2024,2028,2032,2036,2040,2044,2048,2052,2056,
2060) //please god let this be far enough??



Equation to see if it is "far enough":



((truncate(((60 - current age) + current year) / 10)) * 10) + 20 (to not screw the next gen too)



code for that current year was probably 2003



which puts that programmer between the ages of 14 and 23

Re: Holiday Smorgasbord

2005-12-23 14:51 • by Disgruntled DBA
54548 in reply to 54544
How many times does an error message have to be used, before it gains professional status?  Or is it governed by a certification test? </humor>

Re: Holiday Smorgasbord

2005-12-23 15:00 • by kipthegreat
Alex Papadimoulis:

And I suppose I'll wrap it up with this bit from TomA, who shows us yet another way to zero-pad a number


$limit = 9999;

for($i=1000;$i<$limit;$i++)
{
$number = "$i";
if ($i<10) $number = "0".$number;
if ($i<100) $number = "0".$number;
if ($i<1000) $number = "0".$number;
if ($i<10000) $number = "0".$number;
if ($i<100000) $number = "0".$number;
[ ... snip ...]
}



I've done something like this before.  Except it wasn't for 9999-digit long numbers, and there was no for-loop involved.  I was using some scripting language I wasn't familar with and didn't want to look up the equivalent of printf() to just pad a number so that it was 3 digits long, so i just did something like the first two if statements.

And I immediately saw the WTF about the year 1900, but then I saw that several other people had beaten me to it. :)

Re: Holiday Smorgasbord

2005-12-23 15:01 • by thomas.galvin
54550 in reply to 54544
Anonymous:
From production these are of course removed, since they are unprofessional.


You've obviously never experienced the joy of having some profainty get tossed to the screen during a customer demo.  Or having a system password, also a profainty, make it into the final documentation.

Re: Holiday Smorgasbord

2005-12-23 15:04 • by Omnifarious
54551 in reply to 54544
Anonymous:
Alex Papadimoulis:


try

{
/* SNIP: 15 lines */
}
catch
{
//How did this happen??
log.fatal("Aaaaarrrgghhhh");
}

I occasionally use errors like this, especially when debugging an application. Provided that every 'unprofessional' error message is unique, such expressions are very easy to search for in the source code. A search for 'error' might give you 100 matches, but 'Aaaaarrrgghhhh' is most likely to give just one match.

From production these are of course removed, since they are unprofessional.

Nowadays, I hardly every write UI code, but early in my programming career (10+ years ago now), I wrote a program that did a lot of input validation. And, for various reasons, it was completely text based. No windows or other UI doo-dads. It was written in completely portable C++ and just used iostreams.


All the input validation messages were very chatty and somewhat silly. They were to the point, and it was obvious what it was complaining about each time, but the tone of the messages was that of a good friend chiding you over a silly mistake.


The company I worked for was pretty small, and I was the only person on their staff who knew much of anything about the inner-workings (hardware or software) of computers. So the program went into production that way.


I ended up having to change all the error messages to be 'boring' anyway though. One person on staff complained that in order for him to maintain his professional demeanor and focus in the office, the program had to report the error messages in a dry, neutral tone.


I was both amused, and slightly irritated. But I did it. :-)


I sort of think people get way too uptight about stuff like that. I don't really understand why a program can't say "Arrrggghh!" as long as it doesn't confuse anybody.


Re: Holiday Smorgasbord

2005-12-23 15:10 • by My Name
Alex Papadimoulis:

And I suppose I'll wrap it up with this bit from TomA, who shows us yet another way to zero-pad a number


$limit = 9999;
for($i=1000;$i<$limit;$i++)
{
$number = "$i";
if ($i<10) $number = "0".$number;
if ($i<100) $number = "0".$number;
if ($i<1000) $number = "0".$number;
if ($i<10000) $number = "0".$number;
if ($i<100000) $number = "0".$number;
[ ... snip ...]
}




Why all that "if"s if you know the number is always 4 digits long?

Re: Holiday Smorgasbord

2005-12-23 15:11 • by My Name
54553 in reply to 54552
Anonymous:
Alex Papadimoulis:

And I suppose I'll wrap it up with this bit from TomA, who shows us yet another way to zero-pad a number


$limit = 9999;
for($i=1000;$i<$limit;$i++)
{
$number = "$i";
if ($i<10) $number = "0".$number;
if ($i<100) $number = "0".$number;
if ($i<1000) $number = "0".$number;
if ($i<10000) $number = "0".$number;
if ($i<100000) $number = "0".$number;
[ ... snip ...]
}




Why all that "if"s if you know the number is always 4 digits long?




The board eats half the code...

Re: Holiday Smorgasbord

2005-12-23 15:12 • by Paul Tomblin
54554 in reply to 54551
Omnifarious:

I sort of think people get way too uptight about stuff like that. I don't really understand why a program can't say "Arrrggghh!" as long as it doesn't confuse anybody.



How do you feel about the message "Holy Bat, Fuckman, how did we get here?", which I accidentally left in code that got to a production server?

Re: Holiday Smorgasbord

2005-12-23 15:21 • by Disgruntled DBA
54555 in reply to 54554
Anonymous:
Omnifarious:

I sort of think people get way too uptight about stuff like that. I don't really understand why a program can't say "Arrrggghh!" as long as it doesn't confuse anybody.



How do you feel about the message "Holy Bat, Fuckman, how did we get here?", which I accidentally left in code that got to a production server?


Personally, I'd take a screenshot, and mail it to a bunch of friends.

Re: Holiday Smorgasbord

2005-12-23 15:24 • by lucky luke
54556 in reply to 54553
Anonymous:
Anonymous:
Alex Papadimoulis:

And I suppose I'll wrap it up with this bit from TomA, who shows us yet another way to zero-pad a number


$limit = 9999;
for($i=1000;$i<$limit;$i++)
{
$number = "$i";
if ($i<10) $number = "0".$number;
if ($i<100) $number = "0".$number;
if ($i<1000) $number = "0".$number;
if ($i<10000) $number = "0".$number;
if ($i<100000) $number = "0".$number;
[ ... snip ...]
}




Why all that "if"s if you know the number is always 4 digits long?




The board eats half the code...


I'd have to see all the code.... but it looks like at the end of the loop you're left with:
limit = 9999
i = 9999
number = "009998" (more 0's depending on how many alex snipped out...)

and a heck of a lot of wasted cycles for iterating from 1000 to 9999
wtf???  I hope there's more to this than I can see...

Re: Holiday Smorgasbord

2005-12-23 15:25 • by John
54557 in reply to 54542
cconroy:
He misspelled "Aaaaaarrrgghhhh".
He must have died while carving it.

Re: Holiday Smorgasbord

2005-12-23 15:26 • by Xocomil
54558 in reply to 54540
ummm... it has been a long time since I've coded PHP, so I am probably exposing my gross ignorance, but how does the original code ever produce anything but '09998'?


Re: Holiday Smorgasbord

2005-12-23 15:47 • by whiskers_
54560 in reply to 54557
MP!

Re: Holiday Smorgasbord

2005-12-23 15:58 • by MrGrudge
The "Aaaargh!" error is better than one program I had to debug that simply said "Something Wrong".

Re: Holiday Smorgasbord

2005-12-23 17:24 • by TankerJoe
54568 in reply to 54561

Anonymous:
The "Aaaargh!" error is better than one program I had to debug that simply said "Something Wrong".


Its also better than "Something didn't quite work out."


 

Re: Holiday Smorgasbord

2005-12-23 17:34 • by joe_bruin
54569 in reply to 54545
Mikademus:
Alex Papadimoulis:
The customer service at Jason Harmon's
had been telling clients that the bad data coming seen in their system
was a configuraiton problem, not a code problem. A client finally
complained enough to get the problem pushed back to development where
Jason learned that this just might be a coding problem after all ...


private bool IsValid() 
{
return true;
}




This is neither a configuration nor a code problem, it is a
philosophical problem. Or rather, a non-problem, because IsValid is of
course trivially true.


/*
Is the object's validity not implicit in the asking of the question?  If it were not, would we be asking the question?  It's a very anthropic situation that is far too complicated to discuss in code comments, please refer to the product documentation for more insight.
*/


Something didn't quite work out ...
- CAPTCHA Validation Incorrect

Re: Holiday Smorgasbord

2005-12-23 17:46 • by Maurits
54571 in reply to 54536
Anonymous:

I'm ashamed to admit that I've done the
zero-padding code before, but in my defense it would only pad one or
two zeros to the front of a number string. Then I learned about


Do Until Len(myNumStr) >= 5
   myNumStr = "0" & myNumStr
Loop


I can't believe it's not butter.





Or



    myNumStr = String("0", 5 - Len(myNumStr)) & myNumStr

Re: Holiday Smorgasbord

2005-12-23 17:47 • by Maurits
54572 in reply to 54571
Maurits:


    myNumStr = String("0", 5 - Len(myNumStr)) & myNumStr




Oops, got the arguments backwards:

    myNumStr = String(5 - Len(myNumStr), "0") & myNumStr

Re: Holiday Smorgasbord

2005-12-23 18:04 • by foxyshadis
54574 in reply to 54555
Disgruntled DBA:
Anonymous:
Omnifarious:

I sort of think people get way too uptight about stuff like that. I don't really understand why a program can't say "Arrrggghh!" as long as it doesn't confuse anybody.



How do you feel about the message "Holy Bat, Fuckman, how did we get here?", which I accidentally left in code that got to a production server?


Personally, I'd take a screenshot, and mail it to a bunch of friends.

And thus was born Alex's screenshot fridays. =D

Re: Holiday Smorgasbord

2005-12-23 18:18 • by neuro
54575 in reply to 54558
Anonymous:
ummm... it has been a long time since I've coded PHP, so I am probably exposing my gross ignorance, but how does the original code ever produce anything but '09998'?




please note that it produces 01000 through 09997 in the meantime.
i would think that the [snip] removed non-wtf-relevant code which was processing the numbers

Re: Holiday Smorgasbord

2005-12-23 18:29 • by Now, See Here
54576 in reply to 54553
Anonymous:
Anonymous:
Alex Papadimoulis:

And I suppose I'll wrap it up with this bit from TomA, who shows us yet another way to zero-pad a number


$limit = 9999;
for($i=1000;$i<$limit;$i++)
{
$number = "$i";
if ($i<10) $number = "0".$number;
if ($i<100) $number = "0".$number;
if ($i<1000) $number = "0".$number;
if ($i<10000) $number = "0".$number;
if ($i<100000) $number = "0".$number;
[ ... snip ...]
}


void format_it(char *target, int source)

(

        sprintf(target,"%04d",source);

}









Why all that "if"s if you know the number is always 4 digits long?




The board eats half the code...

Re: Holiday Smorgasbord

2005-12-23 18:30 • by nathan
54577 in reply to 54534
And (s)he's the dork?

Re: Holiday Smorgasbord

2005-12-23 19:01 • by Evan
54580 in reply to 54571
Maurits:
Anonymous:

I'm ashamed to admit that I've done the
zero-padding code before, but in my defense it would only pad one or
two zeros to the front of a number string. Then I learned about


Do Until Len(myNumStr) >= 5
   myNumStr = "0" & myNumStr
Loop


I can't believe it's not butter.





Or



    myNumStr = String("0", 5 - Len(myNumStr)) & myNumStr


Why not Format( CInt(myNumStr), "000000")?

I don't have VB installed at the moment so can't test it for correctness or efficiency, but I think it's slightly clearer in any case.




Re: Holiday Smorgasbord

2005-12-23 19:03 • by TLLOTS
54581 in reply to 54558
Anonymous:
ummm... it has been a long time since I've coded PHP, so I am probably exposing my gross ignorance, but how does the original code ever produce anything but '09998'?


You're almost exactly right. It will always produce 009998. Hopefully there is some code to transform that into something meaningful, though even then it wouldn't atone for this attrocity of bad programming.

Re: Holiday Smorgasbord

2005-12-23 19:19 • by TLLOTS
54582 in reply to 54580
Anonymous:


Why not Format( CInt(myNumStr), "000000")?

I don't have VB installed at the moment so can't test it for correctness or efficiency, but I think it's slightly clearer in any case.






If you wanted to keep it in PHP (which I assume the original WTF is written in) you could simply write.

$padded_number = str_pad($number_to_pad,$pad_length,'0',STR_PAD_LEFT);

Makes more sense that way I think.

Re: Holiday Smorgasbord

2005-12-23 19:47 • by Ben A.
54583 in reply to 54581
I am assuming that the number-padding code does something with the padded numbers in the snipped part of the loop...otherwise it would be a monumental waste of time.

And yes, it's PHP.  (It could also be valid Perl, except that Perl requires curly brackets around if statements with a single body statement.)

Re: Holiday Smorgasbord

2005-12-23 22:21 • by Anonymous
The real WTF in that second one is the misspelling of "license".

Re: Holiday Smorgasbord

2005-12-23 22:58 • by mjonhanson
54595 in reply to 54550
thomas.galvin:
Anonymous:
From production these are of course removed, since they are unprofessional.


You've
obviously never experienced the joy of having some profainty get tossed
to the screen during a customer demo.  Or having a system
password, also a profainty, make it into the final documentation.




Ding!  Ding!  Ding!  Ding!  We have an analyst
trolling!  We have and analyst trolling!  Ding! 
Ding!  Ding!  Ding!

Re: Holiday Smorgasbord

2005-12-23 23:00 • by Nimrand

Speaking of unprofessional error messages, a few months ago I was trying to teach a coworker how to use CVS.  We use a CVSNT service as our repository.  She was having lots of very strange networking problems on her computer, however.  Appearantly those networking problems were preventing the connection to the repository from working as well.  Imagine my surprise when I tried to check out a module, and the reply I got from the CVSNT service was "I hate you."

Re: Holiday Smorgasbord

2005-12-23 23:39 • by josh
Alex Papadimoulis:

        If iFile.Exists Then

            fileSizeBytes = iFile.Length.ToString
        Else
            'Actually this test was done earlier
            ' - the code wouldn't be here if it didn't exist
            Throw New FieldAccessException("File does not exist.")
        End If


This is actually a sign of very good code.  I assume there is another test earlier in the code path for iFile.Exists, so execution should not reach this point if the condition is false.  This code is then just a safety net in case the coder missed some case where the first test could be skipped.

The only problem is that the comment says that the code wouldn't be there when it means that execution would not reach there.

Re: Holiday Smorgasbord

2005-12-24 01:08 • by Different Anonymous
54598 in reply to 54580

You could use a logarithm for the width of the number... (in VB again.)


print string(myWidth - int(log(myNum)/2.30258509299403) - 1, "0") + trim(str(myNum))

Re: Holiday Smorgasbord

2005-12-24 02:19 • by no name
54599 in reply to 54596

Speaking of unprofessional error messages, a few months ago I was trying to teach a coworker how to use CVS. We use a CVSNT service as our repository. She was having lots of very strange networking problems on her computer, however. Appearantly those networking problems were preventing the connection to the repository from working as well. Imagine my surprise when I tried to check out a module, and the reply I got from the CVSNT service was "I hate you."




And did you imeadiatly run to your boss and demand more professional software?



Or, did you chuckul for a second or two (possibly calling over your coworkers to chuckle too), and then get on with your work?

Re: Holiday Smorgasbord

2005-12-24 02:20 • by akrotkov
54600 in reply to 54598
Anonymous:

You could use a logarithm for the width of the number... (in VB again.)


print string(myWidth - int(log(myNum)/2.30258509299403) - 1, "0") + trim(str(myNum))



Heh, rounding errors?

Re: Holiday Smorgasbord

2005-12-24 04:35 • by Mikademus
54602 in reply to 54569
Anonymous:
Mikademus:
Alex Papadimoulis:
The customer service at Jason Harmon's
had been telling clients that the bad data coming seen in their system
was a configuraiton problem, not a code problem. A client finally
complained enough to get the problem pushed back to development where
Jason learned that this just might be a coding problem after all ...


private bool IsValid() 
{
return true;
}




This is neither a configuration nor a code problem, it is a
philosophical problem. Or rather, a non-problem, because IsValid is of
course trivially true.


/*
Is
the object's validity not implicit in the asking of the question? 
If it were not, would we be asking the question?  It's a very
anthropic situation that is far too complicated to discuss in code
comments, please refer to the product documentation for more insight.
*/




/*


Is
the object's validity not implicit in the asking of the question? 
If it were not, would we be asking the question?  It's a very
anthropic situation that is far too complicated to discuss in code
comments, please refer to the product documentation for more insight.




This is not a new problem. Heidegger has treated it and the
Existentialist approach would be an investigation starting with the
(legitimate) question "where lies validitys validness?". However, a
more Wittgensteinian (the later Wittgenstein) approach would recognise
that this might in fact
be a grammatical problem rather than a philosophical one in that by
using the noun "validity" we take for granted and posit as real the
objective existance of "validness".



However, the authors of the code refute these essentially nihilistic
approches, including post-modernistic conceptions of validity, and
instead defines the problem as an analytical one. Thus we see that the
question IsValid() in fact contains its own truth condition, and the
answer is trivially always true. (Gadamer, Warheit und Metode;
Heidegger, Zeit und Zein; Wittgenstein, The Blue and The Brown Book,
Tractatus Logico-Philosophicus; Russel, Principa Mathematica)


*/


private bool IsValid() 
{
return true;
}



Re: Holiday Smorgasbord

2005-12-24 05:06 • by Steve Kemp
54605 in reply to 54596
Anonymous:

Imagine my surprise when I tried to check out a module, and the reply I got from the CVSNT service was "I hate you."



The success message for CVS is the matching "I love you"....

Re: Holiday Smorgasbord

2005-12-24 06:24 • by Avalanche
54606 in reply to 54594

The real WTF in that second one is the misspelling of "license".

Check out a dictionary: both ways are valid!

Re: Holiday Smorgasbord

2005-12-24 08:42 • by RevMike
54607 in reply to 54605
Anonymous:
Anonymous:

Imagine my surprise when I tried to check out a module, and the reply I got from the CVSNT service was "I hate you."



The success message for CVS is the matching "I love you"....


But the opposite of love is indifference.

Re: Holiday Smorgasbord

2005-12-24 15:19 • by Xargon
54609 in reply to 54607


    try
    {
      /* SNIP: 15 lines */
    }
    catch
    {
      //How did this happen??
      log.fatal("Aaaaarrrgghhhh");
    }


I've always preferred to preface error messages with "Errah!"

The author of the code in "Logged to Death" should have used something like this.
http://www.thedailywtf.com/forums/53224/ShowPost.aspx

Re: Holiday Smorgasbord

2005-12-25 02:07 • by Benjamin Smith
54613 in reply to 54544
When I develop software, the first thing I do is to create a debug()
function, and use it to toggle the display of internally reported
errors. An example function (in PHP)



Function DisplayError($msg)

{

if (!Debug())

    return true;

/* display the message by whatever means here */

}



With this, code like this works out OK:



if ($someCondition)

    {

    /* do something */

    }

elseif ($otherCondition)

    {

    /*other Something */

    }

else

    {

    DisplayError("Function foo(): WTF?!?!? How could this happen?");

    }



I have lots of such code in my application - it makes it much easier to
identify when changes to the codebase break previous expectations and
assumptions!



PS: The real WTF is that captcha doesn't work well on this site!

« PrevPage 1 | Page 2Next »

Add Comment