Recent Articles

Jun 2013

My Battery Goes Up to 11

by in Error'd on

"With battery life this good, I'm almost afraid to see what would happen if I picked Power Saver," writes Scott.


We're Going to Need Another Guru!

by in CodeSOD on
Jonathan Mooney's office recently lost their resident SQL Server Reporting Services guru to greener pastures. As such, a general consensus began to take hold of the teams that nobody could ever hope to match his high-level abilities and that their organization as a whole was doomed.

This fear was confirmed after the first programming change arrived after the guru's departure. A relatively simple one really - allow for the addition of another parameter - "Overview". Unfortunately, the departed guru prided him self on his complex methods, as represented by the code below.

=SWITCH(
Parameters!View.Count = 1,IIF(Parameters!View.Value(iif(Parameters!View.Count=1,0,0)) = "Redemptions" ,false,true),
Parameters!View.Count = 2,IIF(Parameters!View.Value(iif(Parameters!View.Count=2,1,0)) = "Redemptions" or
Parameters!View.Value(iif(Parameters!View.Count=2,0,0)) = "Redemptions",false,true), Parameters!View.Count = 3,
IIF(Parameters!View.Value(iif(Parameters!View.Count=3,2,0)) = "Redemptions" or
Parameters!View.Value(iif(Parameters!View.Count=3,1,0)) = "Redemptions" or
Parameters!View.Value(iif(Parameters!View.Count=3,0,0)) = "Redemptions",false,true), Parameters!View.Count = 4,
IIF(Parameters!View.Value(iif(Parameters!View.Count=4,3,0)) = "Redemptions" or
Parameters!View.Value(iif(Parameters!View.Count=4,2,0)) = "Redemptions" or
Parameters!View.Value(iif(Parameters!View.Count=4,1,0)) = "Redemptions" or
Parameters!View.Value(iif(Parameters!View.Count=4,0,0)) = "Redemptions",false,true), Parameters!View.Count = 5,
IIF(Parameters!View.Value(iif(Parameters!View.Count=5,4,0)) = "Redemptions" or 
Parameters!View.Value(iif(Parameters!View.Count=5,3,0)) = "Redemptions" or 
Parameters!View.Value(iif(Parameters!View.Count=5,2,0)) = "Redemptions" or 
Parameters!View.Value(iif(Parameters!View.Count=5,1,0)) = "Redemptions"  or 
Parameters!View.Value(iif(Parameters!View.Count=5,0,0)) = "Redemptions",false,true), Parameters!View.Count = 6,
IIF(Parameters!View.Value(iif(Parameters!View.Count=6,5,0)) = "Redemptions" or 
Parameters!View.Value(iif(Parameters!View.Count=6,4,0)) = "Redemptions" or 
Parameters!View.Value(iif(Parameters!View.Count=6,3,0)) = "Redemptions" or 
Parameters!View.Value(iif(Parameters!View.Count=6,2,0)) = "Redemptions"  or 
Parameters!View.Value(iif(Parameters!View.Count=6,1,0)) = "Redemptions"  or 
Parameters!View.Value(iif(Parameters!View.Count=6,0,0)) = "Redemptions",false,true), Parameters!View.Count = 7,
IIF(Parameters!View.Value(iif(Parameters!View.Count=7,6,0)) = "Redemptions" or 
Parameters!View.Value(iif(Parameters!View.Count=7,5,0)) = "Redemptions" or 
Parameters!View.Value(iif(Parameters!View.Count=7,4,0)) = "Redemptions" or 
Parameters!View.Value(iif(Parameters!View.Count=7,3,0)) = "Redemptions"  or 
Parameters!View.Value(iif(Parameters!View.Count=7,2,0)) = "Redemptions"  or 
Parameters!View.Value(iif(Parameters!View.Count=7,1,0)) = "Redemptions"  or 
Parameters!View.Value(iif(Parameters!View.Count=7,0,0)) = "Redemptions",false,true), Parameters!View.Count = 8,
IIF(Parameters!View.Value(iif(Parameters!View.Count=8,7,0)) = "Redemptions" or 
Parameters!View.Value(iif(Parameters!View.Count=8,6,0)) = "Redemptions" or 
Parameters!View.Value(iif(Parameters!View.Count=8,5,0)) = "Redemptions" or 
Parameters!View.Value(iif(Parameters!View.Count=8,4,0)) = "Redemptions"  or 
Parameters!View.Value(iif(Parameters!View.Count=8,3,0)) = "Redemptions"  or 
Parameters!View.Value(iif(Parameters!View.Count=8,2,0)) = "Redemptions"  or 
Parameters!View.Value(iif(Parameters!View.Count=8,1,0)) = "Redemptions" or 
Parameters!View.Value(iif(Parameters!View.Count=8,0,0)) = "Redemptions",false,true)
)

Reminder - OMGWTF2 Contest Deadline Soon!

by in Announcements on

Alright everybody: the clock is winding down on The Daily WTF's contest: The Olympiad of Misguided Geeks Part 2 sponsored by our friends at New Relic. Only 2 days left until the deadline!

Now, if you haven't started on an entry then I suggest that you get a move on. Remember - we aren't interested in an "epic win" level of quality ...we want your greatest EPIC FAIL. Your entry doesn't have to be the grandest affair - and there are runner-up prizes available too - so the solution you cook up at the last minute might steal the show!


Affidavit Deficit

by in Tales from the Interview on

Dave D. and his wife counted themselves lucky: they'd been in the right place at the right time more than once. When a family member's health began to fail, they were able to sell their software business and retire to help him manage. In their forties, their good fortune and low-key lifestyle meant they wouldn't have to return to work unless they wanted to.

After a couple of years, things had settled into a routine and Dave was ready to consider new opportunities. A local startup was courting him for a senior position, and their engineering team, relatively young and untested, seemed excited to have a steady hand at the tiller. But this startup was unusual: no hiring decision could be made on nautical metaphors alone. They - specifically, their overlords at WTF Ventures, Inc. - prided themselves on fusing the discipline and professionalism of the corporate world to the innovation and foosball-playing of startup culture.


Running for Free Memory

by in CodeSOD on

Jon checked the source control system and discovered a recent check-in by a new-hire touched nearly every file. The check-in comment read, “Performance enhancements; reduced memory usage.”

Runtime runny = Runtime.getRuntime();
runny.freeMemory(); //performance

/* Add the allocation level information */
TxnMaker tm = new TxnMaker(txnId, buySell, rate, taxFlag, isForeign, map);
xmlMessage.getTxns().addAll(tm.getTxns());
runny.freeMemory(); //performance

Log.writeTrace("Txns built");

TxnGroupMaker gm = new TxnGroupMaker(txnId, buySell, rate, spanishTaxFlag, isForeign, map);
Log.writeTrace("Txn Groups Built");

gm.smoothAllEconomicFields(tm.getAllocations(), map, isForeign);

xmlMessage.getTxnGroups().addAll(gm.getTxnGroups());
runny.freeMemory(); //performance

Screen Recording HARDWARE

by in Feature Articles on

It was an all-hands meeting for the entire Los Angeles branch staff at InstaPet, the kind that Ellen always hated. It typically meant one of the three Ls: layoffs, lawsuits, or Lindbergh, their temperamental and flaky CEO. This time, it was the third L.

“It has come to my attention,” Lindbergh said from the front of the conference room, “that some divisions are using insecure software. As you know, we have a reputation for the most secure processes in our entire industry.”


Ruth Bader Ginsburg is Everywhere!

by in Error'd on

Shane writes, "You gotta admire a septuagenarian who managed to get involved with an armed standoff, Chris Brown, a Twitter contest, Seth Meyers, the Bulgarian elections, and California prisons--all within 24 hours."


You Can't Spell "Date" Without "Database"

by in CodeSOD on

At Shaun's company, the fiscal month ends on the 18th. Nothing wrong with that, but there's plenty wrong with this Perl code that finds the most recent fiscal month-end:

my $date='0000-00-00';
my $dd = 1;
my $mm = 1;
while(substr($date,8,2) ne '18') {
    my $sel0="select date_format(date_sub(date_sub(now(),interval $dd day),interval $mm month),'%Y-%m-%d')";
    my $setup=$dbh->prepare($sel0);
    $setup->execute();
    ($date)=$setup->fetchrow_array();
    $setup->finish();
    ++$dd;
}

In Fool We Trust

by in Feature Articles on

Stan arrived one morning to find his boss, Monty, typing up a storm. This meant two things: a horrible spec would land in Stan’s inbox by the next morning, and that spec would shoehorn in a database where none belonged. Monty was a database “expert.” There was no problem his weighty and ill-performing hammer couldn’t nail. During Stan’s first year on the job, he had implemented everything the way Monty described, because he hadn’t known better. Now more knowledgeable of the company’s system, he yearned for an opportunity to do something properly.

In his inbox, Stan found a copy of the customer request that occupied Monty. It asked for two existing ASP.NET applications to be hooked up to one another: a pleasant surprise. This is a perfect case for a simple web service, Stan thought, and since they’re using .NET, WCF is all we need.


Pot o' Gold

by in CodeSOD on

Since the first caveman first discovered the concept of this is more valuable than that, the science of alchemy has captured the imagination of many an enterprising soul. Unfortunately, to date, nobody has had any real success in transforming worthless metal into gold. That was, until the wonder that is PHP came along...

Generally, Brad M, doesn't care who wrote what bad code as long as it gets fixed. This little PHP snippet however, made him look up the responsible programmer on Linked In:


Excellent Sex

by in Feature Articles on

Thomas was outrunning a hurricane.

Storm clouds loomed from the south, the outer fringes of hurricane Gustav. He and the other employees at a volunteer center in New Orleans had been mandatorily evacuated a few hours earlier. The battery LED indicator on Thomas’s phone shone red, the battery drained to 1%. He was still a few hours from Hattiesburg, where a couch at his brother’s house was waiting for him.


Babies for Sale - Cheap!

by in Error'd on

"It's nice to know I can get a good deal on a 16 pound baby on the internet rather than having to resort to the old-fashioned way of getting one," writes Mike Sargent.


SQL Injection: What's That?

by in CodeSOD on

Jon C. was planning to outsource a very simple order tracking system. He interviewed many prospects, each more hopeful than the last. He viewed samples of the websites they had built, and picked the one he liked the best. Jon then commissioned the job for his order tracking system to a local developer.

Upon delivery, Jon discovered that the email notification function didn't work, so he glanced at the code to see if he could identify the problem. Before Jon got that far, he discovered this on the login page:


The Email Virus

by in Feature Articles on

Joe worked hard every day fighting the good fight against viruses and malware for a large financial firm in the UK. Their security setup suffered flaws, but it worked well enough. Scanners on incoming email, an antivirus product on the mail servers, signature updates every 30 minutes, and a basic antivirus on desktops all worked at Joe’s command to protect their network. There was no default route back out to the Internet and a Machiavellian filter restricted web access. Despite all this, Joe had to contend with one vulnerability not even the most advanced security system in the world could defend.

Spam changed faster than their filter-rules, and sometimes bad things slipped through. Joe’s team hoped to lessen the risk of this by educating their users to NEVER, EVER, EVER OPEN SOMETHING THAT LOOKS SUSPICIOUS. As predictable as an Enterprise Red Shirt dying on an Away Team mission, users would always go ahead and crack open malicious EXE files from their “long-lost cousin Frank” and completely fry their computer in minutes.


Welcome to the New Order

by in Feature Articles on

Matthew was the system administrator of a smallish warehousing company. His responsibility was to more or less keep the facility's computer systems working at a reasonable pace and ensure that nothing unexpected would bring the company's business to a screeching halt. Due to the typical resource constraints (money, time, qualified people), companies of this size frequently contract the development work for their internal software out to a third party. Moreover, as you might expect, the quality of those 'third parties' varies widely. Luckily, John, the third party responsible for his warehousing company's software was an industry veteran and was held in very high regard. You could say that there were those in the company thought he walked on water, but that would be unfair to the original. John's following was more devout.

One Monday morning, calls started pouring in complaining that the systems had slowed down markedly. As any good administrator would do, Matt checked to see if a number of potential culprits that had previously been identified and corralled in the past had popped up again. In this case, however, none of the usual suspects were at fault so, Matt reached out to John.


A Bad Leg

by in CodeSOD on

“The Killer Robot program won’t run correctly.” An middle-school student beckoned Artyom to her computer in the lab.

“Let me have a look.” Artyom pulled one of the child-sized chairs and sat next to his student. He had given his class some educational, open-source C programs to try out. Killer Robot looked like good, text-based fun, according to the SourceForge description.


Don't Quit Your Day Job

by in Error'd on

OMGWTF2Hey everybody - just in case you missed it, about a week and a half ago, we announced the long awaited return of our programming contest The Olympiad of Misguided Geeks at The Daily WTF - Part 2, sponsored by our good friends at NewRelic. The contest runs until June 28th so there's still plenty of time to join in on the fun!


 



Where We're Going, We Don't Need Tables

by in Best of the Sidebar on

The Oracle database doesn’t allow you to execute a SELECT statement without a FROM clause. You can't, for example, do SELECT 2 + 2, you must do SELECT 2 + 2 FROM dual. “dual” is a fictional table which exists solely to allow these sorts of operations.

What it isn’t meant for is Aspirist’s sample, from the Sidebar.


From Three Days to 15 Minutes

by in Feature Articles on

The Abstractor, as Greg and his team liked to call him, was a contractor at their company. The Abstractor had built a C# framework architecture (affectionately called Big Momma) that quickly went from being the company's framework, to being his personal baby. At the heart of Big Momma were abstract "Values" collections that wrapped the normal microsoft.net collections. This was so that any time The Abstractor decided that using arrays, XML or List<T> was bad, he could easily change "Values" to store data in some other data structure, and the code using it would be none-the-wiser. After all, enlightened developers use encapsulation, right?

While The Abstractor tended to stay away from any code that involved business logic due to his time being too valuable to be spent researching anything, he was eventually forced into creating a service that populated a database table for the new e-commerce website. The table would be used as a quick "real time" check for determining if a product was available at a location for in-store pickup. The records for each and every product needed to be updated every 30 minutes. Using Big Momma and armed with his "Values" collections, The Abstractor quickly had a solution in place. Unfortunately, it took 3 days to process 500,000 rows in the database - once. Greg was amazed that it could run that slowly. That was until Greg saw this error exception:


The Slow Down Loop

by in CodeSOD on

Arlen's manager was the kind of guy who always smiled, so when he stepped into the conference room full of developers without his trademark grin, everybody knew something was definitely wrong.

"The good news is that that Jones likes the revamped site since we uplifted that gnarled mess of ASP to PHP, but there's just one thing: he's not so much of a fan of the performance."


Who Automates the Automation?

by in Feature Articles on

Steve huffed up the steps of the state Capitol to his office in the IT department. As he caught his breath in the lobby elevator, his PDA buzzed. The flag coordinator, responsible for processing state flag orders from citizens, had written him an email in his typical tone. WHY ARE THERE NO FLAG ORDERS IN THE SYSTEM? IT’S YOUR JOB TO GET THEM TO US!

Still panting from the climb, Steve logged in at his work computer and checked the FTP server where flag orders were stored after being faxed or mailed to the Capitol. Requests were uploaded as PDF files and renamed automatically with a numeric suffix, such as “flag_order_1234.pdf,” by the automated system in the flag coordinator’s office.