Watch Titanic Sinks in Real Time


Yet Another Cleaner Way To Construct CSV String in Java

Accidentally found this util class while reading an ebook, and think it worth sharing since myself always found this a tedious code especially prefix and suffix the string.

We used to construct CSV string as below:

With new StringJoiner util in Java 1.8, we can do it in a cleaner way.

The constructor also allow us to prefix and suffix the string.



IntelliJ Darcula For Netbeans

WOW…. finally it come as Netbeans plugin after long awaited. I can now get rid of my own Darcula customisation.

Thank you all contributors who make this happen.

darcula darcula2darcula3



When [The Mermaid] Not Just Comedy


Yet another long-awaited comedy by Stephen Chow.
Not surprise, it hit on top of box office record in China, and good comments widespread across different media.
This movie delivered more than just comedy. It humorously depicts human egoism who treat all creature as nothing but we can monetize.

But have we ever think of, we are just part the world, and we are not suppose to treat all living creature are here for us. They have their own life, they play the role as important as us to make the world a better place to stay.

Classic dialog I like the most from the movie:

如果世界上连一滴干净的水,一口干净的空气都没有,挣再多的钱又有什么意义。~The Mermaid~

Top 10 Country To Launch Startup

Surprisingly, my country being rate by Forbes as one of it.

Source from


My Plant – Little Harmony (小和谐)

It used to be healthy like this…

And when it’s thirsty, it switch to standby mode…

When it’s super thirsty, it switch to hibernate mode… And… no one take action after long time hibernate, it tend to switch to shutdown mode 🙁

After intensive therapy treatment, it seems ok now, and I see hope 🙂


Steve Jobs

Not only Apple… But philosophy we can learn from him and apply in our life…


Running Spring Scheduler In Cluster Mode

Facing an issue where the email scheduler job keep sending duplicate activation email to user after they registered to the system.
After some troubleshooting time, found the culprit was actually spring schedule job running separately in separate node under cluster environment.

I then decide to “borrow” the idea from Liquibase on how it ensure only one instance running the changeset at one time. I first create a table call schedule_lock with column below:

By having the job_type column, we can store different schedule job status in single table. lock_time and lock_by simply store the lock  time and host name for easy debugging later. So the idea behind is pretty simple, any job will need to check against the lock status and their job type before running the job.

For eg: Node A run the job, it own the lock by updating is_lock to TRUE, lock_time and lock_by to current time and host name. Now Node B kicks in with the same job, it then check against the column, found is_lock = TRUE, it know some node already performing the job, so it can have some rest time by discard it’s own job.
After Node A complete it’s job, it will then release the lock by updating is_lock to FALSE, lock_time and lock_by to null.

And here is the code snippet for getting and releasing the lock.

OK, seems everything is now in place and my spring scheduler is “cluster safe”, Yay !

BUT … when the job run again with this new implementation, some weird behavior again happen.
Node A and Node B got the lock one after another, Node A release the lock successfully, but Node B throw an exception when releasing the lock. Logs below explain the situation:

Lets zoom into the code and see what is happening.

In this situation, the only possibility I can think of is Node B run the job first and got the lock by updating the record into database, but before Node B commit the changes into database, Node A kicks in safely with lock status still FALSE, so it then overwrite the lock status updated by Node B just almost immediately.

After some thought, I come out with an idea to make them run in different time by setting random Thread sleep time for each of the job and guess what, problem solved 🙂

p/s: This might not be the best way, as the scheduler job will not run in exact 2 minutes we set, in this case will be 2 minutes + Thread sleep time from 1 – 60 sec. Leave me a comment if you have better idea.


Create Custom Facebook Fan Page Web Address Without 25 Fans

Facebook will allow us to change our fan page username only once after we create, and we will need at least 25 likes to reset the username subsequently.

So what if you have already used up the first chance, and you don’t have 25 fans yet to change the new username?

Here is the tricks which you can by pass it:

1. Create new facebook account, then create a new fan page from the new account.

2. Goto to create your new fan page username.
3. Goto Page Settings –> Page Roles then specify an email address (your real facebook login email) to be the page admin, then click Save to apply.

4. And you will see this.

5. You will receive an email as below after few second, just confirm and proceed to login if needed.

6. All set, you can now start managing the new fan page with new username. Follow step here to delete your temporary facebook account if you no longer using it, since this temporary account is also an admin for the fan page, so people who login using this account will be able to delete the fan page 🙂



Fake It Until You Become It