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

      Sunshine And March Vibes (2025 Wallpapers Edition)

      May 16, 2025

      The Case For Minimal WordPress Setups: A Contrarian View On Theme Frameworks

      May 16, 2025

      How To Fix Largest Contentful Paint Issues With Subpart Analysis

      May 16, 2025

      How To Prevent WordPress SQL Injection Attacks

      May 16, 2025

      Microsoft has closed its “Experience Center” store in Sydney, Australia — as it ramps up a continued digital growth campaign

      May 16, 2025

      Bing Search APIs to be “decommissioned completely” as Microsoft urges developers to use its Azure agentic AI alternative

      May 16, 2025

      Microsoft might kill the Surface Laptop Studio as production is quietly halted

      May 16, 2025

      Minecraft licensing robbed us of this controversial NFL schedule release video

      May 16, 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

      The power of generators

      May 16, 2025
      Recent

      The power of generators

      May 16, 2025

      Simplify Factory Associations with Laravel’s UseFactory Attribute

      May 16, 2025

      This Week in Laravel: React Native, PhpStorm Junie, and more

      May 16, 2025
    • Operating Systems
      1. Windows
      2. Linux
      3. macOS
      Featured

      Microsoft has closed its “Experience Center” store in Sydney, Australia — as it ramps up a continued digital growth campaign

      May 16, 2025
      Recent

      Microsoft has closed its “Experience Center” store in Sydney, Australia — as it ramps up a continued digital growth campaign

      May 16, 2025

      Bing Search APIs to be “decommissioned completely” as Microsoft urges developers to use its Azure agentic AI alternative

      May 16, 2025

      Microsoft might kill the Surface Laptop Studio as production is quietly halted

      May 16, 2025
    • Learning Resources
      • Books
      • Cheatsheets
      • Tutorials & Guides
    Home»Development»CodeSOD: Secondary Waits

    CodeSOD: Secondary Waits

    November 14, 2024

    ArSo works at a small company. It’s the kind of place that has one software developer, and ArSo isn’t it. But ArSo is curious about programming, and has enough of a technical background that small tasks should be achievable. After some conversations with management, an arrangement was made: Kurt, their developer, would identify a few tasks that were suitable for a beginner, and would then take some time to mentor ArSo through completing them.

    It sounded great, especially because Kurt was going to provide sample code which would give ArSo a head start on getting things done. What better way to learn than by watching a professional at work?

    DateTime datTmp;
    
    File.Copy(strFileOld, strFileNew);
    // 2 seconds delay
    datTmp = DateTime.Now;
    while (datTmp.Second == DateTime.Now.Second);
    datTmp = DateTime.Now;
    while (datTmp.Second == DateTime.Now.Second);
    File.Delete(strFileOld);
    

    This code copies a file from an old path to a new path, and then deletes the old path after a two second delay. Why is there a delay? I don’t know. Why is the delay written like this? I can’t possibly explain that.

    Check the time at the start of the loop. When the second part of that time stops matching the second part of the current time, we assume one second has passed. This is, of course, inaccurate- if I check the time at 0:00:00.9999 a lot less than a second will pass. This delay is at most one second.

    In any case, ArSo has some serious questions about Kurt’s mentorship, and writes:

    Now I don’t know if I should ask for more coding tasks.

    Honestly, I think you should ask for more. Like, I think you should just take Kurt’s job. You may be a beginner, but honestly, you’re likely going to do a better job than this.

    [Advertisement] Plan Your .NET 9 Migration with Confidence
    Your journey to .NET 9 is more than just one decision.Avoid migration migraines with the advice in this free guide. Download Free Guide Now!

    Source: Read More 

    Facebook Twitter Reddit Email Copy Link
    Previous ArticleMongoDB, Microsoft Team Up to Enhance Copilot in VS Code
    Next Article Recreating the Mac Mini Effect Step-by-Step in Rive

    Related Posts

    Security

    Nmap 7.96 Launches with Lightning-Fast DNS and 612 Scripts

    May 17, 2025
    Common Vulnerabilities and Exposures (CVEs)

    CVE-2025-48187 – RAGFlow Authentication Bypass

    May 17, 2025
    Leave A Reply Cancel Reply

    Continue Reading

    Microsoft wants mobile cases to not only protect the device, but also personalize its settings and features

    Development

    Hackers Exploit WP-Automatic Plugin Vulnerability, Threatening WordPress Site Security

    Development

    CodeSOD: A Secure Item

    News & Updates

    From Simple Data Transfer To Modern Composable Architectures

    Web Development
    GetResponse

    Highlights

    Development

    Meet Otto: A New AI Tool for Interacting and Working with Artificial Intelligence AI Agents – Using Tables

    June 25, 2024

    In today’s fast-paced digital world, efficient interaction and management of tasks using Artificial Intelligence (AI)…

    Your TV’s USB port has superpowers: 4 useful benefits you’re not taking advantage of

    January 25, 2025

    7 Code Editors You Can Use for Vibe Coding on Linux

    April 5, 2025

    Remix + React Router == React Router?

    May 16, 2024
    © DevStackTips 2025. All rights reserved.
    • Contact
    • Privacy Policy

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