Kill Node.js!

UPDATE: (4-24-2014) added additional ways to do this based on feedback from the community on twitter! Thanks guys!

Nope! Not what you think, or maybe hoping to find.  Remember, I am an accused “Nodejs Fanboy.”

Ever get stuck with the dreaded:

Error: listen EADDRINUSE

It can put a damper on your day, but never fear.  That error just means that another instance of that particular Node.js program is running, and you need to kill it to start it up again.  When ctrl-c doesn’t work (Mac or Linux) then you need to get all “greppy.” (Yes, greppy is a real serious technical term).

Hit the command line and type this:

ps aux | grep node

Then check for the process ID and type:

kill -9 <the process id you want to kill>

Hope you find this usefull, and remember, most of these posts are for me to remember what it was I did that “one time.”

Additional ways to do this:

A shout out to some awesome folks in the community who tweeted me alternative ways to kill Nodejs.  Thanks folks!

From: @ahmetalpbalkan   Run this command>  killall node

From: @tjanczuk   Run this command>  kill -9 $(pgrep node)

Node.js and C have a conversation about the JVM ..

So I am a huge fan of Tucker and Dale vs Evil as well as being a “fanboy” of Node.js.  Well, for those who don’t know me I have an odd sense of humor, deadpan tongue and cheek.  So don’t freak out, it’s just an amusing “TO ME” thought that just ran through my head…  I have nothing against the JVM.

The part of Tucker will be played by NodeJS, while the part of Dale will be played by C.  The scene is …. (can’t give the spoiler, see the movie)

Node.js: All right… I know what this is.
C: What?
Node.js: This is a suicide pact.
C: It’s a what?
Node.js: These kids JVMs are coming out here, and killing themselves all over the woods  servers.
C: My God, that makes so much sense.

Tucker and Dale, I mean Node.js and C discuss the situation

Hash it out quick with Node.js (md5)

This is a quick how to in creating a simple MD5 hash in your Node.js application.  I am not recommending this for security or to be the best practice for protecting your data, so here is a little background.  Marvel comics just released an API at developer.marvel.com and one of the requirements is to pass them an MD5 hash of a timestamp, public key, and private key.  Being the geek I am I said okay and proceeded to do my thing.

This is so simple it might make you laugh.  To create an MD5 hash in Node.js… drumroll….

var data = "what ever secret I could think of";
var crypto = require('crypto');
var hashedValue = crypto.createHash('md5').update(data).digest("hex");