Recent Articles

Jul 2005

Operator Overloading Overload

by in Feature Articles on

The ability to define how operators behave on structures and classes is one of the cooler features available in modern programming languages. It's one of those things that everyone knows how to do but no one has actually done. Aside, of course, from writing that String class back in CS-215: C++ Programming.

But some are not content with having only overloaded operators in college. These programmers work to use it whenever possible under the guise of "simplifying" things for them self. Take, for example, Tim O's predecessor, who insisted on this creation instead of os.path.join() which was used four or five times throughout the application ...


A False Detector

by in Feature Articles on

Today I've decided to abstain from my normal introduction so that we may focus our full attention on this function that Mikhail K came across in a production system ...


Are You IN Or NOT IN?

by in Feature Articles on

Colin S' fellow developers were completely fed up with the incredibly slow database they had to work with. They weren't sure exactly what was wrong with it, but they figured it was probably an incompetent DBA who couldn't index a table to save his life. Or it was a clueless infrastructure guy who didn't know his hubs from his switches. Or, most likely, it was SQL Server, which everyone knows is a really slow database.

Colin, however, had another idea. He took a look at some of the queries they were running. He found this snippet from a 175-line long query ...


Weird Stripping

by in Feature Articles on

Braun Schweitzer was tasked with reverse engineering a giant, VB6-based system at his company. No one knew everything that it did, nor did anyone really understood how it did it either. No less, they were determined to rewrite it and document it. Sadly, these circumstances on their own do not justify a "WTF" post.

However, I do think that this small snippet of code from the system has merit. Note that it is actually twice-removed from the proper solution of parameterized queries and somehow manages to avoid the obvious Replace ... twice in a row. But it's name and comment is what officially brings it into Whiskey Tango Foxtrot country ...


Erring On The Side of Danger

by in Feature Articles on

When it comes to application error handling, there are two major schools of thought. Some believe that you should show the end-user as little detail as possible, instead logging the full error information somewhere. Others think that you should dump as much information as possible when the program crashes since the end-user won't understand what it means anyway. Today, we can scratch one for the "little info" team:


The Flat-File Society

by in Feature Articles on

Normally, when I bring up highly-paid consultants, it's to remind us that their $200+/hr fees are very well worth it by looking at the code they produce. But today's post actually comes from a highly-paid consultant working at a client's site to help them with some of their ... problems. A few years ago, the company decided to do a complete rewrite of their 15-year old ERP system. The developers understood that flat-file storage and processing was quite passé, so they decided to store things in a relational database. As Phil learned, the developers seemed to not quite understand the point of a relational database ...


True, False, or Yellow

by in Feature Articles on

One thing that I've always found annoying about languages with built-in Boolean data types is that values for those Booleans can only be TRUE or FALSE. Really, how useless is that? What happens when you want IsConnected() to return the string "I'll tell you, but it'll cost you a buck". This is why I'm glad that there's plenty of opportunities out there to work in languages like C that do not have such types built in. Look at how much easier it was for Duncan Young's colleague to add functionality to one of their applications ...


Perly Dates

by in Feature Articles on

Jeff D works on a team that develops applications on just about any platform under the sun. One day, a perl-based application they developed for a client just stopped working. This was actually a pretty common occurrence; the perl programmer who built the app would just jump in, do his magic, and voilà, it'd be fixed. But this time, the perl guy was unavailable, leaving Jeff (who had no perl experience whatsoever) to fix the problem.

Jeff learned that the problem was caused by $ftpdate, or, more specifically, $ftpdate not having yesterday's date being stored in it. There was definitely a bug in the code generating $ftpdate, but Jeff had no idea what it was. He was able to use Google to find out what the built-in modules were for date manipulation. This was apparently beyond the resident "perl expert" who believed in using the operating system's /bin/date instead ...


Do You Believe In Magic?

by in Feature Articles on

Mike O (the guy who worked with A Database's Database), sent in an entertaining story about a vendor app he's been working with ...

At our shop, we use an off-the-shelf web-based application called "Magic" for defect tracking, migration scheduling, and a few other things. Magic lacks some of the features that I would consider a must, such as generating an email with the contents of a ticket. Or allowing you to search for tickets in any meaningful way. Or even providing a reasonable way to find your own tickets.


Stringing Your Heart Out

by in Feature Articles on

Here's a fun snippet of "Classic" ASP from our dear old friend, Tim Cartwright. Ignore for the moment that the application stores name/value pairs in the session to be directly be displayed on a following page. Also, ignore that there are potentially enough items in session that the usage of a regular, 16-bit integer would not be enough to index these items. Instead, try to focus on the ever-so-elegant way the author manages to split the session's name/value pairs into a two-dimensional array for further display processing ...


A Constant Barrage

by in Feature Articles on

I'm a bit disturbing that our standards have gotten so low that it requires no less than *six* "constants abuse" submissions to justify a single post. It's a good thing in some ways, I suppose; when you're asked to "look into a little bug in this application," it'll take you that much longer to regret every saying "sure, no problem!"

Our first example is from David who is, admittedly, at fault. They sent business requirements, along with their coding standards, to an offshore coding partner. Among lots of other fun results, they received the following in a shared code file ...


The Little Button That Could

by in Feature Articles on

Today's post is a bit different than most. You see, the code is well written, well commented, and well documented. No less, we shall take a tour through the system which Steve L. maintained for a brief time, that had "The Little Button That Could" ...

The requirement was simple. Develop an ASP web-page with a single button that calls the Reset_Approval stored procedure in the database (passing in the approval number from the page's querystring) and display a message indicating success or failure.


Exception Disfunction

by in Feature Articles on

I was originally going to post this code from szeryf because of the way it used exceptions: exceptions are meant to be thrown and this method returns one, requiring the caller to check the type of object returned to see if it's an exception. But now that I look at six-line wonder a bit more, I've noticed that the WTF-to-LOC* ratio has surpassed one. And whenever this happens, you know what it means: time for a game of Where's WTF! I stopped counting at seven ... how many can you find?


Select Just In Case

by in Feature Articles on

In the past year or so that I've been doing the Daily WTF, I can't tell you how many times I've wondered (or have been asked) when I will officially run out of unique content. I'm sure that day will come, but today certainly isn't that day. Especially with folks like Ederson Peka discovering completely new paradigms out in the wild. Today's particular find is entitled the "Select (just in) Case." Note that if for whatever reason, the condition falls through the cracks of the Switch/Case statement, you're safe with that extra If.


Configuration According to Consultants

by in Feature Articles on

Today's code (from Mark H) may come as a bit of surprise to you. After all, we're so used to seeing only the best quality work from those who bill more per hour than most take home in a day, especially when they use VB6 as a platform. For some bizarre reason, this nearly flawless recipe for success didn't quite work out so well. In addition to writing his own INI-reading functionality, the highly-paid consultant found a rather unique way of reading through lines in a file ...


A "Priceless" Server Room

by in Feature Articles on

Yes, I do realize that today's post has a big ole' photograph employing a hackneyed spoof of MasterCard's "Priceless" campaign. But bare with it; the accompanying story from Zack makes it worthwhile ...

I work for a company that has recently started to grow in the technology realm. One of the growing pains we're having is our Network Administrator. Being the CEO's son-in-law, you'd think he'd be more than qualified for the job. But as it turns out, there's a slight qualifications gap. Among many other things, he ordered a new $2,000 laptop because the network card was "broken." I easily fixed it by installing the drivers.


Inheritance 101

by in Feature Articles on

At Barknee's place of work, it is pretty common place to have a "code walkthrough" when a project is complete. The idea is that other developers will have a general idea how system works in case they ever need to support it.

A recent walkthrough was given by a senior-level developer who wanted to make sure that everyone understood not only the basics of the system, but the fundamentals of some of the programming and architecture techniques used. After all, not everyone is an expert at the more complex concepts in computer science such as inheritance. The developer used the following code to demonstrate the fundamentals of inheritance and how it was used within their application ...


Hovering In Style

by in Feature Articles on

A little while back, K. was asked to change the mouse-over color for links on a client's website. He figured it'd be a pretty easy change: just edit the CSS file and change the :hover class containing the links. Obviously, since I'm talking it about it here, that wasn't the case.

Upon looking at the source code for the site, K. was greeted with this rather unique way of changing link colors, underlines, and a number of other styles. Naturally, this technique was not in any central JavaScript file, but copy-pasted into each page with a few minor tweaks.


SELECTing The Hard Way

by in Feature Articles on

There was a time where I used to believe that the worst possible way one could retrieve rows from a table was to SELECT the entire table, iterate through the rows, and test a column to see if it matched some critera; all the while ignoring the WHILE clause. Ahh, how naive I was back then. This procedure from Jeremy Price makes a WHERE-less SELECT look like a celebrated best practice ...


            

Happy July Fourth!

by in Feature Articles on

It is once again America’s Independence Day. I normally don’t post on federal holidays, but I thought I’d make an exception with something totally festive and a bit off-topic.

The normal Fourth of July tradition is fireworks: watching 'em, shooting 'em, and getting third degree burns from 'em. Unfortunately, in the state of Ohio, the only legal fireworks are sparklers. But who’s to say you can’t have fun with those cheap novelties… especially lots and lots and lots of them …


A Great Gallimaufry of Goofiness

by in Feature Articles on
Betcha didn't know there were *that* many synonyms for the noun "jumble". No less, you know what that means ...

Geoff Thompson found a rather obnoxious pattern in his former co-worker's code; all of the "important" methods had a "confirmation" argument that you had to set to true. You know, just in case you accidentally called the method ...