Infinite | Squares

Art of code and more

Friendly Node.js Error Message

While working with Node.js, I used fs module often. One function that I used frequently is fs.exists() to check if the file is there before doing any processing. Today, I read through Node.js fs documentation and found the following :

Makefile .PHONY

Currently I am working on a Node.js module to abstract cloud storage interaction with filesystem idioms. My partner in the project suggested to use Makefile for running test scripts. So I created following Makefile

Resumable Download and Upload With Qt

Qt is one of my favorite C++ framework. It provides great IDE, GUI components that easy to use and its signal slot mechanism is powerful. I did a lot of work with Qt a while back and wrote some Qt apps for Symbian and Meego (It’s unfortunate that both platform is dead now). I can say that coding with Qt is fun.

Flatten Node_modules

If you worked with Node.js, you might start notice youd node_modules started to simply nested into the abyss and the path is getting longer and longer. Consider this :

/C/Users/ArifSetiawan/Repository/Katch/katch/node_modules/sails/node_modules/grunt-contrib-less/node_modules/less/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-handle-source-errors.js

Yes, it is a headache to see deeply nested node_modules. You got more headache when you see that there are some duplicated node_modules pop out elsewhere. Well, the headache part is subjective my opinion.

Know Your Npm

NPM (Node Packaged Modules) is indespensable part of Node.js ecosystem. Knowing how to use npm is really important when working on Node.js project. Some of the npm commands :

  • npm init –> create package.json file to start a Node.js project
  • npm install MODULENAME --save –> install module and save to dependencies in package.json
  • npm install MODULENAME --save-dev –> install module and save to devDependencies in package.json
  • npm install --production –> skip devDependencies install
  • npm shrinkwrap –> lock modules version dependency for the app
  • npm view -g --depth=0 –> list global installed modules
  • npm view MODULENAME –> view module metadata on npmjs registry, you can check available versions

Resizing MongoDB Data Disk

I received a message saying the are issue in our Node.js app running on Azure: Can’t take a write lock while out of disk space. The issue is clear enough: our MongoDB data disk is run out. I will outlined steps how we can resize MongoDB data disk. Well, it’s not actually that hard. Simplified steps are :

Git Commands Collection

Git is very powerful distributed revision control. It has lots of commands but I only use several of them. I often forget some of the rarely used git commands so I make notes here.

  • git clone REPOURL LOCALFOLDER –> obviously to clone
  • git status –> get status of what files are modified, added or deleted

Hello Octopress

Starting to blog with octopress! blogging with markdown is fun!

Steps on blogging with Octopress

(So I don’t always google)