Sunday, 15 December 2013

Mobile UI frameworks

Good overview with some examples of mobile UI frameworks such as jQueryMobile etc.

Sunday, 3 November 2013

Issues with booting via USB

After upgrading my MacBook Pro to OSX Maverics this week, my bootcamp stopped working (Windows 8.1). Long story short had to get USB recovery stick booted up. I have tried both;

1. Restarting MacBook and pressing and holding option to change boot manager to USB stick. This booted recovery stick, however for some reason I was unable to actually recover anything due to lack of access to Windows partition. 
Plot Boot Manager screen

2. Loading USB via Parallels. This didn't work for some reason either. It wouldn't even boot.

Note: I'm not sure why my BootCamp suddenly had some corrupted/missing files in Windows folder as it was working perfectly fine. I could not find anyone else with similar issues.


After some time on Google and countless hours trying I have found this little tool (Plop Boot Manager).

It allows you to first boot your machine (using CD/DVD ROM) to Plop Manager and from there to select the actual media you wanted to boot. In my case it was USB. Absolutely brilliant!

Thanks Jeroen @

Note: Parallels 8 is not working with this. You will need to upgrade to version 9.

Thursday, 24 October 2013

Keep IIS App Pools warm with PowerShell script

Happy Friday!

Due to the fact that our CI deploys the site every single check-in, very often nobody actually bothers loading up the pages afterwards to make sure those are operational. We work on applications that take sometimes even 5-10 min to come back up after deployment (eg. Sharepoint).

Anyway, I decided it would be a good idea to have a script running every 5 min on one of the servers that will actually try loading pages for us. This in theory means that pools will be warm and ready to go and you will not be stuck with forever loading browser window.

Below is my PowerShell script that will do the job. You will also need XML file that will hold all URLs.

Your XML needs to follow structure below. It can contains as many URLs as you require.

    [string]$ConfigFile = "config.xml",
    [string]$TransactionFile = "lastRun.log"

# Get Config file
$0 = $myInvocation.MyCommand.Definition
$env:currentDir = [System.IO.Path]::GetDirectoryName($0)
$env:parentFolder = Get-Item $env:currentDir | Split-Path -Parent

[xml]$cfg = Get-Content (Join-Path $env:currentDir $ConfigFile)

if($cfg -ne $null){
    $wc = new-object net.webclient;  
    $wc.credentials = [System.Net.CredentialCache]::DefaultCredentials;  

    Start-Transcript (Join-Path $env:currentDir $TransactionFile)

    Foreach($url in $cfg.Urls.Url){
        if($url -ne $null){
                Write-Host "Warming up $url"
                $pageContents = $wc.DownloadString($url);
                Write-Host "Warming up of $url has timed out!"
                #throw $_


Configuration steps

Fig 1
Once you have both XML config file and ps1 script file in one folder we can setup Task Scheduler.

  1. Open Task Scheduler
  2. Right click to "Create New Task"
    1. Press "Change User or Group" button 
    2. Press "Advanced..." button
    3. Press "Find" and Select "NETWORK SERVICE"
    4. Fig 2
      1. We are doing this so that this script runs under a different account (system account) otherwise every time you change your password you have to update this job.
    5. Tick "Run with highest privileges"
  3. Change Tab to Triggers
    1. Press "New..." - here you setup your trigger. (ie. what causes this to run)
    2. In my case I wanted this to run every 5 min. So I have ticked "Repeat task every" and selected "5 min" then select for duration of "Indefinitely"
    3. I set it to run "One time", however due to the "Repeat task every 5 min" it actually runs once and then repeats indefinitely.
  4. Change Tab to Actions
    1. This is where we set ps1 to run by pressing on "New..."
    2. Fig 3
      1. Select action to be "Start a program"
      2. Program script to be "PowerShell.exe"
      3. Under Add arguments (optional) enter "-ExecutionPolicy Bypass -File D:\KeepWarm\keepwarm.ps1 -Path D:\KeepWarm". Change your paths accordingly.
  5. Press OK to close
  6. Press OK to finish setting up this task.
  7. Right click task you just created and click "Run"
  8. Open Explorer and browse to a folder where you keep your keepWarm.ps1 and see if there is a new file there called "lastRun.log". 
  9. You can open this file to see last run results.
  10. You are done!

Monday, 21 October 2013

ASP.NET Custom Error Pages

Found this great article that covers pretty much every possible way of getting it done with pros and cons. Thanks!

Monday, 30 September 2013

TFS 2010 to SVN Migration

Brief introduction

Migration between TFS to SVN can be quite challenging as there are no tools* that I could find that actually work smoothly with Team Foundation Server 2010 and SVN. This brief how-to assumes that you know your way around Linux/SVN and TFS. 

* I have only found one tool for this tfs2SVN however it is heavily outdated and it hasn't been much use with Team Foundation Server.

Instead I have split this migration process into two.
  1. Migration from TFS to GIT - using GIT-TF
  2. Migration from GIT to SVN - using SubGit

Requirements for migration

  1. Linux box (Ubuntu) for SVN hosting (this is vanilla install purely for SVN hosting)
    1. SVN installed on Linux box
    2. GIT installed on Linux box
    3. GIT-TF (download ZIP file and chmod +x on git-tf file)
    4. SubGit (see Debian/Ubuntu section in Download for repository - otherwise ZIP is fine)
  2. Windows Server - Team Foundation Server 2010

Business requirements

  1. History of all file changes as well as who has made them need to be migrated.
  2. Some configuration (that only relates directly to TFS such as builds - we have migrated to Jenkins instead but that's not part of this how-to).
  3. Some cleaning and re-organizing repositories might be required to align it more with SVN standards.

Migration procedure

Migration from TFS to GIT

  1. Download & Unzip GIT-TF somewhere in your home directory (any directory will do). 
    1. In this example "/home/luke/gittf/git-tf-"
    2. Make sure you "chmod +x on git-tf"
  2. Create a folder where you will keep your Git repository
    1. In this example I have ran following "mkdir /disk2/git/dnd" to create folder
  3. Run git-tf
    1. Run "/home/luke/gittf/git-tf- clone --deep http://tfs-server:8080/tfs/DnDCollection $/"
    2. Replace URL with your TFS URL. Also you can specify single project by changing "$/".
    3. This will prompt you for your username and password you need to connect to TFS.
  4. This step will take quite a while. This particular collection took over 48 hours.
  5. Test if all check ins are there by running "git log".
  6. Run "git status" to see if any files have been changed in the process. This should show you no pending changes to be commited. My git repository showed some files with extra character (hidden character) so I ran "git reset --hard" to discard all changes and get repository as its checked in.
Few notes;
  • Your developers can still use TFS as normal (it will be however slower). Simply once your clone is done you can run git-tf pull to get it up to date.
  • Make sure you run --deep otherwise only last checkin will be pulled from TFS.
  • More documentation here GIT-TF Documentation

Migration from GIT to SVN

To clean SVN repository
  1. Use aptitude to install SubGit
    1. Follow steps on SubGit to download and install SubGit on Ubuntu/Debian
  2. Create empty SVN repository (only if you don't already have one)
    1. In this example my SVN repository will sit in /disk2/svn/dnd to create it I ran
    2. "svnadmin create /disk2/svn/dnd
  3. Setup SubGit
    1. Go inside DND SVN repository by entering "cd /disk2/svn/dnd"
    2. Run "subgit configure"
      1. It will prompt you that new configuration file has been created and you will be required to modify it.
    3. Change settings to associate your repository with Git repository
      1. Open /disk2/svn/dnd/conf/subgit.conf by running "vim /disk2/svn/dnd/conf/subgit.conf"
      2. Find "[git "default"]" section.
      3. Change repository = .git to point to your location. In this case "repository = /disk2/git/dnd/.git"
    4. If your repository is customized you can modify trunk, branches, shelves and tags. I have left this with default settings. See SubGit Documentation for more information.
    5. If you are using existing SVN installation and you just want to migrate your TFS as a subproject then modify translationRoot. Eg. if your SVN already has folder called Clients\[Projects] then setup your translationRoot folder to be "translationRoot = /Clients/
  4. Run migration
    1. Run "subgit install" - it will pop up with progress bar.
    2. This takes a lot less than TFS to GIT. In this particular example it took about 2 hours.
  5. Test your SVN repository to make sure that all Logs are there and you can successfully checkout/commit etc.
  6. SubGit create tags folder with every single check-in in TFS showing as separate tag - I have simply removed it. I appears to be a biproduct of double migration. 
Addition to existing SVN repository
  1. Use aptitude to install SubGit
    1. Follow steps on SubGit to download and install SubGit on Ubuntu/Debian
  2. You will be required to have Bare GIT repository - to create one all you need is
    1. Move .git folder out of your git repository eg. mv /disk2/git/dnd/.git /disk2/git/dnd.git
    2. Then you need to mark it bare with "git config --bool core.bare true"
    3. See for more info on this.
  3. Configure your dnd.git to be connected to SVN
    1. Run " subgit configure --svn-url dnd.git"
      1. Your folder is any path that you want your git to be migrated to. Make sure it doesnt exist yet.
      2. Modify /disk2/git/dnd.git/subgit/passwd with your username and password for SVN. (if you require authentication for your repository)
  4. Go to physical location of your SVN repository and add a hook to enable all information to be migrated (such as authors of each check-in)
    1. In this example my SVN is under /disk2/svn/dnd
    2. Go inside /disk2/svn/dnd/hooks with "cd /disk2/svn/dnd/hooks"
    3. Create new file with "touch pre-revprop-change"
    4. Open it for editing "vi pre-revprop-change"
    5. All it needs to do is to return true - ie. exit with 0
      1. Follow (section 5.8) for exact content of the file.
    6. Make sure you run "chmod +x pre-revprop-change" otherwise it will not be executed!
  5. Run "subgit install /disk2/git/dnd.git"
  6. Wait for the process to complete. 
  7. Test your SVN repository to make sure that all Logs are there and you can successfully checkout/commit etc.
  8. SubGit create tags folder with every single check-in in TFS showing as separate tag - I have simply removed it. I appears to be a biproduct of double migration. 


Please follow this procedure at your own risk. I strongly recommend doing a test run on empty TFS collection with empty SVN repository. I'm not responsible for any loss of data or damages caused by tools or procedures in this How-To.