Feed aggregator
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.
Spotify's Car Thing, Due For Bricking, Is Getting an Open Source Second Life
Read more of this story at Slashdot.
VMware Makes Workstation and Fusion Free For Everyone
Read more of this story at Slashdot.
Microsoft Edge Is Trying To Forcefully Get Your Chrome Tabs Again
Read more of this story at Slashdot.
23andMe To Lay Off 40% of Its Workforce, Discontinue All Therapy Programs
Read more of this story at Slashdot.
Open Source Project DeFlock Is Mapping License Plate Surveillance Cameras All Over the World
Read more of this story at Slashdot.
Bitcoin Pushes Past $90,000
Read more of this story at Slashdot.
Red Hat is Acquiring AI Optimization Startup Neural Magic
Read more of this story at Slashdot.
The US Has a Cloned Sheep Contraband Problem
Read more of this story at Slashdot.
Growth of AI Adoption Slows Among US Workers, Study Says
Read more of this story at Slashdot.
Microsoft is Killing off Windows 11's Mail and Calendar Apps By the End of the Year
Read more of this story at Slashdot.
Power Shortage To Hit 40% of AI Data Centres by 2027, Gartner Warns
Read more of this story at Slashdot.