Sunday, December 16, 2012

Node.js in Windows

If you have not heard of Node.js, you have been missing out. This post is for you.

Node.js is a JavaScript runtime built on Google Chrome's V8 engine.

From the Node.js website:
Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices.

What's the big deal?

When we talk about JavaScript, most people will think about client-side scripting in browser.

With Node.js, you can do server-side coding, with JavaScript. 

Imagine you can create an HTTP server with just a few lines of code:

var http = require('http');
http.createServer(function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/plain'});
  res.end('Hello World\n');
}).listen(1337, '127.0.0.1');
console.log('Server running at http://127.0.0.1:1337/');

Put this code in a file, say myWebServer.js, and you can start running this web server by executing this command in command prompt:

node myWebServer.js

Of course, it is not just about creating a web server. You can put business logic, data access, or anything else that you would typically put in your server-side coding.

If you are familiar with Ruby or Python, this should not be strange for you. The concept is similar; the difference is only the language.

It's been a long wait...

I first heard about Node.js back in year 2010 or 2011, when it was version 0.3.x.

If you visit my Google profile or LinkedIn profile, or if you know me well enough, you would know that I have always been a Windows / .NET developer (read: I don't use Linux, though I played around with Ubuntu a lilttle bit before).

And Node.js at that time had always been a pain to make it play nicely with Windows. You had to install Cygwin, which makes your Windows act like Linux; and there are quite some complicated steps which are enough to deter me from installing it into my own machine. Just look at this post to see how difficult it was.

I did not look into Node.js anymore until last month when I accidentally found out there is finally an official Node.js version 0.8 Windows installer. And it comes bundled with npm, a package manager for Node.js. Sweet!

The Node.js Windows installer was first available since November 2011. I should have subscribed to their news or blog earlier.

With Node.js installed in my machine, I have a lot more to play with now. Can't stop my curiosity itch!

I encourage you to play with it. Head over to nodejs.org and download the installer. The installation is painless and takes just a few minutes. Don't forget npm - there are a lot of useful modules that you can make good use of.

In the future, I'll post more of my experiences playing with node.js. Stay tuned. 

Saturday, December 15, 2012

What is Your Principle?

What guides you in your life?

What guides you in your creation?

A few months ago, I stumbled upon this video.



This talk was given by Bret Victor at CUSEC 2012. Here's a short bio on Bret:
Bret Victor invents tools that enable people to understand and create. He has designed experimental UI concepts at Apple, interactive data graphics for Al Gore, and musical instruments at Alesis. 
Source: Vimeo 
This is a must-watch for everyone. It is about an hour long, but it is worth every minute. If you are a software developer, I hope the idea will resonate with you.

If you are interested with Bret Victor's work, feel free to visit his website at worrydream.com. There are a lot of interesting projects, ideas and papers worth checking out. Most of the projects there reflect his principles.

So, what guides me in my life, in my creation?

I'm still on the road of seeking my principles.

How about you?

Friday, December 7, 2012

Inception

No, this post is not about the movie Inception.

This is about me finally starting a blog.

Inception (noun): The establishment or starting point of an institution or activity. 
Source: Google Dictionary.

I do not know if this is going to last, whether I have enough determination to keep it going.

I have been thinking about this for a year, but never really took an action. I mean, I researched on some blogging platforms, I created blogs, explored around, but never really give out efforts to write posts.

Probably because I have short attention span. Like Kevin Rose. I always got attracted (or distracted) by so many interesting things. I am a Mr Curiosity.

I read more than I write. I consume more than giving out. I think thrice before I do.

Time to change that. Time to start giving out. People always say that you will get more when you give more.

At least this is a good start. I guess.

See you in the near future.