Sweden Starts Building 100,000 Year Storage Site For Spent Nuclear Fuel
Read more of this story at Slashdot.
Helen Flanagan is banned from driving for six months despite claiming she is struggling financially as a 'mummy at home' after failing to say her boyfriend was speeding
Cameron Diaz makes first red carpet appearance in FIVE YEARS for Netflix's Back in Action premiere in Berlin
Hugh Jackman and Sutton Foster look happier than ever amid his divorce drama with ex Deborra-lee Furness
Linda Nolan's heartbreaking final wish: Star was 'grateful' for spending Christmas with her beloved sisters before her death 65
Kanye West posts NAKED Pamela Anderson video as rapper sparks fears for Bianca Censori marriage
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.
Disturbing footage inside derelict Chelmsford home of woman who murdered her own parents investigated by police
Timothee Chalamet slapped with $79 fine after THAT e-bike stunt at London premiere of A Complete Unknown
Twerking flight attendant is fired from Alaska Airlines over viral video filmed while waiting two hours for a pilot
Cameron Diaz shocks Jamie Foxx with comment about 'President' Elon Musk while sharing wild conspiracy theory
US adds Chinese RISC-V player that TSMC suspected of helping build Huawei GPUs to risky company register
Chinese chip designer Sophgo, a suspected supplier of AI silicon to Huawei, has been added to the USA’s “Entity List” of orgs felt to represent a national security risk and therefore prohibited from working with American companies unless a license is issued to allow such dealings.…
Parallels brings back the magic that was waiting seven minutes for Windows to boot
Desktop hypervisor specialist Parallels has released an early technology preview of code that allows virtual machines running OSes coded for the x86_64 architecture, such as Microsoft Windows, to run on Apple’s Arm-powered silicon.…