Feed aggregator
US and China Agree To Temporarily Slash Tariffs
Read more of this story at Slashdot.
US Copyright Office to AI Companies: Fair Use Isn't 'Commercial Use of Vast Troves of Copyrighted Works'
Read more of this story at Slashdot.
CodeSOD: Would a Function by Any Other Name Still be WTF?
"Don't use exception handling for normal flow control," is generally good advice. But Andy's lead had a PhD in computer science, and with that kind of education, wasn't about to let good advice or best practices tell them what to do. That's why, when they needed to validate inputs, they wrote code C# like this:
public static bool IsDecimal(string theValue) { try { Convert.ToDouble(theValue); return true; } catch { return false; } }They attempt to convert, and if they succeed, great, return true. If they fail, an exception gets caught, and they return false. What could be simpler?
Well, using the built in TryParse function would be simpler. Despite its name, actually avoids throwing an exception, even internally, because exceptions are expensive in .NET. And it is already implemented, so you don't have to do this.
Also, Decimal is a type in C#- a 16-byte floating point value. Now, I know they didn't actually mean Decimal, just "a value with 0 or more digits behind the decimal point", but pedantry is the root of clarity, and the naming convention makes this bad code unclear about its intent and purpose. Per the docs there are Single and Double values which can't be represented as Decimal and trigger an OverflowException. And conversely, Decimal loses precision if converted to Double. This means a value that would be represented as Decimal might not pass this function, and a value that can't be represented as Decimal might, and none of this actually matters but the name of the function is bad.
[Advertisement] ProGet’s got you covered with security and access controls on your NuGet feeds. Learn more.Videogame's Players Launch Boycott Over Bugs, Story Changes, Monetization
Read more of this story at Slashdot.
Apple's iPhone Plans for 2027: Foldable, or Glass and Curved. (Plus Smart Glasses, Tabletop Robot)
Read more of this story at Slashdot.
Researchers Just Solved a Big, 70-Year-Old Problem for Fusion Energy
Read more of this story at Slashdot.
Over 3,200 Cursor Users Infected by Malicious Credential-Stealing npm Packages
Read more of this story at Slashdot.
How Spaceport America Will Grow
Read more of this story at Slashdot.
Whoop Promises Free Upgrades - But Some Users Will Have to Pay to Extend Their Subscriptions
Read more of this story at Slashdot.
OpenAI Enters 'Tough Negotiation' With Microsoft, Hopes to Raise Money With IPO
Read more of this story at Slashdot.
'Who Needs Rust's Borrow-Checking Compiler Nanny? C++ Devs Aren't Helpless'
Read more of this story at Slashdot.
Chinese Hackers Exploit SAP NetWeaver RCE Flaw
Read more of this story at Slashdot.
What Happens If AI Coding Keeps Improving?
Read more of this story at Slashdot.
Can an MCP-Powered AI Client Automatically Hack a Web Server?
Read more of this story at Slashdot.
Nintendo Can Render Your Switch 2 'Permanently Unusable' If You Break Their Rules
Read more of this story at Slashdot.
CISA/DOGE Software Engineer's Login Credentials Appeared in Multiple Leaks From Info-Stealing Malware in Recent Years
Read more of this story at Slashdot.
Blizzard's 'Overwatch' Team Just Voted to Unionize
Read more of this story at Slashdot.
Theranos Fraudster's Partner Launches His Own Blood-Testing Startup
Read more of this story at Slashdot.
Life of a Marathon Streamer: Online for Three Years, Facing Isolation and Burnout
Read more of this story at Slashdot.
Developer Tries Resurrecting 47-Year-Old 'Apple Pascal' (and its p-System) in Rust
Read more of this story at Slashdot.