Programming Wizards

17 March 2007 in Programming

Worse than Failure

I do think programming can be fun, specially when I make my periodic visits to the old thedailywtf, now renamed to Worse Than Failure and see some beautiful examples of work, like this ones added recently to the website:

Evidence for the mystical power of C can be gleaned directly from code…


if (error)
  if (fprintf(stderr,"An error occured while writing to the file")<0){
    if (fprintf(stderr,"An error occured while writing to stderr")<0){
      if (fprintf(stderr,"An error occured while writing to stderr")<0){
        if (fprintf(stderr,"An error occured while writing to stderr")<0){
          return fprintf(stderr, "An error occured while writing to stderr");
          /* lets stop here, its enough */
        }
      }
    }
  }

and some Math skills…

public String rowClass( int index ) {
    String evenRow =
        (BigInteger.valueOf(index).mod(new BigInteger("2"))).toString();
    return ( (evenRow.equals("0")) ? "odd" : "even" );
}

instead of a simple:

return (( index%2 == 0) ? "even" : "odd" );

and Some SQL tricks…

  If sAction = "Send" Then
      bAccepted = True
  ElseIf sAction = "Cancel" Then
      bAccepted = False
  ElseIf IsNull(sAction) Then
      bAccepted = 1
  EndIf

  ' ...

  sql = "INSERT INTO MyTable (...,b_accepted)
VALUES(...,'"&CInt(bAccepted)&"')"

probably the most ugly javascript you will ever see (detect leap years):

  div = year / 4;
  str = new String( div );
  var dec = str.indexOf(".");
  if ( dec != -1 )
      { feb_end = 28; }
  else
      { feb_end = 29; }

and Last, but not least, Screenshots of chaos:

Winamp Bug

For more of these, please visit this great website…
Worse Than Failure

Leave a Comment

Name (required)

E-mail (required - not published)

Website

Your comment:


Search


Pages


Top Posts


Categories


Advertising