Recent Articles

Feb 2009

Sponsor Thanks, ASSorted Out-of-placeness, & More

by in Feature Articles on

And now, a quick break from our sponsors. If there are any companies that you think would make a good sponsor, let me know. Otherwise, if you haven't done so already, please show your support by taking a look at what our sponsors have to offer.

 

Software Verification   Software Verification - software engineering tools for memory leak detection, code coverage, performance profiling, thread lock contention analysis and thread deadlock detection, flow tracing and application replay on the Windows Vista, 2003, XP, 2000 and NT platforms.
Mosso   Mosso - massively scalable hosting for .NET (2,3,3.5) PHP, Ruby, etc., with unlimited sites & mailboxes, simple online provisioning, and an enterprise clustered platform that's supported by real people.
SlickEdit   SlickEdit - makers of that very-impressive code editor and some pretty neat Eclipse and VisualStudio.NET tools and add-ins, some of which (Gadgets) are free. Check out this short video highlighting just one of SlickEdit's Visual Studio integration features.
SoftLayer   SoftLayer - serious hosting provider with datacenters in three cities (Dallas, Seattle, DC) that has plans designed to scale from a single, dedicated server to your own virtual data center (complete with racks and all)
WTF   The Non-WTF Job Board - Powered by HiddenNetwork, it features some great job opportunities like:

The Docile Monster

by in Feature Articles on

credit: gwen @ flickr Although The University billed itself as “a leader on the forefront of Information Technology,” it was neither a leader nor anywhere near the forefront. At least, not any more. Its “next generation” hardware – graciously donated by a company known as Big Green – had slowly devolved to “last generation.” And then to “several generations old.” And then, finally, to ancestral. By that point, many students’ laptops rivaled that of the once great, Big Green hardware.

Fortunately, The Professor had excellent connections at Big Green. And Big Green, not exactly a non-profit organization saw the potential in educating students on their platforms. So after much negotiation, Big Green finally agreed to provide The University – free of charge – with some rather expensive and quite interesting hardware. The media dutifully published the relevant press releases and the students began dreaming of virtual environments, sandboxes, compiler farms, databases and everything else that nerds would want.


Beneath Dave

by in Feature Articles on

When John Smith started his job as the IT Manager/Network Admin/Webmaster for a small, sixty-employee subsidiary, he thought that he had found a pretty sweet gig. Everybody from his boss on down seemed reasonable, plus he got a laptop and a nice 19" LCD monitor. And best of all, the vending machine gave out drinks for $0.25.

Overall, things went along pretty smoothly and, once he got to understand how everything was connected at the company, he brought up some very good suggestions on how to improve things further. Including his idea for an VPN to secure transactions between his and the parent company. But instead of a round of applause, John got a nervous "Well, your VPN idea sounds pretty solid, but.....you're going to need to run that past Dave first."

Who's Dave?


A Man's Array

by in CodeSOD on

It's always a little frustrating when you're trying to write the most beautiful code you can, but because of a limitation in the programming language you have to roll up your sleeves and brute force it. As programming technologies mature, I find this to be rarer and rarer.

Sadly, Dan M. inherited a project in which some cutting-edge features weren't available. For example, the cutting-edgiest feature conceivable: arrays!


The Manual Migration

by in Feature Articles on

The time had come for the national telecom we'll call Communicommco to shed its legacy systems and move into the future. In fact, calling them "legacy systems" is perhaps too charitable – these things were freaking dynasty systems. The dusty green screen terminals and ancient interface were being replaced with a cutting-edge the-future-has-arrived VB6 frontend. There was just one problem: the existing data had to be migrated in somehow.

Having just graduated college, Joe B. had a lot of free time on his hands. He had a job lined up, but that was six months away, and he was still too wet behind the ears to sell his services as a contractor. After seeing a lot of late-night commercials that made data entry sound pretty lucrative, he decided to try to get a position on Communicommco's migration project.


A Little Out of Place

by in Error'd on

"Hmmm," Tracy McKibben wrote, "something seems out of place in Amazon's 'Classic Horror Titles' deals."


Dividing by Zero for Fun and Profit

by in CodeSOD on

When the Web Applications Group and the Distributed Applications Group were merged into one, it should have been a joyous day for Greg Beech. After all, Greg would finally get the chance to see first hand the "Enterprise CMS" system that the Distributed group had been bragging about for so many years. It was built by a team of elite consultants and billed "the quintessential collection of best practices."

After downloading the source code, following the seventy-two steps required to install the Enterprise CMS on a development workstation, and spending an entire afternoon fiddling around with his computer's settings, Greg finally had the software running. But when he fired it up in up in debug mode through Visual Studio, he noticed something strange: a preposterous number of exceptions were being thrown, many of which were of type DivideByZeroException.


The Son of ITAPPMONROBOT

by in Feature Articles on

It’s always been my goal that the stories shared here on The Daily WTF provide a “certain” kind of inspiration. Perhaps the kind of inspiration leads towards better code instead of the disasters featured here. Or maybe the inspiration to gently nudge that “certain” programmer into a career of, say, accounting. Or even just pure inspiration which reminds us that, while sometimes boring, our jobs aren’t completely meaningless.

That said, it’s been a bit surprising to see that one particular article – ITAPPMONROBOT – has provided the inspiration for other IT professionals to build to their own "robot". Not once (see: Open Sesame), but now twice. Felix explains...


Consultants of the Crystal Citadel

by in Feature Articles on

Photo Credit: 'Thristian' @ FlickrIt was the mid-1990's and business was booming at the company that Terry worked at. It was booming so much that the existing process of entering an order — faxing in an order form torn out of an outdated-as-soon-as-it-was-printed catalog — was delaying things enough that it was costing the company some serious dough in missed sales. Needing a way to re-engineer the process without hiring an army of support staff, management decided on an innovative plan that would enable customers to place orders electronically without needing to contact customer service.

With resources being tight (even the help desk was fielding order inquiries), management decided to farm out the work to an outside IT firm. Now, important work like this wasn't going to be farmed out to the boss's nephew who was a whiz at programming in Word and Excel. Instead they were going with a big name, "we named our building after ourselves" company. Yes it would be expensive, but the money that could be saved by receiving orders this new way would allow the program to more than pay for itself in short order.


Opener Beware

by in Error'd on

"We received a new Canon imageRUNNER, and it included 10 licenses for imageWARE Document Manager Personal," wrote Chris LeBlanc, "We'd love to install it, but it looks like opening the envelope to install the software will void the warranty."


Non-Compliant By Design

by in Feature Articles on

The IT Support Department at Stephen S.'s company was divided into two distinct castes: helpdesk admins and system admins. And the differences between these two groups were many.

The helpdesk admins had rotating shifts and were there 24/7 (and each was on call 24/7), while the system admins had a solid 9-5 and a rotating on-call admin. The helpdesk admins staff was always on duty, while the system admins would frequently attend catered vendor meetings, leaving the helpdesk admins crew to fight over the remaining scraps. There was a considerable difference in pay scale. The helpdesk admins were the low men on the totem pole, while the company bent over backwards to keep the system admins happy, stopping just shy of providing palanquin transportation to and from work (instead, they had a 50/50 mileage split).

The Wee Hours


The Path to WTF is Paved with Good Intentions

by in CodeSOD on

Let's say that I have a stupid report that needs constant attention and maintenance because of waffling business requirements.  Rather than buying a fruit bouquet for the server admin because of all the promotes I'd be doing, one solution might be to dynamically fetch the SQL for the report from a table. That way, all I would need to do is run a single UPDATE statement, COMMIT, and it's done!

Better yet, what if I wrote a generic procedure that could call any of the SQL my query table.  How enterprisey!!  This seems to be the general intenet of the original developer behind a web app that Patrick Magee recently inherited. 


Programming Sucks! Or At Least, It Ought To

by in Alex's Soapbox on

Programming is not fun. It’s boring, it’s tedious, and it’s certainly not challenging. And no matter how much you stretch it, programming is most definitely not sexy.

I know what you’re thinking. Anyone who says that – let alone blogs it – should immediately be stripped of his software development license, have his keyboard taken away, and be permitted to only use only to CP/M on 8" floppies with a 1200 baud modem.


Some Crazy Reason

by in CodeSOD on

One time, out of boredom, I wrote a little utility called BitVerifier. It would loop over a folder and check every bit of each file. If the bit's value wasn't one or zero, it would prompt the user for the correct bit. At least in theory. I somehow never encountered a file with a "two" bit. But I got one key component right – an understanding of the valid range of values.

Rob K.'s colleague didn't even get that far.


Does Not Compute: Crunchies, Virtual Returns, & More

by in Feature Articles on

It’s easy to take for granted a lot of the words that have entered our high-tech lexicon. Many of the words – from Amazon to the Web – have real-world meanings that, oftentimes, are very far removed from “our” meanings. Here are a few stories from readers that serve as a fun reminder to all this.

Crunchies (from Romjin)
Recently, one of our customers called in with some problems he was having with his computer.


Seasonal Slowness

by in Feature Articles on

Photo Credit: 'peterallen' @ FlickrFlash back to the early 1990s when David S. was working for a large health care provider, maintaining an application that passed data files between two servers across a leased line.

Normally, data transfers went off without a hitch - the applications responsible for shuffling data between the servers were well written and while the hardware on either end wasn't exactly bleeding or even cutting edge, it was mature enough that all of the kinks were worked out.  For David, day to day maintenance was a piece of cake.


Somewhat Obsolete

by in Error'd on

"I'd hate to be the one to break it to BDT," wrote Nathan Dunn, "but I'm pretty sure that position isn't needed anymore."


The How, Not the Why

by in CodeSOD on

Habits, good or bad, are easy to gain but hard to break. Often, the way one learns to do something is the way they keep doing it, sometimes never questioning if there is a better approach.

One of Lance K.'s colleagues had one habit that was well-intentioned – thoroughly commenting his code – but he apparently didn't realize that comments are meant to explain the why rather than the how:


Damn the River

by in Feature Articles on

Hitchcock River had gotten so badly polluted that going for a dip in it would get you one of two things: superpowers or some kind of nasty flesh-eating bacterial infection. And as awesome as it'd be to have X-Ray vision, it was just not worth the risk.

Decades ago, Ed B. was working for an underfunded state research team with an insanely-frugal mad scientist at the helm. They were working together to study the sludge that flowed through Hitchcock River, and had a semi-friendly rivalry with a well-funded lab in a neighboring city ("Shelbyville"). Ed didn't mind the cheap boss or shoddy equipment, though, because the equipment they used had such cool names. Honestly, one of the devices they used was called a "gas chromatograph mass selective detector." Awesome.

Measuring Flux Capacitance


Zipping Files - The Matryoshka Doll Way

by in CodeSOD on

Upon reading the code submitted by Eric Williams, the first thing I thought of was a series of Matryoshka Dolls.  You know, those little Russian dolls where the one doll has a smaller doll, which has a slightly smaller doll which in turn and so on...

The Windows-based application that Eric inherited from a previous developer needed to zip the contents of a folder full of files.  Normally, this functionality is a little difficult to implement without a third party library.  However, the original developer thought "outside the box" and wrote up the following implementation.

CreateZipFromFolder(CString m_outfile, CString outfolder)
{

 CString m_outputfilename = m_outfile;
 CString outpath = outfolder;
 CString p;

 TCHAR lpPathBuffer[BUFSIZE];
 TCHAR lpPathBuffer1[BUFSIZE];
 DWORD dwBufSize=BUFSIZE;

 DWORD dwRetVal;
 //find temp directory;
 dwRetVal = GetTempPath(dwBufSize, //buffer length
     lpPathBuffer); //path buffer
     
    if (dwRetVal > dwBufSize || (dwRetVal == 0)) {
        printf ("Failed to get temp path (%d)\n", GetLastError());
        FILE *fp = fopen("C:\\Zip.vbs","w+");
    }
   
    FILE *fp ;
    strcat(lpPathBuffer,"zip.vbs");

    CString fileName = lpPathBuffer ;

    if((fileName[0] != '\0'))
        fp = fopen(fileName,"w+");
    else(fp = fopen("C:\\Zip.vbs","w+"));
        p.LoadString(RESID_30);
       
    fprintf(fp,"Dim fso, winShell, MyTarget, MySource, file \n") ;
    fprintf(fp,"Set fso = CreateObject(");
    fprintf(fp,"%s",p);
    fprintf(fp,"Scripting.FileSystemObject");
    fprintf(fp,"%s",p);
    fprintf(fp,")   \n");
    fprintf(fp,"Set winShell = createObject(");
    fprintf(fp,"%s",p);
    fprintf(fp,"Shell.Application");
    fprintf(fp,"%s",p);
    fprintf(fp,")    \n");
    fprintf(fp,"MySource =");
    fprintf(fp,"%s",p);
    fprintf(fp,"%s",outpath);
    fprintf(fp,"%s \n",p);
    fprintf(fp,"MyTarget =");
    fprintf(fp,"%s",p);
    fprintf(fp,"%s",m_outputfilename);
    fprintf(fp,"%s \n",p);
    fprintf(fp,"Set file = fso.CreateTextFile(MyTarget, True)   \n");
    fprintf(fp,"file.write ");
    fprintf(fp,"%s",p);
    fprintf(fp,"PK");
    fprintf(fp,"%s",p);
    fprintf(fp,"& chr(5) & chr(6) & string(18,chr(0)) \n");
    fprintf(fp,"file.close \n");
    fprintf(fp,"winShell.namespace(MyTarget).CopyHere winShell.namespace(MySource).items    \n");       fprintf(fp,"do until winShell.namespace(MyTarget).items.count = winShell.namespace(MySource).items.count    \n");
    fprintf(fp,"wscript.sleep 1000 \n");
    fprintf(fp,"loop \n \n");
    fprintf(fp,"Set winShell = Nothing \n");
    fprintf(fp,"Set fso = Nothing");
    fclose(fp);

    PROCESS_INFORMATION pi;
    STARTUPINFO si;
    ZeroMemory( &si, sizeof(si) );
    si.cb = sizeof(si);
    ZeroMemory( &pi, sizeof(pi) );

    CString filename;
    filename = p + lpPathBuffer + p;
    CString szCommand;
   
    BOOL ret = Is64Bit();
    if(ret) {
        DWORD dwRetVal;
        //get the windows directory;
        dwRetVal = GetWindowsDirectory(lpPathBuffer1,dwBufSize); //path buffer
        strcat(lpPathBuffer1,"\\syswow64\\");
        szCommand = lpPathBuffer1;
        szCommand +="
cmd.exe /c cscript //B ";
    }   else {
            szCommand ="cmd.exe /c cscript //B ";
    }

    szCommand += filename ;
    if(CreateProcess(NULL,szCommand.GetBuffer(szCommand.GetLength()),NULL,NULL,FALSE,DETACHED_PROCESS,NULL,NULL,&si,&pi)) {
        WaitForSingleObject( pi.hProcess, INFINITE );
        CloseHandle( pi.hProcess );
        CloseHandle( pi.hThread );
    }
   
    return 0;
}

Stupid Coding Tricks: A Batch of Pi

by in CodeSOD on

It's high time for the second installment of stupid coding tricks! As we learned from the T-SQL Mandelbrot, a stupid coding trick isn't really about obfuscation per se... just, well, stupid awesomeness. Kinda like a quine, except even more useless.

Don Cross was gracious enough to provide today's example, which teeters on the edge of what many consider "code". It's a Win32 batch file. Unlike the analogous *nix shell script, batch "programming" comes with an incredibly limited syntax and a miniscule number of commands. While one can certainly do far more in batch than ever should be done, the technology works well foa shortcut for typing in a bunch of commands.


The Secret DTS Package

by in Feature Articles on

"I don't know, Gerald, this doesn't look right."

"What do you mean?"


Hard Coded Rubbish

by in Error'd on

"Little did I realize that a trip to the local recycling centre would provide the material for a WTF submission," Simon D wrote, "for the record, 'Actual Rate' was hand written as 61%"


Re-enlisting the Data General

by in Feature Articles on

Photo Credit: 'glass window' @ FlickrFlash back to the early 90's when Remy P. was working as a system administrator for a major oil and gas company. Getting his hands dirty on a mix of Windows, VaxVMS, Alpha, and Solaris servers, Cisco routers, and even an old Xenix box that everybody prays never crashes, things were never dull, and today was certainly no exception.

Scratching his head the whole way down the freight elevator, Remy and two strapping lads from building services were to fetch the old, retired Data General server that once ran the old legacy accounting database before being replaced by a Dec Alpha and Oracle database from the server graveyard in one of the dimly lit storage rooms. Once in place and he would then play Doctor Frankenstein with it so that it may fulfill one request - print out all of the financial records that could be restored from tape backup for none other than the almighty Internal Revenue Service.


For a Good Time, Call...

by in CodeSOD on

Let's face it; being a developer doesn't really foster a great social life. Late-night coding and sitting still for days makes our eyes bloodshot, our bellies large, our breath toxic, and our postures almost parabolic.

So sometimes we have to get creative to become more popular, or to at least get more phone calls. Maybe it's time to take a cue from one of Josh's colleagues.


The Expert System

by in Feature Articles on

As a highly paid consultant, Bruce didn't make a whole lot of friends with the "locals." Whenever his New York City-based systems-integration firm placed him at a client site, the in-house developers tended to resent him for one of two reasons: They'd either believe that he didn't bring nearly enough innovation to justify his company's three-figure hourly bill rate ("We could have thought of that, too"), or they'd feel that he was far too much of an outsider to provide any valuable contributions to their team ("We already know what's best").

Victor was no exception. Almost immediately, it was obvious that Victor had come to the conclusion that bringing in any outside consultants would just delay things further.


The Littering ATM

by in Error'd on

"When I saw this on my way to lunch," J.R. Raith writes, "I remember thinking, for crying out loud people, there's a freakin' garbage can right there!"


#WHO WROTE THIS JUNK

by in CodeSOD on

Justin de Vesine was less than thrilled with his internet service. On a good day, his high-speed would pretend to be dial-up; usually, it seemed that things would just give up loading half-way through. Through some trial and error, he narrowed it down to the brand-name DSL modem that his ISP gave him. Since it was running a stripped down version of Linux, and supported telnet administration, Justin decided to log in and poke around some of the scripts and config files to see if he could find the source of his problems.

When he came across this gem of a start-up script, Justin was not surprised that his DSL modem was the source of his troubles.