https://github.com/ahmadtheswe.png

How Web Browser Works

This article covers the basic concepts of how a web browser works from a high level perspective. We will talk about how the browser requests a web page until it is displayed on the screen.

This article is intended for those who are new to web development and want to understand how web browsers work.

Why this knowledge is important?

  • It helps you understand how web browsers work, which can help you debug issues in your web application.
  • It helps you understand how web browsers render web pages, which can help you optimize your web application for better performance.
  • It helps you understand how web browsers handle security, which can help you secure your web application.
  • It helps you understand how web browsers handle user input, which can help you create better user experiences.
  • Sometimes, interviewers ask this question to test your knowledge of web development. (Yes, I was asked this question in an interview once.)

How Web Browser Works

The over-simplified flow of how a web browser works is like this:

From Java OOP to Golang

As a Java developer, moving to Go can be a bit challenging, especially when it comes to understanding how Go handles object-oriented programming (OOP) concepts. In this article, I will represent some common OOP concepts in Java and how they can be implemented in Go. This will help you transition from Java to Go more smoothly (hopefully, lol).

How To Make Go Classes in Go? (Compared to Java)

Let’s say we have a class in Java like this:

Generate UUID in PostgreSQL

UUID is an important data type that we can utilize in relational database (RDS). There are two common ways to generate UUIDs in PostgreSQL: using the uuid-ossp extension or the pgcrypto extension. In this article, we will discuss how to generate UUIDs using both pgcrypto.

To use this function, make sure that the pgcrypto extension is enabled in your database. You can do this by running this command:

CREATE EXTENSION IF NOT EXISTS "pgcrypto";

Let’s say, you have a table named candidate with a UUID column named id. You can create the table like this:

How to Export & Import Docker Image

We can always pull docker images from docker registry. But, sometimes we need to share our images manually. In this post, I will share you how to import and export docker images.

Export Docker Image

Let say we have these two docker images in my local docker

$ docker images
REPOSITORY    TAG       IMAGE ID       CREATED         SIZE
mysql         5.7       547b3c3c15a9   4 weeks ago     501MB
postgres      12        d480c196f9b0   3 months ago    405MB

We want to export postgres docker image. To do that, we can do that using docker export command like this :

Move Your WSL2 to Another Drive

Windows Subsystem Linux (WSL) is one of the most useful modern tools for software development, in my opinion. Since Windows offered this feature, we don’t need to use fully virtualized Linux (using VMWare or VirtualBox) but can just use WSL that fully integrated with our Windows machine.

The downside of WSL is we can’t choose the directory to install it. I will installed by default in our system drive (C drive). This maybe not a problem if we allocate huge amount of storage for our C drive. But, the case is we commonly not allocate much storage for our system drive because we thought we will only use this drive to install essential things.

Configure GitHub Actions Unit Test for Java Project (Plus code coverage with Jacoco)

In this short article, we will talk about how to set up GitHub Actions for Java projects (such as Spring Boot projects). We also integrate Jacoco to produce code coverage information.

Configure Jacoco

We must set up Jacoco in our build.gradle file. The script is like this :

plugins {
    /* Other plugins */
    id 'jacoco'
}

/* Other configurations and dependencies */

test {
    testLogging {
        events "passed", "failed", "skipped"
    }
    finalizedBy jacocoTestReport
}

jacoco {
    toolVersion = "0.8.9"
}

jacocoTestReport {
    dependsOn test // tests are required to run before generating the report
    reports {
        xml.required = false
        csv.required = true
        html.outputLocation = layout.buildDirectory.dir('jacocoHtml')
    }
}

Here are some explanations :