Computer
Starship Rocket Breaks Up Mid-Flight, But SpaceX Catches Booster Again After Launch
Read more of this story at Slashdot.
PC Gaming Has Been Outperforming Console For Years, Report Finds
Read more of this story at Slashdot.
Apple Pulls AI-Generated Notifications For News After Generating Fake Headlines
Read more of this story at Slashdot.
David Lynch, Director of Twin Peaks and Dune, Dies At 78
Read more of this story at Slashdot.
Blue Origins' New Glenn Rocket Reaches Orbit
Read more of this story at Slashdot.
AI Slashes Google's Code Migration Time By Half
Read more of this story at Slashdot.
Microsoft Patches Windows To Eliminate Secure Boot Bypass Threat
Read more of this story at Slashdot.
Nvidia Reveals AI Supercomputer Used Non-Stop For Six Years To Perfect Gaming Graphics
Read more of this story at Slashdot.
A New Jam-Packed Biden Executive Order Tackles Cybersecurity, AI, and More
Read more of this story at Slashdot.
Nintendo Admits Emulators Are Legal Despite Crackdown
Read more of this story at Slashdot.
Drinking Water Sources in England Polluted With Forever Chemicals
Read more of this story at Slashdot.
Replit CEO on AI Breakthroughs: 'We Don't Care About Professional Coders Anymore'
Read more of this story at Slashdot.
Nintendo To Unveil Next-Generation Switch 2 in April
Read more of this story at Slashdot.
Governments Call For Spyware Regulations In UN Security Council Meeting
Read more of this story at Slashdot.
Pastor Who Saw Crypto Project In His 'Dream' Indicted For Fraud
Read more of this story at Slashdot.
Sweden Starts Building 100,000 Year Storage Site For Spent Nuclear Fuel
Read more of this story at Slashdot.
CodeSOD: Halfway to a Date
Roger took on a contract to fix up a PHP website. During the negotiations, he asked some questions about the design, like, "Is it object-oriented or more procedural?" "No, it's PHP," said the developer.
Which about sums it up, I suppose. Have some date handling code:
function MnameToMnumber($mname) //takes month name 'January' and returns month number '01' { if($mname == 'January'){$mnum = '01';} elseif($mname == 'February'){$mnum = '02';} elseif($mname == 'March'){$mnum = '03';} elseif($mname == 'April'){$mnum = '04';} elseif($mname == 'May'){$mnum = '05';} elseif($mname == 'June'){$mnum = '06';} elseif($mname == 'July'){$mnum = '07';} elseif($mname == 'August'){$mnum = '08';} elseif($mname == 'September'){$mnum = '09';} elseif($mname == 'October'){$mnum = '10';} elseif($mname == 'November'){$mnum = '11';} elseif($mname == 'December'){$mnum = '12';} return $mnum; } function MnumberToMname($mname) //takes month number '01' and returns month name '01' { if($mnum= '01'){$mname = 'January';} elseif($mnum= '02'){$mname = 'February';} elseif($mnum= '03'){$mname = 'March';} elseif($mname == 'April'){$mnum = '04';} elseif($mnum= '05'){$mname = 'May';} elseif($mnum= '06'){$mname = 'June';} elseif($mnum= '07'){$mname = 'July';} elseif($mnum= '08'){$mname = 'August';} elseif($mnum= '09'){$mname = 'September';} elseif($mnum= '10'){$mname = 'October';} elseif($mnum= '11'){$mname = 'November';} elseif($mnum= '12'){$mname = 'December';} return $mname; }So, for starters, I "love" the use of Whitesmiths indenting. I don't think I've seen this in the wild. (I predict the comments section will be links to articles where I have seen this in the wild).
Beyond that, there's nothing terribly surprising here, in terms of bad date handling code, with a few small exceptions. First is their insistence on the conversion itself being stringly typed: January isn't month 1, but "01".
But more notable: MnumberToMname just doesn't work. They're using the assignment operator instead of the equality operator. At least, for all the cases where they're doing the correct comparison direction. A stray "name to number" conversion is lurking in April. Not that it matters- this will always return January.
[Advertisement] Keep the plebs out of prod. Restrict NuGet feed privileges with ProGet. Learn more.Startup Raises $200 Million To 'De-Extinct' the Woolly Mammoth, Thylacine and Dodo
Read more of this story at Slashdot.
FTC Says Refunds For Razer's False N95 Face Masks Are Going Out Now
Read more of this story at Slashdot.
Russia's Largest Platform For State Procurement Hit By Cyberattack
Read more of this story at Slashdot.