Stay Hungry. Stay Foolish.

Time flies in 2016. It’s almost 4th quarter of this year.

Looking back, so many things has happened this year, including baby Max, parents arrival & leave, quitting DOTA, excessive weight gain and limited exercise including early morning dog walking.

Quietly, so many other important aspects in me have also changed. Gold has slipped by before I could realize the substantial damage inside.

I need to remind myself again,

  1. Stay Hungry, stay foolish
  2. Keep fighter attitude
  3. Let presure drive instead of crash

Technically, maintain a good routine as,

  1. Keep Side project going
  2. Constant reading from Hacker News
  3. Clear objective & promises, and be competent of finishing it
  4. Keep posting weekly

Life isn’t going any easier as same as this blog/post won’t go anywhere else. Keeping the reminder of the future days (drinking chicken soup).

Don’t die inside. Keep fighting and thriving.

– The end –

Handy script to work with PDF files

PDF is commonly used printing file format. Creating & organising it might be a bit hard if without Acrobat Pro’s help.

Today I discovered some open source lib to manipulate PDF files, including Creating, Splitting, Merging, and Re-Ordering PDF pages.

Below is the script line for creating PDF,

echo 'Hello World!' | enscript -B -o - | ps2pdf - content.pdf

-B for enscript omit the header for the output

Here is the script for re-ordering the raw PDF into a book-style printable version.


if [ $# -ne 2 ] ; then
    echo "Invalid input supplied, please choose input PDF and page counts"
    echo "    example : ./ <input.pdf> <pageCount>"
    exit 1

echo "Formatting begins ... "

let "blankPageCount = $pageCount % 4"

# Check if blank page padding needed, if so create one
if [ $blankPageCount -ne 0 ] ; then
    echo ' ' | ps2pdf - blank.pdf 

# setup each fold loop - one fold means one print page
let "foldCount = $pageCount / 4"

echo "    total $foldCount printing slides generated";
echo "    with $blankPageCount blank pages";

while [ $startFold -lt $foldCount ] ; do
    let "coverPrintpage = $startFold * 4 + 4"
    let "leftPrintpage = $startFold * 4 + 1"
    let "backPrintpage = $startFold * 4 + 3"
    pageOrganizor="$pageOrganizor A$coverPrintpage A$leftPrintpage-$backPrintpage"
    let "startFold += 1"

if [ $blankPageCount -eq 0 ] ; then
    cmd="pdftk A=$file cat$pageOrganizor output fmt_output.pdf"
elif [ $blankPageCount -eq 3 ] ; then
    let "blankStartPage = $pageCount-2"
    cmd="pdftk A=$file B=blank.pdf cat$pageOrganizor B A$blankStartPage-$pageCount output fmt_output.pdf"
elif [ $blankPageCount -eq 2 ] ; then
    let "blankStartPage = $pageCount-1"
    cmd="pdftk A=$file B=blank.pdf cat$pageOrganizor B A$blankStartPage A$pageCount B output fmt_output.pdf"
    cmd="pdftk A=$file B=blank.pdf cat$pageOrganizor B A$pageCount B B output fmt_output.pdf"

echo "Merging pdfs ... "

# cleanning up
echo "Cleanup and done"
if [ -e "blank.pdf" ] ; then
    rm blank.pdf

Outline about RESTful API system

Recently I have been doing RESTful API programming a lot. My understanding about RESTful evolves from “HTTP-Only” request to something more. Below is what I get from recent thoughts.

  1. REST is Representational State Transfer

    It is and only is a design framework for making network communication “web-like.” No specific protocol was proposed, and its main focus was on the communication part. Several questions should be considered during the developement,

    • What are the components of the system?
    • How should they communicate with each other?
    • How do we ensure we can swap out different parts of the system at any time?
    • How can the system be scaled up to serve billions of users?
  2. Client-server

    This is basic system flow of any REST system looks like. It has to be 1-to-1 flow with a centralized resource server. And any other parties who wants to interact with the resources

  3. Stateless

    Most important principle in REST, which means “Each request is treated as a standalone“. In detail, when a client is not interacting with the server, the server has no idea of its existence. The server also does not keep a record of past requests.

  4. Stable identification of resources

    Each resource must be uniquely identified by a stable identifier. A “stable” identifier means that it does not change across interactions, and it does not change even when the state of the resource changes.

  5. Manipulation of resources through representations

    Client manipulates resources through sending representations to the server–usually a JSON object containing the content that it would like to add, delete, or modify. In WEB case, it sends an HTTP POST or PUT request with the content to the server. The server sends back a response indicating whether operation was successful.

  6. Self-descriptive messages

    A self-descriptive message is one that contains all the information that the recipient needs to understand it. In WEB case, for example, request like below

    GET / HTTP/1.1

    This message is self-descriptive because it told the server what HTTP method was used, and the protocol that was used (HTTP 1.1).

    The server may send back a response like this:

    HTTP/1.1 200 OK
    Content-Type: text/html
    <!DOCTYPE html>
        <title>Home Page</title>
        <div>Hello World!</div>

    This message is self-descriptive because it told the client how it needs to interpret the message body, by indicating that Content-type was text/html.

  7. Hypermedia

    Hypermedia is a fancy word for data sent from the server to the client that contains information about what the client can do next–in other words, what further requests it can make. (Optional)

  8. Cache refers to the constraint that server responses should be labelled as either cacheable or non-cacheable. It should contains in the “self-descriptive message” described mentioned above.
  9. Layered system refers to the fact that there can be more components than just servers and clients. For example, proxy as load balancer, or security checker, authenticator, gateway.
  10. Code on demand works as the ability for a server to send executable code to the client, for example, HTTP server send <script> tag to client to execute locally.

Quora Read about Job Difficulty

Today I came across a question about Job Difficulty in Quora. Ref

One line here hit me the most,

I believe comments are an abomination – if you need to comment the code, its overly complex and the code should be rewritten to be clearer

I can’t agree more.

Once in my early days of coding, I believe code should be properly commented with reasonably “human language” explanation.

However, when the coding progress, it really comes to a question of “why will I comment this well structured, perfectly cleared and beautifully styled code?”

Well, most of the times, daily tasks involves clear, straight-forward meaning of code which doesn’t requires too much thinking on algorithms, or sophisticated calculations. If you are writing something too complicated for a production env purpose, you are either over thinking the objective, or you just doing it quite inefficiently. Most of commonly used functionalities, (like jquery-file-uploader, or node cheerio, or node mongoose), try to find a library, and improve from there externally.

In summary, comment are only used for pieces of code where GEEKs wrote in dodgy “Hackthon” project where it can cut-corners, and improve trivial performance in exchange of hard reading style, in which case I would highly doubt there will be a comment.

Normal coding should always follow best practice, structure the code clearly (MVC, middleware, etc). Naming properly with intention of the code objectives. and styled consistently throughout the code. (Which means always space/tabs, and tabs is of 4 spaces wide).

Thanks for reading, keep up to date with resume & coding.

Shock Shock Shock, life is fast – 56 UP

56 UP Review

I got tremendous shock after view the moving called 56 up. Its way of expressing one’s life in a flash urges me doing something worthy immediately.

Once I were young, I thought there will always be plenty of time to plan things, and lay back a bit to enjoy the life a little bit, and push other important things later. Because I knew at that time, for certain, if I became determined at some later moment, I will finish the task which was important to me.

However, that moment never came…

I always find myself lots of reasons to make myself believe that I was delayed for so many practical reasons, holding the fear of facing the fact that I was behind schedule.

Life is to short for planning and holding unrealistic reasons to wait, to hesitate. In a flash, I am already near 30. I dare to say, when I am near 50 and started looking back, life is still in a flash. And you will never know where all the time has been gone when you can achieve so many and so much while you were 30.

Life has been given equally to all human being in terms of time. The question is whether one can seize it and accomplish something worthwhile.

The deepest fear in me now is spending the time for absolutely nothing, accomplished nothing. Waste my life in wandering. When look back, there is nothing worth mentioning. And life is already behind me, and then started deeply question myself, what have I done to my life?

Most people won’t regret, at lease won’t admit it to themselves. But the truth is they know for sure there is nothing can be done to fix the issue which are already happened. There are so many thing cannot be undone once the timing is passed.

So seize the opportunity now, and leave no regret in the future.

Push harder, and harder. The only reason of being unsatisfied is not pushing hard enough.

Only in that sense, one can say for sure, my life has reached the upmost limitation. Even that limitation is so insignificant comparing to others. You know for sure, you cannot do any better even if with a second chance granted.

TPG acquired iiNet for 1.4 Billion AU dollars

Absolutely out of no where, I heard colleagues talking about iiNet acquisition this morning after I stepped into the office.

Firstly, one colleague came to us say “HiFI”, and others are applauding.

Then several minutes later, majority of people are discussing about the stock price. Saying they should buying more beforehand.

It turns out the stock price really rock up from 7.4 to 9.1 (17:03 at Syndey time 13rd March, 2015).

What a shocking news. This is a Capital Game!

Agile software development


  • Individuals and interactions over processes and tools
  • Working software over comprehensive documentation
  • Customer collaboration over contract negotiation
  • Responding to change over following a plan

According to Kent Beck, the Agile Manifesto is based on twelve principles:

  • Customer satisfaction by rapid delivery of useful software
  • Welcome changing requirements, even late in development
  • Working software is delivered frequently (weeks rather than months)
  • Working software is the principal measure of progress
  • Sustainable development, able to maintain a constant pace
  • Close, daily cooperation between business people and developers
  • Face-to-face conversation is the best form of communication (co-location)
  • Projects are built around motivated individuals, who should be trusted
  • Continuous attention to technical excellence and good design
  • Simplicity—the art of maximizing the amount of work not done—is essential
  • Self-organizing teams
  • Regular adaptation to changing circumstances


个体和互动 高于 流程和工具
工作的软件 高于 详尽的文档
客户合作 高于 合同谈判
响应变化 高于 遵循计划







根据3月5号最新RBA消息:Statement by Glenn Stevens, Governor: Monetary Policy Decision