Recent Articles

Jul 2014

Tablemania!

by in Feature Articles on

We've all heard of dates. Not the kind with someone to whom you're attracted. No, I mean the kind that represent some relative position on the calendar. Now we've all seen what people do when faced with the extremely difficult task of working with dates. Short of programming in brainfsck, intelligent programmers use the built-in variety, be it in C#, Java, etc.

Sometimes, you need to be able to identify different parts of a date. But, given (let's use Java as an example) a java.util.Date, how on Earth can any reasonable person possibly figure out the year without too much grief? I mean, it's mathematically hard to convert all those milliseconds to years. There must be a better way to identify years!


The Joys of Interdisciplinary Work

by in CodeSOD on

Lisa thought that the Modesto Biology Institute was the perfect working environment. The scientists who showed her around were all friendly, not the "evil, lab-coated villains" portrayed in Fritz Lang films. The lab director, Howard, pointed out the lack of horror monsters in their lab after Lisa joked about it during her interview.

"See?" Howard said, gesturing. "You won't find anything scarier than a petri dish in here ... except for grant applications." He looked disgusted at the suggestion.


Circle Around the Requirements

by in Feature Articles on

Bakdar was the only technical person at PromoCorp, a marketing company. When someone finally launched a technical project, he was ready. The product was a cutting-edge web-to-print technology, in which Joe User could easily upload an image of his plumbing company’s logo onto a mock-up of a pen, and send it to PromoCorp with his order. It would save time, money, and provide a revenue stream for PromoCorp. The project was big, the project was technical, and the project was the attractive sort of thing that made careers. Bakdar was over the moon.

It was a brilliant idea, with one problem. PromoCorp didn’t have the internal resources to create the web interface on their own, so they contracted a third party, Weblutions, to do it for them. Bakdar was the liaison between the two, tasked with making sure things went smoothly. The interface between Weblutions and PromoCorp was supposed to import the images from Weblutions so that they could be emblazoned onto things like crappy t-shirts nobody would ever wear. The finished goods would then be returned to the customer who initiated the request.


A Team of One

by in CodeSOD on

Bob worked at a small company. There’s a messy history in its founding. The owner, Aaron, worked for another company making basically the same software, until he finally got fed up with their coding style and practices. So he quit to found his own company, with his own rules about things, like how many blank lines there should be before a for loop (exactly 1), how to order variable declarations (alphabetically, with “::” coming after “z”), and how source control should be organized (about as organized as organized crime).

Aaron didn’t waste a lot of time managing, and made sure to keep his hands in the code. Of course, no one wanted to touch the code after he did, which meant Aaron wasn’t just the owner, but he was a one-man team. The other teams might deliver features, but Aaron’s team delivered vision. Well, vision, and code blocks like this, which parse parameters off the command-line:


The Best Truck in the World!

by in Error'd on

"Apparently this truck has a few more features than standard trucks," writes Derek, "I'm sure the price would have been an even $3,000,000 but there are a few miles on it to drive it down."


Doing a Split...the Hard Way

by in CodeSOD on

Way back when Java first came out, if you wanted to split a string into tokens, you had to roll your own mechanism to do so. Of course, even as far back as Java 1.2, there were some built-in secrets to help you tokenize your string so you could iterate over the tokens.

David S. found this little gem written by one of his cohorts in a very recent version of Java (which we all know has absolutely no way of splitting a string into tokens).


Limited Options

by in Feature Articles on

Security is challenging to get right. It's always a complex balancing act between what users want and what administrators need. Between placing the server in a hermetically sealed container with no cables running the outside world, and setting the server up on the busiest street corner in town with an already logged-in administrator account pulled up on the attached monitor. Depending on the O/S update policy in practice at your company, that last example can be roughly the equivalent of connecting your server to the Internet.

Here at TDWTF, security is a common topic of submissions. If only because there are so many different (and creative) ways to set things up that are wrong and only a couple of ways to set it up that are correct. And there is a non-zero percentage of administrators that are, shall we say, less than diligent in how they go about their job. We're sure that none of you fit into that category. We're talking about other people.


An Odd Way to Find Even Numbers

by in CodeSOD on

Fred S. never much cared for zebra striping, the UI pattern that was all the rage after Mac OS X launched in 2001. It found its way into other Mac applications, web pages, even onto Linux. Like a tsunami of alternating grey-and-white waves, it overtook everything in its path.

After numerous requests from users, the project manager for WeightTracker asked Fred to add zebra striping to the weight journal window. Fred had inherited oversight of the application after the original developer, Louis, had been poached by their underperforming rival.


The Great Bacon Conspiracy

by in Feature Articles on

As an IT infrastructure manager, Jerry spent more time skimming his junkmail folder than he liked. Unfortunately, a large number of important messages landed there, because Garrett, the CSO, mandated an extremely aggressive approach to identifying spam. No less than once a week, a vital message was marked as spam.

NCI bacon.jpg


It's Cheaper to Buy the Train

by in Error'd on

"I was looking at prices for a train journey," writes Hamish, "I think my company's accountant might raise an eyebrow if I upgraded to first class".


A Little of Everything

by in Tales from the Interview on

Chinese buffet2.jpg
"Chinese buffet2". Licensed under CC BY-SA 3.0 via Wikimedia Commons.
Assembler. C. C++. C#. PHP. Javascript. Bash. Perl. Ruby. Java. These were just some of the technologies featured on the resume of a candidate Christian recently interviewed for a senior Linux sysadmin position. The impressive list of programming languages (and related data-interchange acronyms like XSLT and JSON) made the candidate, let's call him Rob, seem more qualified for a developer position, but he went on to list common web server databases like MySQL and Postgres (plus a couple flavours of NoSQL), and, finally, the qualifications Christian was actually interested in: Tomcat, JBOSS, the Hotspot JVM, and every major Linux distro. While the resume reeked of keyword-baiting, Christian didn't want to risk missing out on an excellent sysadmin who just happened to spend a lot of time hacking, and brought Rob in.

Christian kicked off the interview by describing their infrastructure. Working for a major enterprise, his division was responsible for fifteen hundred Java application servers, clustered into groups of three or four. He explained to Rob how they managed the large number of identical deployments using Puppet, with SVN to track changes to their enormous catalog of scripts. He got through most of their rollout and monitoring processes before Rob cut in with a question.


A Priestly Epoch, Running off the Tracts

by in Coded Smorgasbord on

Peter came across this helpful little utility function:

public static DateTime EPOCH_UTC()
{
   DateTime epoch = new DateTime(1980, 1, 1, 0, 0, 0);
   return epoch;
}

Just Roll With It

by in Feature Articles on

DBAs are supposed to bring knowledge of the underpinnings of databases to the table. How to lay out tables and indices across disks for linear vs. striped access. How to properly set up partitioning for different types of access. Granting assorted privileges and roles. Managing backup and aging off data in a controlled manner, and so forth.

Some take pride in showing developers the "right" way. Some are maniacal in their tight-fisted my-way-or-the-highway approach. Others seem better suited to a career of asking do you want fries with that?

6sided dice

Survey Results & Site Redesign

by in Announcements on

A little while back, I posted a user survey and asked for some general comments -- thanks to everyone who replied and shared their thoughts. I was hoping to share the survey results sooner, but I got a bit caught up in that Release! Kickstarter project.

In addition to some basic demographics questions, the survey asked some questions about a site redesign:


State of the UNION

by in CodeSOD on

Correct now, optimize later. is one of the most important developer mantras and Scott K. followed it to a fault. He was on a team of programmers debugging a C# package management application, which used Microsoft SQL for revision tracking. Make sure it works right the first time; you can always tease out more performance after launch.

But if your program takes ten minutes to extract a C# package, as Scott discovered, you might want to optimize sooner rather than later.


This Squirrel Error is Driving Me Nuts!

by in Error'd on

"When War Thunder crashed, apparently there were some squirrels hiding in there and they gnawed on something. I don't know which button I'm supposed to push!" Jay wrote.


Sound and Fury, Implementing Nothing

by in CodeSOD on

Mark was upset. You didn't have to sit next to him to know it, either. Even though his cubicle was at the far end of the farm, his frequent tirades were always audible to the rest of the office. Mark wasn't the most skilled or the most careful developer on the team, but what he lacked in ability he made up for in volume: a lot of his poorer decisions stood simply because his colleagues wanted to avoid a barrage.

The installer for their main product was Mark's pride and joy, so Jonathan tried to stay as far from the code as possible. Mark had long ago added a timeout to the code that checked for a stuck installation, but it consistently went off too early, complaining about failure when the installation would eventually succeed. When Mark tired of the QA team complaining, Jonathan overheard him bellowing at the team lead.


In the Belly of the Beast

by in Feature Articles on

A large company is something like a whale. They are huge beasts who strain their sustenance (profits) from the ocean that surrounds them. In this analogy, customers are krill, but their employees are more like Jonah- wrapped up inside of a beast larger and more complex than they can possibly imagine.

First, we have no control over who gets swallowed up in that whale with us. Phil, for example, found himself huddled in the bowels of a large manufacturer with Len as his only company.

The Broken Piece


One Bad Ternary Operator Deserves Another

by in Representative Line on

Personally, in all my years of application development, I have had zero use of ternary operators.

You might argue that ternary operators are useful in that they reduce the code footprint of an application of those unnecessarily lengthy if-then-else statements. But really...who are we kidding here? The only practical application of ternary operator is to either intentionally obfuscate your code or use it as a soapbox to brag about how "l33t" you are.


Code Abuse

by in CodeSOD on

A client of Jim's with a WordPress site had been having performance issues that were off the scale bad. Slower then a snail on Valium. Slower than a herd of turtles rampaging through a molasses factory. Worse than that, the actual in-browser rendering was taking significantly longer than any benchmarking tests would lead you to believe. Even massively loaded benchmark tests had a better rendering time. And the client's browser's weren't massively loaded.

After investigating a number of avenues, Jim decided to migrate the site to newer, faster infrastructure. The older machines were due for a refresh anyway. And the newer infrastructure would be on Ubuntu Precise, whereas the older was Lucid. So, as a bonus, the client got a free upgrade! Free as in beer.


Classic WTF: The Program Generator Program

by in Feature Articles on

It's the 4th of July, which is the day the US attempts to forget they ever pretended to like soccer through wild displays of patriotism and fireworks. It's also a holiday, so enjoy this WTF from the archives, The Program Generator Program from 2012.

When you've been in IT for as long as Pat McGee, you're bound to have survived at least one or two COBOL horror stories. While COBOL is certainly not the worst platform to develop software on (MUMPS will most certainly hold that title through at least our grandchildren’s lifetimes), its extreme verbosity and unique idiosyncrasies make it a challenge for organizations to develop clean, maintainable code.


if(useTCP) return;

by in Feature Articles on

A long, long time ago, in a phone company long since gone and resurrected, if Aunt Bee wanted to call Sheriff Andy, she picked up the phone, pressed the receiver a couple of times, the operator picked up, Bee said to connect her to Andy, and the operator shoved a jack into a hole to complete the circuit. For long distance calls, two or more operators and switchboards were involved. It left something to be desired, but it worked.

Fast forward a while, and Vint Cerf and Bob Kahn got the idea to automate it all with a packet-switched network. David Reed designed UDP, which helped eliminated the operators sitting at switchboard jack panels, but didn't guaranty delivery of the packet, and if the packets did arrive, there was no particular ordering to them. This fire-and-forget mechanism was fine for the sender. Not so much for the recipient.


Everyone Wants Validation

by in Coded Smorgasbord on

Faibbus works with an international team. Some of his fellow developers don’t quite adhere to the same standards. This code was in a module, and the comments and text were originally in Dutch.

if(this.value.length!=0){

   //because the greater/smaller signs are being escaped  

   if(this.value.length==1){alert('The year must have 4 digits.');this.focus();}

   if(this.value.length==2){alert('The year must have 4 digits.');this.focus();}

   if(this.value.length==3){alert('The year must have 4 digits.');this.focus();}

}

Scriptzilla

by in Feature Articles on

In the late 90s, Jeremy fought a battle against a menace more terrifying than the dreaded Y2K bug. He maintained a network management application running on Solaris which managed TDM and ATM switches, called PortLog. This prototype CMDB maintained a database of all of the equipment in the network. It created a unique identifier encoded each device’s shelf, slot and port number according to a “magic” formula. That formula needed to change in the next release, thus forcing the unique ID of each device to change as well, in every deployed instance of their database.