Error'd: Too Spicy For My Hat
The Daily WTF | Curious Perversions in Information Technology
by Lyle Seaman
7h ago
My plate has been full this week, but not as full as Walter's! "Maybe hold the cheese?" suggests Walter T. regarding a pepper and steak grinder. "Seen at Reading (MA) House of Pizza on Jul 24 2024." If you decide to search around to try to understand the different names for this kind of sandwich, you will undoubtedly discover someone trying to claim that really, the hoagie is a different sandwich from a submarine, which is different from a grinder and so on. They are wrong, and this is how we know: if they truly were different kinds of sandwiches, then somewhere on this planet would be a shop ..read more
Visit website
NPath Complexity
The Daily WTF | Curious Perversions in Information Technology
by Remy Porter
3d ago
We're not going to look at code today, and instead, we're going to talk about a code metric. Specifically, "NPath complexity". NPath complexity is a good metric to track, and many static analyzers will do it. Formally written, it's defined: "The NPath complexity of a method is the number of acyclic execution paths through that method." Or, more simply, not counting loop iterations, this is how many branches you have in a single method. Obviously, for simplicity's sake, this number should be small. Hell, ideally, it should be small enough that you can count it on your fingers. Ideally, small en ..read more
Visit website
CodeSOD: Serial Properties
The Daily WTF | Curious Perversions in Information Technology
by Remy Porter
4d ago
Jan wrote some code that set a property, and a few lines later had to write code to read that value- and the compiler complained. Which is what drew his attention to this C# code: public string ViewNodeFilter { protected get { if (viewNodeFilter.IsNotValid()) { return "null"; } return new JavaScriptSerializer().Serialize(viewNodeFilter); } set { viewNodeFilter = value; } } Now, one of the features of properties in C# is that the getter and setter can have different access l ..read more
Visit website
Error'd: Pennies From Heaven
The Daily WTF | Curious Perversions in Information Technology
by Lyle Seaman
1w ago
Adrian M. lit up this blooper for us. "Apparently Siemens Mobility wasn't satisfied that a mere 95-year copyright term would be enough for the brochure about their m60-series traffic light controller. I hope I won't have to wait until 2029 for a green light." See for yourself here.   Mark W. thinks Doordash needs a kiss on the boo-boo to make it all better. "Sometimes even a major app has a little mishap, the software equivalent of skidding on a wet floor or fumbling shuffling a deck of cards, and all they need is a bit of reassurance."   An Anonymous Cheapskate pinches every p ..read more
Visit website
CodeSOD: False True is True False
The Daily WTF | Curious Perversions in Information Technology
by Remy Porter
1w ago
Languages which do type-coercion are generally setting users up for failure. At some point, you'll make some assumption about your inputs, and then type-coercion kicks in and changes what you expect. We see this all the time in JavaScript, and of course, in PHP. PHP booleans, for example, can surprise you: 0 is false, which is a common enough assumption, but so is "0"- the string zero. As are empty arrays. But what if you wanted more control over it? Peter sends us this PHP he found: $trueFalse = array('false', 'true'); This creates the trueFalse array such that it holds the strings false an ..read more
Visit website
CodeSOD: Sanitary Paths
The Daily WTF | Curious Perversions in Information Technology
by Remy Porter
1w ago
When accepting user input for things like, say, accessing the filesystem, you need to do some validation. Bad or inappropriate characters could lead to surprises that no one is going to like. So when Christian first spotted this C# method called SanitizePath, he didn't think much of it. But then he looked at the implementation… public static string SanitizePath(string path, char replacementchar) { string result = ""; try { // Split path and filename FileInfo fi = new FileInfo(path); string filename = FileUtilities.ReplaceInvalidFileNameChars(fi.Name, replacementchar); st ..read more
Visit website
CodeSOD: Prefixual
The Daily WTF | Curious Perversions in Information Technology
by Remy Porter
1w ago
Maciek has the distinct pleasure of working on Dynamics Ax, and ERP system. Like every other ERP system, it's endlessly customizable, and scriptable. In this case, scriptable in a custom language called "X++". While it's probably entirely possible to write good code under these circumstances, it's not an environment conducive to that. And that's how Maciek inherited this method: public boolean modified() { boolean ret; str itemPrefix; str itemId; ResponseCodeTable responseCodeTable; ; itemId = SalesLine_ItemId.getLine(1 ..read more
Visit website
CodeSOD: Uniquely Enough Identifiers
The Daily WTF | Curious Perversions in Information Technology
by Remy Porter
1w ago
Running and hosting a database is expensive. Not only do you need the server for it (even if you rent in the cloud), you also need the expertise to administer it. And that's why Lucas ended up working on an application which used Google Sheets as its database. Now, this was an application used by a marketing team to create new marketing campaigns, so Google Sheets wasn't the worst choice made in the entire process. With only a handful of users and dozens of records, it was fine. You didn't need to put a huge amount of effort or expertise into it- at least, that's what management thought. The a ..read more
Visit website
Error'd: Watching the Days
The Daily WTF | Curious Perversions in Information Technology
by Lyle Seaman
2w ago
This week, we saw some unexpected results in UK politics. Nothing was more unexpected than the dark-horse results that Richard and a few anonymice remarked on. "A glorious victory for the Undefined party!" crowed Richard "The UK general election has seen a surge of support for minor parties."   Some numbers are lucky. Michael R. sympathizes with the unlucky ones. "I reckon 1 and 5 are feeling left out."   Phil J. bought a thing, and muses "I hope they took my money." 'Twere me, and I'd hope they didn't.   Gordon S. has a little storage crunch. "It would be nice to free ..read more
Visit website
Best of…: Classic WTF: Python Charmer
The Daily WTF | Curious Perversions in Information Technology
by Alex Papadimoulis
2w ago
When comparing your language to a snake*, be careful to not get bitten. (*Yes, I know, the name of the language is a reference to Monty Python, not snakes). Original. --Remy "I don't have a whole lot of experience in Python," writes Jakob, "in fact, when I was hired, the only thing I knew about the language was that whitespace was important." "Fortunately — actually, unfortunately — it doesn't take a whole lot of experience in Python to recognize that my company's codebase is... well... sub-optimal. Submitted for your approval is a method used to generate a password, found in our network secur ..read more
Visit website

Follow The Daily WTF | Curious Perversions in Information Technology on FeedSpot

Continue with Google
Continue with Apple
OR