Ever since I saw a video of Corey Haines running Autospec I’ve been looking for an option to automatically run my tests when files change. So here is a list of different solutions.

I found a python package that allows me to do what I wanted to do with onchange. It’s called watchdog and is OS-independent. So apparently it works in linux, mac and windows.

There is also a ruby gem called Guard which can accomplish the same thing.

Then we have the continuous testing guys with mighty moose, which seems to be a paid option for .net, but which adds the idea of only running affected tests.

Bookmark and Share

We’ve been having this annoying crash going on for a while. We’ve seen it show up in Eqatec Analytics for a while, but since the stacktrace never had any of our code in it, we we’re a bit perplexed of what to do.

This is the stacktrace:

at System.Drawing.Bitmap..ctor(Int32 width, Int32 height, PixelFormat format)
  at System.Drawing.Bitmap..ctor(Int32 width, Int32 height)
  at System.Drawing.Icon.ToBitmap()
  at System.Windows.Forms.ThreadExceptionDialog..ctor(Exception t)
  at System.Windows.Forms.Application.ThreadContext.OnThreadException(Exception t)
  at System.Windows.Forms.Control.WndProcException(Exception e)
  at System.Windows.Forms.Control.ControlNativeWindow.OnThreadException(Exception e)
  at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
  at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
  at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
  at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
  at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
  at System.Windows.Forms.Application.Run(Form mainForm)

Then one day I got a report describing the crash and I said what the hell. So I started Googling for possible causes, could we find a service pack that solves the issue or just get an idea of whats going on.

When I stumble on a post claming that there was a GDI handle leak when converting bitmaps to imagesources, typically done when working with resources in a winforms applciation to support wpf.

The more I Googled the GDI leak the more apparent it became that this might be the root cause of our troubles. Luckly after some more research I found this article on Code Project describing our exact scenario and had itterated over the problem several times. If you run into this issue I highly recommend giving the article a read, and this post is primarily to help expose the article to others with similar issues.

Bitmap to BitmapSource at Code Project

Bookmark and Share

Everyone wants metrics these days, but it takes a while to invest in good quality metrics for your software. However, if your running a javascript based single app page, or well mostly any webpage. You could use Google Analytics to get some basic quality metrics.

What can we measure?

So I’ll briefly cover some things that you can use google analytics for.

  • Ajax response times
  • Ajax failed requests
  • Feature usage
  • some aspects of javascript errors

There are more specialized measuring tools, but one thing that is interesting with using Google Analytics for this is that your accutally measuring what people are using. The response times will be the response time a client acctually has. Which I find quite intresting. But were getting ahead of our selves.

I’ll some some code at the end of the post describing how to measure some of these. Others can be deducted from the code.

Ajax response times

jQuery has these interesting functions you can add, where you get to maniupate the jQuery jqXhr request before sending it. Here you can jack in, take a timestamp and save it on the request for when your sending it. Then when the request recieves is done you can take the timestamp and compare it against the current time. I’m sure there are similar functions with other libraries, and if not you could easily wrap all your ajax calls in a method that support taking these snapshots.

So now we have a measurement of how long a request took to complete the request, and this can easily be sent to Google Analytics as a custom event.

Ajax failed request

Similar to the time calculated, we can also handle the case where the server returns certain error codes, and just measure how much of these error codes we get. It’s quite easy then to see, how many timeouts does our clients get? Are we getting internal server errors? Unauthorized, not found, etc.

Feature usage

You could make a simple function that you call with a given key to log a usage of a certain feature. This can allow you to experiment with the user interface, or just measure the popularity of a new feature.

Be warned, just because a certain feature gets low measures dosn’t necesarilly mean you can drop it.

Javascript errors

Now adays you can pick up on window.onerror in most browsers, which does allow you to keep track on how many javascript / image loading faults you have on your page. There are tools that speciallize in this, such as my own www.js-analytics.com. That will allow you better details regarding such errors, but sometimes just getting a number will be enough.

The code

As you can see the code sets up two functions to save a timestamp and report back the calculated execution time of the ajax request in milliseconds. There is also a function for reporting ajax errors and hooks up on window.onerror.

It should be quite easy to attach a function that reports back usage on a function based on a given key. But as the script does not attach any public funtions I didn’t want to decide on a namespace or object to attach the feature tracking too.


So you can capture a bunch of metrics and report to Google Analytics. You can probably collect even more metrics form the site, that I have yet too think of. Don’t hesitate to point out if I missed anything or you come up with some other brilliant metric to capture.

What is interesting is that the metrics gathered are also gathered along with other metrics such as how long the user stayed on the site, what content he or she browsed, if they used adcampagins to reach the site, etc. Allowing you to correlate the data gathered with the behaviour data already gathered by Google Analytics itself.

This post is called “poor mans metrics” as you need not set up any service and just depend on Google Analytics, which in most cases already is available. I wonder how poor it really is. Then again, it will never give you detailed metrics of your servers behaviour.

Bookmark and Share

I found this bug which was caused in our REST-API at RemoteX which was a bit strange.

It was an InvalidCastException being thrown inside Microsofts MSMQ libraries. So a quick Google found this following reported issue:


In short, in a threaded environment never send arbitrary objects over an MSMQ channel, instead send Messages with the content.

Bookmark and Share

There is this ci project I’ve been following with some interest, sadly I havn’t had the chance to try it out since it’s only for open-source software. It seems however, that that is about to change!

They are opening up a beta access program for Travis-CI, which I think is really exciting!

Here is a link to sign up, and there seems to be some sort of pyramid scheme going on to get access to the beta. So sign up using this link :)

Subscription link


Bookmark and Share

I’ll be speaking at the Web-5 conference this April.

I’ll be holding two talks: 1. A talk about continous delivery, how we at RemoteX moved set up our environment to deploy to production more or less continously. 2. A talk about our HTML5 client at RemoteX. At the date of the conference we’ve had a HTML5 offline capable client in production for a year. I hope to share some of the experiences we’ve gathered along the way.

There are still a few tickets left if you want to join us. If you live in Stockholm there is a direct flight from Skavsta airport, and the southern France is quite nice around easter.


Bookmark and Share

I got an IPad a while back, and something was always bothering me with it. It had this really nice looking calendar application that was useless because it only showed one of my 5 google calendars.

Turns out Google tought of that. You need to navigate to their Google Iphone Calendar Selector and select which calendars you want to display in your IPad.

Suddenly my IPad’s calendar app got a lot better. Now if I could only find some way to get a better mail application as well :)

Bookmark and Share

After listening to a changelog episode about Vim I heard of Janus, a set of plugins set togeather and maintained for MacVim. I checked it out Janus and it seems great!

So once I got my vim working after some slight issues in the segmentation fault department, I started looking at it more closely.

I got a bit scared when I realised that all this configuration would go into my .vim directory with out me keeping track of things.

So instead of installing Janus I made a git repository in my .vim directory, and added it to GitHub.

It will probably never be quite as extensive as Janus, but feel free to use it if you want.

You can find it here

Bookmark and Share