Building a Simple Node.js Hello World Docker Container from Scratch

In this blog post, we will walk through the process of creating a simple Node.js Hello World Docker container. We will start with a basic Node.js Dockerfile and then build an image from it. First, let’s take a look at the Dockerfile: FROM node:14 WORKDIR /usr/src/app COPY package\*.json app.js ./ RUN npm install EXPOSE 3000 CMD ["node", "app.js"] Note: Make sure to use double quotes in the CMD line. Using single quotes will result in an error....

Building an HTTP Server with Node.js

In this article, we will walk you through the process of building an HTTP server using Node.js. This HTTP server will serve as a basic “Hello World” application using the Node.js introductory code. const http = require('http') const hostname = 'localhost' const port = 3000 const server = http.createServer((req, res) => { res.statusCode = 200 res.setHeader('Content-Type', 'text/plain') res.end('Hello World\n') }) server.listen(port, hostname, () => { console.log(`Server running at http://${hostname}:${port}/`) }) Now, let’s analyze the code step by step....

Building an iPad Dashboard with JavaScript

In this blog post, I will walk you through the process of building a signups counter for the JavaScript Course using JavaScript. This counter allows me to keep track of how many people have signed up for the course, which is open from Nov 15 to Nov 22. Although this counter may seem unnecessary, I often find myself working on such projects when I want to procrastinate and avoid important tasks....

Building an SEO Friendly Command Line App with Go: lolcat

Do you enjoy working with Command Line Interface (CLI) applications? If so, then you’re going to love this tutorial on building a CLI app with Go called lolcat. While searching for some terminal applications for inspiration, I stumbled upon lolcat. The original version can be found at https://github.com/busyloop/lolcat, but there are already several Go implementations available. Here are some examples: glolcat latotty lalyos gogololcat Now, you might be thinking, why would anyone want to build something so useless?...

Building an SEO Friendly System for Your Blog

As a developer, I understand the power of systems. They provide structure, consistency, and help us stay on track. When it comes to blogging, having a system in place can simplify the process and make it more efficient. In this blog post, I’ll walk you through the system I use for my own blog. While it may not be a one-size-fits-all solution, it serves as a great starting point that you can customize to create your own perfect system....

Building Composable Layouts in Astro - Simplify Your Website Structure

When working on a website, it’s important to have the ability to divide layouts into separate files. This not only improves organization but also helps avoid the hassle of duplication and makes global changes easier. Traditionally, creating a landing page or another page with a similar structure would involve duplicating code and making individual changes. However, static site builders like Astro offer a solution to this problem. In Astro, layout composition is based on components....

C Conditionals: An Introduction to if/else and switch

Introduction Conditional statements are fundamental in programming languages as they allow programmers to make choices based on the state of the data. In C, there are two primary ways to perform conditional statements: the if statement, accompanied by the else helper, and the switch statement. if Statement The if statement allows you to check a condition and execute a block of code enclosed in curly brackets if the condition is true....

C Constants: An Introduction

In my previous blog post, I discussed variables in C. This time, I want to dive into the concept of constants in C. Constants in C are similar to variables, but they have a fixed value that cannot be changed during the program’s execution. To declare a constant, you use the const keyword followed by the data type and the value it holds. Here’s an example: const int age = 37; While it’s valid to declare constants using lowercase letters, it is a convention to use uppercase letters....

C Conversion Specifiers and Modifiers: A Handy Reference

In this blog post, we will provide a helpful reference for all the C conversion specifiers commonly used with functions like printf(), scanf(), and other I/O functions. Specifier Meaning %d / %i Signed decimal integer %u Unsigned decimal integer %c Unsigned char %s String %p Pointer in hexadecimal form %o Unsigned octal integer %x / %X Unsigned hexadecimal number %e Floating point number in exponential format in e notation %E Floating point number in exponential format in E notation %f double number in decimal format %g / %G double number in decimal format or exponential format, depending on the value In addition to these specifiers, we have a set of modifiers....

C Global Variables: Understanding the Difference

In the previous blog post on C variables and types, we explored the basics of working with variables. Now, let’s dive deeper into the world of variables and understand the distinction between global and local variables. A local variable is defined inside a function and is accessible only within that function. For example: #include <stdio.h> int main(void) { char j = 0; j += 10; printf("%u", j); // Output: 10 } In this case, variable j is confined within the main function and cannot be accessed outside of it....