Mincong Huang Blog
Inspecting Maven dependencies via Maven Depenedency Plugin: dependency listing, dependency filtering, exporting result to file etc.
Introduction to Docker Maven Plugin: how to build and run Docker images in Maven via samples from Debezium and Docker Maven Plugin itself.
Unzipping zip file in Java 8 using builtin Java classes: ZipInputStream and ZipEntry. Implementation supports sub-directories as well.
As a software engineer, what I did this year at Nuxeo over plan, code, build, test, release, deploy, operate, and monitor for Nuxeo Online Services (NOS).
How NOS team improves the performance of Nuxeoctl, Nuxeo Server's command line, recently.
Verify interaction with mock objects with verify(), verifyZeroInteractions() verifyNoMoreInteractions(), and inOrder().
NOS Test is a QA project consists of 3 parts: RESTful API, browser, and command line. In this article, I will explain how I implemented it.
Initialize Mockito mock objects in JUnit using MockitoJUnitRunner, MockitoAnnotations#initMocks, or Mockito#mock.
How JGit optimizes internally the configuration loading process using file snapshots and reduces unnecessary file I/O?
Experience sharing on code coverage measurement of Python program using Coverage.py.
My recent bug fixing experience on Google Web Kit (GWT) with GwtMockito: problem understanding, code refactoring, mocking framework preparation, testing, and comparison between GwtMockito and GWTTestCase.
Fix import order in Java class using Checkstyle's CustomImportOrder module. This article explains how I did it for Nuxeo Online Services.
In my daily work, I have to deal with legacy frameworks. Here are 6 tips that I summarized for bug-fixing, including documentation, searching, testing, patching library and more.
Simple but common use-cases: create options, create option, parse command line arguments, print usage, and more using Apache Commons CLI.
Create a Git hook prepare-commit-msg for inferring JIRA ticket as commit message prefix, based on the branch name.
Fun experience on fixing a custom comparator by identifying the sub-problems, testing different combinations, and finally fix it.
Use option "maven.repo.local" to specify the Maven local repository path.
Listing files inside a JAR or displaying content of a single file using different commands: "jar", "unzip", or "vim".
Glob expression syntax, and its usage in Java through Path Matcher and Directory Stream.
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.
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.
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.
Recently, I merged 20 Git repositories into a single one while keeping the history. Here's how I did it.
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.
Quality Watch (qWatch) is a data aggregator for code quality, based on different metrics.
Understand static factory method pattern in Java with concrete examples from Selenium WebDriver, Jackson JSON object mapper, and SAX reader for XML.
Difference between Vavr List and Java List? I'll compare them via CRUD operations, immutability, performance, streaming, and thread safety in this article.
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.
My study notes of security training (day 3), including insecure direct references, broken access control, improper input validation, and software best practices.
My study notes of security training (day 2), including some ways of SQL injection, Cross-site scripting (XSS), and XML External Entity (XXE).
My study notes of security training (Day 1), including web thread landscape (Java in particular), security tools, and some Juice shop training answers.
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.
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.
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.
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.
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.
This post explains different param annotations in JAX-RS 2.1 and their use-cases, including @QueryParam, @MatrixParam, @PathParam, @HeaderParam, @CookieParam, @FormParam and @BeanParam.
This article explains the common HTTP methods in JAX-RS: annotation @GET, @POST, @PUT, and @DELETE.
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 to show dirty-state, untracked files, stash, upstream in your Bash console: MinGW64 (Minimalist GNU for Windows x64).
Engineering story: how I merge two Git repositories and what are the hidden tasks you didn't think about.
How to speed up a Maven project by using different tips.
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.
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 runs integration tests for your Maven project. In this article, we will see what is Failsafe plugin and its common use cases.
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.
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.
A step-by-step guide for understanding Maven JAR Plugin in Java 8 and Java 11.
A step-by-step guide for understanding Maven Compiler Plugin in Java 11.
In this post, I will explain how to create JSON-LD structured data for Jekyll blog.
Auto Value generates immutable value classes during Java compilation, including equals(), hashCode(), toString(). It lighten your load from writing these boilerplate source code.
The basics of creating a script in Node.JS, including execution syntax, dependency declaration, arguments, template literals, iterations and promises for asynchronous operations.
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.
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.
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...
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...
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.
A simple JS cheat sheet for newbies, containing the basic syntax of commonly used statements: variable, class, array, JSON, ...
I occasionally write Python scripts, but I always forget those very basic syntax. So I'm writing this Python 3 cheat sheet.
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.
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.
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:
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).
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.
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.
Today, I'd talk about how to install and configure ZA proxy for intercepting HTTP requests and responses in localhost in macOS.
Today, I’d like to talk about the famous
Tomcat 8.5 server.
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 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.
This post explains how to configure your Haskell project for testing, using Cabal and Travis CI.
Understand java.util.HashMap in Java 11: bitwise operations, hash computation using hash code, index calculation, and more.
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.
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.
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.
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.
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.
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.
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.
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.
A concret Sonar integration example for your Java project, using Maven + JaCoCo + SonarCloud + Jenkins.
Today, I'd like to share with you the review of year 2017.
Some interesting facts that I discovered about Maven plugins.
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().
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.
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
think it’s worth to take some notes, so I wrote them down and share with you.
Today, I would like to share with you about how to secure your GWT application
by using package
com.google.gwt.safehtml. After reading this post, you’ll
understand how to:
最近在看一本很有名的关于HTTP的书籍，叫 « HTTP: The Definitive Guide »，以下是第六章“网络代理”的部分翻译。网络代理服务器是介于客户端和服务器之间的中间件，它双向地传送HTTP信息。这一章将讲述所有HTTP代理服务器的类型，对于代理服务器属性的特殊支持，以及一些当你使用HTTP代理时将会遇到的比较棘手的行为。
My review note about book "Web Application Security: A Beginner's Guide", written by Bryan Sullivan and Vincent Liu.
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.
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.
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.
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 https://sybextestbanks.wiley.com/.
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 https://sybextestbanks.wiley.com/.
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 https://sybextestbanks.wiley.com/.
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 https://sybextestbanks.wiley.com/.
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 https://sybextestbanks.wiley.com/.
Here’s the guide about how to setup a GitLab server locally using Docker under mac OS through the following steps:
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
ArrayList, and Java Time in Java 8.
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.
Convert Java dates to ISO-8601 string: this post explains how to convert java.util.Date, java.util.Calendar, java.time.ZonedDateTime to string.
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.
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.
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.
Miscellaneous tips for development in Git and Maven.
Git commit hook for checking the JIRA number before commiting.
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.
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.
In this article, I'll focus on how batch indexing is implemented 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.Queryin 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.
The Twilio/Wigle.net 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.
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.
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 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.
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.
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 :
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.
How to add listener to Android ListView.