Understand node stream (what I learned when fixing Aws sdk bug)

Node.js stream

Node.js provides asynchronous I/O base on event loop.
When reading and writing from filesystem or sending http request,
Node.js can process other events when waiting for response, which we called it non-blocking I/O.
Stream is an extend of this concept, it provides an event base I/O interface to
save memory buffers and bandwidth.


What I Talk About When I Talk About Pairing

Pair programming, I used to heard a lot about it.
Some said, it is fun.
Some said, it produce good and clean code.
Some said, you can learn from your pair everyday.
Therefore, When I have chance to join a pair programming shop. I took the offer without any hestitation.

So after 7 months of pair programming. I thinks it’s a good time to talk about it.


Understand chef lwrp (Heavy version)

Recently I am mainly working on devops things, including system admin and chef.
We are refactoring our old chef recipes into a more modulize shape with tests,
So I think it’s a good time to share some experience in this refactor!

Resource and Provider in Chef

In chef, we use resource to describe the state of our system.
And cookbook is a series of resources that describe the server state.


Test driven server configuration with chef

Recently I am working on Devops things, including server, network,deployment and chef scripts. In the Devops team, we are working hard on refactoringour old chef recipes into more clean and modularize cookbooks.So I thin


Announcing Code-Warrior

Recently I am preparing the interview with some companies in West Coast.
One of the problem I have during the preparation, which is because I am a vim user,
It is uncomfortable to practice algorithm questions on TopCoder, so I think it would be great if I have a npm tool that can
download algorithm problems and provide some skeleton test case for practice.
Therefore I created Code-Warrior


Bacon.js for dummies

Bacon.js is an FRP module for events on javascript. Which can transform
your event listener/handler to a functional event stream. After servey a few blogs and example project,
I found it is a really interesting concept and can make event handling speghetti code into clear functional logics.

Event stream

First, what is event stream?
Actually it is nothing special, it is just an event listener that listen to specific event.

For example,

$("#clickme").on('click', function(event){ alert(event.target)})

Can transfer to event stream by Bacon.js’s asEventStream helper:

clicked = $("#clickme").asEventStream('click')

And add handler to event stream, listen to click event:

clicked.onValue(function(event){ alert(event.target) })


express bigpipe experiment


Bigpipe is an unique frontend technique used by Facebook to increase their page rendering speed.

When I read the article talk about bigpipe on facebook, I was pretty shocked about how facebook implements those unique ideas to
increase their page rendering speed.

Recently I am using node.js for web development, I think the async structure of node is a perfect environment to use this technique, so I wrote a small experiments app with express:


Understand event loops

Event loop is the core feature in node.js,
and is also the reason why it is better on handling requests and realtime communication like long polling.

The Obstacle of IO

The reason is on this is because the I/O is expensive:


Review of 2012

2012 is a great year for me, lots of new things and new experience happened,
and I also explored and learned lots of things in software from work and projects.

In the last day of 2012, I think it is a good time to review what I have done in this year,
what I can improve and my expectation for the incoming year.


Announcing N37 url shortener

Few days ago, I started to work on a simple url shortener. The original idea was from one of my friends, he mentioned about the idea of implement a simple and deployable url shortener. This idea just popout my head when I was working on other side project. So I spend a few days working on it and it turns out to be an interesting project that I want to blog about:

A Url Shortener

A url shortener, as its name, is a application that provide user a shorter version of url. Like the most famous one: tinyurl.com, which map the url address into a short sequence of code, like tinyurl.com/ccxngqo. Make user easier to share the link on social media like twitter or forum.