Controlling the physical storage location of the Azure Storage Emulator

September 25, 2014


You are reading the old blog! This post has been moved to


The Azure Storage Emulator is a very convenient tool for working against mocked Azure Storage services – blobs, queues and tables. However, it appears to have no visible means of setting the physical location used for storage, or even determining it. Luckily, both are easily achieve.


Blobs are stored on the file system, and that location is very easy to control:

  1. Navigate to C:Users<YourUserName>AppDataLocalWAStorageEmulator
  2. Open WAStorageEmulator.<EmulatorVersion>.config with the test editor of your choice
  3. Change the PageBlobRoot and BlockBlobRoot to the location you desire (the default is something like C:Users<UserName>AppDataLocalWAStorageEmulatorPageBlobRoot)

Tables and queues

Tables and queues are stored in a SQL server database (LocalDB by default), so in order to set the physical storage location, we simply need to set the physical storage location of the database (mdf file). We’ll use the sqlcmd utility to do that:

  1. Close all programs that may be using the storage emulator database (the storage emulator itself, management studio, visual studio, etc.)
  2. Run sqlcmd -S instancePath
    • By default the storage emulator uses LocalDB, so the above would be sqlcmd -S (localdb)v11.0
    • If you configured a different SQL Server instance you’ll have to use that instead
    • You can always determine the instance path used by the storage emulator by examining the SQLInstance element in the WAStorageEmulator.<EmulatorVersion>.config file mentioned in the Blobs section above
  3. Type the following commands with [enter] after each line:
    1. SELECT name, physical_name AS CurrentLocation, state_desc FROM sys.master_files;
    2. Go;
  4. You will now see the list of all database files. Pick a file you want to move and note its name and current physical location. For example, suppose you want to move the WAStorageEmulatorDb32 file from its current location to E:StorageEmulatorLocalDBWAStorageEmulatorDb33.mdf
  5. Type the following commands with [enter] after each line:
    1. ALTER DATABASE WAStorageEmulatorDb33 SET OFFLINE with no_wait;
    2. Go;
  6. Move the mdf file from its current location to E:StorageEmulatorLocalDBWAStorageEmulatorDb33.mdf
  7. Type the following commands with [enter] after each line:
    1. ALTER DATABASE WAStorageEmulatorDb33 MODIFY FILE ( NAME = WAStorageEmulatorDb33, FILENAME = ‘E:StorageEmulatorLocalDBWAStorageEmulatorDb33.mdf’);
    2. ALTER DATABASE WAStorageEmulatorDb33 SET ONLINE;
    3. Go;
  8. All done. You can verify the result of the move by re-running the commands in step (3) and observing the new file location.

Knowing where the storage emulator stores its data and how to change that location can be useful. For example, if your C: drive is a small SSD, space may be running low. Conversely, your C: drive may be a slow hard disk drive, and you wish to use a faster SSD for storage emulation.

Obtaining old Mono and MonoDevelop Mac versions

August 28, 2014


You are reading the old blog! This post has been moved to


I was recently looking for old Mono and MonoDevelop Mac versions and realised they weren’t trivial to find. So for the benefit of all mankind, here are the links:

For more information see:

Happy coding 🙂

Getting spinner gifs from a CDN

August 16, 2014


You are reading the old blog! This post has been moved to


Using animated gifs for spinner / loader animation can be quite convenient, and sites such as AjaxLoad allow you to create them to your liking. However, being the early optimization evil person that I am, I was wondering if I could get those off a CDN. There doesn’t seem to be any official support for this, and you won’t get custom taliored gifs to your exact liking, but a sneaky web search reveals quite a few possibilities. For example:

Enjoy 🙂


July 12, 2014


You are reading the old blog! This post has been moved to


A couple of months ago I blogged about TvGameLauncher, a command line tool to help you launch your favorite games on your HDMI-connected TV (or any other connected display) with all the necessary steps carried out for you (change primary display, change default audio endpoint, prevent sleep).

The tool works great (at least for me 🙂 ), but its command-line nature leaves is inaccessible to users who aren’t comfortable with the command line and the entire experience isn’t that much fun.

Enter TvGameLauncherGUI. I’ve created a nice(?) WPF GUI front-end for TvGameLauncher, and also improved the latter for good measure:

  1. There is now a useful “darken non-primary displays” that will darken all displays except the one where the game takes place for improved gaming immersion atmosphere.
  2. TvGameLauncher now employs the excellent NirCmd instead of the previous relatively unknown (and less reliable and updated) tools.
  3. Improved logging, error handling, and more.

Get it at SourceForge, and be sure to check out the 5 minute tutorial on Youtube.



The Windows API Code Pack – the case of the missing samples

June 13, 2014


You are reading the old blog! This post has been moved to


The Windows API Code Pack can be a boon for managed code developers wanting to access Windows functionality such as the TaskBar, Windows Shell, DirectX, Aero, Sensors, and more (see the article for a more complete list).

Unfortunately, the original link is dead (as is the entire MSDN Archive Gallery, may it rest in peace) – you can try the wayback machine but the download link won’t work. As it turns out, the code pack has found a new home in the Nuget repository:

This is all well and good, but these are just the binaries – where are the original code samples? The documentation comprises of thin XML API coverage, not nearly enough for a developer wanting to get started with development quickly. The original download contained many useful samples and these don’t seem to be available anymore.

Fortunately, a quick web search revealed quite a few mirrors of the original package (in its latest 1.1 version) :

And just because I’m paranoid, I’ve uploaded a copy to my OneDrive.

But wait, there’s more! The Windows 7 Training Kit For Developers contains yet additional samples using the Windows API Code Pack!

Happy coding 🙂


Don’t let Work Guy screw Home Guy over

May 1, 2014


You are reading the old blog! This post has been moved to


A great man once said:

I never get enough sleep. I stay up late at night, cause I’m Night Guy. Night Guy wants to stay up late. ‘What about getting up after five hours sleep?’, oh that’s Morning Guy’s problem… That’s not my problem, I’m Night Guy – I stay up as late as I want! So you get up in the morning, you’re exhausted, groggy… oooh I hate that Night Guy!

See, Night Guy always screws Morning Guy. There’s nothing Morning Guy can do. The only Morning Guy can do is try and oversleep often enough so that Day Guy looses his job and Night Guy has no money to go out anymore.

Today, after tackling some annoying WCF issues at a late hour, I realized Work Guy and Home Guy have a very similar relationship.

When I’m at work , I stay to work late cause I’m Work Guy. I  want to track down that bug, I want to finish that piece of code, I want to get that test to pass, I want to study that interesting .NET topic a little further.

“What about getting home at 10:00 PM, missing the gym session you wanted to have, skipping that UFC title fight event you wanted to watch, and delaying that level you wanted to complete in your latest video game?”, oh that’s Home Guy’s problem – I’m Work Guy, I stay at work as late as I want!

So you get home late, and by the time you eat, shower, and write a small blog post you have to go to bed… ooh I hate that Work Guy ! It’s a good thing that by that time you’re already Night Guy, so you can stay up late 🙂

Measuring on-screen pixels

January 30, 2014


You are reading the old blog! This post has been moved to


There are times when measuring pixels on-screen may be useful. This is especially true when following redline specifications (just make sure your browser zoom is set to 100%). There exist many free tools to aid in this task, and this SuperUser thread lists many of them. Luckily for you, I’ve tested most of the utilities proposed in the thread and the winner is… Cropper !


Even though it’s a screen capture utility, it works very well for pixel measuring. Some of its useful features (the full list appears on their site):

  • Always On Top
  • F8 Show the main form
  • Arrow keys Nudge the main form one pixel (hold Ctrl for 10 pixels)
  • Alt+Arrow keys Resize the main form one pixel (hold Ctrl for 10 pixels)

When you need that extreme precision, you can use it in conjunction with the Windows Magnifier:

  • Win + ‘+’ Magnify (will also open the magnifier if not already open)
  • Win + ‘-‘ Reduce
  • Win + Esc Close Magnifier

An honorary mention goes to Meazure. It is an excellent choice if you prefer a more verbose, extremely detailed UI with many features.


There are also various browser extensions that offer similar functionality, but a global tool is obviously better (I actually didn’t like any of the extensions I tried regardless).

Introducing TvGameLauncher

January 12, 2014


You are reading the old blog! This post has been moved to


I recently blogged about Playing PC games on your HDMI-connected TV, and I mentioned a couple of programs you could use to get the job done, along with a couple of batch files you could whip up to ease the process.

Secretly though, I knew it wasn’t enough. So I wrote TvGameLauncher to take care of everything for you (including something I forgot – preventing computer sleep). Everything is now done automatically in one fell swoop.

For example, in order to run ioquake3 on your TV, you could run a command such as TvGameLauncher.exe -t -h 2 -s 0 -e “F:Gamesioquake3ioquake3.x86.exe”

And in order to run Hotline Miami (through Steam): TvGameLauncher.exe -t -h 2 -s 0 -l steam://rungameid/219150 -e HotlineGL.exe

Again, thanks go to Dave Amenta and Michael Welter for their useful utilities that made this possible!

I have some ideas for improvements, but this should suffice for now.



Playing PC games on your HDMI-connected TV

January 4, 2014


You are reading the old blog! This post has been moved to


Many people have a TV connected to their computer via HDMI as their secondary monitor. It is very convenient for HTPC usages, but playing games on the TV can be nice as well (especially when you have a gamepad connected).

The trouble is, most games will only run on the primary monitor, and the only way to get them to run on the TV is to make it the primary monitor. Windows makes this rather easy, but still, doing it manually each and every time before playing can be cumbersome. Fortunately, Michael Welter comes to the rescue with W7ToggleDisplay, a simple command-line tool that does the switching (don’t worry about the name, it works on Windows 8.1 as well). Simply run w7toggledisplay.exe /primary to make the switch.

Another annoyance is in the audio department. Presumably, when you play a game on the TV, you want the audio to come out of it as well (be it through its speakers or through some audio system connected to it). Since HDMI can carry audio, the easiest thing to do is switch the default playback device to the HDMI audio device. Again, this is easy enough to do but a nuisance to do every time. Fortunately, Dave Amenta created AudioEndPointController, a command-line tool that switches playback devices (even though the post mentions Windows 7, I’ve used it on Windows 8.1 without a hitch). First run EndPointController.exe and note the number identifiers for your regular and HDMI audio devices (the X in Audio Device X:). Then Run EndPointController.exe X where X is the number of the device you want to switch to.

Putting it all together

Now that we have all the prerequisites, we can create the following batch file to switch primary monitors, switch to HDMI audio output, run the game, and finally when the game is over switch everything back:

EndPointController.exe X
w7toggledisplay.exe /primary
EndPointController.exe Y
w7toggledisplay.exe /primary

Where X is the ID of your HDMI audio device, Y is the ID of your regular audio device, and Game.exe is the executable of your game.


Unfortunately, the above won’t work for Steam games, since they are not launched directly via their executable. Instead, they are launched via a special protocol that looks like steam://rungameid/219150. You can replace Game.exe above with start steam://rungameid/X where X is the steam ID of your game (as it appears in the original shortcut). This will launch the game, but the trouble is it won’t wait for the game to quit, switching the audio and display immediately back (the /wait switch doesn’t help). I haven’t found a way around that (if anyone is aware of one I’d be happy to hear), so for Steam games I use two batch files. One to switch primary display and audio, and run the game:

EndPointController.exe IdOfHdmiAudioDevice
w7toggledisplay.exe /primary
start steam://rungameid/SteamId

And then another script to toggle everything back (I give it a shortcut so I don’t have to find the icon on the TV every time):

EndPointController.exe IdOfRegularAudioDevice
w7toggledisplay.exe /primary

Happy gaming !

Mapping network resources to local files using Fiddler

December 9, 2013


You are reading the old blog! This post has been moved to


In web development, it is sometimes useful to alter files locally on the client (browser) side and test their behavior.

For example, let’s say I’m the developer of and I want to test mobile compatibility. One of the scripts participating in this mechanism, at the time of writing, is apparently

Now, say I want to make some changes to this file and test them out, but I want to make them locally on my computer. Maybe I don’t have access to the server right now. Maybe I don’t have a convenient testing environment. Maybe I want to test my changes on the production environment without affecting everyone.

Whatever the reason may be, Fiddler makes the process very simple.

  1. In the right pane, click the AutoResponder tab and check Enable automatic responses and Unmatched requests pass through
  2. Find the network resource you wish to replace in the Web Sessions list (in our case, drag it to the AutoResponder rule
  3. Make sure the newly created rule is selected and in the Rule Editor at the bottom write the path of the local file you want to respond with, for example C:wt_capi.js (you can also click the drop-down arrow and select Find a file…)
  4. Click Save in the bottom right corner.
Fiddler AutoResponder

Fiddler AutoResponder

All done. Whenever the browser asks for, Fiddler will intercept that request and respond with C:wt_capi.js (Fiddler will indicate this by highlighting the corresponding session in the Web Sessions list).


In order for the above to work with HTTPS, Fiddler’s certificate must be installed. This is highly not recommended to do on any machine in which you care about security, and ideally should only be done in a dedicated test-only VM. See the following article for instructions:

Note that FireFox requires special handling:

For further information on Fiddler’s AutoResponder see:

A note on Chrome

Mapping is also supported in Chrome both natively and via extensions:

  1. Dev tools workspaces
  2. Tincr (extension)
  3. Devtools Autosave (extension)

However, I was not able to get any of the above to work as reliably as Fiddler.