Categories

127 pages

Computer

Visual Studio Compilation Character Set [Converted]

C++ cross-platform development. Commonly encountered on Chinese operating systems: error C2001 - constant contains a newline character.

Visual Studio

cmake organizes the project compilation script, generating a temporary solution under the windows system for development. The reason for cross-platform compatibility is that the file encoding is chosen as utf-8.

The cited reference provides a detailed explanation of the causes of the problem from first principles.

Regarding encoding, MSVC has dedicated compilation options /source-charset and /execution-charset. The former indicates the encoding of the file itself, and the latter indicates what encoding the byte array inside the compiled character set is. Encoding issues can basically be solved using these two options.

Quickly calculate folder size on the Windows platform

The Linux platform is very simple: du -sh * – just one line of code solves the problem. What about Windows? With many disks and a desire to clean up, with numerous files, the system’s built-in Resource Manager is too slow to calculate folder sizes, making you want to give up.

Everything

For developers working on the windows platform, you probably haven’t personally used everything, and should at least have heard of it. Its search speed far exceeds that of the built-in file explorer. Given that system-level support for fast indexing exists, we can certainly find similar tools that build file indexes while also calculating file sizes.

How to Copy Webpage Stylesheets (CSS): Element Inspector

Static blog themes, the mainstream is based on foreign templates, modified and adjusted without much consideration for Chinese content layout.

Main Text

About half a month ago, I adjusted the blog’s stylesheet – as I’ve been developing backend services for many years, I’m a pure newbie in frontend. After struggling with it for half a day, the design wasn’t quite reasonable. Suddenly an idea struck me: I looked at the technical blogs I often read – infoq and OpenChina – and their layouts look really good. Could I borrow some of those? After reviewing the source files, I got lost trying to locate the relevant elements.

Editing Extremely Large Files on the Windows Platform: EmEditor (Text Editor)

The Shanghai GuoAn database incident, which caused a huge stir within the black hacking circles, remains unclear whether it’s true or false. Let’s see what we remember in two years and look back on it then. Based on past experience, I updated a batch of local social engineering databases, and I encountered a massive SQL file: 17.9G. A regular text editor couldn’t even preview it, let alone open it. Chatting with netizens, someone mentioned EmEditor.

Adding a code copy button for seemingly simple things

Spent four hours on this, and when I saw the sentence, it was hilarious. How could it have taken so long? Finally looked at the time: three hours.

This was the first draft of the year 2022, and it wasn’t complicated – exactly as the title said. (At that time, I was still quite young), I thought simply copying 作业 would be enough, putting it in my favorites folder, and letting it sit for over a month before finally remembering the task.

Chaos Engineering

A pattern of disruption to test system stability.

Main Text

The domestic internet industry is always fond of playing with new things, often introducing terms that most people wouldn’t be able to guess what they are. After reading some articles, this definition specifically for the early stages of Chaos Engineering is relatively easy to accept:

Early exploration of Chaos Engineering has actually been ongoing within the industry, previously existing under the guise of fault testing and disaster recovery exercises. As microservice architectures continue to develop and distributed systems grow ever larger, Chaos Engineering has begun to emerge and gain increasing importance. Following Netflix’s formal proposal of the Chaos Engineering concept, related theories have also rapidly enriched. Netflix’s practices have also demonstrated the significant impact Chaos Engineering has on stability.

Kubernetes paused pod

Deployment controllers implement a crucial function within a Kubernetes cluster: the ability to horizontally scale and shrink Pods. This capability was essential for traditional cloud-era platforms.

Encountering a business scenario where you need to modify data in a database, restarting Pod nodes after adjustments. However, during Pod operation, table fields are continuously modified, requiring temporary pausing of application updates to tables, adjusting the data, and then restoring the Pod.

Besides abruptly deleting the Deployment, are there other ways to achieve a similar pause effect?

Docker Basics, Intermediate, and Advanced

Having worked with CentOS for many years, content may not apply to macOS or Ubuntu users in some cases.

You can refer to the documentation from Tsinghua University for installation guidance: https://mirrors.tuna.tsinghua.edu.cn/help/docker-ce/

Installation

Due to unknown mysterious forces, domestic Docker installation is recommended to set the cloud vendor’s repository address. Here we recommend using Alibaba Cloud.

Set Repository Source Address

yum install yum-utils device-mapper-persistent-data lvm2 && \
sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

Deploy the Latest Version

Docker is a commonly used background service, we recommend setting it to start on boot. The following command applies to CentOS 7: