“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


I die a little bit inside every time I come across somebody who hates programming, especially when those people are taking up a programming related major.

I’ve heard from people here and there have different reasons as to why they’re taking up their major. But I’ve heard way too many times that a lot of them abhor the thing they’re supposed to love.

Why is it that some students hate programming? Is it the way it’s being taught? Is it the required critical thinking? Is it a stereotype related thing that people don’t really want to be associated with the nerdy folk? Did they take up a computer course just so they’re on the computer? ಠ_ಠ


One thing’s for sure though. Maybe it just takes another approach. Perhaps it may be that those people weren’t given a chance to excel. Maybe they just need another way of learning how to code. Or maybe a different reason to code.

Are you a programming student and you HATE coding?

Try programming about something you love. This also works well whenever you’re trying out a new language or framework, or just plain practicing.

And as for those I’ve come across.. I wonder what they really feel about coding and why they hate it… well apart from personal preference. I would understand them if they’d at least try of course. And not in a half-assed way.

What to do with a .dsc file (dpkg)

My previous post (Nyancat and The Matrix on your terminal) talks about how you can install Nyancat. Let’s use that as an example to package a .dsc file.

BTW, if you just want nyancat on Ubuntu without packaging anything, you can install it via this command: sudo apt-get install nyancat

Back at the Launchpad page for Nyancat, I went to the latest upload (1.2.2-1) and downloaded all three files into one directory. The tar.gz files are required to package the .dsc file.

  • nyancat_1.2.2-1.dsc
  • nyancat_1.2.2.orig.tar.gz
  • nyancat_1.2.2-1.debian.tar.gz

Then I followed the steps on this linuxquestions.org thread about packaging and installing .dsc files on Linux. Read more