Presenting at MEDC

Ashley, Steve and I are giving a talk at MEDC on our baby, Live Search for Mobile. Ash will talk about interaction design for mobile, I'll talk about lessons learned and useful tips for developing on Compact Framework (Live Search is built on CF 1.0 SP3), and Steve will talk about our uber-agile process. Stop by and say hi!

Update: you can see the video here - although it seems to bomb out before I started talking. When I saved it to my local drive it worked fine, so I'm not sure what the issue is with streaming it.

Graham Wheeler on

Monkeyin’ Around

My partner in crime on Live Search for Mobile, Ashley, has started a coding blog, which is much more interesting than mine. He's currently very into functional programming but with a C# bent - basically a C# schemer - and there's some cool stuff he's been playing around with in .Net 2.0 and 3.0. Check it out!

Graham Wheeler on

Easy Architecture Improvements

I was searching a couple of days back for a tool that would generate dependency matrices for C# code. I didn't find free ones, but I did find a plugin for Lutz Roeder's Reflector that will do this for compiled assemblies, which is just as good. I haven't done a fresh install of reflector for quite some time and didn't know it supported add-ins, but it does and there are a few good ones.

The dependency matrix tool is absolutely fantastic, and I highly recommend it. Amongst other things it will generate a report that includes cyclic dependencies. Just that is worth its weight in gold. Cyclic dependencies typically creep in when you make short cut kludges to hack in some inappropriate type-dependent logic into a class.  As such, its usually an indication of a design break, and it also makes unit testing harder. Use this tool, look at any cycles it reports, and fix them. Your code will be better as a result.

Graham Wheeler on

Capturing the Elusive Form

Last night I decided to try write a web browser that has the ability to take screen captures. I have an rss2book program that I wrote for my Sony Reader which has been great at producing PDF content from the web (mostly RSS but it is not limited to that). However, I figured that for some content, especially that which is largely Javascript driven, it might be better to capture the full content of a web page as an image and then turn that into a DJVu document (the Sony Reader doesn't actually support DJVu, but I imagine that there will be e-book readers soon that do - or at the least there's always the Nokia N800).

Essentially, this app needs to do the following:

Read more…

Graham Wheeler on

Functional Synchronicity

There's been some weird synchronicity going on recently. It started a few weeks back at work. Earlier this year I wrote a compiler for Javascript, and this resulted in a conversation with a workmate about virtual machines. I mentioned the SECD machine and Henderson's seminal book from 1980 on functional programming. My workmate was interested enough to order a copy, and we've had a number of conversations about functional programming (which I haven't done in 20 years). At some point in this process I ended up getting the Google paper on map/reduce, and the paper on a history of Haskell. A few days later Joel wrote about map/reduce and Javascript on his blog. Then I ended up almost inadvertently getting a copy of Danny Hillis' Connection Machine book.  Today I read Eric Sink's posting about multicore CPUs and Erlang, in which he also mentioned Larry O'Briens blog - so I head over there and the third posting down discusses a problem very similar to the deadlock issue I just posted about.

Who knows what it all means? Maybe its time to learn F#...

Graham Wheeler on

.Net async calls may run on the calling thread

I got bitten today with a nasty deadlock in my code. It took a while to unravel as this particular code involves large numbers of threads making parallel web service requests. I thought I'd share the particular gotcha that tripped me up.

For performance reasons, all my calls are aynchronous. I have a callback for reading HTTP response data, which included the following (grossly simplified here to just show enough to illustrate the problem):

private void ReadCallBack(IAsyncResult result)
{
    int bytesRead = response.EndRead(result);
    if (bytesRead > 0)
    {
        HandleData(buffer, bytesRead);
        lock(this)
        {
            // kick off next read
            response.BeginRead(buffer, 0, len, new AsyncCallback(ReadCallBack), this);
        }
    }
}

It was important to the logic of my program that I not hold the lock when calling HandleData. However, it turns out that if there is already data available, the call to BeginRead will not queue a callback on a different thread but will do the callback immediately itself on the same thread - so the nested call to HandleData will happen within the locked region!

Graham Wheeler on

Organizing Life

I tend to be one of those people who accumulates vast amounts of clutter on my desk, in my room, and in my life, and then every couple of months has a big cleanout, vowing to maintain the new uncluttered state, but the cycle just begins again (I blame the laws of thermodynamics). In an effort to break that cycle I've recently started paying some attention to David Allen's Getting Things Done approach.

I haven't read his books (part of my clutter is a large number of unread books; his book was among them for a while until it went back to the library), but there is enough info on the web to get the idea. There is also a good description in the wonderful book 'Micro-ISV: from Dream to Reality' by Bob Walsh. One of the first things I did was look for software that I could use to start implementing the GTD approach. The two main contenders seemed to be Bob Walsh's own Masterlist Professional, which is very reasonably priced at \$25, and a Ukrainian product called MyLife Organized, which costs \$60. I downloaded both and tried using them.

Read more…

Graham Wheeler on

This is s-o-o-o true!

Check out this spoof video about if Microsoft designed the iPod packaging.

It is very funny, particularly as it is so spot on! Probably because it comes from Microsoft marketing people.  Even though I personally wouldn't buy an iPod (I have an 8Gb Zen Micro, and can't wait for the 12Gb version - I want small on the outside but big on the inside).

Graham Wheeler on

Digital Reflection

I've been going through old CD-R discs of mine with a view to reburning them on DVD-R to safe some space and generally clean them up. It's amazing what I'm finding - things that I had totally forgotten having written. For example, I found a SNMPv1/v2 MIB compiler and browser that I wrote back in 1995. Until I saw it I had no recollection that I even did that! After some reflection it all came back. In May 1995 I started Open Mind Solutions with two friends from university days. Our plan was to do work for hire to finance the development of a software product. At that stage I had quite a bit of experience with SNMP, having recently implemented RMON while working for Mosaic Software. It seemed that there was a lack of good network management software, and what was available was hugely expensive (HP OpenView pretty much had the market). We felt that we could build a worthy competitor to OpenView based on FreeBSD.

Read more…

Graham Wheeler on