Debugging an iPhone’s network traffic.

One of the most frustrating things when writing an iPhone app (now that we have Swift to banish the hell that is Objective-C!) is the lack of debugging tools, in particular not having Wireshark available.

Fret no more however. It turns out that you can  mirror all your iPhone network traffic to your Mac by exposing a virtual network interface.

Simply launch Terminal, and enter:

$> rvictl -s <UDID of Phone>


$> rvictl -s 4738101a4a910ffa9e368ef683fb2135dec12716

Starting device 4738101a4a910ffa9e368ef683fb2135dec12716 [SUCCEEDED] with interface rvi0

(your UDID can be determined via iTunes)

This will create a new network interface called rvi0 (or whatever the success message tells you) that you can listen on with Wireshark.

Adding a network delay in Windows Server 2008 R2

There is a very cool tool called DummyNet (aka IPFW) which allows you to add latency and set bandwidth or packet loss parameters to any network connection. This can be really useful when testing a client-server application on your local machine, or with virtual machines as it will simulate a more normal network experience and can highlight when you are taking too many round-trips to the server, or 

Download the binary (there is a link at the top of the page) and extract it (I’m assuming you put it in C:\DummyNet).

If you are using a 64-bit version of Windows, then copy all the files in \binary64 to \binary.

Follow the instructions in \binary\readme.txt.

Launch a Command Prompt (as administrator) and start slowing down your network!

Set 200ms of latency

Note we set the latency as 100ms as it will be applied to both incoming and outgoing messages (thus giving 200ms total).

$> ipfw pipe 3 config delay 100ms

$> ipfw add pipe 3 ip from any to any

Remove settings

$> ipfw -q flush

$> ipfw -q pipe flush


Disable dashboard in Mac OS X

I find the dashboard in Mac OS X pretty pointless. Luckily, there is an easy way to remove it (thanks to this post).

Note that I’ve tested this in 10.8 Mountain Lion.


defaults write mcx-disabled -boolean YES 
killall Dock


defaults write mcx-disabled -boolean NO
killall Dock

A tale of two jobs.

For the last 3 years, I have been working for a large, UK financial institution, on a major transformation programme. The aim of this programme was to rip out their 40 year old banking platform, and replace it with a brand-new SAP platform. The total cost of this project was £400 million. Yet when I asked for a 2nd monitor to complement my existing 19″ (and 2 monitors is the *minimum* a developer should expect these days) I waited 6 weeks only to have a man turn up and plonk a 17″ on my desk.

“What the hell is that?!” I exclaimed.

“Yeah, sorry, budget won’t stretch to 19 inches” he explained.

I checked on Amazon and the difference in price was approximately £30. Now, bear in mind that they were paying over £500 a day for me, and you can see how nuts this was!

Before I sound like a whiny little bitch, it’s important to understand that this is an illustrative example of the attitude. The PC I was supplied with was unusably slow – it would sometimes take 15 seconds to open “All Programs” in the Start menu, and when I ordered another 2 GB of RAM a man came and installed 1…

Yet, what a contrast it is with my new company. 3 weeks before I joined they gave me my new laptop. It’s a top-spec Retina Macbook Pro that literally cost more than my car (granted my car wasn’t very expensive, but still!). And the day I started, my boss said “Here’s your iPhone 5. Oh, and someone pinched your monitor so pick whatever you want off Amazon and get Sally to order it.”. The next day I had two 24″ monitors on my desk. Also, there is free Coke in the fridge and nice toilet paper in the bogs.

The flip-side is that the work is challenging – but then, that’s why they employed me. I’m no longer a faceless cog in a giant machine – I’m once again a valued employee and I love it!

Using MvcSiteMapProvider with Twitter Bootstrap

<a href=”“>MvcSiteMapProvider</a> provides an easy way to add Sitemap functionality to your MVC application. One very nice thing is that integrating it with Twitter’s Bootstrap UI framework is child’s play (assuming the child in question has a decent background in .NET web-programming of course).

Once you have NuGet’ed both the sitemap provider and Bootstrap, and defined your sitemap XML file, you will typically add the following code to your master page to render the menu into the output HTML.


However, Bootstrap expects the HTML elements to use certain classes (e.g. “nav nav-pills”) which, by default, MvcSiteMapProvider will not do.

You can fix this easily by modifying the following template:


to include all the necessary CSS classes.

Edited template

<!-- Edited to work with Twitter Bootstrap by adding 'nav' and 'nav-pills' classes. -->
<ul class="nav nav-pills">
<% foreach (var node in Model.Nodes) { %>
    <!-- Edited to work with bootstrap by adding 'active' class for current node. -->
    <li class='<%= node.IsCurrentNode ? "active" : string.Empty %>'><%=Html.DisplayFor(m => node)%>
    <% if (node.Children.Any()) { %>
        <%=Html.DisplayFor(m => node.Children)%>
    <% } %>
<% } %>