Node.js: Array looping with async

To be honest, Node.js based asynchronous pattern makes me sick! It can be the worst idea to combine synchronous based coding pattern you’ve learned since first year in computer school. One of very special case of this sickening pattern is to use array based iteration (which is by default, synchronous) to process your data each by each asynchronously and do something else afterwards. Imagine you get code like this :

// data = [{_id: "1", childData: "1"}, {id: "2", childData: "2"}, {id: "3", childData: "2"});
// sum = [{_id: "1", sum: 500}, {_id: "2", sum: 600}]{}, function(err, datas) {
    var count = 0;
    for(idx in datas) {
        // Do MongoDB's relation query somewhere else
        db.childData.findOne({_id: datas[idx].childData}, function(err, childData) {
            count += childData.sum;

    // Show data output

Read More

Node.js 101: #2 The Basic of Node.js

Yesterday, I wrote my first post about Node.js explaining how to deal with its asynchronous non-blocking nature. Now in this post, let jump inside and learn how to code in Node.js. I won’t explain to you about the basic coding (such as sequence, branching and looping) because it is just as same as Javascript language that you know before.

Read More

dnode: Object oriented RPC with Node.js

Node.js has dozen number of library for everything you need to do a network and web application programming. One of old-school style of network or distributed system program is the use of Remote Procedure Call (RPC) mechanism which provided capability for the client to transparently call a function or modify an object inside the server remotely.

Read More

Node.js 101: #1 Introducing Node.js: Blocking vs Asynchronous Non-Blocking

Node.js is one of programming language which become more popular today, especially in the era of Cloud Computing where all of your stuff are saved in a cloud and people can easily reaching (or accessing) the cloud to take or put something in it. It still gaining more programmer who are attracted with its simplicity and capability for scalable based network programming.

Read More