Computer
Amazon Shuts Down Secret Project To Develop Fertility Tracker
Read more of this story at Slashdot.
Meta To Introduce Ads On Threads In Early 2025
Read more of this story at Slashdot.
OpenAI Nears Launch of AI Agent Tool To Automate Tasks For Users
Read more of this story at Slashdot.
Microsoft Gaming Handheld Device 'Few Years' Away, Says Xbox Chief
Read more of this story at Slashdot.
How Italy Became an Unexpected Spyware Hub
Read more of this story at Slashdot.
AI Systems Solve Just 2% of Advanced Maths Problems in New Benchmark Test
Read more of this story at Slashdot.
Dutch Publisher's AI Translation Plan Sparks Industry Backlash
Read more of this story at Slashdot.
Clues To Windows Intelligence Found in Windows 11 Builds
Read more of this story at Slashdot.
Cheap Fix Floated For Plane Vapor's Climate Damage
Read more of this story at Slashdot.
The Ultimate in Debugging
Read more of this story at Slashdot.
Secret Service Says You Agreed To Be Tracked With Location Data
Read more of this story at Slashdot.
Will We Care About Frameworks in the Future?
Read more of this story at Slashdot.
Apple Defends Mac Mini Power Button Relocation
Read more of this story at Slashdot.
AI Companies Hit Development Hurdles in Race for Advanced Models
Read more of this story at Slashdot.
Canada Passes New Right To Repair Rules With the Same Old Problem
Read more of this story at Slashdot.
New Study On Moons of Uranus Raises Chance of Life
Read more of this story at Slashdot.
Congress To Hold Another UFO/UAP Hearing
Read more of this story at Slashdot.
CodeSOD: The First 10,000
Alicia recently inherited a whole suite of home-grown enterprise applications. Like a lot of these kinds of systems, it needs to do batch processing. She went tracking down a mysterious IllegalStateException only to find this query causing the problem:
select * from data_import where id > 10000The query itself is fine, but the code calling it checks to see if this query returned any rows- if it did, the code throws the IllegalStateException.
First, of course, this should be a COUNT(*) query- no need to actually return rows here. But also… what? Why do we fail if there are any transactions with an ID greater than 10000? Why on Earth would we care?
Well, the next query it runs is this:
update data_import set id=id+10000Oh. Oh no. Oh nooooo. Are they… are they using the ID to also represent some state information about the status of the record? It sure seems like it!
The program then starts INSERTing data, using a counter which starts at 1. Once all the new data is added, the program then does:
delete from data_import where id > 10000All this is done within a single method, with no transactions and no error handling. And yes, this is by design. You see, if anything goes wrong during the inserts, then the old records don't get deleted, so we can see that processing failed and correct it. And since the IDs are sequential and always start at 1, we can easily find which row caused the problem. Who needs logging or any sort of exception handling- just check your IDs.
The underlying reason why this started failing was because the inbound data started trying to add more than 10,000 rows, which meant the INSERTs started failing (since we already had rows there for this). Alicia wanted to fix this and clean up the process, but too many things depended on it working in this broken fashion. Instead, her boss implemented a quick and easy fix: they changed "10000" to "100000".
[Advertisement] Picking up NuGet is easy. Getting good at it takes time. Download our guide to learn the best practice of NuGet for the Enterprise.Discord Leaker Sentenced To 15 Years In Prison
Read more of this story at Slashdot.
New Thermal Material Provides 72% Better Cooling Than Conventional Paste
Read more of this story at Slashdot.