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

      UX Job Interview Helpers

      August 5, 2025

      .NET Aspire’s CLI reaches general availability in 9.4 release

      August 5, 2025

      15 Essential Skills to Look for When Hiring Node.js Developers for Enterprise Projects (2025-2026)

      August 4, 2025

      African training program creates developers with cloud-native skills

      August 4, 2025

      Why I’ll keep the Samsung Z Fold 7 over the Pixel 10 Pro Fold – especially if these rumors are true

      August 5, 2025

      You may soon get Starlink internet for a much lower ‘Community’ price – here’s how

      August 5, 2025

      uBlock Origin Lite has finally arrived for Safari – with one important caveat

      August 5, 2025

      Perplexity says Cloudflare’s accusations of ‘stealth’ AI scraping are based on embarrassing errors

      August 5, 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

      Send Notifications in Laravel with Firebase Cloud Messaging and Notifire

      August 5, 2025
      Recent

      Send Notifications in Laravel with Firebase Cloud Messaging and Notifire

      August 5, 2025

      Simplified Batch Job Creation with Laravel’s Enhanced Artisan Command

      August 5, 2025

      Send Notifications in Laravel with Firebase Cloud Messaging and Notifire

      August 5, 2025
    • Operating Systems
      1. Windows
      2. Linux
      3. macOS
      Featured

      This comfy mesh office chair I’ve been testing costs less than $400 — but there’s a worthy alternative that’s far more affordable

      August 5, 2025
      Recent

      This comfy mesh office chair I’ve been testing costs less than $400 — but there’s a worthy alternative that’s far more affordable

      August 5, 2025

      How to get started with Markdown in the Notepad app for Windows 11

      August 5, 2025

      Microsoft Account Lockout: LibreOffice Developer’s Week-Long Nightmare Raises Concerns

      August 5, 2025
    • Learning Resources
      • Books
      • Cheatsheets
      • Tutorials & Guides
    Home»News & Updates»CodeSOD: Objectifying Yourself

    CodeSOD: Objectifying Yourself

    April 28, 2025

    “Boy, stringly typed data is hard to work with. I wish there were some easier way to work with it!”

    This, presumably, is what Gary‘s predecessor said. Followed by, “Wait, I have an idea!”

    public static Object createValue(String string) {
    	Object value = parseBoolean(string);
    	if (value != null) {
    		return value;
    	}
    
    	value = parseInteger(string);
    	if (value != null) {
    		return value;
    	}
    
    	value = parseDouble(string);
    	if (value != null) {
    		return value;
    	}
    
    	return string;
    }
    

    This takes a string, and then tries to parse it, first into a boolean, failing that into an integer, and failing that into a double. Otherwise, it returns the original string.

    And it returns an object, which means you still get to guess what’s in there even after this. You just get to guess what it returned, and hope you cast it to the correct type. Which means this almost certainly is called like this:

    boolean myBoolField = (Boolean)createValue(someStringContainingABool);
    

    Which makes the whole thing useless, which is fun.

    Gary found this code in a “long since abandoned” project, and I can’t imagine why it ended up getting abandoned.

    [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.

    Source: Read More 

    Facebook Twitter Reddit Email Copy Link
    Previous ArticleDual Booting CachyOS and Windows
    Next Article CVE-2025-4006 – Youyiio BeyongCms Unrestricted File Upload Vulnerability

    Related Posts

    News & Updates

    Why I’ll keep the Samsung Z Fold 7 over the Pixel 10 Pro Fold – especially if these rumors are true

    August 5, 2025
    News & Updates

    You may soon get Starlink internet for a much lower ‘Community’ price – here’s how

    August 5, 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

    Ubuntu 24.04 LTS Adds Power Warnings for EU Compliance

    Linux

    CVE-2025-52989 – Juniper Networks Junos OS and Junos OS Evolved Delimiter Injection Vulnerability

    Common Vulnerabilities and Exposures (CVEs)

    BrosTrend AX1800 USB WiFi 6 Adapter AX4L Linux Compatible

    Linux

    10-Year-Old Roundcube RCE Vulnerability Let Attackers Execute Malicious Code

    Security

    Highlights

    CVE-2025-41687 – Cisco u-link Management API Stack Buffer Overflow Vulnerability

    July 23, 2025

    CVE ID : CVE-2025-41687

    Published : July 23, 2025, 9:15 a.m. | 15 hours, 14 minutes ago

    Description : An unauthenticated remote attacker may use a stack based buffer overflow in the u-link Management API to gain full access on the affected devices.

    Severity: 9.8 | CRITICAL

    Visit the link for more details, such as CVSS details, affected products, timeline, and more…

    How to Refactor Complex Codebases – A Practical Guide for Devs

    May 21, 2025

    RM Fiber Optic SC LC ST Connectors Price in India – Best Deals and Competitive Pricing

    May 9, 2025

    Researchers from Tsinghua and ModelBest Release Ultra-FineWeb: A Trillion-Token Dataset Enhancing LLM Accuracy Across Benchmarks

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

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