Spiral Matrix II

Problem Description

Java large file line by line read example

Large file reads are very memory intensive. You can use BufferedReader to read the contents of the file line by line.

Restore IP Addresses

Problem Description

MySQL show open transaction

Once I got stuck while executing sql. I checked the process with the following command

Spring EventListener example

The EventListener annotation in the spring framework can be used to decouple logic. The trigger of the event does not need to pay attention to the processing logic of the event.

Google Guava

Google Guava is an open-source set of common libraries for Java, mainly developed by Google engineers.

guava CaseFormat example

There are many variable names that need to be processed when writing code. Using the following tool classes can easily convert variable names in various formats.

Display table size in MySQL

Use the following sql to query the space occupied by each table in the database.

Delete large amounts of data in MySQL

Recently I want to delete a large amount of data from mysql. There are about 400 million records. Fortunately, the data to be deleted can be queried according to the index. If I delete one by one, it will be very slow. If the entire deletion will cause the database to freeze. So I Write a script to delete these data in batches. The script probably looks like this.

mac copy current path to clipboard in terminal

In order to copy the current path to the clipboard you can use the following command.


Problem Description

Sum Root to Leaf Numbers

Problem Description

Binary Tree Paths

Problem Description

Nginx htpasswd old password still working

Today I encountered a problem about htpasswd. I use htpasswd to make simple user authentication for my website. I use nginx as the reverse agent of my personal website. Today I tried to modify a password. I added a random number behind my old password. Like this old_pwd -> old_pwd_666. After the password is modified, I found that the old password can still pass the authentication. It's too strange. After reviewing the htpasswd helping documentation, I found the reason for the problem.