Ben | Ben Clark-Robinson

Click here to download the latest installer of Freq-Press.

Ever been interested to know how many keys you type per day? I certainly was curious to know just how much I type each day (especially while I’m replying to a gazillion email).

Features

  • Automatically count your key presses and mouse clicks each day,
  • Boast your typing and clicking prowess with Slack and HipChat integration built-in,
  • Easy to use installer,
  • Quick and simple check for updates to stay on the latest version,
  • Lightweight application that doesn’t take a ton of system resources.

Privacy

  • The application doesn’t log what you’re typing, its only counting the number of keys.
  • What you type isn’t uploaded to a server or analysed.
  • No advertising, there’s no interest to store what you’re typing.

Future releases

  • Report on keys & clicks over time and not just today,
  • Nicer application icon,
  • Mouse movement distance calculator.

Click here to download the latest installer of Freq-Press.

This is a quick and easy way to identify what TFS paths a changeset has been merged into. Simply pass in the changeset ID, source path (like: $/project/dev) and a list of branches to check (like: $/project/release/release-1.0).

///
/// Track a changeset merged into a possible list of branches.
public ExtendedMerge[] TrackChangesetIn(int changesetId, string projectPath, IEnumerable branches)
{
var projectCollection = _tfsServer.Connection(); // Get your connection to TFS
if (projectCollection.HasAuthenticated == false)
projectCollection.Authenticate();
 
// Get the Changeset list from the TFS API.
var source = projectCollection.GetService();
 
var merges = source.TrackMerges(new int[] { changesetId },
new ItemIdentifier(projectPath),
branches.Select(b => new ItemIdentifier(b)).ToArray(),
null);
 
return merges;
}

You can use this method like this:

var mergeBranch = TrackChangesetIn(id, "$/project/dev", new List { "B1", "B2" });
if (mergeBranch.Any())
{
var targetItems = mergeBranch.Select(mb => mb.TargetItem.Item);
}

Importing the MSBuild Community Tasks into a Visual Studio project can make difficult tasks easy. In my scenario I wanted to hook into the BeforeBuild target so I could modify the defaultVersion attribute in a combres.xml before TeamCity created a Release build.

Firstly you need to import the MSBuild Community Tasks (MSBCT) into the .csproj. And in my scenario I didn’t want other developers to have to install MSBCT so I conditionally import on non-debug builds.

Then I wanted to prove the concept so I used XmlRead first. I had to workout the XPath first, so once that was defined I dropped that into the XPath attribute:

 

Running from the command line:

msbuild.exe project.csproj /t:BeforeBuild /p:configuraton=Release

I could see the output of XmlRead on the command line.

Switching to XmlUpdate now made sense. So I commented out the XmlRead and added

Now the combres.xml file has it’s defaultVersion attibute modified for every Release build.

I recently purchased a Christmas themed laser light to augment my LED christmas lights. I wanted something snazzy and with a unique look. A laser light show was perfect. It cost roughly AUD$68 + $12 postage.

Take a look at the video, I think this will explain how it looks better than I can describe with words.

Click to see Laser in action (Video)

Pros:

  • It came with a remote to turn it on/off, change colours, change mode. (Though I doubt I will use the remote much).
  • Also included was a small (10cm) tripod.
  • It’s light in weight, and very powerful (pointing at trees 50-100m away you could see the laser still).

Cons:

  • The “XMAS” wording is printed backwards (hoping to open the box and fix).
  • It’s not waterproof, so you need to bring it in of a night.

I recently had a frustration trying to inspect the DOM while writing a Windows 8 Store App with HTML5 and JavaScript. Finding a way to Inspect Element as if I was using Chrome or Safari wasn’t possiblee.

I knew Microsoft would have solved this issue and I couldn’t find anything using Google. That’s because I was googling ‘Windows 8 Store App page inspector’ whereas I should have been Googling ‘Windows 8 Store App DOM Explorer’.

Now that I have the correct search term; Quickstart: Debugging apps (JavaScript)

In short:

  1. Debug the Metro app in Simulator or Local Machine,
  2. Switch back to Visual Studio 2012,
  3. Press F12 or click DOM Explorer.

Visual Studio can at times be painfully slow. From startup, to compile, to running the web-application. Without having to resort to hardware solutions which can cost $$$ I investigated how to get Visual Studio running as fast as possible. This included tweaking VS options and using a RAMDisk.

tl:dr Using a RAMDisk may halve compile times (your milage may vary). SSDs are (in practice) close to the speed of a RAMDisk.

Solution Compile Times
7200rpm HDD RAMDisk
23 seconds 12 seconds

Tweaking VS Options

First up I recommend reading this article from Daniel Fisher. This will give some great tweaks to VS options and anti-virus exclusions to give your system a small speed boost (note: I prefer to leave ‘Track active item in Solution Explorer’ on).

RAMDisk

Next up I tried setting up a RAMDisk to simulate having an SSD. A RAMDisk will take some of your system RAM and make it appear as a very fast drive on your system. The size of the RAMDisk will reduce the amount of free RAM. If you have 6GB RAM and the RAMDisk is 2GB, this will leave 4GB of available RAM for the OS and other processes.

To give you an idea of how fast your system RAM compared to a 7200RPM HDD I used a simple benchmarking tool (CrystalDiskMark).

HDD speeds in MB/s
7200rpm HDD RAMDisk
Read 105 4995
Write 85 3554

Setting up RAMDisk

Download RAMDisk, install it and create a RAMDisk size ~1024MB. Configure it so it should automatically Load/Save the RAMDisk image. And I recommend turning on the AutoSave for approx ~15 minutes (900 seconds).

After you create the RAMDisk open the Windows Disk Management app and partition/format the new drive (NTFS, quick format) to drive R:.

I tried two different approaches to using the RAMDisk so I’ve separated these into “Phases”. Phase 2 is slightly more complicated.

RAMDisk – Phase 1

With the RAMDisk running create a folder on the drive R:\”tempvs”.

Let’s now tell Visual Studio to use this RAMDisk for it’s temporary folder. Create a batch file vs2010.bat with the contents:

set TEMP=R:\tempvs
set TMP=R:\tempvs
"C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe"

Also tweak your web.config so ASP.NET dynamic compilation system can run as fast as it possibly can with the tempDirectory attribute:

<compilation debug="true" strict="true" explicit="true" tempDirectory="R:\tempaspnet">

If there was a speed boost at this point it was negligable.

RAMDisk – Phase 2

Now I wanted to see the compile time performance if I moved all the project source on to the RAMDisk too. By using a symlink from our current source location to our RAMDisk means there is no configuration changes or mucking around with the Solution or Project files.

If 1024MB RAMDisk isn’t big enough for your projects source code, resize it. (The existing RAMDisk will be lost and you have to create a new one).

Please backup your HDD or commit to source control before attempting this.

Copy solution folder on to the RAMDisk. Example c:\source\client\project => r:\source\client\project.

Rename (or remove) the existing solution folder. Example c:\source\client\project => c:\source\client\project_before_ramdisk

Now create the symlink to the solution folder on the RAMDisk (I’m using Windows 7, unsure if the command line differs for Vista)

c:
cd \source\client\
mklink /d "project" "r:\source\client\project"

You will now have a symlink from c:\source\client\project => r:\source\client\project. When you start Visual Studio and open your project from c:\source\client\project (like normal) the project should just load. With luck it will feel snappier and your compile times will be faster.

RAMDisk – Observations

Running a RAMDisk didn’t appear to have the speed benefits that I would have originally expected. I think because the .NET compiler has been optimised into oblivion the speed benefits of the RAMDisk is minimal.

That said, halving the time your waiting on the compiler is a big win.

Also if you’re running a SSD or RAID 0 solution on your PC already, I doubt there will be much benefit to you. Also if you’re already using fast disks you’re getting all-round speed benefits rather than just using a RAMDisk for source compilation.

So what speed difference did I observe?

Solution Compile Times
7200rpm HDD RAMDisk
23 seconds 12 seconds

Overall VS2010 feels snappier, and if you’re compiling many times a day and/or frequently running your Unit Tests the difference of even a few seconds will add up over days/weeks/months.

Turning off the RAMDisk and returning to my previous set up feels sluggish compared, so I will keep with this solution for the time being.

RAMDisk Warning

I want to be very clear that you’re using a RAMDisk. This means if your computer loses power you will lose your changes! That is until the RAMDisk is written to its image or you’ve committed to SCM you are running a risk.

Cheap Hardware Solutions

I also installed a 2nd HDD and moved the System Page file on to it as well as the SQL Server database MDF/LDF files.

I honestly can’t think of much more, I’m clutching at straws on this one.

Slightly more expensive Hardware Solutions

Upgrade to an SSD, 10,000RPM HDD or RAID 0 the HDDs. Not only will your compile times decrease, but you’re also going to see speed benefits for IIS, Visual Studio start up times, etc.

Get as much RAM as your boss will allow (whether that be management or wife).

Throw as much processing power as you can afford at the problem. I’m running an i7 2.8GHz and wishing for more.

Moving VS2010 on to RAMDisk

I created a 2GB RAMDisk and symlinked VS2010 onto it! I was hoping for a massive speed boost! Sadly this was not the case.

VS2010 Start Up Times
7200rpm HDD RAMDisk
1:15 0:43

As this computer has 6GB RAM, with a 2GB RAMDisk I’m now down to 4GB of available RAM. At this point I believe the amount of available RAM for VS is now to low and the system is starting to page. Perhaps if I had 8GB+ RAM this would be a viable solution.

System Specs

Intel Core i7 at 2.8GHz 6GB RAM

7200RPM HDD

Back to top