Viewing the Contents of JAR

Listing files inside a JAR or displaying content of a single file using different commands: "jar", "unzip", or "vim".

| java

Glob Expression Understanding

Glob expression syntax, and its usage in Java through Path Matcher and Directory Stream.

| java glob

Understanding ISO-8859-1 / UTF-8

Character mapping between ISO-8859-1 / UTF-8, decode and encode data between string and bytes, and file I/O operations including MIME encoding detection. All examples are written in Java and Python 3.

Jackson XML Mapper

How to do Java / XML mapping using Jackson XML Mapper. This article explains the annotations used for root element, property, and collection mapping. Also, the basic configuration of Jackson XML Mapper.

SLF4J Understanding

Simple Logging Facade for Java (SLF4J) reduces the coupling between application and logging framework. It support various logging frameworks as bindings. In this article, I will explain what is SLF4J, why and how to use it.

| java log

Merging 20 Git Repositories

Recently, I merged 20 Git repositories into a single one while keeping the history. Here's how I did it.

| git

What I Know About Logs

The information inside a log event, the advantages of having a log platform (aggregate, enrich, search, analysis, monitor), the sources of logs, and log analytics.

| java log

Project qWatch

Quality Watch (qWatch) is a data aggregator for code quality, based on different metrics.

Design Pattern: Static Factory Method

Understand static factory method pattern in Java with concrete examples from Selenium WebDriver, Jackson JSON object mapper, and SAX reader for XML.

Vavr List vs Java List

Difference between Vavr List and Java List? I'll compare them via CRUD operations, immutability, performance, streaming, and thread safety in this article.

TDD: After 3 Months' Practice

I started TDD in all my personal projects 3 months ago. Here're some thoughts about it, including architecture, IDE, methodology, execution speed up, legacy code, and limits.


Using 100% CPU effortlessly in Java: submit all your tasks to thread pool and wait for completion.

| java concurrency

Security Training Day 3

My study notes of security training (day 3), including insecure direct references, broken access control, improper input validation, and software best practices.

| security http

Security Training Day 2

My study notes of security training (day 2), including some ways of SQL injection, Cross-site scripting (XSS), and XML External Entity (XXE).

Security Training Day 1

My study notes of security training (Day 1), including web thread landscape (Java in particular), security tools, and some Juice shop training answers.

VAVR HashMap vs Java HashMap

What is the difference between VAVR Collection API and Java Collection API? Why should you give it a try? Today, we will start comparing them via Map and HashMap, including the map creation, entries iteration, streaming, and the side effect.

Test Polymer 2 Using WCT

Web Component Tester (WCT) allows you to test your Polymer elements easily. This article explains how to launch tests locally, set up the tests on CI, detect browsers, and write unit tests using WCT.

Discard Old Build Artifacts on Jenkins

How to discard old build artifacts on Jenkins and free the disk space by configuring the duration to keep builds / artifacts, and the quantity of builds / artifacts to keep.

Highlight 2018

My highlight 2018.

| career project

Testing JAX-RS Resources

This article explains how to set up and tear down a Grizzly Server for testing JAX-RS resources, how to create a HTTP request and assert the response using JUnit 4. And finally, the limits of testing API in reality.


This post explains what is JAX-RS Client API and how to use it via Jersey Client API. We will talk about the Maven dependencies, Client, WebTarget, and HTTP response.

Exception Handling in JAX-RS

This post explains exception mapper, how to register it in JAX-RS application programmatically or via annotation, the exception matching mechanism (nearest-superclass), and more.

JAX-RS Param Annotations

This post explains different param annotations in JAX-RS 2.1 and their use-cases, including @QueryParam, @MatrixParam, @PathParam, @HeaderParam, @CookieParam, @FormParam and @BeanParam.

HTTP Methods in JAX-RS

This article explains the common HTTP methods in JAX-RS: annotation @GET, @POST, @PUT, and @DELETE.

Simple REST Demo With JAX-RS

A quickstart demo for creating REST service in Java using JAX-RS 2.0. The sample is implemented by Jersey, the reference implementation of JAX-RS.

Customize Git Prompt in MinGW

Customize Git prompt to show dirty-state, untracked files, stash, upstream in your Bash console: MinGW64 (Minimalist GNU for Windows x64).

Merging Git Repositories

Engineering story: how I merge two Git repositories and what are the hidden tasks you didn't think about.

Speed Up The Maven Build

How to speed up a Maven project by using different tips.

Personal Finance: Data Collection

A step-by-step guide sharing how I build my data collection tool in Python for personal finance, and why it might also fit your needs.

How Quick Switcher is implemented?

The internal mechanism of Quick Switcher, a Polymer element allowing you to jump into any feature, layout, or menu option in Nuxeo Studio.

Maven Failsafe Plugin Understanding

Maven Failsafe Plugin runs integration tests for your Maven project. In this article, we will see what is Failsafe plugin and its common use cases.

| java maven

Maven Surefire Plugin Understanding

Maven Surefire Plugin is used during the "test" phase of Maven build lifecycle to execute unit tests. It can be used with JUnit, TestNG or other frameworks. This article explains what is Surefire plugin and its common use cases.

| java maven

Maven Resources Plugin Understanding

Maven Resources Plugin is part of the core Maven plugins, which handles resources copying to the output directory. It has 3 goals: "resources", "testResources", and "copy-resources". In this post, I'll show you some common use-cases of this plugin.

| java maven

Maven JAR Plugin Understanding

A step-by-step guide for understanding Maven JAR Plugin in Java 8 and Java 11.

| maven java

Maven Compiler Plugin Understanding

A step-by-step guide for understanding Maven Compiler Plugin in Java 11.

| maven java

Create JSON-LD Structured Data in Jekyll

In this post, I will explain how to create JSON-LD structured data for Jekyll blog.

Why You Should Use Auto Value in Java?

Auto Value generates immutable value classes during Java compilation, including equals(), hashCode(), toString(). It lighten your load from writing these boilerplate source code.

| java auto-value

My First Script in Node JS

The basics of creating a script in Node.JS, including execution syntax, dependency declaration, arguments, template literals, iterations and promises for asynchronous operations.

| javascript node

Maven: Deploy Artifacts to Nexus

Declare Maven deploy plugin in the parent POM. It's the same no matter your project is a single module project or a multi-modules project. Then, define the Nexus repository id and url in distributionManagement. After that, add your credentials in ~/.m2/settings.xml. Finally, execute command `mvn deploy` to deploy your artifacts.

| java maven

JGit: Protect Branches on Git Server

If you're using JGit for your Git server, you can combine Git config (.git/config) and a customized pre-receive hook to protect branches on a specific Git repository.

| java git jgit

Git: Understanding Git Config

The format of Git internal configuration file (.git/config) is very simple: it has multiple sections, each of which contains multiple options. An option is indeed a key-value pair...

| git study-note

SEO: Improve Blog Ranking in Google Search

This post explains how to improve your blog ranking in Google Search when you know nothing about SEO. I'm using my Jekyll blog as an example, to implement everything step-by-step: add robots.txt, sitemap, structured data; improve title tags, meta description; use Google Search Console...

Create Element with Polymer 2

Want to create your first web element with Polymer 2? This post provides a step-by-step tutorial for you: Polymer CLI, useful websites, Polymer element's structure, dependency management, AJAX request and more.

JavaScript Cheat Sheet

A simple JS cheat sheet for newbies, containing the basic syntax of commonly used statements: variable, class, array, JSON, ...

Python 3 Cheat sheet

I occasionally write Python scripts, but I always forget those very basic syntax. So I'm writing this Python 3 cheat sheet.

| python study-note

Java Server on Raspberry Pi

A step-by-step guide for installing Java server on Raspberry Pi: install Raspbian OS, install JRE, configure SSH, transfer data, and setup Java server with Systemd.

Create Systemd Unit File for Java

This post explains how to create a systemd unit file for Java, so that you can run your Java application as a service in Linux. It also explains the structure of a service file, and tells your the useful commands after service's creation.

| java systemd

Method Execution In Multithreading

Today I met some multithreading problems. Many Java syntax become very confusing in a multithreading environment. So I created a mini Java program, and wrote this study note to clarify the unclear methods. This blog post will go through the following steps:

  1. Source code and execution
  2. Understand Thread#join()
  3. Understand logic sharing
  4. Understand variable sharing

JGit: Customize Git references using RefFilter

This post explains how to apply a Git reference filter to your Git server in Java. It allows you to customize Git references before sending data to clients (upload-pack).

| java jgit git

Create a HTTP Request in JS

Today, I'll explain how to send HTTP request from your browser. You can achieve that by using builtin JavaScript (XML HTTP Request, or "XHR") or jQuery (1.4, 1.5+).

Use Auto Value and Jackson in REST API

This post explains what is Google Auto Value and why it is the best alternative for Data Transfer Objects (DTO) in your web service. It shares how to apply Jackson annotations on top of Auto Value classes. There're also some advanced configurations about this topic.

My Java Code Style

My Java code style: a collection of Java good practices.

| java

Git: Communication over HTTP

What happens when Git communicates over HTTP protocol? In this post, I'll intercept the HTTP traffic to discover git-receive-pack, git-upload-pack and more.

| git http

Intercept HTTP traffic using ZA Proxy

Today, I'd talk about how to install and configure ZA proxy for intercepting HTTP requests and responses in localhost in macOS.

Servlet and Filter

Today, I’d like to talk about the famous HttpServlet and Filter, in Tomcat 8.5 server.

Git: Upstream Tracking Understanding

A quick introduction about Git upstream tracking: set upstream with git-push or git-branch, the internal mechanism inside Git config (.git/config), unset upstream, and related implementation in Java (JGit).

| git java jgit

Git: Understanding the Index File

Git index file (.git/index) is a binary file having the following format: a 12-byte header, a number of sorted index entries, extensions, and a SHA-1 checksum. Now let's create a new Git repository, and see how index file changes when a new file is added.

| git macos

Testing Haskell

This post explains how to configure your Haskell project for testing, using Cabal and Travis CI.

Learning HashMap

Understand java.util.HashMap in Java 11: bitwise operations, hash computation using hash code, index calculation, and more.

| java study-note

Introduction to Selenium WebDriver

A quick introduction to Selenium WebDriver, a practical tool for running functional tests and browser automation. The sample is written with Firefox 58 and GeckoDriver 0.20.

GWT SafeCSS Internal

Recently, I helped the GWT community for porting module gwt-safecss to GitHub. I think it’s also a good opportunity to learn more about GWT SafeCss. That’s why I’m writing this study note.

JGit Internal: Reference and RevObject

Today, I want to discuss Git internal mechanism with you: How Git resolves references? How JGit, a pure Java implementation of Git, resolves references in Java? Then, how to use them via class RevObject and its subtypes.

| jgit git java

Java 9 Migration

Java 9 migration for Maven project. It consists Java 9 installation, IDE update, Maven project update, CI update, and fixing tests. This article is written using macOS and IntelliJ IDEA.

Learning Checkstyle

Checkstyle is a development tool to help programmers write Java code that adheres to a coding standard. By default it supports the Google Java Style Guide and Sun Code Conventions, but is highly configurable. It can be invoked with an ANT task and a command line program.

Learning JNI

Today I would like share my very first experience about JNI—Java Native Interface. The Java Native Interface (JNI) is a programming framework that enables Java code running in a Java Virtual Machine (JVM) to call and be called by native applications and libraries written in other languages such as C, C++ and assembly. This post uses a Hello-world example to demonstrate the communication between Java and C on Mac OS X.

| java c jni

Learning GWT with Maven

Today, I want to share how to learn GWT 2.8 with Maven GWT Plugin. I wrote this post because the official GWT tutorial has some inconvenience: source code and resources are stored as GWT standard structure, commands must be launched from Apache Ant, JARs and classpath must be handled explicitly etc. I found it more comfortable to start with Maven, the tool which many Java developers are familiar with.

OCP Java 8 Review Notes

Here're some review notes before my Oracle Certified Professional Java SE 8 exam. They're highly inspired by the following books: OCP Java SE 7 Certification Guide and Java 8 in Action. They are excellent resources for learning Java, which I highly recommend.

Sonar Integration with Maven

A concret Sonar integration example for your Java project, using Maven + JaCoCo + SonarCloud + Jenkins.

Highlight 2017

Today, I'd like to share with you the review of year 2017.

Maven Plugins Understanding

Some interesting facts that I discovered about Maven plugins.

| maven

Introduction to Threads

Today, I want to share with you an introduction to multithreading in Java. In order to make the blog post more fun, I'll use the roles of "Game of Thrones" in my examples: white walkers and the Night King. After reading the blog post, you'll understand: How to create and run a thread, use wait(), notify(), notifyAll() and join().

Cookie Understanding

The 8 different fields in an HTTP cookie.

| cookie http

What Is Git Branch?

Many developers use Git in their daily life. Among all the operations, branch commands might be one of the most important part. But do you know what “branch” is, and what are the secrets behind branches? This blog post will share some Git internals with you.

| git

Test a POM-Packaging Maven Module

Recently, I need to write tests for resources inside a Maven module and I met some technical issues. The context of the situation is that I need to test some resources located in a Maven module, where its packaging value is pom. I think it’s worth to take some notes, so I wrote them down and share with you.

| maven java

How to Use Safe HTML in GWT

Today, I would like to share with you about how to secure your GWT application by using package After reading this post, you’ll understand how to:

  • Secure HTML using SafeHtml
  • Secure URI using SafeUri
  • Secure CSS using SafeStyles

什么是HTTP代理服务器(HTTP Proxy)?

最近在看一本很有名的关于HTTP的书籍,叫 « HTTP: The Definitive Guide »,以下是第六章“网络代理”的部分翻译。网络代理服务器是介于客户端和服务器之间的中间件,它双向地传送HTTP信息。这一章将讲述所有HTTP代理服务器的类型,对于代理服务器属性的特殊支持,以及一些当你使用HTTP代理时将会遇到的比较棘手的行为。

Web App Security - Review 1

My review note about book "Web Application Security: A Beginner's Guide", written by Bryan Sullivan and Vincent Liu.

| security web

HTTP: The Web's Foundation

My reading note about book "HTTP - The Definite Guide", part I: The Web's Foundation. After reading this article, you'll understand the definition of HTTP, URL and resources, the flow of messages, and the different status codes in HTTP.

| http web

Git Repository Transfer

A step-by-step guide for transferring a Git repository from one place to another while keeping the entirety of the data, including all branches and tags.

| git

OCA Review 8 - Notes

Today, I want to write blog post to summarize all the important review notes for Oracle Certification Associate (OCA) - Java SE 8 Programmer. This article will be separated into several subjects: Java basics, Java data types, methods and encapsulation, core APIs, flow control, inheritance, and exception handling.

| java oca

OCA Review 7 - Online Test Chapter 5

Today, I’m going to review my online test, chapter 5 of Oracle Certified Associate (OCA), provided by SYBEX. If you need to access to this online resources, you need to buy their book first. See

| java oca

OCA Review 6 - Online Test Chapter 4

Today, I’m going to review my online test, chapter 4 of Oracle Certified Associate (OCA), provided by SYBEX. If you need to access to this online resources, you need to buy their book first. See

| java oca

OCA Review 5 - Online Test Chapter 3

Today, I’m going to review my online test, chapter 3 of Oracle Certified Associate (OCA), provided by SYBEX. If you need to access to this online resources, you need to buy their book first. See

| java oca

OCA Review 4 - Online Test Chapter 2

Today, I’m going to review my online test, chapter 2 of Oracle Certified Associate (OCA), provided by SYBEX. If you need to access to this online resources, you need to buy their book first. See

| java oca

OCA Review 3 - Online Test Chapter 1

Today, I’m going to review my online test, chapter 1 of Oracle Certified Associate (OCA), provided by SYBEX. If you need to access to this online resources, you need to buy their book first. See

| java oca

Setup GitLab Sever Locally

Here’s the guide about how to setup a GitLab server locally using Docker under mac OS through the following steps:

  1. Create folder in file system to store GitLab data.
  2. Create GitLab container.
  3. Setup GitLab container.
  4. Setup a new user.

| git docker

OCA Review 2 - Java Core APIs

I’m preparing the OCAJP: Oracle Certified Associate Java SE 8 Programmer. Here’s the second review of the certification training. In this review, I’ll talk about the Java Core APIs, including operations of String, StringBuiler, Arrays, ArrayList, and Java Time in Java 8.

| java oca

OCA Review 1 - Java Basics

I’m preparing the OCAJP: Oracle Certified Associate Java SE 8 Programmer. Here’re something interesting that I learned from the study guide, chapter 1 and chapter 2. They’re rarely used in our daily mission, but I just wrote them down for fun.

| java oca

Convert Date to ISO 8601 String in Java

Convert Java dates to ISO-8601 string: this post explains how to convert java.util.Date, java.util.Calendar, java.time.ZonedDateTime to string.

Configuring IntelliJ for Nuxeo

IntelliJ Logo

Do you want to develop Nuxeo Platform with you favorite IDE IntelliJ? Today, I’d like to share with you the IntelliJ configuration for Nuxeo.

| nuxeo intellij

Goals of 2017

Year 2017 is the first year in which I start my first full-time job as a software engineer. Therefore, I want to share with you some goals and expectation about this year. I try to split the goals into several parts: the Oracle Java Certifications, the goal of Stack Overflow, Hibernate Search, the goal in my work at Nuxeo and the improvement of my English level.

| career

Code Quality Improvement For Newbies

This week, let’s talk about code quality improvement for newbies. As a junior developer, I made a lot of mistakes as most of the newbies. But thanks to my colleagues, I learned many useful skills to improve my code quality. Now, let’s take a look together.

| code-quality

Learning Git Basics

Learning Git Basics.

| git

Miscellaneous Tips for Development

Miscellaneous tips for development in Git and Maven.

| git maven linux



| interview

Git Hook for JIRA Number

Git commit hook for checking the JIRA number before commiting.

| git

Projects Highlight 2015-2016

Today, I want to share with you all the projects that I've done during the last 365 days. They’ve special meaning for me because it’s the first time that I kept a very active status in programming during a whole year. There're many projects that have been done in various contexts, including IoT, Mobile, Web, blog, Business Intelligence and open-source framework.

| project

New repo: Java Examples

I’ve been learning different Java frameworks since my last intern in Beijing. Today, I want to share my new GitHub repository: Java Examples. This repository is built on Maven, modularized and extensible.

| java

MassIndexer in Hibernate Search

In this article, I'll focus on how batch indexing is implemented in Hibernate Search.

| hibernate-search

Lucene queries in Hibernate Search

Today, I want to share something about the search feature in Hiberante Search. As mentionned in the official guide Getting started with Hibernate Search :

Now we’ll finally execute a first search. The general approach is to create a Lucene query, …, and then wrap this query into a org.hibernate.Query in order to get all the functionality one is used to from the Hibernate API.

In this article, I will focus on the Apache Lucene queries and find out what features can we use on it.

| hibernate-search

How to use the public dataset Twilio Street Vector in Amazon AWS

The Twilio/ Street Vector data set provides a complete database of US street names and address ranges mapped to zip codes and latitude/longitude ranges, with DTMF key mappings for all street names. The complete description about this data set can be found on Amazon Web Service. This article will mainly focus on how to use the install and this data set in Amazon AWS.

| open-data

Starting Hibernate Search

This week I’ve started learning the Hibernate Search. Actually, this is my very first experience in open source project, so I’m really excited about it. At the first step, I started by Apache Lucene about the index and search. Then I learnt the Lucene query syntax, such as wildcard search, fuzzy search, proximatity search. Then I read a book about Hibernate Search, called Hibernate Search by Example. The book is quite good for beginers despite some methods are deprecated now. The essential of book reading, is to understand the mechanism about how hibernate search works, with hibernate ORM, JPA and Apache Lucene.

| hibernate-search

Boolean query in Apache Lucene

Today, I created an example to demostrate how BooleanQuery works and two different ways to construct a boolean query, using default constructor and using query builder.

| apache-lucene

Install Apache Lucene

Apache Lucene is a high-performance, full-featured text search engine library written entirely in Java. It is a technology suitable for nearly any application that requires full-text search, especially cross-platform. It is an open source project available for free download.

| apache-lucene

Review of my first project

After 8 weeks intensive works in nights and weekends, we've finally released the first application of our life: "eRallye". This Android application is an app built for French association "Elles bougent". This article reviews what have been done and how to do better in the future.

| project

Run SSIS package using 32-bit drivers

Today, when I used an OLD DB source to connect a MS Access database, I met the following message error during debug :

[Connection manager “\DVDSIB46\d$\DVI_Datas\Source\Dise\EXTRACTION DONNEES MOBILITE.accdb”] Error: The requested OLE DB provider Microsoft.ACE.OLEDB.12.0 is not registered. If the 64-bit driver is not installed, run the package in 32-bit mode. Error code: 0x00000000. An OLE DB record is available. Source: “Microsoft OLE DB Service Components”
Hresult: 0x80040154 Description: “Class not registered”.

The message suggests me to use 32-bit driver because the driver of 64-bit is not available. This is caused by the MS Access provider.

In order to resolve this problem, I configured the SSIS pakcages to run by referencing the 32-bit dlls :

| sql-server

Release unused space using Shrink

Database's size can be optimized using Shrink command. It helps to release unused space. There're 2 ways to do it: via GUI or via T-SQL.

| sql-server

Add listener to Android ListView

How to add listener to Android ListView.

| java android