Monitor IO in Linux

There are a lot of tools to monitor IO in Linux. iotop is one of the most common command to monitor IO of each process. iostat is another common commands. I will show you how to use them in this blog.

Use top command in Linux

We often use top command to see the tasks in Linux. There are many numbers in the output of top. In this page I will shortly introduce them. The output of top command is like following.

Use ESC to close Windows Explorer in Windows

As we all know, we can use Alt+F4 to close any windows in Window. But Alt+F4 is hard for us to press. Every time I have to find the F4 button. I want change the way to close windows especially for Window Explorer. Recently I found AutoHotkey can help me solve this problem. In this blog I will show you how to close Windows Explorer with ESC button.

Make a request with Apache HttpClient

Sometimes we need request the resources programmatically. Apache HttpClient is one of the best way to make a request in your project. This blog will show you how to make "Get" and "Post" request for restful resource. The structure of this project is like following.

Plus or minus date in java by joda time

Plus or minus date in java is boring. joda-time can help you finish this task easily. If you use JDK8 you may not need use joda-time, there is a new date API in JDK8. For more detail you can click here. In this blog I will show you how to use joda-time plus or minus date.

Spring unit test example

Unit test can help you correct the logic error. In this page I will show you how to use unit test in spring. I create a simple project to display a sentence in the page. The structure of this project is like following.

Spring MVC forward redirect example

You can return jsp file name in Spring MVC controller when you want client show this page. You can also add forward or redirect keyword at the front of jsp file. I will show you how to "redirect" and "forward" a page in this blog.

Change keyboard repeat rate

A key will repeat when you press and hold down it. You can change the repeat rate (make it quicker or slower). Open "control panel" -> search "keyboard" in the top right input box. Click "Keyboard" to open "keyboard properties" dialog box. You can see there are two scroll bars. The first one is for repeat delay and the other is for repeat rate. Now you can adjust them. Do not forget click "OK" button.

Read file under WEB-INF directory example

For JavaEE project you can request the file under project directory except the file under WEB-INF. Put the file under WEB-INF directory if you do not want others to access it informally. The question is how to access it in project. This blog will show you how to access the file under WEB-INF directory programmatically.

Download file in Spring MVC example

Each download method is transfer data from server to client. Use Spring MVC is the same way to do that. The first thing is find the downloaded file. The second thing is read it and transfers it. In this blog I will show you how to use Spring MVC download file. For quickly start I use Spring Boot. The code also works fine in Spring.

Spring Boot change default port

The default port in Spring Boot of web application is 8080. There are two ways to change this default port. The first way is to change application.properties file. The second way is to add VM option when start your web application.

Spring Boot get resource file example

I have written the blog Read values from properties file in Spring to show how to get values from properties file. In this blog I will show you how to get resource file (not only properties file) in Spring. As using maven build the project all resource file are put in resources folder.

Avoiding null check in java

There is lots of ugly null checking in my project. For example if you want print out the address of user. ORM (Hibernate or MyBatis) will help you query this user with address info. You may get a user entity like following.

MyBatis pagination example

In this blog I will show you how to get paged query result with MyBatis plugin pagehelper. If you are interested in it see the link for more detail. I use MyBatis generator plugin to generate mapper and xml file. If you do not know how to use it click here

MyBatis generator return id after insert

In this blog I will show you how to generate mapper that can return auto increase id after inserting. If you do not know how to use MyBatis generator you can click here. You can also use maven plugin or other tools to generate mapper xml file and model class.