When I run mvn clean install -DskipTests to build my project I got an error message. The content of message is like following.
Nginx will add Content-Type depend on suffix of url in response header. The suffix and Content-Type mapping are in /etc/nginx/mime.types. There are two ways to change Content-Type in Nginx.
When I run Spring Boot jar in different environment I need different configuration. I use command line to assign the location of application.properties. Let's say you have a project without application.properties file and you package it as jar. You can use java -jar YOUR_PACKAGE_NAME.jar to start this project. The output is like following.
I install CentOS in virtualBox and I use Bridged Networking to connect internet. Virtual machine is like a real machine in bridged networking mode. The problem is that when I restart virtual machine the ip will be changed. I have to use ssh to reconnect virtual machine(CentOS). To solve this problem I add another network adapter in virtual machine with Host only mode. Finally, I can connect virtual machine by static ip address.
Let's say you have a file which contains log content. awk command can help you split every line of it and print the field you care about. awk can do more than this. Let's say your log file might look like this.
I always use cron expression to execute scheduling task. I want to know when the task will be executed. I use CronSequenceGenerator to calculate the next run time which is a class of Spring Framework. The example code is here.
It is easy to use log4j2 in spring boot. Create a maven project, structure like following.
I installed VirtualBox in my computer and installed CentOS in it. When I need Linux environment I start VirtualBox and use ssh(XShell) to connect it. It's boring to start VirtualBox by click Start menus every time. I write a bat script to run VirtualBox in the background. It seems like this.
In this page I will show you how to sort a stack by using a temporary stack. The key step of sorting is make sure that push items into temporary stack in order. The code is here.
The key step of reversing stack by using recursion is implementing the method popBottom. If we can pop an item from bottom of stack, then we can reverse a stack with two items.
There are two ways to implement queue by using two stacks. The first way is moving all items to another when push or poll method invoked. Another way is using second stack hold some items, move items when needed.
As we all known mv command can help me to rename one file. rename is another command to rename file and files. rename command is very useful for renaming multiple files. For example you have three files like following.
Question: Design a stack supports all stack operations and an extra function getMin() which can get the min element of the stack. The time complexity of all operations above must be O(1).
ForkJoinPool is used to handle the big task which can split into small tasks. I will show you how to use ForkJoinPool and RecursiveTask in this page. Let's say you want to calculate the sum from 1 to 1,000,000,000. There are two ways to calculate. The first way: calculate directly. The second way: split 1,000,000,000 numbers into different groups and calculate them in different thread then adding their respective results together. ForkJoinPool can help you to use different threads
I use Intellij IDEA on Linux Mint. Today I found the shortcut Alt + Insert not working. I guess other program may register the same shortcut(Alt + Insert). I close other programs and retry the shortcut again. It's still not working. I know this shortcut may conflict with the system hotkey.