Feed aggregator
Hyundai To Help Build Nuclear-Powered Datacenter In Texas
Read more of this story at Slashdot.
CrowdStrike Investigated 320 North Korean IT Worker Cases In the Past Year
Read more of this story at Slashdot.
The Uproar Over Vogue's AI-generated Ad Isn't Just About Fashion
Read more of this story at Slashdot.
ChatGPT Nears 700 Million Weekly Users, Up 4x From Last Year
Read more of this story at Slashdot.
Engineer Restores Pay Phones For Free Public Use
Read more of this story at Slashdot.
World in $1.5 Trillion 'Plastics Crisis' Hitting Health From Infancy To Old Age, Report Warns
Read more of this story at Slashdot.
The Great Indian IT Squeeze
Read more of this story at Slashdot.
Google Tells iPhone Buyers To 'Just Change Your Phone' After Apple's AI Delays
Read more of this story at Slashdot.
What Happens To Your Data If You Stop Paying for Cloud Storage?
Read more of this story at Slashdot.
Delta's Dynamic AI Pricing Plan Sounds Different Now
Read more of this story at Slashdot.
Microsoft Used China-Based Engineers to Support Product Recently Hacked by China
Read more of this story at Slashdot.
Perplexity is Using Stealth, Undeclared Crawlers To Evade Website No-Crawl Directives, Cloudflare Says
Read more of this story at Slashdot.
Fujifilm Is Raising Camera Prices By Up To $800
Read more of this story at Slashdot.
How McKinsey Lost Its Edge
Read more of this story at Slashdot.
Is AI Causing Tech Worker Layoffs? It's Complicated
Read more of this story at Slashdot.
With Flight of Six More Tourists to Space, Blue Origin Carries 75th Passenger
Read more of this story at Slashdot.
CodeSOD: Concatenated Validation
User inputs are frequently incorrect, which is why we validate them. So, for example, if the user is allowed to enter an "asset ID" to perform some operation on it, we should verify that the asset ID exists before actually doing the operation.
Someone working with Capybara James almost got there. Almost.
private boolean isAssetIdMatching(String requestedAssetId, String databaseAssetId) { return (requestedAssetId + "").equals(databaseAssetId + ""); }This Java code checks if the requestedAssetId, provided by the user, matches a databaseAssetId, fetched from the database. I don't fully understand how we get to this particular function. How is the databaseAssetId fetched? If the fetch were successful, how could it not match? I fear they may do this in a loop across all of the asset IDs in the database until they find a match, but I don't know that for sure, but the naming conventions hint at a WTF.
The weird thing here, though, is the choice to concatenate an empty string to every value. There's no logical reason to do this. It certainly won't change the equality check. I strongly suspect that the goal here was to protect against null values, but it doesn't work that way in Java. If the string variables are null, this will just throw an exception when you try and concatenate.
I strongly suspect the developer was more confident in JavaScript, where this pattern "works".
I don't understand why or how this function got here. I'm not the only one. James writes:
No clue what the original developers were intending with this. It sure was a shocker when we inherited a ton of code like this.
[Advertisement] ProGet’s got you covered with security and access controls on your NuGet feeds. Learn more.Disney Struggles With How to Use AI - While Retaining Copyrights and Avoiding Legal Issues
Read more of this story at Slashdot.
How Napster Inspired a Generation of Rule-Breaking Entrepreneurs
Read more of this story at Slashdot.
'A Black Hole': America's New Graduates Discover a Dismal Job Market
Read more of this story at Slashdot.