Close Menu
    DevStackTipsDevStackTips
    • Home
    • News & Updates
      1. Tech & Work
      2. View All

      How To Prevent WordPress SQL Injection Attacks

      June 13, 2025

      This week in AI dev tools: Apple’s Foundations Model framework, Mistral’s first reasoning model, and more (June 13, 2025)

      June 13, 2025

      Open Talent platforms emerging to match skilled workers to needs, study finds

      June 13, 2025

      Java never goes out of style: Celebrating 30 years of the language

      June 12, 2025

      OneDrive for Mac will soon give you more flexible storage options

      June 13, 2025

      From The Editor’s Desk — new Windows Central community features, we’d like to hear from you!

      June 13, 2025

      New code strings attached to Xbox Game Pass suggests a price increase may be imminent

      June 13, 2025

      This could be the versatile laptop accessory I’ve been waiting for — Here’s why it stands out from other portable monitors

      June 13, 2025
    • Development
      1. Algorithms & Data Structures
      2. Artificial Intelligence
      3. Back-End Development
      4. Databases
      5. Front-End Development
      6. Libraries & Frameworks
      7. Machine Learning
      8. Security
      9. Software Engineering
      10. Tools & IDEs
      11. Web Design
      12. Web Development
      13. Web Security
      14. Programming Languages
        • PHP
        • JavaScript
      Featured

      Worker Threads in Node.js: A Complete Guide for Multithreading in JavaScript

      June 13, 2025
      Recent

      Worker Threads in Node.js: A Complete Guide for Multithreading in JavaScript

      June 13, 2025

      Everybody’s gone lintin’

      June 13, 2025

      QAQ-QQ-AI-QUEST

      June 13, 2025
    • Operating Systems
      1. Windows
      2. Linux
      3. macOS
      Featured

      OneDrive for Mac will soon give you more flexible storage options

      June 13, 2025
      Recent

      OneDrive for Mac will soon give you more flexible storage options

      June 13, 2025

      From The Editor’s Desk — new Windows Central community features, we’d like to hear from you!

      June 13, 2025

      New code strings attached to Xbox Game Pass suggests a price increase may be imminent

      June 13, 2025
    • Learning Resources
      • Books
      • Cheatsheets
      • Tutorials & Guides
    Home»News & Updates»CodeSOD: Tangled Up in Foo

    CodeSOD: Tangled Up in Foo

    April 24, 2025

    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.

    Source: Read More 

    Facebook Twitter Reddit Email Copy Link
    Previous ArticleLinux Show Player is a cue player designed for stage productions
    Next Article CVE-2025-3761 – My Tickets – WordPress Privilege Escalation Vulnerability

    Related Posts

    News & Updates

    OneDrive for Mac will soon give you more flexible storage options

    June 13, 2025
    News & Updates

    From The Editor’s Desk — new Windows Central community features, we’d like to hear from you!

    June 13, 2025
    Leave A Reply Cancel Reply

    For security, use of Google's reCAPTCHA service is required which is subject to the Google Privacy Policy and Terms of Use.

    Continue Reading

    I would pay a LOT of money for this absolutely incredible AI laptop… But maybe not as much as it actually costs

    I would pay a LOT of money for this absolutely incredible AI laptop… But maybe not as much as it actually costs

    News & Updates
    Adobe Patches 11 Critical ColdFusion Flaws Amid 30 Total Vulnerabilities Discovered

    Adobe Patches 11 Critical ColdFusion Flaws Amid 30 Total Vulnerabilities Discovered

    Development

    How to Master Typography – Tips for Stunning Text Designs

    Web Development

    CVE-2025-4094 – “Acunetix DIGITS WordPress OTP Brute Force Vulnerability”

    Common Vulnerabilities and Exposures (CVEs)

    Highlights

    ASUS Urges Users to Patch AiCloud Router Vuln Immediately

    April 21, 2025

    ASUS Urges Users to Patch AiCloud Router Vuln Immediately

    Source: A_Gree via Alamy Stock PhotoNEWS BRIEFASUS recently disclosed a critical security vulnerability affecting routers that have AiCloud enabled, potentially allowing remote attackers to perform un …
    Read more

    Published Date:
    Apr 21, 2025 (5 hours, 35 minutes ago)

    Vulnerabilities has been mentioned in this article.

    CVE-2025-2492

    CVE-2025-3855 – CodeCanyon RISE Ultimate Project Manager File Inclusion Vulnerability

    April 21, 2025

    CVE-2025-5303 – Freightview, Daylight, Day & Ross WordPress Plugins – Stored Cross-Site Scripting

    June 7, 2025

    How to easily run your favorite local AI models on Linux with this handy app

    April 30, 2025
    © DevStackTips 2025. All rights reserved.
    • Contact
    • Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.