Recent Articles

May 2005

Time Well Spent

by in Feature Articles on

Have you ever starting something, then stopped yourself a fifth of way through, then thought "gee, there has to be better way", then realized that the better way would have actually taken less time than the you had already spent, then finally started over with the better way? Some folks (like Sixstring's predecessor) get caught up somewhere between the "thinking about it" portion and the "doing it better portion" ...


Miscellaneous WTFery

by in Feature Articles on

Before delving into our assortment of WTF, I thought I'd take the opportunity to announce that The Daily WTF is now officially one year old. Note that this does *not* constitute as a "blogiversary." I refuse to recognize that particular arrangement of letters as a word, let alone use it in any manner other than pointing out that it's a non-word.

In any case, I want to thank, first and foremost, every one for reading; I suppose there wouldn't be much point in writing if it weren't for you. Praise is also due to everyone who's bravely submitted their coworkers' horrible code; I probably would have run out of examples within a few weeks (and don't hesitate to continue to submit, either). And finally, I gotta give props to Brady Gaster for suggesting that I take my daily complaints about work and turn it into a forum were everyone can join it; that was a pretty good idea. For your pedagogical purposes, here is the first post to appear exclusively on this domain: Function Batman().


Peeking On In

by in Feature Articles on

It's just great when you can extrapolate the entire design of a system based on a tiny little peak into it. Actually, I should say, it's great in the context of The Daily WTF. It's really not so great for those, like Rik Hemsley (not that Rik), who have to maintain such a system. No, after their first-day-on-the-job peek, they usually bow their heads in sorrow and wonder why they quit their other job for this ...


Damned IF You Do, Damned ELSE You Don't

by in Feature Articles on

We've established quite a few times that when it comes to highly paid consultants, there is no correlation between "code quality" and "hourly rate" (cost/appearance ratio is a completely different story). No less, it's still fun to point out that today's snippet (from DZ-Jay) comes from a highly-paid consultant. Apparently, this IF/ELSE/OTHERWISE logic was prevalent throughout much of the code DZ was maintaining ...


Tinfoil Hat Program

by in Feature Articles on

I had a pretty good post lined up today about (surprise, surprise) a rather peculiar abuse of HTML SELECTs. However, after reading the Tinfoil Hat House article posted at Slashdot, I knew I just had to share this project request that Mincus came across on one of those IT Project Portal sites (which I've certainly covered before).

A cursory read of the project request (which also happens to be the longest run on sentence ever written), might lead you to believe that it's a lame hoax ... but after looking through the provided evidence I'm pretty convinced myself ...


The Great Pyramids of DIV

by in Feature Articles on

Adam C was a bit dismayed when he was tasked with updating the "look and feel" of his company's web-based application. The system consisted of a good 200-300 pages with each page having a good 200-300 DIV. But I don't think that is too bad ... especially considering the really fun effect you get when scrolling the text up and down. Just think of how neat this would have been on some of the larger pages with 80-100 nested DIV ...


Bad Support, Till the Day I Die

by in Feature Articles on

I've posted quite a few tech support stories in the past. They've all been focused on the folks asking for support and stories I'm sure we all have experienced ourselves. But today, let's shift paradigms and take a look at those who give the technical support ...

Phil Harvey overheard one-side of a tech-support call from a colleague explaining to a customer why the Internet stopped working ...


Macro Polo

by in Feature Articles on

All the talk about macros this week inspired me to share this macro that Lance Robinson came across while maintaining a C-based system at his company. What I really appreciate about this code, well, aside from the fact that it's built into ctype.h and, aside from the fact that it has nests twenty-six ternary operators, is its very subtle bug ... can you spot it?


Java Hoops And Hurdles

by in Feature Articles on

The other day I complained that C# (prounced here as C-Pound) doesn't have macros. The author of today's example (uncovered by Stephen Ostermiller) was equally distraught over Java's lack of "unsigned addition." Of course, had our coder paid attention beyond first lesson in Computer Science 101 (in which he presumably learned about signed vs. unsigned binary representations), he would have discovered the wonders of twos complement binary representation (and the fact that computers represent integers this way). He then could have optimized his uintadd(x,y) method with "x + y".


Divining the Future Through Numeracy

by in Feature Articles on

I'll let Bill Kempf take it away ...

A few years back, I was a developer at a credit card processing company. Our team inherited a J2EE web application that, well, has been around: just about every other team owned it at one time or another. Heck, it even got some "enhancements" from overseas outsourcing partners.


Why C-Pound Needs Macros

by in Feature Articles on

One feature I really miss in C# is the ability to define macros. According to the C# team, compile-time replacement macros make code more confusing (they've obviously never seen pascal.h) and more bug prone. What they failed to realize, however, is how incredibly difficult it becomes for people who don't like the C# syntax to redefine their own. Just look at how much trouble the author of this code (found by Jimmy) goes through to get a loop looking like "For i = 1 To 4" ...


Flipping Out Over Nothin'

by in Feature Articles on

Christoph (Derean's coworker) was presented with a daunting challenge: flip all of the bits of an integer (representing a bitfield) to zero. Many programmers would run away and never look back at just the thought of being given such a task. But not Christoph; being the courageous coder he was, he took this vexing problem head-on and engineered a rather elegant solution ...


HTML Programmer

by in Feature Articles on
I've always felt that seeing the words HTML Programmer on a resume tell quite a bit about the candidate (for a programmer job). I can somewhat understand inflating your "skillset" with items like HTML, typing, breathing, etc; recruiters like to see those. But for a "programmer" to consider markup using a few angle-brackets as "programming" that ... well ... shows a lot. But after seeing how Mike Jervis' colleague programs HTML, maybe I was thinking about thinking about it the wrong way ...

<script id="handleClientEvents" language="VBScript">
  Sub imgNext_OnClick
    With frmForm
      window.location.href = "editAppraisal.asp?page=5"
    End With
  End Sub

  Sub lnkBackToHome_OnClick
    With frmForm
      window.location.href = "/appraisals.asp"
    End With    
  End Sub
</script>

<map name="m_Next">
  <area shape="RECT" coords="0,0,30,30" href="#">
   <img height="30" width="30" style="CURSOR: hand" 
onclick="imgNext_OnClick()" src="/images/next.gif" useMap="#m_Next"
value="Submit" type="button"></img> </area> </map> <a style="CURSOR: hand" id="lnkBackToHome"
name="lnkBackToHome_OnClick">Back to Appraisal Listings</a>

Not For All The Money In The World

by in Feature Articles on

Now that the economic slump is wearing off, we're finally starting to see the IT job market shift from an employers' to an employees'. What inevitably comes with this shift is head-hunters recruiters and their valiant quest to find employers qualified employees for a fee of 25% of the annual salary a mere pittance.

Cyrano got an email from a recruiter who thought that this job would be a great fit and didn't quite understand why Cyrano never got back to him ...


If ++ Increments ...

by in Feature Articles on
If yesterday's post was a bit too long for you, you may appreciate today's three-liner. It's from Steve Local, who had this conversation he had with one of his ... less gifted ... co-workers that was having some C# issues ...


The Best of Both Worlds

by in Feature Articles on

If you've ever worked with a database, chances are you know the difference between "dynamic queries" and "parameterized quires". In the former, you just concatenate a value to your query string ("where col='" + val + "'") and cross your fingers that val isn't "'; drop database --". With the parameter approach, you let the data-access drivers take care of escaping and whatnot with the use of command and parameter objects. I'd be willing to bet, however, you haven't seen the combination of the two techniques ...


SELECT * FROM WTF

by in Feature Articles on

Nothing like a good o'le Friday Smorgasbord exploring how some programmers manage to abuse databases ...

A couple months back, we got a chance to see a fantastic "Database-Driven" website that Miki Watts was lucky enough to inherit. Here's another peek into it, showing just how fantastically dynamic it is. Just incase you ever want to have 10000MB have a size of 9847, a disk size of of 3200 and displayed inbetween 50 and 30000 ... 

disk_options
SKU SizeDesc Size Meas DiskSize SortOrd Active
D000050 50 MB 50 MB 50 1 0
D000050 50 MB 50 MB 50 1 1
D000100 100 MB 100 MB 100 2 1
D001000 1000 MB 1000 MB 1000 3 1
D005000 5000 MB 5000 MB 5000 4 1
D010000 10000 MB 10000 MB 10000 5 1
D020000 30000 MB 30000 MB 30000 6 1
D030000 50000 MB 50000 MB 50000 7 1

Replace(&quot;bad programmer&quot;, &quot;good programmer&quot;)

by in Feature Articles on

It's time again for another game of Where's WTF. Don't worry, it won't be nearly as difficult as spotting Waldo. Actually, I was able to fairly quickly spot six in this twelve lines of VB6 code from AWATS ... what about you?


Wishin' There Was an Easier Way

by in Feature Articles on

Although it has quite a few quirks, the SendEmail() method from David Winslow's former coworker isn't too bad on its own. Some might even say it's impressive that he did low-level SMTP communication in Visual Basic 6, despite the ease of use of CDO, MAPI, and a var-i-e-ty of third-party email components. But what struck me about this code was the combination of the author's insistence that this was the only way to reliably send email from VB6 and the fact that his code was completely unreliable and buggy, sending emails hours late, if ever.


Not Too Hashish ... err ... Hashlike

by in Feature Articles on

The .Net Hashtable (and it's Java cousin, the Hashmap) have some fairly complex internals using hashtrees and bucket algorithms to ensure that objects are quickly retreived from them. But don't let that stop you from writing your own retreival mechanism. As Simon Dyson's former co-worker would say, who needs ContainsValue() when you can have isInList()?


Write Only Coding

by in Feature Articles on

When we use the term "code reuse" it generally does not mean copy-and-pasting the arguments list from another method, copy-and-pasting a try/catch block from another method, and copy-and-pasting a switch statement handling only one (the default) case. No, that's we call write only coding: never stopping to read what you just wrote. And Stan James's colleague seems to have perfected the technique ...