Saturday, September 28, 2013

Building and installing NodeJS on Ubuntu 12.10 ... for noobs (like me)

So I'm a .NET guy and not that much of an expert on Linux. However, recent projects renewed my enthousiasm for JavaScript (AngularJS and KnockOut). Looking at some JavaScript best practices quickly leads to looking into testing and often the testing is done command line and requires NodeJS to be installed.

Obviously, I could have just installed Node on my windows machine (which seems to be possible and is supposed to be very easy), but I'll do it on my Ubuntu Server instance just because I can (or learn). And I found a nice video that walks me through the process: http://www.youtube.com/watch?v=ogprXGQWrQk

So, let's get started. I fired up my Ubuntu and I've read you need to start updating the package manager:

sudo apt-get update
sudo apt-get install git build-essential wget

Now get the latest version of Node and download it to you machine

wget http://nodejs.org/dist/v0.10.18/node-v0.10.18.tar.gz

Untar it 
tar xvf node-v0.10.18.tar.gz

Which is e(x)tract, (v)erbose output and (f) file as input.

Go into the folder 
cd node-v0.10.18
./configure

make
sudo make install

OK - the compilation was quite slow and took more than 10 minutes. I noticed in my vSphere client that only 1 processor was running out of the 8 that the VM has available to it. So Googling resulted in:

make -j
sudo make install

To use all cores. Building Node now only took 2 minutes... NICE. And yes - it worked right away! Piece of cake this.


Sunday, September 1, 2013

JavaScript weekend in videos

We're currently working on an AngularJS website which is really awesome to be doing. So, we're writing a bunch of JavaScript. I wanted to raise my JavaScript knowledge to a higher level so I've been watching some YouTube movies on Javascript this weekend.



Here are a few interesting ones I had a look at.

A 3 part series on JavaScript by Douglas Crockford:
- Part 1: Douglas Crockford: The JavaScript Programming Language
- Part 2: Douglas Crockford: An Inconvenient API - The Theory of the DOM
- Part 3: Douglas Crockford: Advanced JavaScript

A quick 'by example' explanation of closures
Video by Bob Tabor.

Javascript patterns
Which will then lead me to understanding Javascript Patterns - as described here: Learning JavaScript Design Patterns



Javascript Ninja level
Finally - there is this site: http://ejohn.org/apps/learn/ - a site by a guy named John Resig who knows a thing or two about JavaScript ... he created jQuery.