Recent Articles

Apr 2014

cURLing Up With a Good Hook

by in Feature Articles on

A year into his gig as a senior web developer for ClientServiCo, Eddie felt like he had a good grip on the many disparate systems he and his team had built for their clients over the years. Like most web-dev firms formed during the first bubble, the ClientServiCo team had survived by adopting whatever tools were the right combination of familiar, popular, and available at the time. This approach, while allowing them to be flexible in conforming to their clients' needs, also left a tangled legacy spread across a constellation of web hosts. Yeah, it was kludgy in parts. Sure, Eddie would look at some parts and wonder if the coder was high at the time, but hey - overall, it just worked and nobody complained! ...Then came the notification from their current host that a Drupal installation belonging to a ClientServiCo client was spewing spam and had to be taken offline.

The first oddity Eddie noticed was that Drupal wasn't running the entire site. Instead, it was just a calendar and event-registration system. The administrative section was powered by a CMS that ClientServiCo had written in-house during the aughts, and abandoned years ago in favor of something more robust. Though the site was meant to be accessible to authorized users only, the .htaccess and .htpasswd files which comprised the authorization system were only protecting the third part of the site: a set of static webpages written in FrontPage. With the Drupal system and admin backend both freely accessible from the web, it was incredible that the five year-old site had only recently been compromised. As a simple first step to stop the bleeding, Eddie moved the .htaccess file up one directory to protect the entire web root and trudged on.


Seeing Sextuple

by in CodeSOD on

(Read to the tune of "The Way We Were")

Bitmaps
Clog the corners of my RAM
Giant, duplicated bitmaps
of the memes that were

Left Hand, Meet Right Hand

by in Feature Articles on

You have to love the folly of big companies. Bear Stearns. Lehman. Tyco. Enron. MF Global. MegaCorp. WTF Inc. They always put out advertisements telling us how soft and gentle their products are for us, our children and the planet. They cajole us with ads extolling the virtues of their products, and how we can't live without them. Of course, you know that they use the strictest rules and procedures to guaranty the safety of our personal data, and take every conceivable measure to make sure that things are done correctly. In short, we can trust them. There are rules for how to do everything. Protocols to be implemented. Procedures will be followed. Period.

Phone companies, especially, take extreme precautions when releasing software because the communications grid simply cannot be allowed to go down. Ever. I mean, it's critical that you be able to get important messages through, like: I'm on my way, or Pick up milk.


Clbuttic Journalism

by in Error'd on

"The Wall Street Journal was a little late in 'target'ing April Fool's Day," writes Ryan.


Psychic Software

by in Feature Articles on

Lawrence’s first task at his new job would be an easy one. “All you gotta do is carry this across the finish line. It’s practically done already,” Chris the Costly Contractor informed him. Costly Chris was nearing the end of his contract and the company didn’t want to keep paying his jacked-up rates. That’s where Lawrence, the cheaper, full-time alternative to Chris, came in. “But, there are some recent change requests that we need to do. You’ll have the pleasure of talking to Becky about that,” Chris said with a sly grin.
Poster of Alexander Crystal Seer
The software was a simple CRM with a PHP front end. It was a straight-forward MVC application with a slew of stored procedures responsible for managing the data. Lawrence’s group worked on the UI layer.

Shepherd, guru, and leader of the UI effort was Becky, the designer. Becky’s background was in graphic design for print, and someone up the management tree had decided that design was design, and appointed her head of the user interface and experience group.


Your Letters are Numbered

by in CodeSOD on

The First Rule of Enterprise Software is: don't talk about enterprise software. The Second Rule of Enterprise Software is: when you do talk about enterprise software, make references to stylish dramas from the '90s starring Brad Pitt and Edward Norton to make it seem more exciting. However, the most important rule of enterprise software by far is Rule Number Three: Even the simplest little things can't be simple. Arthur was reminded of Rule Number Three on a recent trip into his employer's company-wide database.

The codebase Arthur maintained had a method for just about everything. "Hah!" You're probably thinking. "I bet it doesn't have a method that returns an array containing the letters of the English alphabet!" Well, Hah! yourself: stumbling across a call to GetAlphabetForHouseCombinedPortfolios in the bloated, inappropriately-generic UploadingTool class, Arthur was curious. Would it contain a hard-coded list of letters? A complex mathematical formula dependent on the current date that would baffle everyone by returning Hebrew when the clock switched out of daylight-savings time? No, like all proper enterprise solutions, the method invoked a stored procedure in the database. And that's why Arthur is proud to present sp_UploadingToolGetAlphabetForHouseCombinedPortfolios:


Desert Packet Storm

by in Feature Articles on

Jonathan D. was the system administrator for a school nestled in a war-ravaged city somewhere in the middle of the desert. What with bombings here, explosions there, and the odd RPG whizzing by, dealing with a converted bathroom as an office/datacenter just didn't seem to be all that big of a deal.

The school had roughly 100 computers split between two buildings, along with the laptops everyone used. His office, ...erm... converted bathroom housed all of the servers, and the main computer room for the high school/middle school (grades 6 and up) building was located right outside the door.


You Can't Handle the True!

by in CodeSOD on

We've all had that feeling before. We see something happening in front of us, yet because the sight doesn't conform to the worldview held within our brain, we just can't believe our own eyes. Dogs playing poker. Cats wearing panty hose. Politicians telling the truth. You get the idea. And depending on your personal threshold for incredulity, you might experience this feeling as a double take, a spit take or a psychotic break. If you happen to be prone to psychotic episodes, then I'm going to have to ask you to move on. Wait for tomorrow's WTF. Or maybe pet some kittens. Here's a picture to help you get started.

Incredibly cute kitten...sorry you can

Feeling calm and relaxed? Good. Now let me tell you a story about Steve. Steve is what you call a 'skeptic' (which is scarily close to septic, but I digress). He questions absolutely everything he encounters. He walks with overly firm footfalls to make sure that the ground won't open up under him. He carries two watches to act as verification for the clock on his smartphone. He even checks his own pulse to make sure he's alive.


Social Insecurity Number

by in Error'd on

"Adding an account on Mint.com, it asks for the last 4 digits of my SSN and for the first 3 digits," John A. wrote, "Seriously? There are only 100 combinations left to guess the full SSN!"


Sweet Mysteries of Life

by in Coded Smorgasbord on

When you read a lot of bad code, you start to get a sense of why the code exists. Often, it’s ignorance- of the language, of the functional requirements, of basic logic. Sometimes, it’s management interference, and the slavish adherence to policy over practicality. Other times, it’s just lazy or sloppy work.

And sometimes, the mysterious logic that gave birth to a WTF is just that- a mystery.


Secure Development

by in Feature Articles on

Steven's multi-billion dollar tech firm spared no expense in providing him two computers. One was stuffed in a broom closet down the hall; he used it for email, Internet access, and other administrative items. At his cubicle sat the computer on which he did all his programming, connected to the company's separated development environment (SDE).

The SDE was a company-wide network that existed in parallel to the normal network. No Internet connectivity, and login was only possible with an RSA SecurID dongle. The stated purpose was to provide a secure environment for software development. The other devs on Steven's team had their own SDE boxes for the same purpose.

Bank of the West Los Altos branch vault

I Had My Reasons

by in CodeSOD on

Trevor spent a huge amount of time writing a 2,000,000+ PHP/JavaScript/HTML system for an e-commerce company. Like a few other I'm-Special geniuses in our field, he believed that he could do it better than everyone else. For this reason, he came up with his own way of doing things. Database queries. Date-time logic. You name it.


All Your RAM Are Belong to Us

by in Feature Articles on

Back around the turn of the century, governments were a different place to work at. The public trough, while not as fat as it had been, was still capable of providing funding for boondoggles handed out to friends and family. This was before deficit hawks made a sport of picking off small cost overruns that scurried around the fields of government largesse. Before billions was spent on wars of questionable necessity. Before mayors broke down the stereotype that all crack addicts were skinny.

In this heyday, Ray worked for a government department that contracted, managed and passed-through telecommunications services from external providers to other government departments. The department's central billing and administration system was built and run on the Ingres ABF framework and it's origin dated back to the early 90's. What's more, as soon as the application could be put into minimal funding status, it was. Even in the heady Internet bubble days, no money was spent beyond what was needed to keep the application running.


Visit Scenic NON-STATIC METHOD

by in Error'd on

"I was hoping to take a trip to Hong Kong, but NON-STATIC METHOD seems to be a good value," writes Ryan.


Best of Email: (Un)Helpful Support, An Epic Opportunity, and more!

by in Feature Articles on

Don't forget, The Daily WTF loves terrible emails. If you have some to share, mail in your mail!


Perfectly Safe to Open This (from Alex)


Exceptional Date Formatting

by in CodeSOD on

The Java-based application that Dan M. supports does something that is frequently accomplished by applications the world over - based on the value of a passed string containing a valid date, convert it to datetime. Simple stuff. Java even has built-ins to make this task even easier.

Well, the developer behind the below code decided to take the idea of date conversion using Java's built-ins and run with it ...way off of the reservation.


Nursing the Plan Along

by in Feature Articles on

In the ancient time of 2008, people were still using Lotus Notes. Rumor has it that some still do, even today. Danny worked for an IBM partner which was a “full service” provider. It was the kind of company that you’d leas your entire IT infrastructure from, from servers to desktops and soup to nuts.

Their newest client was the state Nursing Board, the government agency responsible for keeping track of every nurse in the state- when they became a nurse, when they last paid to renew their license, any complaints or reports. From the IT side, this involved tracking payments, physical documents, and navigating custom Lotus Notes applications developed by the Board’s own development team. It was a giant pile of confusion with a highly manual and error prone process.


Offshore Obfuscation

by in CodeSOD on

JH supports web-based property management software, which is exactly as exciting as it sounds. We've all been there: obsolete tech—their database was running SQL Server 2000 long past its sunset date—and outsourced development. The Indian office had a problem to solve: they'd already written a database function to return all completed work orders for a given tenant's unit, but since notifications were only sent once a day, the client wanted to scoop up any work orders from the previous day that were completed after that day's notification was sent. JH could have modified the function to look back at the previous day in five minutes, but then his company would have missed out on the incredible cost and efficiency gains of offshoring. Instead, JH was tasked with reviewing the code. The first thing he noticed was that, instead of just comparing the work order dates to the current date using SQL Server's GETDATE() function, the technician did this:

where datediff(day, @asofDate, wo.DTWCOMPL) between -1 and 0

Not All Birthdays are Created Equal

by in Error'd on

"Apparently Microsoft realizes that my chosen birthdate is fake," Chris D. writes, "I can have the 2nd of January, though."


Translate Everything!

by in Feature Articles on

"Pourriez-vous s'il vous plaît répéter la question?" said Andre, head developer. His voice was garbled over a VoIP connection. "My English ... not great."

Yvonne sighed. She was the project manager of MetaPortal, the creatively named flagship product of MetaCortex. "Why is there no email validation for the signup form?" Yvonne repeated, speaking slowly and clearly.


This Round Robin Laid an Egg

by in CodeSOD on

One of the The Architect's developers laid the egg that is this round-robin connection pooling code. He discovered this when he noticed that his connection was getting incorrect responses under load.

public class RoundRobinConnectionContainer { 
  private static final Logger LOG = Logger.getLogger( RoundRobinConnectionContainer.class ); 
 
  private int useNext = 0; 
  private List<BehaviorEngineConnection> connections = 
               Collections.synchronizedList(new ArrayList<BehaviorEngineConnection>()); 
 
  // Find the index of the next connection to try

  public int getNextIndex() { 
    if (useNext > this.connections.size() - 1) { 
       useNext = 0; 
    } 
    return( this.useNext++ ); 
  } 
 
  public void addConnection(BehaviorEngineConnection connection) { 
    connections.add(connection); 
  } 
 
  public BehaviorEngineConnection getConnectedConnection() { 
    int size = this.connections.size(); 
    while (size-- > 0) { 
      BehaviorEngineConnection conn = connections.get(getNextIndex()); 
      if (conn.isConnected()) {
         return conn; 
      } 
      LOG.error("No connected connection available!"); 
      return null; 
    } 
  }
}

Make It Work

by in Feature Articles on
Update 2014-04-02 10:07pm (EDT): direct downloads are now hosted on thedailywtf.com instead of Soundcloud. Break out your decoder rings, mix up a glass of Ovaltine, and don't touch that dial! It's time for...

Radio WTF Presents!

Today's episode: "Make It Work", adapted for radio by Lorne Kates, from a submission by Mitch G.