Windows 8 Pro

I have updated three PCs to Windows 8 Pro, so far. The Windows 8 upgrade tool that you download at makes buying, downloading, and installing or updating, a breeze. This post will not go into the nitty-gritty of the update procedure itself, but will cover my general impressions of Windows 8 Pro. All thoughts are from the point of view of a Windows 7 user accustomed to the mouse and keyboard.

Start Screen

The Start Screen is a much better replacement for the Start Menu. I don’t miss the Start Menu. To access programs that are not available as a tile on the Start Screen itself, invoke the charms bar (Windows+C or take mouse pointer to the top or bottom right corner) and choose Search. The charms bar is well worth becoming familiar with, it is also used for searching and changing settings inside an app.

Windows 8 Apps

This is the most exciting new area of Windows 8, Apps. The Windows 8 Store is still a poor cousin of stores for Android, iOS, and OS X. That may change rather quickly once more and more developers adopt Windows 8.

The first app I downloaded from the Store is Netflix. What a difference that app is from the browser-based offering. It drops Silverlight as a development platform, which allows it to use much less CPU, in the range of 2 to 5%. That should significantly boost battery life. If you miss the search functionality remember that you can search using the charms bar I mentioned earlier.

Apps for Windows 8 from Microsoft that come preinstalled and I have tried are – Calendar, Mail, Messaging, Music, People (Contacts), Reader, and Weather. The apps are all quite slick and I will be using them all going forward. For communications related apps, it is easier to use the Start Screen as a dashboard to quickly view all the pending notifications, and go back to work.

The Reader app allows viewing XPS and PDF files. EPUB support is sadly missing, and there are no good apps in the Windows store for reading those. I am sure that will change rather quickly.

Other noteworthy apps that I have downloaded and will be using on a regular basis are – Chrome, Google Search, Kindle, Music Maker Jam, Skitch, and Skype.

Windows Desktop Accessories

Windows Explorer looks and feels much better with the ribbon toolbar. It works quite as expected. One useful addition for those that have a lot of media backed-up to ISO files, Windows Explorer can now mount them as a virtual drive.

Even though there is a new Music app which works quite well, Windows Media player is available as well. Microsoft is also offering the Windows Media Server as a free upgrade at the moment. That upgrade brings support for watching DVD movies, and viewing and recording live TV.

The Task Manager has improved a lot. It has a richer UI and gives a better picture of CPU, memory, network, and disk activity. It is much easier to disable apps that launch at startup from the Startup tab.

Developer tools

Visual Studio 2010 works just fine even though the upgrade tool highlights it as not being compatible with Windows 8. Tools based on Java and the Visual Studio Isolated Shell also work.


I have used Origin and Steam based games without any hick ups. Game titles like The Sims 3 and Fifa work all right. I am quite confident that is the case for most games that work on Windows 7. Try running a game in compatibility mode if it fails for some reason.


Windows 8 is a breath of fresh air. It deserves its place besides the likes of Android, iOS, and OS X. I hope you’ll agree.


Node.js and Sqlite3

Node.js and Sqlite3 can be used as a foundation for apps that are cross-platform, browser-based (leverage HTML5), and network-intensive. In this post I comment about some of the work required in building such a foundation.

Install sqlite3 for Node.js on Windows

The installation procedure for the sqlite3 module is slightly complex and requires that you have installed the python interpreter and the VC++ compiler. Then just head over to the command prompt and run:

npm install sqlite3 --arch=ia32

You can add the -g option after npm if you want to install to the global node_modules folder. The arch option is required for the module to work on Windows 7 64-bit. Without it you’ll get a cryptic message like:

Error: %1 is not a valid Win32 application

Hopefully, at some point pre-compiled binaries will be provided for Windows.

Opening or creating a database

I like to maintain a database creation script. The code below is a simple example of how I detect and execute the creation script.

var fs = require('fs');
var sqlite3 = require('sqlite3').verbose();

fs.exists('database', function (exists) {
  db = new sqlite3.Database('database');

  if (!exists) {'Creating database. This may take a while...');
    fs.readFile('create.sql', 'utf8', function (err, data) {
      if (err) throw err;
      db.exec(data, function (err) {
        if (err) throw err;'Done.');

Here’s how create.sql may look like:

CREATE TABLE customer (


Embedding Node.js

It is rather convenient if you can package Node.js and its modules in a single installer. I discussed this in a post about the Wix Toolset recently. I use npm without the -g option to download and install all modules in a node_modules folder. I place the single executable version of Node.js in the same folder. The installer just needs to package that folder, and you have a Windows-specific package of Node.js and your application’s module dependencies ready to install.

JSON and associative arrays

JSON does not support serialization of associative (key-value pair) arrays of the kind

var a = new Array();
a['a'] = 'a';
a['b'] = 'b';

This means that Socket.IO and other code that relies on JSON serialization will not work. It is also not wise to use large numeric values as the array index, for instance

var a = new Array();
var id = '1000';
a[id] = 'foo';

This will result in an array with 1001 items, where the first 1000 items store nothing. This array when serialized will result in a really long JSON string.

The solution is to use a sequential counter, or use the push method to add an object into the array. Of course, finding an object in a large array will be slow. You’ll have to scan array items sequentially till you find the desired object.

Adding lots of source files to a WiX installer script

Now that Visual Studio has dropped support for creating installers, I have taken to studying the WiX Toolset quite earnestly. Manually editing the WiX script is all right as long you have a handful of files. A particular installer I am working on has over nine hundred. I need to bundle the Node.js executable along with all the node_modules.

A quick look at the WiX documentation revealed the heat tool, that when executed thus produces a script file with elements that we can copy and paste into your wxs

"c:\Program Files (x86)\WiX Toolset v3.6\bin\heat.exe" dir . -o out.wxs -cg MyComponentGroup -sfrag -gg -g1

The dir option followed by a . tells heat to gather the directory structure (source file) information from the current folder and its children. The cg option tells it to create a ComponentGroup with an id of MyComponentGroup. The sfrag option tells it to suppress wrapping individual directories and components in a Fragment element. The gg and g1 options tell it to generate GUIDs for the components, but without the curly braces.

The Component elements can be copied from within the TARGETDIR DirectoryRef element in out.wxs to the target wxs. Similarly, the list of ComponentRef elements in the MyComponentGroup ComponentGroup can be copied into the Feature element of the target wxs.

A Sample Wix Installer Script

The following installer script can serve as a starting point for your installer. It does several things

  • Install files and folders to User’s Local AppData folder
  • Add shortcut to node.exe in the Start menu and on the Desktop
  • Add a shortcut to uninstall the app in the Start menu
  • Uninstall older version when upgrading
  • Allow killing node.exe during uninstall if it is in execution
  • Customizing the icons and bitmaps that appear in the installer UI

Remember to replace UpgradeCodeGuidHere with a valid GUID. GUIDs can be generated by executing guidgen.exe from Visual Studio’s Developer Command Prompt. Choose the registry format and remove the braces. There are also quite a few online GUID generators.

Compiling and linking

To compile the above script using the WiX compiler, execute

candle.exe demo.wxs -ext WixUtilExtension

To link the object file produced by the compiler and create an msi, execute

light.exe -out demo.msi demo.wixobj -ext WixUIExtension -ext WixUtilExtension

You can put both steps in a batch file

set WIX_BIN=c:\Program Files (x86)\WiX Toolset v3.6\bin\
echo Wix Toolset Bin Path: %WIX_BIN%
"%WIX_BIN%candle.exe" demo.wxs -ext WixUtilExtension
if exist demo.wixobj (
  "%WIX_BIN%light.exe" -out demo.msi demo.wixobj -ext WixUIExtension -ext WixUtilExtension

Microsoft Visual Studio Express 2012 for Web

Visual Studio Express 2012 for Web, or VS Express for Web as its shortcut is called, is a fairly competent free IDE for developing Browser apps. It has some nice entry-level features, that compete favorably with features in IntelliJ IDEA Community Edition (Free) and WebStorm, both from JetBrains.

I like the ability to start working with HTML code by opening a folder as a Web Site. These are some noteworthy features:

  • Open a Web Site from a folder. Execute it in Google Chrome. Yes, that is quite literally the default browser if you have it installed. Static content is delivered by an ASP.NET Development Server.
  • Edit HTML. The editor does syntax highlighting, code folding, and document formatting. It validates HTML on the fly and shows errors in the editor. You can jump to CSS style definitions. It has a design mode, where you can do WYSIWYG editing, add typical HTML components (tags) from the toolbox, and edit their properties. Nice for typical server request/response applications, but not so useful for single page applications.
  • Edit JavaScript, inline or in a .js file. The editor does syntax highlighting, code folding, checks for mistakes in syntax, and supports IntelliSense. If you are toying with TypeScript, there is a Visual Studio 2012 extension that adds a new project type called  HTML Application with TypeScript.
  • Edit CSS. Does syntax highlighting, validation, and document formatting. IntelliSense supports CSS3. Context-sensitive help for a keyword (F1) takes you to its documentation at MSDN.

There are several things that can be improved. Refactoring support, a tremendous feature in WebStorm, would be a welcome addition. I haven’t yet had the opportunity to try other editions of Visual Studio 2012. Better features are probably reserved for paying developers.

Transfer lots of data between PCs

So, you just bought a new PC and are wondering how you’ll transfer tons of data from one to the other?

Here’s a quick tip. You probably have a gigabit Ethernet adapter on both and can use an Ethernet cable to transfer gigabytes of data in a couple of hours.

Just plug a regular Ethernet cable into both PCs, configure network interfaces with  static IP addresses, and you are ready to transfer your data. Older Ethernet adapters may have difficulty with a normal cable, you may need a crossover cable, but most adapters auto-detect crossover and work with regular cables just fine.

Configuring the static IP address is operating system specific. So is file copying. On Windows, use the network adapter settings page to access Internet Protocol version 4 properties. Set the network address to something like on one PC and on the other. Set the network mask on both to

Now, just share a folder or disk you wan’t to copy over the network, and access it from the other PC to copy whatever files you need. I got an average data transfer rate of about 25 Megabytes per second. That is far less than the theoretical 125 MB per second I should get from gigabit Ethernet. Need to figure out why, but it got the job done.

Of course, if you have an external USB drive, you can save yourself the pain above, and use that for doing the transfer, even though it may take at least twice as long.