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: Delectable Code

    CodeSOD: Delectable Code

    May 20, 2024

    Good method names are one of the primary ways to write self-documenting code. The challenge there, is that documentation often becomes out of date.

    Take this delectable PHP nugget, from Nathaniel P, who has previously been tortured by bad date handling.

    function deleteTenDays()
    {
    //This delects everything from the table minus 3 days
    $thedel = $this->db->query(‘Delete FROM ClientReportsRelationship where DateEntered <= (CURRENT_DATE – Interval 31 DAY) ‘);
    //$thedel2 = $this->db->query(‘Delete FROM ClientReportsRelationship where CustomerId = 33 ‘);
    }

    The function is called deleteTenDays. The comment tells us that it “delects everything” from the table “minus 3 days”. The actual delete query deletes everything older than a month. For bonus points, there’s a commented out query which just deletes everything from a single customer.

    Honestly, this function needs to be delected.

    [Advertisement]
    ProGet’s got you covered with security and access controls on your NuGet feeds. Learn more.

    Source: Read More 

    Facebook Twitter Reddit Email Copy Link
    Previous ArticleLWiAI Podcast #167 – GPT-4o, Project Astra, Veo, OpenAI Departures, Interview with Andrey
    Next Article Feature-rich Photo Editing Component For React Native

    Related Posts

    Security

    Nmap 7.96 Launches with Lightning-Fast DNS and 612 Scripts

    May 17, 2025
    Common Vulnerabilities and Exposures (CVEs)

    CVE-2024-47893 – VMware GPU Firmware Memory Disclosure

    May 17, 2025
    Leave A Reply Cancel Reply

    Continue Reading

    UX/UI Roundup 2025: The Best Design So Far

    Web Development

    This month in security with Tony Anscombe – April 2025 edition

    Development

    Threat Actors Exploited Bitbucket Artifacts to Expose AWS Secrets in Plaintext

    Development
    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

    Highlights

    Skype Will Shut Down on May 5, As Microsoft Shifts to Teams

    February 28, 2025

    Microsoft is pivoting to support Teams instead. Microsoft 365 head Jeff Teper encouraged Skype users…

    TP-Link Gaming Router Vulnerability Exposes Users to Remote Code Attacks

    May 28, 2024

    DeepSeek’s new open-source AI model can outperform o1 for a fraction of the cost

    January 21, 2025

    North Korean Hackers Exploit PowerShell Trick to Hijack Devices in New Cyberattack

    February 12, 2025
    © DevStackTips 2025. All rights reserved.
    • Contact
    • Privacy Policy

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