Computer
Google Tests AI Search on Its Homepage
Read more of this story at Slashdot.
'Qatar's $400 Million Jet For Trump Is a Gold-Plated Security Nightmare'
Read more of this story at Slashdot.
Meta Threatens To Pull Facebook And Instagram Out Of Nigeria Over $290 Million Fine
Read more of this story at Slashdot.
Audible Is Giving Publishers AI Tools To Quickly Make More Audiobooks
Read more of this story at Slashdot.
Student's Robot Obliterates 4x4 Rubik's Cube World Record
Read more of this story at Slashdot.
Google Wants To Make Stolen Android Phones Basically Unsellable
Read more of this story at Slashdot.
Nextcloud Cries Foul Over Google Play Store App Rejection
Read more of this story at Slashdot.
Republicans Try To Cram Decade-Long AI Regulation Ban Into Budget Reconciliation Bill
Read more of this story at Slashdot.
USENIX Sunsets Annual Technical Conference After 30 Years
Read more of this story at Slashdot.
Google Says Over 1 Billion RCS Messages Sent in the US Daily
Read more of this story at Slashdot.
Office Apps on Windows 10 No Longer Tied To October 2025 End-of-Support Date
Read more of this story at Slashdot.
Trump Administration Scraps Biden's AI Chip Export Controls
Read more of this story at Slashdot.
Intel Certifies Shell Lubricant for Cooling AI Data Centers
Read more of this story at Slashdot.
Linus Torvalds Returns To Mechanical Keyboard After Making Too Many Typos
Read more of this story at Slashdot.
Microsoft is Cutting 3% of All Workers
Read more of this story at Slashdot.
Carmack: World Could Run on Older Hardware if Software Optimization Was Priority
Read more of this story at Slashdot.
Apple Wants People To Control Devices With Their Thoughts
Read more of this story at Slashdot.
The Stealthy Lab Cooking Up Amazon's Secret Sauce
Read more of this story at Slashdot.
Universe Expected To Decay Much Sooner Than Previously Thought
Read more of this story at Slashdot.
CodeSOD: Exactly a Date
Alexandar sends us some C# date handling code. The best thing one can say is that they didn't reinvent any wheels, but that might be worse, because they used the existing wheels to drive right off a cliff.
try { var date = DateTime.ParseExact(member.PubDate.ToString(), "M/d/yyyy h:mm:ss tt", null); objCustomResult.PublishedDate = date; } catch (Exception datEx) { }member.PubDate is a Nullable<DateTime>. So its ToString will return one of two things. If there is a value there, it'll return the DateTimes value. If it's null, it'll just return an empty string. Attempting to parse the empty string will throw an exception, which we helpfully swallow, do nothing about, and leave objCustomResult.PublishedDate in whatever state it was in- I'm going to guess null, but I have no idea.
Part of this WTF is that they break the advantages of using nullable types- the entire point is to be able to handle null values without having to worry about exceptions getting tossed around. But that's just a small part.
The real WTF is taking a DateTime value, turning it into a string, only to parse it back out. But because this is in .NET, it's more subtle than just the generation of useless strings, because member.PubDate.ToString()'s return value may change depending on your culture info settings.
Which sure, this is almost certainly server-side code running on a single server with a well known locale configured. So this probably won't ever blow up on them, but it's 100% the kind of thing everyone thinks is fine until the day it's not.
The punchline is that ToString allows you to specify the format you want the date formatted in, which means they could have written this:
var date = DateTime.ParseExact(member.PubDate.ToString("M/d/yyyy h:mm:ss tt"), "M/d/yyyy h:mm:ss tt", null);But if they did that, I suppose that would have possibly tickled their little grey cells and made them realize how stupid this entire block of code was?
[Advertisement] Utilize BuildMaster to release your software with confidence, at the pace your business demands. Download today! -->