Running Python Programs: A Comprehensive Guide

Learning how to run programs written in Python is an essential skill for any developer. In this guide, we will explore the different ways you can execute Python programs, including interactive prompts and running Python code from files. Running Python Programs Using Interactive Prompts One way to run Python programs is by using interactive prompts. By opening your terminal and typing python, you can access the Python REPL (Read-Evaluate-Print-Loop). This interactive environment allows you to write and execute Python code immediately....

Same POST API call in different JavaScript libraries

When testing APIs, it’s common to use tools like Insomnia to perform HTTP requests to REST API or GraphQL API services. In this blog, I want to showcase the same API call implemented in different JavaScript libraries. API Call Description Let’s consider an example API call - a POST request to the api.randomservice.com website’s /dog endpoint. The request body includes an object with two properties: name and age, encoded as JSON....

Sanitizing input in Express using express-validator

In the world of running a public-facing server, it’s crucial to never trust the input you receive. Even though you may have implemented client-side code to sanitize and block any weird input, there are still ways for people to manipulate and exploit your server. That’s why it’s important to sanitize your input. Luckily, the express-validator package that you already use for input validation can also be used for sanitization. Let’s say you have a POST endpoint that accepts parameters like name, email, and age:...

Scaling HTML Elements with CSS: A Guide on Resizing

In web design, there may be instances where you find the need to adjust the size of an element to achieve the desired layout. Fortunately, CSS offers a convenient property called “zoom” that allows you to scale HTML elements effortlessly. To make an element smaller, you can assign a value less than 1 to the zoom property. For example, if you want to reduce an element to half its original size, you can set the zoom value to 0....

Scope of Variables in C

Learn about variable scoping in C and how it impacts the availability of variables within a program. When you declare a variable in a C program, the scope of the variable is determined by where it is declared. This means that the variable will be accessible in certain parts of the program, but not in others. There are two types of variables based on their scope: global variables and local variables....

Scraping with Puppeteer: A Practical Example

If you’re looking to scrape websites for data, Puppeteer is a powerful tool to consider. In this blog post, we’ll walk you through the process of creating a JavaScript job board that aggregates remote jobs for JavaScript developers using Puppeteer. Steps to Complete the Project To complete this project, you’ll need to follow these steps: Create a Node.js scraper using Puppeteer to fetch jobs from the remoteok.io website. Store the jobs into a database....

Search and Replace in VS Code Using Regular Expressions

I recently encountered a situation where I needed to make a significant change in my website’s repository. Within my markdown files, I had included images with spaces in their filenames. However, due to an update in Hugo, the markdown library I was using (Blackfriday) was no longer supported, and only Goldmark, which does not allow spaces in image filenames, was supported. To update my website and stay current with Hugo, I needed to update all the image links....

Semantic Versioning with npm: A Guide for Developers

Semantic Versioning is a widely adopted convention for version numbering in Node.js packages. This convention is essential as it provides meaning to versions and enables compatibility among different packages. In this blog post, we will explore the concept of Semantic Versioning and how it is implemented using npm. Understanding Semantic Versioning Semantic Versioning format consists of three digits: x.y.z, where each digit represents a specific aspect of a version. The first digit (x) indicates the major version....

Semicolons in JavaScript: Should I Use Them or Not?

JavaScript semicolons are not required but have been a topic of debate among developers. While some prefer using semicolons in their code, others choose to avoid them. Personally, I used to rely on semicolons for years until the fall of 2017, when I decided to experiment with omitting them. I configured Prettier, an automated code formatter, to remove semicolons from my code unless they were necessary for specific language constructs....

Semicolons in Swift

This tutorial is part of the Swift series. In Swift, semicolons are optional. You can write statements on separate lines without needing to add a semicolon: let list = ["a", "b", "c"] var a = 2 Adding a semicolon in this case does not change anything: let list = ["a", "b", "c"]; var a = 2; However, if you want to write multiple statements on the same line, you must include a semicolon:...