Feed aggregator
How Americans View AI and Its Impact on People and Society
Read more of this story at Slashdot.
Gen Z Leads Biggest Drop In FICO Scores Since Financial Crisis
Read more of this story at Slashdot.
Nvidia To Invest $5 Billion in Intel
Read more of this story at Slashdot.
LimeWire Acquires Fyre Festival Brand
Read more of this story at Slashdot.
Color-Changing Organogel Stretches 46 Times Its Size and Self-Heals
Read more of this story at Slashdot.
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.
[Advertisement] Keep the plebs out of prod. Restrict NuGet feed privileges with ProGet. Learn more.China Is Sending Its World-Beating Auto Industry Into a Tailspin
Read more of this story at Slashdot.
DeepSeek Writes Less-Secure Code For Groups China Disfavors
Read more of this story at Slashdot.
After Child's Trauma, Chatbot Maker Allegedly Forced Mom To Arbitration For $100 Payout
Read more of this story at Slashdot.
GNOME 49 'Brescia' Desktop Environment Released
Read more of this story at Slashdot.
Chimps Drinking a Lager a Day in Ripe Fruit, Study Finds
Read more of this story at Slashdot.
Sony Quietly Downgrades PS5 Digital Edition Storage To 825GB at Same Price
Read more of this story at Slashdot.
Congress Asks Valve, Discord, and Twitch To Testify On 'Radicalization'
Read more of this story at Slashdot.
Flying Cars Crash Into Each Other At Air Show In China
Read more of this story at Slashdot.
Microsoft Favors Anthropic Over OpenAI For Visual Studio Code
Read more of this story at Slashdot.
Gemini AI Solves Coding Problem That Stumped 139 Human Teams At ICPC World Finals
Read more of this story at Slashdot.
Extreme Heat Spurs New Laws Aimed at Protecting Workers Worldwide
Read more of this story at Slashdot.
AI's Ability To Displace Jobs is Advancing Quickly, Anthropic CEO Says
Read more of this story at Slashdot.
Darkest Nights Are Getting Lighter
Read more of this story at Slashdot.
OpenAI Says Models Programmed To Make Stuff Up Instead of Admitting Ignorance
Read more of this story at Slashdot.