Yan Blog

读书需要思考。呜呼,尽信书不如无书

Using Java Reflection to mock an object

By doing this simple program, we can learn how to use Java reflection and mock a object with Google gson annotation. The code import java.lang.reflect.*; import java.util.ArrayList; import java.u...

General Learnings about gRpc-golang

gRpc is a remote procedure call framework developed by Google. RPC is a alternative way to develop a web service compared with RESTful architecture. While, comparing gRpc with RESTful is not proper...

Java Generics: PECS principle

Yesterday, I read about PECS principle from the book effective java. In this post, I want to record my current understanding about this PECS principle by using the ArrayList source code from JDK 1....

Random Execution Order by using Java ThreadPool

This post is to remind myself that when using Java thread Pool created by java.util.concurrent.ExecutorService to execute amount of threads, there is going to be no execution orders. The following...

A Simple Commandline Process Bar by Golang

I saw a question people asked which is how to make a commandline process bar by Golang. Here is a simple one I did. package main import ( "fmt" "strconv" "time" ) func main() { ...

Android Learning Note (1)

This post is to write down what I’ve learnd by using Android. I am a Java developer, and trying to learn Android for fun and future career. There are two reasons why I would like to learn Android. ...

Using Java Regular Expression

In this post, I want to present a simple use of Java Regular Expression. Java regular expression is a very powerful tool for manipulating Strings. The usage can be found in many field (e.g. String...

A Simple Tip for Css Selector

As I am not a professional UI developer, I always learn and get confused about the CSS selector. In this post, I just want to remember myself that for a HTML class, we can assign a number of class...

Tutorial: MyBatis using Java

MyBatis is a widely used light-weight ORM tool. MyBatis can use XML or Java Annotations for configure all Jdbc, sql mapping and POJOs to database. In this tutorial, I will create a simple progra...

A Simple Goroutine Like Java Implementation

One of the greatest aspect of golang is that it is easy to do concurrent thing by using goroutine. In Java, when we want to start a thread, we have to define a class and implements the relative met...