Multiple conflicting CSS

When add multiple CSS to the same element which one will work? These CSS code may be in same CSS file, but for the most case they are not. The question is which one will work? I found the answer here When browser parse the CSS it calculates the selector's specificity. Browser will make high selector "override" the low selector.

Install MongoDB on CentOS

In this page I will show you how to install MongoDB on CentOS. I recommend you install MongoDB by yum command. Before installing, you need to add /etc/yum.repos.d/mongodb-org-3.0.repo file. I install 3.0 version, you can change this number to install different version, click here to get which version are available. Add following code in repository file.

Spring Boot tutorial

Spring Boot is Spring's convention-over-configuration solution. You can build a Spring project with less configuration. You do not need deploy you project in Tomcat or Jetty, you can "just run" a Spring Boot project. In This tutorial we will show you how to use spring boot step by step.

Spring Boot upload file with ajax example

Last blog Spring Boot upload file with form example shows how to upload file with form. As we all know upload file with Ajax can improves user experience. Today I will show you how to upload file with Ajax. Same as last blog we use jsp as page. You can click here to learn how to use jsp in Spring Boot.

Spring Boot upload file with form example

For most project uploading file is a commonly-used function. In this page I will show you how to upload a file in Spring Boot. It works if you just use SpringMVC in your project. I use jsp as page, so if you don't kow how to use jsp in Spring Boot you can click here for more detail.

Spring Boot JSP examples

Before learning how to use JSP in Spring Boot you need know there are several limitations. You can click here to learn more. In order to show the page you need add tomcat-embed-jasper dependency in pom file. Spring Boot uses an embedded servlet container which is not rendering JSP as default.

Linux grep command examples

grep command can help you search words (actually a regular expression) in file. You can also use it with other command to print the word you want find. grep is short for "globally search a regular expression and print". There are two things in grep command, search and print. All the parameters in grep centered on them. I will show you the common use of grep`.

JdbcTemplate batch update example

JdbcTemplate provide many batch update functions. When you want update or insert many records you can use batchUpdate. It is more elegant and faster than update(insert) records one by one. In this blog we will show you how to use batchUpdate in JdbcTemplate.

Why batchUpdate return int[][] instead of int[]

There are multiple batchUpdate methods in JdbcTemplate. I found most of them return int[]. Only one method with ParameterizedPreparedStatementSetter parameter return int[][] instead of int[]. It makes me wonder. int[] means the number of rows affected by each statement. int[] is enough why use int[][].

Quick launch programs(start service) on windows

When you want launch a programs on windows open directory and find the exe file then double click it. It is too slow. Today I will show you how to open programs or start service on windows quickly. You do not need open deep directory to find exe file.

JdbcTemplate query examples

There are many powerful query methods in JdbcTemplate. They are flexible enough to do complex query tasks. In this tutorial we will show you how to use query method. In order to get the result quickly I use Spring Boot(SpringMVC) you can access different address to invoke different query method.

JdbcTemplate examples in Spring Boot

JdbcTemplate is the central class in the JDBC core package. You can use it manipulate database without handling common errors. We define JdbcTemplate in Spring config file in the past and before using JdbcTemplate you have to add DataSource config. In this tutorial we will show you how to use JdbcTemplate in Spring Boot. You don't write a single line of XML. No web.xml file either.

Read values from properties file in Spring

There are several ways read values from properties in Spring. You can choose one way in your application or change some code to fit your needs. In this tutorial I will show you different ways to read values from properties in Spring.

Consumer commit offset example

We have learned how to send message to Kafka and get message from it with java client. In demo of previous blog when Consumer get a message Kafka "think" this message have been consumed. Kafka continue to "send" next message. Let's image another scenario while the Consumer processing a message an exception was thrown. Kafka "think" this message was consumed, actually is not. In this scenario we should commit offset manually. In other words, when we make sure a message is processed successfully

Kafka java example

In last blog we have learned how to install Kafka in Linux. We also know how to run a producer and a consumer in commandline. In this tutorial I will show you produce and consume message with apache kafka client.