R&D
How to Ensure Concurrent Data Consistency in Django
· β˜• 2 min read
The first part mainly covers optimistic and pessimistic locking. Locking guarantees data consistency under concurrency at the database level. Understanding locks helps you understand concurrency solutions. The second part mainly covers how to guarantee data consistency in concurrent scenarios within Django. 1. About Locks 1.1 Optimistic Locking The starting point

Using utf8mb4 in Django to Support Emoji
· β˜• 3 min read
1. What Is utf8 In theory, utf8 uses 1-6 characters, In practice, the latest utf8 specification uses only one to four bytes, and can encode at most 21 bits, which is exactly enough to represent all 17 Unicode planes. 2. What Is utf8mb4 utf8mb4 is a superset of utf8. In theory, if you were using utf8 before and then change the charset to utf8mb4, it will not cause any problem when reading the existing utf8-encoded data.

Common NPM Commands
· β˜• 2 min read
** By default, a command operates on the current directory environment. Adding the -g flag makes it apply globally instead.** Upgrade npm 1 npm install npm -g Show the current version 1 npm -v Show the npm registry configuration 1 npm config get registry Change the npm registry 1 2 npm config set registry http://registry.

How to Synchronize and Back Up a Git Repository
· β˜• 1 min read
Because the Git repository currently in use is about to become unavailable, the repository code needs to be migrated to a new Git repository. The specific procedure is as follows: Log in to the new repository and create a repository. After creation, the new repository address is: http://gitlab.your-new-domain.com/project.git Clone the old repository as a mirror locally: 1 2 3 git clone --mirror http://gitlab.

An Introduction to Various Python Environment Isolation Tools
· β˜• 3 min read
1. Non-standard Library 1.1 virtualenv virtualenv is a very popular tool for creating isolated python libraries environments. I strongly recommend you learn about it, because it is very practical and widely used; many people use it to set up python development environments. The other tools below are mainly compared against virtualenv to illustrate the differences.