“Cannot read property ‘getsockname’ of undefined” in your stack trace?

If you see this in your stack trace while trying to start your node app..

TypeError: Cannot read property 'getsockname' of undefined

You might probably want to check if port/s your app is supposed to be using are being used by something else.

For example, your app uses port 80. You can check if that port is being used (via the terminal/command prompt):

UNIX (Linux/Mac):

sudo lsof -i:80


netstat -an | find ":80"

If nothing shows up when you do those commands, the ports are open.

If something shows up, then the port’s being used. You know what to do.

MongoDB “Eager Fetching” Workaround in GeddyJS

As you all know, there’s no such thing as a JOIN in MongoDB. The burden of applying logic is on the application side.

SQL Adapters (like MySQL and PostgreSQL) have an eager fetching solution from the GeddyJS Model ORM. Eager fetching would look like this (taken from the code sample in the GeddyJS tutorial):

this.index = function (req, resp, params) {
  var self = this;

  geddy.model.ToDo.all({}, {includes: 'steps'}, function(err, toDos) {
    if (err) {
      throw err;
    self.respondWith(toDos, {type:'ToDo'});

This would definitely work for an SQL Adapter.. but what about MongoDB with linked collections? The GeddyJS dev team might put this feature up in the future but it has yet to be done.

So let’s do a workaround for now! Let’s assume that we have two separate models (and collections) named ToDo and Step. Read more

GeddyJS, MongoDB, and Querying Subdocs? Try Mongoose

For the past few months I’ve been working on studying NodeJS. Currently, I’m trying to work with the GeddyJS Framework (geddyjs.org). Now they have a database agnostic ORM built into it that can support the likes of MySQL and PostgreSQL but also MongoDB and even flat files.

Unfortunately, there are some things that can’t work very well with the built in ORM (like MongoDB though it does have some functionality) and you might end up on your own there while some things aren’t supported. Now it’s still possible to use a different ORM so don’t npm remove yet!

For example, you have a schema that looks like this:

var Deck = function () {

    title: {type: 'string', required: true},
    cards: {type: 'object', objectProp: [{name: 'string', type: 'string', id: 'string'}]}


Now let’s say you wanted to find all Decks that had a certain card name in it. You can’t use the built in Geddy Model ORM for that yet.

Come in MongooseJS (mongoosejs.com). Actually you can use any other ORM for that matter but for simplicity’s sake let’s use Mongoose. Read more

Device Memory Running Low on Samsung I9100 Galaxy S2

There was a really big problem plaguing my phone the past weeks. For some reason, even if the apps installed weren’t taking up much space (a couple hundred MB at max), my device memory was running low (1.7GB out of 1.97GB). Here’s how I instantly cleaned 700MB off of it:

Read more