Node – install and test

One of my friends asked me what is Node and also how do you install and test to make sure it is working.

Well, Node is in essence a javascript server side environment that allows you to write code that will allow the event model to handle requests very quickly since it does not handle the I/O (well almost of all of the functions within node do not!) so there is no-blocking of code.

Node has a very quick and capable http class that allows for the user to create a server that is capable of doing some very quick responses to multiple connections.

To install Node you just need to do this in ubuntu

sudo -s
apt-get install python-software-properties
add-apt-repository ppa:chris-lea/node.js
apt-get update
apt-get install nodejs

the first line allows you to be the root and thus the next commands are as the user root.

Or if you are using windows just download the executable from here

To test the node to make sure it is working with a basic “Hello world!” example if you save this below as helloworld.js.

var http = require("http");
// create the http server function req'uest, res'ult
http.createServer(function (req, res) 
    // 200 = means http response code of found page, then a array of the content type
    res.writeHead(200, {'Content-Type' : 'text/plain'});
    res.end('Hello world!');  // write out the text
// listen on port 8080 on the ip address
console.log('We have started, check your browser on');

I am using a higher number than 1024 for the port because below that you need to be a root user or administrator on windows to allow anything to connect to those port numbers.

So if you now run the program with the javascript file above as the second parameter

node helloworld.js

and then if you open your browser at then you will see

Hello world!

Firefox – Show results from navigation bar

In Firefox the navigation bar will display the first search result if you type in something that is not a valid URL, e.g. if you type in then it will display web site, but if you typed in codingfriends then it would display the first result which is this website.

But to alter the default settings in the navigation bar so that it will display your favorite search engine, I use Google search engine.

If you type in the navigation bar


This will display


Once you have clicked the button, then do a search for


Double click on the value (the one on the right) and change


You are taking out the gfns=1, which means goto the first result.
I have taken more than the gfns because the rest are encoding standards for text.