Thursday, August 15, 2013

Installing IDLE in Linux Mint

Within Terminal enter:

sudo apt-get install idle

Proto-Hack Challenge: August

Let's set up a Github account!

Drop a comment with your Github username so we can link up!

I'm Heshuge!

Thursday, August 8, 2013

Proto-Hack Monthly Challenges

Over the course of every month, I'm going to walk through the process of building a useful piece of hardware or software.

Sometimes this code will be a module for general use, or sometimes it may be the combination of previously made modules to result in a greater product.

Either way, stay tuned and get ready to start populating your own toolkit!

The first challenge for August is coming soon, so get ready to code something cool!

Sunday, August 4, 2013

Using Node.js and Non-Blocking Code

One of the largest strengths of Node.js is its great usage of non-blocking code.

In essence, non-blocking code creates a function to handle events as they come, so the program or application will be able to handle new events even if they arise during the last event's execution.

It's the difference between these two bits of code:

var contents = fs.readFileSync('/etc/hosts');
console.log('Doing something else');


fs.readFile('/etc/hosts', function(err, contents) {
console.log('Doing something else');

But what's best, is to define a callback function...

var callback = function(err, contents) {
} it can easily be called with one line of code.

fs.readFile('/etc/hosts', callback);