Computer
NASA Uses GPS On the Moon For the First Time
Read more of this story at Slashdot.
World's First 'Synthetic Biological Intelligence' Runs On Living Human Cells
Read more of this story at Slashdot.
China May Be Ready to Use Nuclear Fusion for Power by 2050
Read more of this story at Slashdot.
CodeSOD: Wrap Up Your Date
Today, we look at a simple bit of bad code. The badness is not that they're using Oracle, though that's always bad. But it's how they're writing this PL/SQL stored function:
FUNCTION CONVERT_STRING_TO_DATE --Public (p_date_string IN Varchar2, p_date_format IN Varchar2 DEFAULT c_date_format) Return Date AS BEGIN If p_date_string Is Null Then Return Null; Else Return To_Date(p_date_string, p_date_format); End If; END; -- FUNCTION CONVERT_STRING_DATEThis code is a wrapper around the to_date function. The to_date function takes a string and a format and returns that format as a date.
This wrapper adds two things, and the first is a null check. If the input string is null, just return null. Except that's exactly how to_date behaves anyway.
The second is that it sets the default format to c_date_format. This, actually, isn't a terrible thing. If you check the docs on the function, you'll see that if you don't supply a format, it defaults to whatever is set in your internationalization settings, and Oracle recommends that you don't rely on that.
On the flip side, this code is used as part of queries, not on processing input, which means that they're storing dates as strings, and relying on the application layer to send them properly formatted strings. So while their to_date wrapper isn't a terrible thing, storing dates as strings definitely is a terrible thing.
[Advertisement] Plan Your .NET 9 Migration with ConfidenceYour journey to .NET 9 is more than just one decision.Avoid migration migraines with the advice in this free guide. Download Free Guide Now!
Users Report Emotional Bonds With Startlingly Realistic AI Voice Demo
Read more of this story at Slashdot.
Cult Text-Based Zombie MMO 'Urban Dead' Is Shutting Down After 20 Years
Read more of this story at Slashdot.
TCL Overtakes LG To Become Second-largest Premium TV Brand
Read more of this story at Slashdot.
Firefox 136 Released With Vertical Tabs, Official ARM64 Linux Binaries
Read more of this story at Slashdot.
YouTube Warns Creators an AI-Generated Video of Its CEO is Being Used For Phishing Scams
Read more of this story at Slashdot.
Opera Adds an Automated AI Agent To Its Browser
Read more of this story at Slashdot.
Brother Accused of Locking Down Third-Party Printer Ink Cartridges Via Forced Firmware Updates
Read more of this story at Slashdot.
Automattic CEO Matt Mullenweg Talks Succession - 'I Don't Want To Pass It To a Committee'
Read more of this story at Slashdot.
Judges Are Fed Up With Lawyers Using AI That Hallucinate Court Cases
Read more of this story at Slashdot.
Citi Copy-Paste Error Almost Sent $6 Billion to Wealth Account
Read more of this story at Slashdot.
Australia, With No Auto Industry To Protect, is Awash With Chinese EVs
Read more of this story at Slashdot.
Apple Launches Legal Challenge To UK 'Back Door' Order
Read more of this story at Slashdot.
After Exam Fiasco, California State Bar Staff Recommend Reverting To In-person Exams
Read more of this story at Slashdot.
Scientists Create 'Woolly Mice'
Read more of this story at Slashdot.
Apple Unveils iPad Air With M3 Chip
Read more of this story at Slashdot.
Europe's Biggest Battery Powered Up In Scotland
Read more of this story at Slashdot.