Feed aggregator
Meta Plans To Test and Tinker With X's Community Notes Algorithm
Read more of this story at Slashdot.
Mozilla Warns Users To Update Firefox Before Certificate Expires
Read more of this story at Slashdot.
Meta Stops Ex-Director From Promoting Critical Memoir
Read more of this story at Slashdot.
Anthropic CEO Floats Idea of Giving AI a 'Quit Job' Button
Read more of this story at Slashdot.
Citigroup Plans To Slash IT Contractors, Hire Staff To Improve Controls
Read more of this story at Slashdot.
Google's Gemini AI Can Now See Your Search History
Read more of this story at Slashdot.
OpenAI Warns Limiting AI Access To Copyrighted Content Could Give China Advantage
Read more of this story at Slashdot.
German Spy Agency Concluded COVID Virus Likely Leaked From Lab
Read more of this story at Slashdot.
Microsoft: Recent Windows Updates Make USB Printers Print Random Text
Read more of this story at Slashdot.
'Something Is Rotten in the State of Cupertino'
Read more of this story at Slashdot.
Mozilla Warns DOJ's Google Remedies Risk 'Death of Open Web'
Read more of this story at Slashdot.
Man Survives With Titanium Heart For 100 Days - a World First
Read more of this story at Slashdot.
Microsoft's Xbox Copilot Will Act As an AI Gaming Coach
Read more of this story at Slashdot.
Which Movies Do People Love to Hate? A Statistical Analysis
Read more of this story at Slashdot.
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!