Skip to main content

Posts

I also write on dev.to → — shorter articles for hackathons and coding challenges.

2021

WSL 2 on Windows Part 1 - Installation and Activation

·411 words·2 mins
I’m used to using Linux or Mac terminals for work. I took some time to set up the WSL environment on my home PC to easily switch work environments. Differences between WSL 2 and WSL 1 # WSL 2 is based on Hyper-V and runs a full Linux kernel in a virtual machine. WSL 1 is a simulation of Linux functionalities on the Windows system. Therefore, WSL 2 supports more native Linux features and system calls than WSL 1.

2020

Deep Copy and Shallow Copy

·141 words·1 min
Shallow Copy # Copies as little as possible. A new structure created by a shallow copy has the same structure as the old one, and they share the memory address of elements. For example, in Java: int[] arr1 = {1, 2, 3}; int[] arr2 = arr1; arr2 is a shallow copy of arr1. If one of the structures modifies an element, the other will also be affected. Deep Copy # Copies everything. A new structure created by a deep copy not only has the same structure as the old one, but also copies all elements of the old structure to the new memory address.

C++ Container Characteristics and Usage Scenarios - array, vector, deque, list, forward_list

·1306 words·7 mins
Introduction # C++ provides various containers to store and manage data, each with its unique characteristics and applicable scenarios. This article will delve into five common sequence containers: array, vector, deque, list, and forward_list, comparing their features, performance, and offering selection advice. Array # std::array is a fixed-size array introduced in C++11, combining the performance of C-style arrays with the interface of STL containers.

Docker Operations Log (Part 2)

·348 words·2 mins
Continuing from Docker Operations Log (Part 1) Basic Docker Usage # Deleting a Container # Remember to stop the container using stop before deleting it. docker rm CONTAINER_NAME Or docker rm CONTAINER_ID After deletion, you can use docker ps -a to confirm if the container has disappeared.

HA Cluster Notes and Application Design

·430 words·3 mins
When designing systems with higher traffic, you will eventually encounter cluster-related issues. Cluster # A collection of one or more machines (nodes) with three different purposes: Load Balancing # Allows multiple machines to share tasks as evenly as possible, accelerating application execution. High Availability (HA) # For high availability and redundancy, if one machine suddenly fails, others can take over.

Common DNS Resource Records

·173 words·1 min
Each DNS zone in a DNS server has a zone file. A DNS zone is usually a single domain (though not always). A zone file is composed of many DNS resource records (RRs). There are many different types of RRs. Let’s record some common ones. A record # Maps a hostname to an IPv4 address. (32-bit) hostname IN A xxx.xxx.xxx.xxx