Feed aggregator
Hackers Can Now Bypass Linux Security Thanks To Terrifying New Curing Rootkit
Read more of this story at Slashdot.
Scientists Say They Can Calculate the Cost of Oil Giants' Role In Global Warming
Read more of this story at Slashdot.
Hubble Celebrates 35th Year In Orbit
Read more of this story at Slashdot.
Quantum Messages Travel 254 km Using Existing Infrastructure For the First Time
Read more of this story at Slashdot.
CodeSOD: Tangled Up in Foo
DZ's tech lead is a doctor of computer science, and that doctor loves to write code. But you already know that "PhD" stands for "Piled high and deep", and that's true of the tech lead's clue.
For example, in C#:
private List<Foo> ExtractListForId(string id) { List<Foo> list = new List<Foo>(); lock (this) { var items = _foos.Where(f => f.Id == id).ToList(); foreach (var item in items) { list.Add(item); } } return list; }The purpose of this function is to find all the elements in a list where they have a matching ID. That's accomplished in one line: _foo.Where(f => f.Id == id). For some reason, the function goes through the extra step of iterating across the returned list and constructing a new one. There's no real good reason for this, though it does force LINQ to be eager- by default, the Where expression won't be evaluated until you check the results.
The lock is in there for thread safety, which hey- the enumerator returned by Where is not threadsafe, so that's not a useless thing to do there. But it's that lock which hints at the deeper WTF here: our PhD-having-tech-lead knows that adding threads ensures you're using more of the CPU, and they've thrown threads all over the place without any real sense to it. There's no clear data ownership of any given thread, which means everything is locked to hell and back, the whole thing frequently deadlocks, and it's impossible to debug.
It's taken days for DZ to get this much of a picture of what's going on in the code, and further untangling of this multithreaded pile of spaghetti is going to take many, many more days- and much, much more of DZ's sanity.
[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.Stroke Patients Have High Levels of Microplastics Clogging Their Arteries, Researchers Find
Read more of this story at Slashdot.
Google Forcing Some Remote Workers To Come Back 3 Days a Week or Lose Their Jobs
Read more of this story at Slashdot.
New Jersey Sues Property Management Software Firm RealPage, Says Collusion With Landlords Drives Up Rents
Read more of this story at Slashdot.
Draft Executive Order Outlines Plan To Integrate AI Into K-12 Schools
Read more of this story at Slashdot.
Google Gemini Has 350 Million Monthly Users, Reveals Court Hearing
Read more of this story at Slashdot.
WhatsApp Blocks People From Exporting Your Entire Chat History
Read more of this story at Slashdot.
D&D Updates Core Rules, Sticks With CC License
Read more of this story at Slashdot.
Discord's CEO and Co-Founder Is Stepping Down
Read more of this story at Slashdot.
Meta Rolls Out Live Translations To All Ray-Ban Smart Glasses Users
Read more of this story at Slashdot.
AI Secretly Helped Write California Bar Exam, Sparking Uproar
Read more of this story at Slashdot.
OpenAI Forecasts Revenue Topping $125 Billion in 2029 as Agents, New Products Gain
Read more of this story at Slashdot.
Nintendo Seeks Discord User's Identity Following Major Pokemon Leak
Read more of this story at Slashdot.
Apple, Meta Fined as EU Presses Ahead With Tech Probes
Read more of this story at Slashdot.
More Than 80% of the World's Reefs Hit By Bleaching After Worst Global Event On Record
Read more of this story at Slashdot.
Amazon's Starlink Rival Struggles To Ramp Up Satellite Production
Read more of this story at Slashdot.