Saturday, December 24, 2011

Bing maps–plane taking off

Found this in Bing’s satellite imagery – an airplane taking off from Las Vegas airport.


Monday, December 05, 2011

Installing a windows service using PowerShell

There is a hard way and an easy way. Here is the easy way:

Use Invoke-Command to call InstallUtil instead of New-Service:

Invoke-Command -ScriptBlock { C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe /install "path to windows service.exe"}

Invoke-Command is better than Invoke-Item because the result of the execution is piped back to the console. (With Invoke-Item, any error messages don’t get sent back to caller).

Now here is an additional tip – if you need to specify the username and password under which the service should be run, you can use the undocumented InstallUtil parameters: username and password as shown below

Invoke-Command -ScriptBlock { C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe /username=domain\account /password=password /install "path to windows service.exe"}

Finally, if you need to run this command on a remote machine, use the –ComputerName field that’s part of Invoke-Command

Invoke-Command -ComputerName machineName -ScriptBlock { C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe /install "path to windows service.exe"}

And to uninstall a service:

Invoke-Command -ScriptBlock { C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe /uninstall "path to windows service.exe"}

Useful powershell functions for installing, uninstalling, starting and stopping windows services on a remote machine

function StartService()
    param ([string] $serviceName, [string] $targetServer)
    Write-Host "starting service $serviceName on $targetServer"
    Invoke-Command -ComputerName $targetServer -ScriptBlock {param($sn) START-Service $sn} -Args $serviceName
    Invoke-Command -ComputerName $targetServer -ScriptBlock {param($sn) $servicePrior = Get-Service $sn; Write-Host $servicePrior.status} -Args $serviceName
function StopService()
    param ([string] $serviceName, [string] $targetServer)
    Write-Host "stopping service $serviceName on $targetServer"
    Invoke-Command -ComputerName $targetServer -ScriptBlock {param($sn) STOP-Service $sn} -Args $serviceName
    Invoke-Command -ComputerName $targetServer -ScriptBlock {param($sn) $servicePrior = Get-Service $sn; Write-Host $servicePrior.status} -Args $serviceName

function UninstallService()
    param ([string] $serviceName, [string] $servicePath, [string] $targetServer)
    Write-Host "uninstalling service $serviceName on $targetServer from path $servicePath"
    Invoke-Command -ComputerName $targetServer -ScriptBlock {param($sp) C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe /uninstall "$sp"} -Args $servicePath

function InstallService()
    param ([string] $serviceName, [string] $servicePath, [string] $targetServer)
    Write-Host "uninstalling service $serviceName on $targetServer from path $servicePath"
    Invoke-Command -ComputerName es1sbweb -ScriptBlock {param($sp) C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe `
    /username=domain\username /password=password `
    /install `
    "$sp"} -Args $servicePath

SqlComplete–A must have add-on for Sql-Server users

If you use Sql-Server, then you must get SqlComplete for its awesome intellisense that it provides within Sql Server Management Studio (SSMS).

One of the best things I like about it: Regular SSMS intellisense will not work in SqlCmd mode. SqlComplete works even in SqlCmd mode. (And for me that’s huge, because I open all my query windows by default in SqlCmd mode). In addition it provides you with the ability of formatting your entire t-sql document (awesome!).

SqlComplete has two editions: a free edition that has reduced functionality (Not as great document formatting capabilities) and a standard edition that costs $99 (edition differences). I really wished that they had a personal edition for $50, cause I would definitely buy this tool.

Also remember to install the other awesome SSMS add-on: SSMS Tools, which provides some other useful features that make SSMS a pleasure to work with.

More info:

SqlComplete – Alternative to SSMS intellisense:


Sunday, December 04, 2011

PlasticSCM–First encounters

I was looking for a source-control system that I could use at home, which meant that TFS would not be a good candidate for me (although it’s the SCRM that I have the most experience with). I have tested out SVN and Mercurial, but for some reason they didn’t grow on me.

Today I came across PlasticSCM (via a recent blog post regarding their new release 4.0). So I decided to give it a try. (The main reason being that it’s a distributed SCM and based on what I had seen on PlasticSCM’s website, the visualization tools were very good and it also had decent integration with Visual Studio). Another thing that I liked is that the free community edition allows you to use it with up to 15 users free of charge.

So here are some things I found out (based on usage with Visual Studio): (Remember these are just first impressions and this is also my first true usage of a distributed SCM).

  1. I found having a separate repository for every solution was the way to go. When I first tried it out, I used a single repository and added all my solutions to that repository. (Each solution represented a completely distinct project). But it started getting very confusing, as I had to perform all sorts of merges everytime I opened a solution.
    Instead, when I created a separate repository for every solution (or group of solutions that represented the same project), things began working in what I considered a more predictable way.
  2. I use Resharper and when I first added a solution to PlasticSCM, I had trouble everytime I closed the solution, as the file .user files could not be saved. In addition, PlasticSCM attempted to check-in all the Resharper temporary files. Currently, I am deleting these files after I add the solution to PlasticSCM and then check the files in. Also, once I have done that, I set PlasticSCM to ignore the *.user files and the _Resharper.* folder.
  3. Although I havent performed much branching and merging as of yet, I found the visualization tools pretty cool

Some useful tips:

First thing to do is set PlasticSCM as the current Source Control Provider:


Next open up a solution that you want to put into source-control. Right click on the solution and select the “Add to source control” item.


This will bring up the New-Workspace dialog. Create a new repository for your solution (click New).

image image

When you click on OK, it will automatically add the solution into PlasticSCM (into the newly created repository).

Now bring up the PlasticSCM client application (via the Start Menu).


You will find that a new Workspace has been created for the solution:


Click on the Items node in the left pane and then ensure that all the files that should be under source-control, show up with a status of “Controlled”.


You do this by selecting any item that is setup as “private” and select the “Add to source control” option.


Your final step is to check in all the files. This is done by selecting the “Pending Changes” option in the left pane and then clicking the “Check-in” button.


That’s it. Your solution is now under source-control.

What does PlasticSCM check-ins look like?

Here is an example: I had a main branch. I created 2 separate branches from main to represent 2 sets of changes that I wanted to make: Add a multiplication feature task and Add a division feature task. Both of these features were to be added to a single change-set in main (the most current changeset).

The 2 features represent coding tasks that 2 separate developers may be involved with. Once the 2 features are completed they are checked into their respective branches. After the features are checked into the branches, the branches are merged one by one into the main line.

And here is what the above scenario looks like:


Some final thoughts:

  1. There doesn’t seem to be any in client help for PlasticSCM. So many times I had to go about exploring trying to attempt to do various tasks in PlasticSCM (for example setting the current workspace – there doesn’t seem to be a way to do this in the branch-explorer. Instead you do it via the Branches view).
  2. During merges, I found that PlasticSCM didn’t do a lot of stuff automatically. I was always provided a diff/merge view (which was very beautiful in its rendering), and had to manually accept the merges. On large projects, this will become quite painful for the person incharge of merging various changesets into the main-line.
  3. I definitely like PlasticSCM and will continue testing it out on my personal projects. I think it will be cool for large teams, but I am not entirely sure whether it’s a good replacement for TFS (which we currently do use at work). I plan on figuring this out as I work more with PlasticSCM.

Saturday, December 03, 2011

Installing DD-WRT on TP-Link TL-WR841N


TP-Link’s TL-WR841N router supports the DD-WRT firmware.

The installation process is simple:

Go to DD-WRT’s homepage and search for the router from the Router Database page. Although you will not find TL-WR841N firmware, you can use the TL-WR841ND files. My router uses v7, so that’s the version of the firmware that I downloaded.

You can use the following link to download the files (if you are using v7 of the router):

Upgrading the router’s firmware is simple: (Remember, when upgrading firmware, always be connected to your router through an ethernet cable, as you will loose WiFi connectivity once the firmware has been updated. After the update, you will have to reset your wifi settings).

Under System Tools, select the “Firmware upgrade” link


Choose the “Factory-To-DDWRT.bin” file that you just downloaded and click the upgrade button. Wait for about 5 minutes. DD-WRT should be installed and should come up if you browse to

Next go to the DD-WRT Administration page and select the Firmware tab. Install the 2nd firmware update file “TL-WR841ND-Webflash.bin” that you downloaded.

That’s it – you now have TL-WR841N v7.0 running DD-WRT firmware.

The final step will be for you to go through the setup process and define your Wifi settings.

Reverting to TP-Link’s firmware:

If you need to revert to TP-Link’s firmware, then you need to download the appropriate file from: “”. Remember, to be able to download the file you need to create an account on that website. (After creating the account and logging in via the Quick Links button, you should see the file download link).

Download and unzip the contents of the “WR841Nv7_webrevert.rar” file. You will find a bin file within the RAR file. Go to DD-WRT and use the upgrade option to upload the “wr841nv7_webrevert.bin” file. After clicking the upgrade button, you will have to wait about 5 minutes for the router to reboot and complete installation.

After you have reverted the firmware, download the latest TP-Link firmware from TP-Link’s website and upgrade the firmware to that version.