Author Archives: admin

Solving Poor RDP performance for Windows 8 clients under Parallels 8 (OSX Mavericks)

If you are somewhat like me, purchasing a new copy of Parallels each year to receive a couple of “bug-fixes” and “performance updates” ranks somewhere between a visit to the dentist and a prostate exam.

Hence you may probably understand my frustration when I faced serious performance issues accessing a brand new copy of Windows 8.1 remotely via RDP. Via RDP, you ask? Yes, it just so happens that I utilise a “high-end” Windows 8.1 workstation to access my MacBook Pro via VNC. The Windows virtual machines on the MacBook are accessed via RDP. There are also two Linux Virtual Machines that I connect to as well, but mostly via SSH. They are not pertinent to this article, and I’m not sure why I bothered mentioning them in the first place!

The image below may explain how I conduct my daily affairs (cough.)

Parallels RDP performance

The Windows 7 VM was not exhibiting any performance issue, so it was definitely not something that was network related. Allocating additional physical resources (RAM, VRAM) to the Windows 8 VM did nothing to improve performance.

A Google search proved useless. Sure, there were numerous posts that encouraged me to mess around with the TCP auto-tuning feature, namely…

netsh interface tcp set global autotuning=disabled

which didn’t work. You can go ahead and execute the command from an elevated command prompt though, to see if it makes a difference on your hardware.

After sprouting a couple of additional grey hairs, I decided that the best bet towards solving this issue was to determine the type of hardware acceleration used within the VM. RDP on Windows 8.x tends to rely extensively on acceleration within the video drivers on the host. Was it possible that the drivers installed by Parallels weren’t good enough?

I shut down the Virtual Machine and looked at the Configuration –


From within the configuration dialog box, I clicked on the Hardware tab, followed by Video. I soon saw something very interesting. My pre-existing copy of Windows 7 was using DirectX 9 3d Acceleration. However, the new Windows 8.1 Virtual Machine was configured to use DirectX 10 instead! Could this be the holy grail to my RDP woes? I changed the hardware acceleration to DirectX 9 and rebooted the Virtual Machine…


And lo and behold… it worked! RDP performance was as smooth as a hot knife through (low cholesterol) butter, and performance matched my Windows 7 RDP session. I have no idea why this made a difference. I can only speculate that Parallel’s DirectX 10 drivers aren’t optimised for RDP. They are instead most likely optimised for gaming on the same physical machine that runs the virtual machine.

Blocking an application for all users on a machine

Administrators and Developers may often want to block a single application for all users on a machine. The method listed below is probably one of the simplest (IMHO) available online.

The standard technique involving the use of adding a key named DisallowRun to HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer does not work. The DisallowRun trick (as most users have discovered) only works for a single user. Others (including myself) have tried prodding around with the .DEFAULT entry to no avail…

The solution lies within an alternate set of registry keys which are modifiable through the Local Security Policy tool (secpo.msc). I’ve done the dirty work and listed the actual registry modifications below. Simply copy the content between the BEGIN and END markers into a .reg file of your choice and then run it as an Administrator. Alternately, use your favourite programming language to access, create and write the keys below.

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Group Policy Objects\{F0F4E578-34CA-4B81-B36C-6D01C6DCD3B1}Machine\Software\Policies\Microsoft\Windows\Safer\CodeIdentifiers\0]

[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Group Policy Objects\{F0F4E578-34CA-4B81-B36C-6D01C6DCD3B1}Machine\Software\Policies\Microsoft\Windows\Safer\CodeIdentifiers\0\Paths]

[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Group Policy Objects\{F0F4E578-34CA-4B81-B36C-6D01C6DCD3B1}Machine\Software\Policies\Microsoft\Windows\Safer\CodeIdentifiers\0\Paths\{a798b6fd-44d7-4246-a5f3-38003abaecce}]
— END —


  • The actual application that needs to be blocked is within the ItemData key.
  • The identifier a798b6fd-44d7-4246-a5f3-38003abaecce is a GUID. You should generate one yourself though I suspect that you should be able to use the one within this example without too much of a problem.
  • As usual, this solution comes with no warranties! Use it at your own risk!
  • Yes, I know that there are ways to circumvent this! We’re targeting “casual” users! :)

Using a HttpModule to protect your content from 3rd party referrals.

 There are certain cases under which you may wish to “discourage” external sites from linking directly to public content (images, documents …) on your site. You may for example, prefer to have user’s visit your site first before accessing any of your resources.

The sample code attached to this post illustrates how to use a HttpModule to act as a filter which prevents third-party sites from linking to your content. You can use this approach to prevent others from linking to pages, images and other resources.

Revision History
v1.0  – Initial code base (25/5/2010) – Download from here.

Section 1.0 – Configuration

a. Unzip the file and deploy it to a folder of your choice.

b. Register “non-standard” extensions – You will need (under IIS 5.x and 6) to register non-standard file extensions (e.g. .js, .jpg, .gif etc.). This enables requests for these resources to be channelled via the ASP.NET engine.

The image below depicts .jpg files being associated with the ASP.NET ISAPI engine. You should limit the HTTP verbs to a range that is supported by your web-site.


The image below shows the application configuration screen that is used to add file mappings under IIS.


c. Open the web.config file and locate the  xanWebFilter node. Next, add file extensions that you wish to ban. I’ve added asmx files which would cause requests from third party sites to be redirected to Similarly, I’ve added a jpg key that causes all non-validated requests to be transferred to banned.htm

   1:      <!-- Xanthium web-filter specific values. -->
   2:      <xanWebFilter>
   3:          <add key="asmx" value=""></add>
   4:          <add key="jpg" value="http://localhost/banned.htm"></add>
   5:      </xanWebFilter>

d. Ensure that the web.config file refers to the HTTP Module (IIS <= v6 or IIS7 classic mode)

        <add type="XanIISUtils.BannedExtensionFilter"

web.config changes (IIS7 integrated mode)

        <add type="XanIISUtils.BannedExtensionFilter"

e. Compile the code and run it. You will see that requests for asmx and jpg files that do not have HTTP referrers set will result in redirects to yahoo and banned.htm respectively.

Section 2.0 – How it works

The application makes use of the functionality provided by the HttpModule class which allows HTTP events to be subscribed to. This allows a piece of code for example, to be invoked when a request is received for a resource managed by the ASP.NET subsystem.

In a similar fashion, you could subscribe to the  Http_EndRequest event to append data (for example) to a stream returned by the server.

The following code in BannedExtensionFilter illustrates how an event is registered

public override void Init(HttpApplication app)
    // Register handlers that are called each time a request is received.
    app.BeginRequest += new EventHandler(this.Application_BeginRequest);

Next, when an event is called, the framework automatically invokes Application_BeginRequest() within BannedExtensionFilter. This method is responsible for determining whether a request should proceed unhindered or should be redirected. The following steps briefly describe the steps performed –

1. Determine whether the requested resource is part of a banned extension. In our example, this would be true for asmx and jpg files.

2. If the file is “black-listed”, determine whether the request should be redirected based on the return value of IsValidRequest().

IsValidRequest() performs a simple check to determine whether the HTTP referrer is set to the current application server. If the referrer is something else – the method flags this request for rejection.

protected Boolean IsValidRequest(HttpApplication app)
    Uri fromUrl = app.Request.UrlReferrer;
    if ( null == fromUrl )
         return false;
     // Referrer is not empty - check to see whether it happens to
     // be this server's name
     return _serverName.ToLowerInvariant() == fromUrl.Host ? true : false;

Section 2.1 – Expandability

The current method of validating the HTTP request header for the referrer leaves a lot to be desired, you can start by using some sort of cookie/session check to make things more robust as well as to cater to those (usually custom coded) HTTP clients that may not set a referrer. You can either completely replace IsValidRequest() or override it in a derived class.

Section 3.0 – Conclusion

The code helps illustrate how HTTP modules could be better alternatives to performing similar tasks within the (beloved?) global.asax file. You should typically use this approach if –

1. You are using IIS7 in integrated pipeline mode and want to marshal ALL application requests through your code. I realise that I have not yet talked about setting up the handler for IIS7 – I’ll update the article at a later stage.

2. You need to keep the code modular and reusable within multiple applications. All you need to do is to compile the files into a library and store it within the GAC.

3. You believe in keeping a clean, non-complicated global.asax file.

Section 4.0 – Disclaimer

This code is released “as-is” without any sort of warranty. Please feel free to use it and modify it in your own projects. The code has been kept as simple as possible so that key concepts can be easily understood by the reader.

Please do feel to drop me an email if you find the code useful or if you have any questions.

Anand Balaji

Capturing fireworks

Fire in the sky :.

Fire in the sky :.,
originally uploaded by Anand Balaji.

A lot of people have been asking me questions on how I managed to capture this image. I don’t pretend to be an expert on this subject, but I’ve listed a few things that I feel may help better your chances of not capturing featureless blobs.

a. Use a tripod – Needless to say, you will need a tripod to keep the camera as steady as possible. Superman may have no problems in holding a camera absolutely still for more than a second, but you certainly will!

b. Scout for an area relatively devoid of people – This is not very easy to do especially at crowded venues but it will prevent a perfectly decent shot from getting ruined due by numerous John (and Jane) Does’.

c. Use a wide angle lens – This will allow you to capture a vast area. You can crop the image in your favourite editor at a later stage. I set my lens at 18mm to capture this.

d. Use the lowest ISO speed – Just do it… you won’t regret it.

e. Shoot in RAW mode – If your camera provides you with a RAW capture mode, use it and correct colour casts and other issues in the comfort of your home (or office if you happen to be a “big-shot”). For the record, the image posted here was not captured in RAW mode… I wish I had!

f. Click test shots – You aren’t shooting on film so why act stingy? Use test shots to isolate areas that you want to capture within the final photo.

g. Set the camera to manual focus – Why waste time asking the camera to focus on a subject at a great distance? Set the camera to manual and then use the focus adjustment ring/buttons to pre-focus the lens at infinity.

h. Use the narrowest aperture possible – f13 – f22 work best for me, but you might have luck with other values as well.

i. Don’t lose patience – Remember that photography techniques take time to master. Don’t worry if you don’t capture anything extraordinary… they’ll always be another time and place to repeat the experiment.

j. Use a remote shutter release or timer to click the photograph – This helps prevent camera shake from ruining long exposures. A shutter release works best, but a timer will work wonders as well. This image was captured by setting the timer to fire 2 seconds after the shutter button was depressed (I was too cheap to buy a cable release).

1 x Pentax K100D
1 x Pentax (Kit) 18-55 lens @18mm (lens hood attached)
1 x Hamas tripod (low priced and quite unstable… but hey it did the job!)
1 x Patient wife

Happy capturing…


Another image I captured

Here's a sample...

Nice pretty fireworks

Another one...

Thats it... I promise!

That's it... I promise!

Delta and the Boeing 767 – 400ER

First Impressions – Delta’s Boeing 767 – 400ER

I recently had the opportunity of flying this type on the LHR-JFK-LHR routes. Mind you that I was flying economy and not business (I’m not “there” yet). Here are a couple of my initial impressions which may prove to be helpful for those who are curious or have already booked their flight and have no choice in the matter whatsoever.



1. The cabins were well maintained and didn’t show their age.  The overhead bins seem to incorporate the same design concepts used within the 777 which makes the cabin looks larger than it actually is (not that the 777 has a small cabin to begin with!).  The impression of spaciousness is impressive. Full marks over here!

2.The seats (even in economy) are covered in leather, not cloth. I found them to be a bit softer and therefore comfier, but it could just be my imagination.

3.The cabin layout is 2 – 3 – 2 which is great if you’re with your partner. It also isn’t too bad if you’re stuck right in the middle (and need to take frequent loo breaks!).

4.The entertainment system is really pathetic. Delta has a really limited choice of video and audio. Moreover, the system is really unstable with frequent crashes (3 in my case) and random reboots. Before anyone starts bashing Windows, let me quickly point out that the entertainment system is Linux based! For some obscure reason, the reading light and flight attendant call buttons have been incorporated within the entertainment system! That’s right, you WON’T be able to use either if the screen in front of you is on the blink (Not that it matters as I soon found out).

5.The 767 is an incredibly noisy airliner. This might be a bit harsh when compared to the newer generation 777 and 330/340, but I found it much more noisier than a 747-400 which is of the same generation. The flap and slat retraction operations are painfully noisy and the cabin noise during cruise is quite annoying.

Taking the above points into mind, I would not mind recommending a flight on this aircraft if –

a. The competition involves flights on a 777 with 3 – 5 – 3 abreast (Shock! Horror!) seating configuration. American Airlines offers this on the LHR/JFK route. Needless to say, I would not wish such an experience on my worst enemy.

b. The ticket price is right. When I booked, Delta was the cheapest (and only viable) option.

c. You aren’t expecting great in-flight entertainment. Yes, prepare to carry your own music/video entertainment or (even better) read a book.

d. You aren’t a nervous flyer. The noise can be a bit unnerving to some. If you are nervous, try to sit as close to the business class cabin as possible.

First Impressions: Delta LHR-JFK-LHR service

1. Delta probably is the only airline in the world with cabin crew that simply ignore the flight-attendant call light (the tiny light above your head that lights up when you “request” the services of one of the cabin crew). I noticed this on several occasions. Mind you it just wasn’t me who experienced this.

2. Service was (ahem) curt and professional, but nothing like any of the Asian/Oriental airlines around. For the record, I’ve experienced far better service on Virgin Atlantic and British Airways. However, it seems to be the best amongst US carriers, slightly inferior to that offered by Jet Blue. I’m not sure if I imagined it though, but there seemed to be some sort of internal “animosity” between the Delta and Northwest cabin (Northwest crew are dressed in red) crew on both legs of my journey. I hope that this doesn’t affect service.

3. Food was strictly OK. There was a choice of vegetable pasta and chicken ravioli on both legs. The chicken seemed to be quite chewy and was quite (figuratively speaking) yucky. The Pasta on the other hand was much better, being quite suited for human consumption. You will also need to PAY for alcoholic beverages.

4. The crew were immaculately dressed and groomed and there was no one with the “fresh out of bed” look. The width of the aisles proved not to be a challenge to any of the crew (unlike Air India and American).

To sum it up, you get what you paid for! However, if you do pay a lot, you will probably be disappointed. Those (ahem) habituated to US cabin service will not find anything amiss as they are quite acquainted with lacklustre service in the first place!


Choose your best seat… :

Delta :

Delta (PDA/Mobile) :

Want to read more about the 767?  :

Anand Balaji

Wix – How to forcibly overwrite pre-existing files during installation.



The fly in the ointment

Wix v2 is a pretty nifty tool but since there are a few nasty surprises in store for those who don’t know exactly what it does behind the scenes. More importantly, the Windows Installer tries to perform the intelligent thing of not installing files if the source and destination are exactly the same. This is done by comparing a checksum of the source and destination files. If the checksums match, the file isn’t overwritten at all!

Why would you want to overwrite the same file?

There are a few cases where you might need to do this. For example, if your application relies on the date-time stamps of files for copy-protection or versioning (amongst other things), the checksum comparison will ensure that files having the same checksums are not overwritten. This is not what you might have expected from an installer as one would logically (and sensibly) expect a well behaved installer to blindly overwrite pre-existing files on disc.

It thus becomes impossible for one to overwrite files that are exactly the same even though their timestamps do not match!


Fortunately enough there is a “directive” which can override this behaviour. Simply add the following line to your .wxs file –

<Property Id=”REINSTALLMODE” Value=”amus”/>


Admit it! Quick fixes aren’t usually as simple as this little tit-bit! I was lucky to come across this solution on the Internet (after a long and arduous journey) and decided to put it on a page exclusively devoted to this topic. Hope that someone finds it helpful! :)


Wix – My perfectly imperfect msi file

Wix is an extremely powerful tool that should help you create installers for almost every conceivable type of setup scenario. It’s not without its flaws though and some of its quirks can result in you wasting a not so inconsiderable amount of time. I’ve listed a few of the items that frustrated me. The solutions over here should hopefully prove helpful to you.

My perfectly behaved yet perfectly useless SAPI installer

I had taken the responsibility of creating an installer for one of the products designed by my firm. As part of the install process, the installer needed to install version 5.1 of Microsoft’s Speech Engine.

Microsoft had played their part and created a set of nifty merge (basically a bunch of .MSM files – if you didn’t know that, you’ve got a long way to go buddy!) modules. What could be simpler than adding the msm files to your wixproject, referencing them and then compiling your shiny new creation?

Well to cut to the chase, my spanking new MSI was created. It appeared to install fine but it didn’t actually seem to install all of the files.

Before this incident, the general impression that I got was that MSIs were more of a “plug-and-play” solution and that one didn’t have to worry about the fine intricacies of what the MSM was doing. Wix changed all that…

After a day of accomplishing almost nothing, I came to the conclusion that Wix did almost certainly not know what to do with the contents of the MSI file beyond installing them. My hunch turned out to be correct.

It seems that Wix needs to be (ahem) “prodded” to perform additional tasks that are contained within the MSM database. It won’t do them unless your application –

a. Performs the same tasks as part of its installation routine. For example, if your wxs/wxi files add registry entries as part of the install routine, then Wix will ensure that any registry entries required by the MSM are carried out at runtime as well.

b. Explicitly “prods” Wix to perform one or more tasks within the InstallExecuteSequence directive.

Once you’ve understood that, all you need to do is to add the following snippets of code to your wxs file

     <RemoveFiles />
     <InstallFiles />
     <WriteRegistryValues />

You might need to add a few additional entries, but I think that the ones given above should suffice. Note that the WIX team does not count this as a bug. They claim that the MSM files have been “improperly” created. Basically it sounds that a lot of inter-office “blame the other party” nonsense, but I don’t have the time nor the mental-bandwidth to care.

PS: Users of Crystal Reports’ MSM modules may face the same problems too. The solution is more or less the same…

– Anand Balaji

Life at 44100 hertz – I

Despite claims by the creators of the Digital Audio Compact Disc, CD audio quality is far from perfect. Low cost CD players often sound harsh lacking the warmth and vibrancy of analogue and high resolution digital formats such as SACD and DVD-A.

Many would claim that the differences between CD players are non-existent or minimal. What they do not understand is that the human brain is extremely adept at picking out differences in distortion even though they might not be audible.

I’ll leave it up to you to decide, but you may find that a run of the mill low cost audio system will eventually fatigue your ears. If so, it’s highly probable that the CD player is the culprit.

There are 2 main factors that affect the quality of audio emitted by a CD player.

The transport : This is the mechanism that not only holds the disc but also spins it and moves the laser mechanism. If you do spend a not so inconsiderable amount of time at your local audio dealer (I assume that you’ve established a good rapport with the staff) you’re bound to find that the costlier players have better transports. How do you find the better transports you ask? Better transports are sturdier and they don’t tend to shake or wobble when you open the tray. Apart from that, better transports commonly employ mechanisms to dampen vibrations from external sources thereby ensuring that discs are read without having to resort to rely on the error correction mechanism to fill in erroneous bits.

The DAC : The Digital to Analogue converter is the system responsible for converting data read from disc into analogue signals that can be amplified by your amplifier. It is the DAC that primarily denotes what a player “sounds” like. (In other words, it separates the winners from the loser)

I don’t want to get into the technical aspects over here , but I would like to say that tremendous progress has been made in the quality of signal generated by DACS over the last couple of years.

Here’s the catch, players with good DACs are costly but money is often (for me at-least) scarce. How does one upgrade the sound of their player while keeping costs as low as possible? The next article in which I’ll be able to share my (hopefully useful) experiences aims to answer this question.

– Anand Balaji