devdong

Welcome to devdong — a cozy corner where developers share stories over a cup of coffee. ☕💻

Don't Use MongoDB: Actually, It's Fine
There was a time when "Don't use MongoDB" was a popular saying in the developer community. Developers avoided MongoDB due to its lack of schema enforcement and limited transaction support. But as of 2024, those concerns are mostly a thing of the past.
Everything About TypeScript Type Casting: The Ultimate Mastery Guide
While using TypeScript, there are times when the compiler cannot infer the correct type, or when developers have more precise knowledge about a type. Recently, David Heinemeier Hansson (DHH) reignited the debate over "Do we really need TypeScript?" by removing it from the hotwired/turbo project. Nevertheless, the reliability provided by TypeScript's static type system remains attractive, especially for large-scale projects.
Let’s Explore the New DOM API: setHTML
When developing for the web, you often need to insert HTML dynamically. The most common method is innerHTML, but it comes with a significant drawback—it is vulnerable to Cross-Site Scripting (XSS) attacks. To counter this, many developers have relied on external libraries like DOMPurify to safely insert HTML. Now, there's a promising new way to safely insert HTML, natively supported by web standards. This is thanks to the introduction of the new DOM API, setHTML(). In this post, we’ll dive into what setHTML() is, why it’s needed, and how to use it.
ECS vs EKS: A Guide to Choosing AWS Container Services
Deploying and managing containerized applications in a cloud environment is a core aspect of modern software development. Are you trying to decide between ECS and EKS, the two main container orchestration services offered by AWS? Each service has its own strengths and features, and the best choice depends on factors such as project size, team expertise, and long-term goals. In this article, we clearly analyze the key differences between the two services and provide specific guidance on when to choose each one in practical scenarios.
LoRA and QLoRA: Revolutionizing AI Model Fine-Tuning
Fine-tuning large language models (LLMs) for specific tasks is like tuning an F1 race car for a particular track. It requires precise adjustments to extract maximum performance, but this process can consume massive resources and time. Traditional full parameter fine-tuning methods are costly since they involve updating all parameters of the model, and they can sometimes cause a problem known as "catastrophic forgetting." But don’t worry! There’s a more efficient solution: Parameter-Efficient Fine-Tuning (PEFT). This post delves into LoRA, a prominent PEFT method, and its more advanced variant, QLoRA. You'll gain a clear understanding of how these two techniques are transforming the fine-tuning paradigm for LLMs and which scenarios each is best suited for.
The Complete Guide to JavaScript Type Conversion
When working with JavaScript, you'll encounter situations where "5" + 1 becomes "51", while "5" - 1 becomes 4. This may be confusing at first, but it's due to JavaScript's type conversion mechanism. Type conversion refers to the process of converting one data type into another. Since JavaScript is a dynamically typed language, data types are determined and converted automatically at runtime, even without explicit type declarations by the developer. This feature can be convenient, but it can also lead to unexpected bugs. This guide covers everything you need to know about type conversion in JavaScript, from the differences between explicit and implicit conversion to object conversion and common pitfalls to avoid in real-world applications. By understanding how type conversion works, you'll be able to write safer and more predictable code.
TypeScript: Is It Really Being Phased Out?
Though it’s a slightly older story, a heated debate has been taking place in the developer community. Sparked by David Heinemeier Hansson (DHH), the creator of Ruby on Rails, removing TypeScript from the hotwired/turbo project, the controversy has led to a fundamental question: "Do we really need TypeScript?" Since its release by Microsoft in 2012, TypeScript has become known as a tool that adds static types to JavaScript, enhancing maintainability in large-scale projects. However, after DHH’s decision, other projects like Svelte also began reconsidering TypeScript usage, leaving many developers feeling confused. In this post, we’ll explore the pros and cons of TypeScript and provide criteria to help you determine whether it’s the right fit for your project.
Creating a JavaScript Calculator Without `eval()`
When writing JavaScript code, there are times when you need to execute code dynamically. In such cases, many developers often think of the eval() function. eval() provides a convenient feature that interprets a string as code and executes it. However, behind this convenience lie serious security risks and performance degradation. In this article, we’ll explore why using eval() is dangerous and take a detailed look at how to use the safer and more efficient alternative, new Function(), to execute dynamic code. Through this post, you'll gain the ability to write safer and more robust code.
Alternatives to JavaScript eval()

Alternatives to JavaScript eval()

dong1 min read
Learn why JavaScript's eval() is dangerous and how to safely replace it with new Function() using practical examples. Tips to enhance both security and performance! When working with JavaScript, you may encounter situations where you need to execute code from a string. The first thing that often comes to mind is the eval() function. However, eval() is notorious for its security vulnerabilities and performance issues. In this article, we’ll explore the dangers of eval() and how you can use the safer alternative new Function() with real-world examples.
Complete Guide to Checking Checkbox Status in JavaScript
Let’s explore how to check the status of a checkbox using JavaScript and jQuery. This includes explanations and examples of using the checked property, event listeners, prop(), and is(). User interaction is a key element in web development. Checkboxes are simple yet essential UI elements that allow users to provide consent, or choose one or multiple options. Features like “I agree to the terms and conditions” or “Auto-login” are typically implemented with checkboxes. Knowing how to check whether a checkbox is selected—or its “state”—is a must-have skill to handle user input and run corresponding logic. In this post, we’ll clearly and simply walk through multiple ways to check checkbox status using JavaScript and jQuery. By the end, you'll be able to confidently handle checkbox states in any situation.
Complete Guide to the Access-Control-Allow-Origin Header
Understand and resolve the root of CORS errors—the Access-Control-Allow-Origin header. This guide covers syntax, security considerations, and setup examples for Nginx and Node.js. If you're developing for the web, you've probably encountered the dreaded CORS error in your console at least once. This error usually arises when requesting resources from a different origin, and the key to resolving it lies in the Access-Control-Allow-Origin header. In this article, we’ll take a detailed look at what the Access-Control-Allow-Origin header is—central to Cross-Origin Resource Sharing (CORS)—how it works, and how to configure it in real-world server environments. Read on and you’ll be confident in tackling CORS errors head-on!
Apache AH00072 Error – Complete Solution Guide
When managing servers, it's common to encounter unexpected error messages. For developers and system administrators using the Apache web server, the error message AH00072: make_sock: could not bind to address is one that’s likely to appear at some point. This error is one of the main reasons Apache fails to start, directly leading to website downtime. But don’t worry! This error is usually easy to resolve with a few simple checks and actions. In this post, we’ll go step by step through why the AH00072 error occurs and how to fix it. After reading, you’ll be able to stay calm and resolve the issue quickly the next time it happens.