Java stack trace disappear

I recently found a lot of exceptions without stack information when I looked at the logs. There is only one exception name in the log, and there is no complete stack information. I know the reason after google. To improve efficiency, the JVM hides duplicate stack information. More information can be found here

Java get local address example

I recently need to get a local ip when doing a feature. The following code perfectly implements this function. It’s very simple, just a few lines of code.

vim recording and execution macro

Using macros to perform repetitive operations is a very efficient way. In this page I will show you how to use it.

Spring Boot filter WebFilter annotation example

There is an embedded tomcat in Spring Boot. We can not edit web.xml to add a filter. In this page I will show you how to add filter in Spring Boot without web.xml. I use WebFilter annotation to add filter. After adding this annotation you have to add ServletComponentScan annotation to make Spring Boot find this filter.

git change remote url

Use following command to change the push url of repository.

vim use register

If you want copy content and paste multiple times, "register" is good way to do this. After select the content you want to copy press "ay. This command save the content to the register named a. Use following command to paste this content to the place you want.

vim delete specified line

In Vim we can use j and k to move the cursor to specified line and press D or dd to delete current. You can also use next command to delete specified line.

git sync remote tag to local

I want sync remote tags to local. After google I got some commends. Unfortunately, those commands sometimes work and sometimes don't work. I think this may be related to the environment and the version of git. Eventually I finally found a universal solution.

Get file md5 example

When we download file from remote server. We need to check the integrity of the file. In general, the website will provide the md5 value of the downloaded file. In this page I will show you how to use apache-commons-codec to get the md5 of file.

okhttp post json example

okhttp is one of best network framework. In this page I will show your how to use it post json to remote server. The code is here.

Java understand IncompatibleClassChangeError

When I use thrift generate classes I got IncompatibleClassChangeError. This error means the class you depends has changed. Let's say your project depend on ClassA.class. When ClassA.class upgrades to new version (add some new methods or fields). It's name doesn't change. You project can use both old and new version of this class. This is "Binary Compatibility". But when the new version change one static field to no-static. IncompatibleClassChangeError will be thrown.

Java8 Collectors.mapping example

There are many practical methods in the Collectors class. mapping method is one of them. In this page I will show you how to use mapping method in Collectors. Let's say you have a list of users(List). Let's say you want to group these users by age. The code will be like this.

Java8 CompletableFuture concurrence example

It is very convenient to use CompleteFuture to implement concurrency in java8. I will show you how to use it in this page. Let's say you need to query someone's information(address, company name, family). Every query need 300ms. If you request the information one by one, you will need about 1 second. If you use the CompleteFuture concurrent request, it only takes 300 milliseconds.

CentOS install docker

It is easy to install docker in CentOS. Open the official website of docker copy commands and paste them in your terminal. now docker only supports CentOS7+. Before installing you need make sure your CentOS version is higher than 7. For the detail you can click here

Execute multiple commands by redis-cli

We can use redis-cli to connect redis sever and execute command. Today I want to execute multiple commands. After connecting redis server I copy multiple commands and paste them in redis-cli. I got error message. My commands are like following.