Friday, October 27, 2017

How to Easily Update NodeJS and NPM on Ubuntu 16.04LTS

The Problem

You are installing nodejs with apt-get on Ubuntu 16.04LTS and it is nodejs version 4.x but you want the latest version 8.x. You also want to be able to install updates easily as they are available.

The Solution

We are going to use node and npm it self to update our outdated nodejs and npm installation that came default from the Ubuntu packages. We accomplish this by using the very handy Node Version Manager from npm called "n". Yep it's only one letter called "n" :))

Let's get started

Use apt-get to install the default outdated version of nodejs and npm.
test@localhost:~$ sudo apt-get install nodejs
test@localhost:~$ sudo apt-get install npm
After it installs both of those packages it's time to update it to node 8.x. 

Update nodejs to 8.x

First we are going to install the very handy node package called "n". 
test@localhost:~$ sudo npm install -g n
It's time to update node it self. It's very easy just run this simple command.
test@localhost:~$ sudo n latest
You can confirm that your have the latest version by running the following command and you should see the output similar to this.
test@localhost:~$ node -v
v8.8.1
test@localhost:~$

Update npm to latest version

First check what version of npm you have currently installed by running this command. On my server it was 5.4.2 as you can see below.
test@localhost:~$ npm -v
5.4.2
test@localhost:~$ 
Now lets update npm using it self. After it installs run the same command as above to see what version you have.
test@localhost:~$ sudo npm install -g npm@latest
test@localhost:~$ npm -v
5.5.1
test@localhost:~$

Celebrate

There you have it. You are running now the latest version of NodeJS and NPM on Ubuntu 16.04LTS. You can us "n" to install other versions of node and switch between them. Here are the links for reference.
You can find me on twitter @LZAntal  or instagram @LZAntal

Thursday, October 26, 2017

The Science of Programming

Thank you all who recommended this book to me after reading my post on Discipline of Programming by EWD. What I was told this book is a more hands on with tutorials and I can use it as a reference. Great complement to my ever growing library of books on CompSci, Math, and Space.
Happy to see that I can order it through amazon with a reasonable price. If you have anyone has more recommendation please find me on twitter or instagram and let me know.

You can find me on twitter @LZAntal  or instagram @LZAntal

Monday, October 23, 2017

Discipline of Programming

I scored big time today at my fav used bookstore. I've been wanting to read Discipline of Programming by Edsger W. Dijkstra for a long time but  never could convince my self to spend $100 or more. I didn't pay that today.... not even close.
Only read the first 40 pages or so and I really like it. It is truly a hard book to read since he does not provide a real world example of the problem he is solving, and the GCL is not applicable to the languages I am using day to day.
However the way it teaches reasoning about programs is really good and something I haven't read or practiced before. So it seems that it might not be a directly applicable text to day to day work but a good source of deep CompSci knowledge. 
The mini prog language he is using is Guarded Command Language. Pretty easy to understand and I kind of wish to have time and maybe give it a shot to implement it someday.

You can find me on twitter @LZAntal or instagram @LZAntal