Red packet algorithm

This is an interview question. Not fully understood yet. ;(

guava BloomFilter example

The biggest advantage of the Bloom filter is that his space usage is very high. His disadvantage is that there may be misjudgments. Bloom filters return two values: elements may exist and elements definitely do not exist.

redis benchmark

Benchmarking Redis is very easy. After completing the redis installation, there is a command tool in his directory to perform benchmark tests. Here is a simple example.

Understanding Java references

There are four different types of references in Java.

guava read resources file

It is very simple to read files using the tool classes in guava. Here is the example.

git quick clone

It takes long time to clone a particularly large git repository. Use the following command to help you quickly clone a git repository.

yum install nginx

There are several ways to install nginx in CentOS. I recommend you install it by yum command. Quick and safe.

CentOS7 virtualBox install guest additions

In order to use share folder you have to install guest additions in VirtualBox. In this page I will show you how to install it. Click devices -> Install Guest Additions... and wait a minute. Open terminal in CentOS7. Before installing it you need make sure your environment is OK.

CentOS config double network adapter

When you install CentOS in virtual machine you need to config double network adapters. One is for connecting internet another is for ssh. For more detail you can click VirtualBox CentOS static ip address.

Nginx basic http authentication

I want to add basic http authentication in my personal wiki. I don't want to write any code to implement this function. After searching on the Internet, I found Nginx can do this by adding configuration. basic http authentication is very simple and unsafe. It adds user name and password information in http header which encoded by base64.

IDEA find unused code

There are many unused code in my project. Whenever I see useless code, I will remove them. I think this is too inefficient. Fortunately, I found that IDEA can help me discover all the useless code in the project. In this blog I will show you how to use this feature.

Linux restart one network interface

Use following commands to restart on network interface. First you need to know that how many network cards on your machine.

Linux crontab example

The crontab command can be used to create timed tasks. Here are some simple examples.

Linux sed command example

sed is stream editor for filtering and transforming text. I will show you how to use it to cut text into another file. Let's say you have file(test.txt) like following.

fastjson JSONPath example

We can use fastjson to serialize and deserialize json. When the json structure is complicated, it will be more troublesome to handle. The json is like following.