Programming Wizards
17 March 2007 in ProgrammingI 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:
For more of these, please visit this great website…
Worse Than Failure
Search
Pages
Top Posts
- 15 Visual Studio .NET Add-Ins you won't live without
- Using SQLite in .NET
- How to get started with Silverlight Streaming
- Avoid chaos, don't let bugs take your project away
- Best-Ever Ad from Microsoft
Categories
- All
- Random tidbits
- Links
- Windows
- Fun
- Portuguese
- WebDev
- Programming
- Blogging
- Personal Experience
- Microsoft
- Tech
- OS
- Linux
- Security
- TV
- Software
- Databases
- Hardware
- WPF


Leave a Comment