Meta teams up with Oakley on AI sports glasses with an action-ready hidden camera - the ultimate gadget for fitness influencers
Second by second, Prince Andrew's ill-judged royal appearance: JANE FRYER
CodeSOD: An Echo In Here in here
Tobbi sends us a true confession: they wrote this code.
The code we're about to look at is the kind of code that mixes JavaScript and PHP together, using PHP to generate JavaScript code. That's already a terrible anti-pattern, but Tobbi adds another layer to the whole thing.
if (AJAX) { <?php echo "AJAX.open(\"POST\", '/timesheets/v2/rapports/FactBCDetail/getDateDebutPeriode.php', true);"; ?> AJAX.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); AJAX.onreadystatechange = callback_getDateDebutPeriode; AJAX.send(strPostRequest); } if (AJAX2) { <?php echo "AJAX2.open(\"POST\", '/timesheets/v2/rapports/FactBCDetail/getDateFinPeriode.php', true);"; ?> AJAX2.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); AJAX2.onreadystatechange = callback_getDateFinPeriode; AJAX2.send(strPostRequest); }So, this uses server side code to… output string literals which could have just been written directly into the JavaScript without the PHP step.
"What was I thinking when I wrote that?" Tobbi wonders. Likely, you weren't thinking, Tobbi. Have another cup of coffee, I think you need it.
All in all, this code is pretty harmless, but is a malodorous brain-fart. As for absolution: this is why we have code reviews. Either your org doesn't do them, or it doesn't do them well. Anyone can make this kind of mistake, but only organizational failures get this code merged.
Fuming office worker leaves 'unhinged' note after a colleague stole her lunch - then changes it 15 minutes later: 'This is relatable'
Live A12 updates as road completely closed after serious crash near Chelmsford
'Much-loved' nan killed on her birthday after van driver using phone ploughed into car on A12
Man arrested after walking into Loughton school 'acting unusually'
Jimmy Kimmel's sidekick Guillermo Rodriguez dodges questions as staff abruptly exit studio moments after ABC pulled show off air over Charlie Kirk 'joke' backlash
Donald Trump warns Seth Meyers is 'next' while celebrating Jimmy Kimmel's 'cancelation' as 'great news for America'
Witnesses describe horror as mass shooting leaves at least three police officers dead
Donald Trump lays a wreath at the tomb of Queen Elizabeth II during poignant tour of St George's Chapel
Donald Trump designates 'sick and dangerous' Antifa as a 'major' terrorist organization
5 adorable pets at RSPCA Essex centres who are looking for their forever homes
Delays to train services last full day after tree falls on railway line
Six-metre Mars replica to be suspended in Chelmsford Cathedral
5 adorable pets at RSPCA Essex centres who are looking for their forever homes
The 47 schools in Chelmsford rated 'Good' by Ofsted
Woke Hollywood stars unleash their fury on ABC over Jimmy Kimmel suspension
China Is Sending Its World-Beating Auto Industry Into a Tailspin
Read more of this story at Slashdot.