# Wednesday, July 04, 2007
Tony Blair takes residence in Connaught Square
Tony Blair takes residence in Connaught Square, uploaded to Flickr by James Snape.

This is the moment that Tony Blair moved into Connaught Square at the weekend during our engagement party. Unfortunately I didn't have a paparazzi style long lens on the camera so couldn't get a really tight shot.

Canon 400D, Canon 24-105 f/4L IS lens - 1/250 second, f/4, ISO 400

by This posting is provided "AS IS" with no warranties, and confers no rights.
posted on Wednesday, July 04, 2007 1:22:08 PM (GMT Daylight Time, UTC+01:00)  #    Comments [1] Trackback
# Wednesday, June 27, 2007

As everyone knows Tony Blair resigned as Prime Minister and member of parliament today.

He'll be moving into his new house soon and turned up to the residents garden party. My sister lives in the same square and the Daily Mail managed catch her in the background when snapping pictures of him.

by This posting is provided "AS IS" with no warranties, and confers no rights.
posted on Wednesday, June 27, 2007 10:53:13 PM (GMT Daylight Time, UTC+01:00)  #    Comments [0] Trackback
# Tuesday, June 19, 2007

The results of the previous three tests are interesting. In both IE7 and Firefox all three render correctly (although the PRE tag in the first one causes the text to spill into the right hand bar). When viewing the RSS feed it becomes a whole new story:

  • IE7 doesn't honor PRE tags, single spaces or stylesheets
  • Firefox doesn't honor PRE tags, single spaces or stylesheets as well but at least it cuts out the embedded stylesheet in the last post
  • Google Reader also doesn't honor PRE tags, single spaces or stylesheets and to cap it all anything in a PRE tag just renders to the end of line and stops so it makes things impossible to read

I wonder, is there a standard that feed readers need to adhere to? What is the best way of embedding syntax colored code in blog posts?

by This posting is provided "AS IS" with no warranties, and confers no rights.
posted on Tuesday, June 19, 2007 5:14:50 PM (GMT Daylight Time, UTC+01:00)  #    Comments [0] Trackback

Same post but with embedded styles.

I'm trying to get a decent solution to inserting code in blog articles so the next few posts are all about the code. The sample below is a simple line counter tool I use to work out some metrics for code reviews.

using System;
using System.Collections.Generic;
using System.Text;
using System.IO;

namespace LineCount
{
  class Program
  {
    private static int folders;
    private static int files;
    private static int lines;
    private static int code;
    private static int comments;

    static void Main(string[] args)
    {
      if (args.Length == 0)
      {
        Console.WriteLine(@"
Usage: linecount <root folder>

e.g. linecount t:\dev\projects\main

NB: Only .cs files are considered
  Review time is hard coded to 200 lines per hour
"
);
        return;
      }

      CountLines(new DirectoryInfo(args[0]));

      Console.WriteLine("FOLDERS:{0} FILES:{1} LOC:{2} SLOC:{3} COMMENTS:{4}",
        folders, files, lines, code, comments);
      Console.WriteLine("Code density: {0:p}",
        (double)code / (double)lines);
      Console.WriteLine("Comment density: {0:p}",
        (double)comments / (double)lines);
      Console.WriteLine("Comment ratio: {0:p}",
        (double)comments / (double)code);
      Console.WriteLine("Estimated review time: {0}h", 1+ (code / 200));
    }

    private static void CountLines(DirectoryInfo parent)
    {
      ++folders;

      foreach (DirectoryInfo folder in parent.GetDirectories())
      {
        CountLines(folder);
      }

      foreach (FileInfo file in parent.GetFiles())
      {
        CountLines(file);
      }
    }

    private static void CountLines(FileInfo file)
    {
      switch (file.Extension)
      {
        case ".cs":
          break;
        default:
          return;
      }

      ++files;

      using (StreamReader reader = file.OpenText())
      {
        string line = null;
        bool inComment = false;

        while ((line = reader.ReadLine()) != null)
        {
          ++lines;
          line = line.Trim();

          if (line.Length == 0)
            continue;

          if (line.StartsWith("//"))
          {
            if (line.Replace("//", "").Trim().Length > 0)
              ++comments;

            continue;
          }

          if (line.StartsWith("/*"))
            ++comments;
          else if (!inComment)
            ++code;

          if (line.Contains("/*"))
          {
            inComment = true;
          }

          if (inComment && line.Contains("*/"))
          {
            inComment = false;
          }
        }
      }
    }
  }
}
by This posting is provided "AS IS" with no warranties, and confers no rights.
posted on Tuesday, June 19, 2007 4:34:25 PM (GMT Daylight Time, UTC+01:00)  #    Comments [0] Trackback

Same post but without the PRE tags:

I'm trying to get a decent solution to inserting code in blog articles so the next few posts are all about the code. The sample below is a simple line counter tool I use to work out some metrics for code reviews.

using System;
using System.Collections.Generic;
using System.Text;
using System.IO;

namespace LineCount
{
  class Program
  {
    private static int folders;
    private static int files;
    private static int lines;
    private static int code;
    private static int comments;

    static void Main(string[] args)
    {
      if (args.Length == 0)
      {
        Console.WriteLine(@"
Usage: linecount <root folder>

e.g. linecount t:\dev\projects\main

NB: Only .cs files are considered
  Review time is hard coded to 200 lines per hour
"
);
        return;
      }

      CountLines(new DirectoryInfo(args[0]));

      Console.WriteLine("FOLDERS:{0} FILES:{1} LOC:{2} SLOC:{3} COMMENTS:{4}",
        folders, files, lines, code, comments);
      Console.WriteLine("Code density: {0:p}",
        (double)code / (double)lines);
      Console.WriteLine("Comment density: {0:p}",
        (double)comments / (double)lines);
      Console.WriteLine("Comment ratio: {0:p}",
        (double)comments / (double)code);
      Console.WriteLine("Estimated review time: {0}h", 1+ (code / 200));
    }

    private static void CountLines(DirectoryInfo parent)
    {
      ++folders;

      foreach (DirectoryInfo folder in parent.GetDirectories())
      {
        CountLines(folder);
      }

      foreach (FileInfo file in parent.GetFiles())
      {
        CountLines(file);
      }
    }

    private static void CountLines(FileInfo file)
    {
      switch (file.Extension)
      {
        case ".cs":
          break;
        default:
          return;
      }

      ++files;

      using (StreamReader reader = file.OpenText())
      {
        string line = null;
        bool inComment = false;

        while ((line = reader.ReadLine()) != null)
        {
          ++lines;
          line = line.Trim();

          if (line.Length == 0)
            continue;

          if (line.StartsWith("//"))
          {
            if (line.Replace("//", "").Trim().Length > 0)
              ++comments;

            continue;
          }

          if (line.StartsWith("/*"))
            ++comments;
          else if (!inComment)
            ++code;

          if (line.Contains("/*"))
          {
            inComment = true;
          }

          if (inComment && line.Contains("*/"))
          {
            inComment = false;
          }
        }
      }
    }
  }
}
by This posting is provided "AS IS" with no warranties, and confers no rights.
posted on Tuesday, June 19, 2007 4:27:52 PM (GMT Daylight Time, UTC+01:00)  #    Comments [0] Trackback

I'm trying to get a decent solution to inserting code in blog articles so the next few posts are all about the code. The sample below is a simple line counter tool I use to work out some metrics for code reviews.

using System;
using System.Collections.Generic;
using System.Text;
using System.IO;

namespace LineCount
{
    class Program
    {
        private static int folders;
        private static int files;
        private static int lines;
        private static int code;
        private static int comments;

        static void Main(string[] args)
        {
            if (args.Length == 0)
            {
                Console.WriteLine(@"
Usage: linecount <root folder>

e.g. linecount t:\dev\projects\main

NB: Only .cs files are considered
    Review time is hard coded to 200 lines per hour
");
                return;
            }

            CountLines(new DirectoryInfo(args[0]));

            Console.WriteLine("FOLDERS:{0} FILES:{1} LOC:{2} SLOC:{3} COMMENTS:{4}", 
                folders, files, lines, code, comments);
            Console.WriteLine("Code density: {0:p}", 
                (double)code / (double)lines);
            Console.WriteLine("Comment density: {0:p}", 
                (double)comments / (double)lines);
            Console.WriteLine("Comment ratio: {0:p}", 
                (double)comments / (double)code);
            Console.WriteLine("Estimated review time: {0}h", 1+ (code / 200));
        }

        private static void CountLines(DirectoryInfo parent)
        {
            ++folders;

            foreach (DirectoryInfo folder in parent.GetDirectories())
            {
                CountLines(folder);
            }

            foreach (FileInfo file in parent.GetFiles())
            {
                CountLines(file);
            }
        }

        private static void CountLines(FileInfo file)
        {
            switch (file.Extension)
            {
                case ".cs":
                    break;
                default:
                    return;
            }

            ++files;

            using (StreamReader reader = file.OpenText())
            {
                string line = null;
                bool inComment = false;

                while ((line = reader.ReadLine()) != null)
                {
                    ++lines;
                    line = line.Trim();

                    if (line.Length == 0)
                        continue;

                    if (line.StartsWith("//"))
                    {
                        if (line.Replace("//", "").Trim().Length > 0)
                            ++comments;

                        continue;
                    }

                    if (line.StartsWith("/*"))
                        ++comments;
                    else if (!inComment)
                        ++code;

                    if (line.Contains("/*"))
                    {
                        inComment = true;
                    }

                    if (inComment && line.Contains("*/"))
                    {
                        inComment = false;
                    }
                }
            }
        }
    }
}
by This posting is provided "AS IS" with no warranties, and confers no rights.
posted on Tuesday, June 19, 2007 3:54:31 PM (GMT Daylight Time, UTC+01:00)  #    Comments [0] Trackback
# Wednesday, June 13, 2007
Digg This!
Digg This!, uploaded to Flickr by James Snape.

Canon 400D, Canon 24-105 f/4L IS lens - 1/500 second, f/4, ISO 100

It should be noted that I'm not very good at naming things so if you can come up with a better title for this picture I'd appreciate it.

by This posting is provided "AS IS" with no warranties, and confers no rights.
posted on Wednesday, June 13, 2007 8:14:54 PM (GMT Daylight Time, UTC+01:00)  #    Comments [5] Trackback
# Wednesday, June 06, 2007

My programmer personality type is: DHTC

You're a Doer.
You are very quick at getting tasks done. You believe the outcome is the most important part of a task and the faster you can reach that outcome the better. After all, time is money.
You like coding at a High level.
The world is made up of objects and components, you should create your programs in the same way.
You work best in a Team.
A good group is better than the sum of it's parts. The only thing better than a genius programmer is a cohesive group of genius programmers.
You are a Conservative programmer.
The less code you write, the less chance there is of it containing a bug. You write short and to the point code that gets the job done efficiently.

by This posting is provided "AS IS" with no warranties, and confers no rights.
posted on Wednesday, June 06, 2007 6:58:18 PM (GMT Daylight Time, UTC+01:00)  #    Comments [0] Trackback
# Tuesday, June 05, 2007

I'm spending today and tomorrow working with DPE on a lab for ISV's working with the Microsoft BI stack (SQL, SSIS, SSAS, Excel, BSM, PPS etc). Basically each customer brings along an application they are working on and we help on everything from architecture to solving any problems they might be having. It's a lot of fun and I even learned a few things. Because customers turn up with their own applications and problems you never really know what to expect. In the mix today we had:

  • A stock trading system
  • A very cool spreadsheet based query designer
  • A tool to automatically create cubes based on Dynamics customizations
  • Someone working with SharePoint, Business Scorecard Manager and Reporting Services

I'm not sure when the next lab will be but keep an eye on Eric Nelson as he runs most ISV events in the UK.

On a similar note, I'm taking on a new customer. It seems you never escape your past - the customer has a number of call centers they develop applications for... 

by This posting is provided "AS IS" with no warranties, and confers no rights.
posted on Tuesday, June 05, 2007 9:26:09 PM (GMT Daylight Time, UTC+01:00)  #    Comments [0] Trackback
# Monday, June 04, 2007
Calm Water
Calm Water, uploaded to Flickr by James Snape.

Taken at a friend's house... I liked the contrast of yellow and blue.

Canon 400D, Canon 24-105 f/4L IS lens - 1/25 second, f/4, ISO 100

by This posting is provided "AS IS" with no warranties, and confers no rights.
posted on Monday, June 04, 2007 10:33:19 PM (GMT Daylight Time, UTC+01:00)  #    Comments [0] Trackback
# Tuesday, May 29, 2007
Bournemouth Pier
Bournemouth Pier, originally uploaded to Flickr by James Snape.

Canon 400D, Canon 18-55 f/3.5-5.6 lens - 49mm, 1/200 second, f/11, ISO 100

by This posting is provided "AS IS" with no warranties, and confers no rights.
posted on Tuesday, May 29, 2007 8:33:07 PM (GMT Daylight Time, UTC+01:00)  #    Comments [0] Trackback
Branksome Beach
Branksome Beach, originally uploaded to Flickr by James Snape.

Canon 400D, Canon 24-105 f/4L IS lens - 24mm, 1/125 second, f/4, ISO 100

by This posting is provided "AS IS" with no warranties, and confers no rights.
posted on Tuesday, May 29, 2007 8:29:41 PM (GMT Daylight Time, UTC+01:00)  #    Comments [0] Trackback