Node.js has released an exe version that can be run on Windows to execute JavaScript on the server. The current version is 0.5.2. On the internet there are various articles on what Node.js is and how to use it.

Microsoft has recently partnered with Joyent to get Node.js running on Windows. Maybe in the future to run on the Microsoft Azure platform (My speculation).

To get started head over to the Node.js site and download the exe. Create an directory to put the exe.

Folder Directory

Create a folder next to the exe for you first Node.js project like Hello. Inside the Hello folder you create an server.js file to create your first web server application.

Here is an very basic example

Server Code

To run the Node.js example open up PowerShell and run the following command:

.\node.exe .\Hello\server.js

Run in Powershell

Now open your favourite browser and browse to the URL you specified in the source file.

Browser Display

That is it! Your first Node.js application running from Windows. Very easy.

Here are some additional links to read:

http://nodebeginner.org/

http://howtonode.org/

http://nodeguide.com/

https://github.com/joyent/node/wiki/

I will later follow up with a full blow HTML application.

Cheerio!

Here are a couple of tips and tricks for Oracle VirtualBox. At the time of writing this blog the latest version of VirtualBox is 4.1. The VirtualBox commands that follow is run in Windows but is more or less the same in Linux environments.

Tip 1 – Clone existing Virtual disk

In command line go to the path of where VirtualBox is installed because you are going to need access to the program VBoxManage. Windows command to change path: cd "C:\Program Files\Oracle\VirtualBox"

Command to clone an existing vdi file:

VBoxManage clonehd "path_to_source_image.vdi" "path_to_destination_image.vdi"

From version 4.1 there is an menu option to clone existing images in the VirtualBox Manager GUI.

Tip 2 – Clone existing Virtual disk to raw format

Cloning an existing image file to raw makes an copy of the image without any compression to the vdi format.

Command to clone to raw file:

VBoxManage clonehd --format RAW “path_to_source_image.vdi” “path_to_destination_image.raw”

Tip 3 – Convert raw image to vdi format

If you have an raw image you can convert it to the compressed vdi file format.

Command to convert from raw to vdi:

VBoxManage convertfromraw --format VDI “path_to_source_image.vdi” “path_to_destination_image.raw”

Tip 4 – Recompress an vdi file

After using an image file for an while it will keep allocating disk space if dynamic allocation is used, but you can reclaim some of that used disk space.

Inside the image you need to remove unused data and use an tool like CCleaner in Windows images to clear temp files.

Then you need to defrag the hard drive inside the image. Do defrag the hard drive twice. I use the tool Defraggler which is much better that the default defrag tool of Windows.

After that you can use the CCleaner drive wipe tool to clear free space only or use an similar tool. This will replace all clear space with 0 bits.

After that shutdown the image file and run the following command to recompress the vdi file: VboxManage modifyhd “path_to_target_image.vdi” compact

This command will remove all those 0 bits from the image file. After running the above command you will see that your vdi disk allocation has reduced. I have successfully shrink an vdi file from 70GB to 41GB.

Tip 5 – Host VMWare images

Firstly on you host you need to uninstall all VMWare tools.

Inside VirtualBox mount the VMWare image (.vmdk file) as an IDE, not SATA (the default when using the VirtualBox wizard).

Make sure the .vmdk filename does not contain '.' suffices.

After that you should be able to run the virtual disk.

 

Hope all these tips help you to run VirtualBox more efficiently and make you life easier. If you use any other VirtualBox command regularly let me know!

Cheerio!

I had the pleasure of presenting at the SA Dev workshop on 27 July 2011.Thanks to everyone who attended and please continue to support the local communities.

My discussion was based on Web application UI testing with open source tools and Visual Studio Testing tools. More specific I was covering AutoTest.Net for C# unit testing, QUnit for JavaScript testing and Web Tests and Load Tests in Visual Studio 2010.

Here is the links to my slides and demo application:

Web UI Testing Slides

World of Football Demo Application

Any feedback is welcome and thanks again!

Cheerio!

Disqus