Feed aggregator
Researchers Spot Black Hole Eating Stuff At Over 40x the Theoretical Limit
Read more of this story at Slashdot.
CodeSOD: Counting it All
Since it's election day in the US, many people are thinking about counting today. We frequently discuss counting here, and how to do it wrong, so let's look at some code from RK.
This code may not be counting votes, but whatever it's counting, we're not going to enjoy it:
case LogMode.Row_limit: // row limit excel = 65536 rows if (File.Exists(personalFolder + @"\" + fileName + ".CSV")) { using (StreamReader reader = new StreamReader(personalFolder + @"\" + fileName + ".CSV")) { countRows = reader.ReadToEnd().Split(new char[] { '\n' }).Length; } }Now, this code is from a rather old application, originally released in 2007. So the comment about Excel's row limit really puts us in a moment in time- Excel 2007 raised the row limit to 1,000,000 rows. But older versions of Excel did cap out at 65,536. And it wasn't the case that everyone just up and switched to Excel 2007 when it came out- transitioning to the new Office file formats was a conversion which took years.
But we're not even reading an Excel file, we're reading a CSV.
I enjoy that we construct the name twice, because that's useful. But the real magic of this one is how we count the rows. Because while Excel can handle 65,536 rows at this time, I don't think this program is going to do a great job of it- because we read the entire file into memory with ReadToEnd, then Split on newlines, then count the length that way.
As you can imagine, in practice, this performed terribly on large files, of which there were many.
Unfortunately for RK, there's one rule about old, legacy code: don't touch it. So despite fixing this being a rather easy task, nobody is working on fixing it, because nobody wants to be the one who touched it last. Instead, management is promising to launch a greenfield replacement project any day now…
[Advertisement] Keep all your packages and Docker containers in one place, scan for vulnerabilities, and control who can access different feeds. ProGet installs in minutes and has a powerful free version with a lot of great features that you can upgrade when ready.Learn more.Sweden Scraps Plans For 13 Offshore Windfarms Over Russia Security Fears
Read more of this story at Slashdot.
visionOS 2.2 Beta Adds Wide and Ultrawide Modes To Mac Virtual Display
Read more of this story at Slashdot.
Netflix Is Removing Nearly All of Its Interactive Titles
Read more of this story at Slashdot.
Robinhood and Kraken Launch New Global Stablecoin Network With Paxos' USDG
Read more of this story at Slashdot.
Perplexity CEO Offers To Replace Striking NYT Staff With AI
Read more of this story at Slashdot.
Prime Video Will Let You Summon AI To Recap What You're Watching
Read more of this story at Slashdot.
FFmpeg Devs Boast of Up To 94x Performance Boost After Implementing Handwritten AVX-512 Assembly Code
Read more of this story at Slashdot.
Perplexity Will Show Live US Election Results Despite AI Accuracy Warnings
Read more of this story at Slashdot.
Windows 11 Continues To Creep Up Behind Windows 10
Read more of this story at Slashdot.
Singapore To Increase Road Capacity By Tracking All Vehicles With GPS
Read more of this story at Slashdot.
Lawsuit Accuses PowerSchool of Selling Student Data To 3rd Parties
Read more of this story at Slashdot.
Netflix Bullish on Gen AI for Games After Laying Off Human Game Developers
Read more of this story at Slashdot.
Newest Device To Run Doom: Nintendo's Alarm Clock
Read more of this story at Slashdot.
Inside the Massive Crime Industry That's Hacking Billion-Dollar Companies
Read more of this story at Slashdot.
Google, Apple Drive 'Black Box' IP Policing with App Store Rules
Read more of this story at Slashdot.
Apple Approved Another Illegal Streaming App
Read more of this story at Slashdot.
'The Law Must Respond When Science Changes'
Read more of this story at Slashdot.
Governments Stress Links Between Climate and Nature Collapse
Read more of this story at Slashdot.