Computer
UK Investigation Says Apple, Google Hampering Mobile Browser Competition
Read more of this story at Slashdot.
Keep Kids Off Roblox If You're Worried, Its CEO Tells Parents
Read more of this story at Slashdot.
Anthropic CEO Says Spies Are After $100 Million AI Secrets In a 'Few Lines of Code'
Read more of this story at Slashdot.
Legacy 32-bit PhysX Removal Cripples Performance On New GPUs
Read more of this story at Slashdot.
Supercomputer Draws Molecular Blueprint For Repairing Damaged DNA
Read more of this story at Slashdot.
CodeSOD: Don't Date Me
I remember in some intro-level compsci class learning that credit card numbers were checksummed, and writing basic functions to validate those checksums as an exercize. I was young and was still using my "starter" credit card with a whopping limit of $500, so that was all news to me.
Alex's company had a problem processing credit cards: they rejected a lot of credit cards as being invalid. The checksum code seemed to be working fine, so what could the problem be? Well, the problem became more obvious when someone's card worked one day, and stopped working the very next day, and they just so happened to be the first and last day of the month.
protected function validateExpirationCcDate($i_year, $i_month) { return (((int)strftime('%y') <= $i_year) && ((int)strftime ('%m') <= $i_month))? true : false; }This function is horrible; because it uses strftime (instead of taking the comparison date and time as a parameter) it's not unit-testable. We're (ab)using casts to convert strings into integers so we can do our comparison. We're using a ternary to return a boolean value instead of just returning the result of the boolean expression.
But of course, that's all the amuse bouche: the main course is the complete misunderstanding of basic logic. A credit card is valid if the expiration year is less than or equal to the current year and the month is less than or equal to the current month. As this article goes live in March, 2025, this code would allow credit cards from April, 2026, as it should. But it would reject any cards with an expiration of February, 2028.
Per Alex, "This is a credit card date validation that has been in use for ages."
[Advertisement] Utilize BuildMaster to release your software with confidence, at the pace your business demands. Download today!Large Study Shows Drinking Alcohol Is Good For Your Cholesterol Levels
Read more of this story at Slashdot.
Netflix Used AI To Upscale 'A Different World' and It's a Melted Nightmare
Read more of this story at Slashdot.
Google Claims Gemma 3 Reaches 98% of DeepSeek's Accuracy Using Only One GPU
Read more of this story at Slashdot.
Saudi Investment Fund Pays $3.5 Billion To Capture Pokemon Go
Read more of this story at Slashdot.
Sonos Cancels Its Streaming Video Player
Read more of this story at Slashdot.
Mark Klein, AT&T Whistleblower Who Revealed NSA Mass Spying, Has Died
Read more of this story at Slashdot.
Apple Set To Unveil Boldest Software Redesign In Years Across Entire Ecosystem
Read more of this story at Slashdot.
Intel Appoints Lip-Bu Tan As CEO
Read more of this story at Slashdot.
Google's New Robot AI Can Fold Delicate Origami, Close Zipper Bags
Read more of this story at Slashdot.
The Curious Surge of Productivity in US Restaurants
Read more of this story at Slashdot.
D-Wave Claims 'Quantum Supremacy,' Beating Traditional Computers
Read more of this story at Slashdot.
Rules for Portable Batteries on Planes Are Changing.
Read more of this story at Slashdot.
Global Smartwatch Sales Fall For First Time
Read more of this story at Slashdot.
FTC Asks To Delay Amazon Prime Deceptive Practices Case, Citing Staffing Shortfalls
Read more of this story at Slashdot.