CodeSOD: Query Query Query
The Daily WTF
by Remy Porter
13h ago
Bob's employer had a data-driven application which wasn't performing terribly well. They had some in-house database administrators, but their skills were more "keep things running," and less "do deep optimizations". The company opted to hire a contract DBA to come in, address the performance problems, and leave. In actual fact, the DBA came in, ran some monitoring, and then simply wrote some guidance- generic, and frankly useless guidance. "Index on frequently queried fields," and "ensure database statistics are gathered on the appropriate schedule." The only meaningful output of the contracto ..read more
Visit website
CodeSOD: An Obsolete Approach
The Daily WTF
by Remy Porter
2d ago
Marcus's team was restructuring the API, and the architect thus wanted a number of methods marked obsolete, to encourage developers to move to the new version of the API. So the architect created a Jira task, assigned it to a dev, and moved on. Somehow, this C# code got committed and merged, despite being code reviewed: public static void OBSOLETE_PopulateOfferNodes(Ecometry.New.Model.CategoryHierarchyNode _mainNode, ref Ecometry.New.Model.CategoryHierarchyNode _defaultOffersNode, ref Ecometry.New.Model.CategoryHierarchyNode _foundOffersNode) { foreach (Ecometry.New.Model.CategoryHier ..read more
Visit website
CodeSOD: Concrapenate Strings
The Daily WTF
by Remy Porter
3d ago
As oft discussed, null-terminated C-style strings are an endless source of problems. But there's no problem so bad that it can't be made worse by a sufficiently motivated developer. Today's rather old code comes from Mike, who inherited an old, MFC application. This code is responsible for opening a file dialog, and the key goal of the code is to configure the file filter in that dialog. In MFC, this is done by passing a delimited string containing a caption and a glob for filtering. E.g., "Text Files (.txt) | *.txt" would open a dialog for finding text files. char szFileNa ..read more
Visit website
Error'd: Believe It Or Not
The Daily WTF
by Lyle Seaman
5d ago
This week we have a special visit from a mythical beast: the snarklemma. But first, a non-error Error'd. Obsessive Optimizer Ian K. "Walmart's nationwide network of warehouse stores means they can save time and money by shipping locally. FedEx has them covered: Their nationwide shipping fleet determined the shortest path from Houston to its largest suburb goes via Georgia." Not the shortest path, nor the fastest, but surely the cheapest one that meets the delivery date requirement. It's probably not an error, and I believe it, but I still can't believe it!   Possibly our most faithful ..read more
Visit website
CodeSOD: A List of Mistakes
The Daily WTF
by Remy Porter
1w ago
Yesterday we talked about bad CSS. Today, we're going to talk about bad HTML. Corey inherited a web page that, among other things, wanted to display a bulleted list of links. Now, you or I might reach for the ul element, which is for displaying bulleted lists. But we do not have the galaxy sized brains of this individual: <table style="font-family: Verdana;"> <tr> <td valign="top"> • </td> <td> Google <br /> <a href="http://www.google.com" target="_blank">http://www.google.com</a> </td> ..read more
Visit website
CodeSOD: Classical Design
The Daily WTF
by Remy Porter
1w ago
There is a surprising amount of debate about how to use CSS classes. The correct side of this debate argues that we should use classes to describe what the content is, what role it serves in our UI; i.e., a section of a page displaying employee information might be classed employee. If we want the "name" field of an employee to have a red underline, we might write a rule like: .employee .name { text-decoration: underline red; } The wrong side argues that this doesn't tell you what it looks like, so we should have classes like red-underline, because they care what the UI element looks like, n ..read more
Visit website
CodeSOD: A Small Partition
The Daily WTF
by Remy Porter
1w ago
Once upon a time, I was tuning a database performance issue. The backing database was an Oracle database, and the key problem was simply that the data needed to be partitioned. Great, easy, I wrote up a change script, applied it to a test environment, gathered some metrics to prove that it had the effects we expected, and submitted a request to apply it to production. And the DBAs came down on me like a sledgehammer. Why? Well, according to our DBAs, the license we had with Oracle didn't let us use partitioning. The feature wasn't disabled in any way, but when an Oracle compliance check was pe ..read more
Visit website
CodeSOD: A Top Level Validator
The Daily WTF
by Remy Porter
1w ago
As oft stated, the specification governing email addresses is complicated, and isn't really well suited for regular expressions. You can get there, but honestly, most applications can get away with checking for something that looks vaguely email like and call it a day. Now, as complicated as the "accurate" regex can get, we can certainly find worse regexes for validating emails. Morgan did, while on a contract. The client side had this lovely regex for validating emails: /* Check if a string is in valid email format. Returns true if valid, false otherwise. */ function isEmail(str) { v ..read more
Visit website
Error'd: Paycheque
The Daily WTF
by Lyle Seaman
1w ago
There are an infinite variety of ways to be wrong, but only very small number of ways to be right. Patient Peter W. discovers that MS Word is of two minds about English usage. "Microsoft Word just can't seem to agree with itself on how to spell paycheck/pay check." Faithful readers know it's even worse than that.   Slow Daniel confused me with this complaint. He writes "It seems that the eclipse has reversed the flow of time for the traffic-free travel time." I don't get it. Can readers explain? The only WTF I see here is how much faster it is to walk than to drive 2 miles. Franconia i ..read more
Visit website
CodeSOD: To Tell the Truth
The Daily WTF
by Remy Porter
1w ago
So many languages eschew "truth" for "truthiness". Today, we're looking at PHP's approach. PHP automatically coerces types to a boolean with some fairly simple rules: the boolean false is false the integer 0 is false, as is the float 0.0 and -0.0. empty strings and the string "0" are false arrays with no elements are false NULL is false objects may also override the cast behavior to define their own everything else is true Honestly, for PHP, this is fairly sane and reasonable. The string "0" makes my skin itch a bit, and the fact that the documentation page needs a big disclaimer warning tha ..read more
Visit website

Follow The Daily WTF on FeedSpot

Continue with Google
Continue with Apple
OR