My Life As A Blog

Archive for the ‘Design’ Category

Occasionally Connected Silverlight Applications

leave a comment »

Earlier this year, Dr Dave and I worked on a Proof of Concept with Trader Media (probably most famous for Autotrader) and Fortune Cookie.  You can read more about the project here.   The application needed to be able to cope with being disconnected some of the time.  Dr Dave and I took what we learned from this aspect of the project and wrote an article for MSDN Magazine, which you can read here.

Written by remark

June 8, 2010 at 10:01 am

Polyglot Programming at the AIC

leave a comment »

Thanks to everyone who attended my session on Polyglot Programming at AIC earlier today.  The ability to combine languages to achieve simpler solutions is worth consideration, although the potential downsides of adopting multiple languages need to be borne in mind.  In truth, many of us are already doing a form of polyglot programming – combining a programming language server side (such as C#) with Javascript on the client and SQL for data access.  However, this form of polyglot programming arises passively and is done because we have to and not because we have deliberately and actively selected a set of languages.  In order to be successful with polyglot programming, there are two crucial components: a platform and architecture.  The platform should provide language interoperability and the architecture should provide guidance on which languages to use and where in the architecture they are appropriate (taking into account that this guidance will evolve over time as you gather information and feedback about what really works for you and your team.)  In discussing the platform, I briefly touched on some of the features in .NET 4 and talked about the trends in language design.  I’ll be expanding on these platform themes and diving into a little more detail about .NET 4.0 at TechDays in April.

Here are the links and references I used in my session:

Nick Watts’ post on polyglot programming (I used his definition)

The definition of polyglot in the Compact Oxford English Dictionary

Neal Ford’s post on polyglot programming

Bertrand Meyer’s article on polyglot programming in Dr.Dobb’s

Information about the Babel Project at the Lawrence Livermore National Laboratory

Ted Neward’s MSDN article The Polyglot Programmer: Mixing and Matching Languages

History of Programming Languages

Hans Christian Fjeldberg’s thesis on Polyglot Programming

Dean Wampler’s presentation on Polyglot and Poly-Paradigm Programming

I also referred to Ola Bini’s idea of fractal programming.

I suggested that there are two practical areas where experimentation with polyglot programming could be beneficial with existing applications and systems:  extension and testing.  By extension, I mean the ability to customise and add functionality – which is a great fit for a dynamic language like IronRuby or IronPython.  Testing is also an area where dynamic languages have much to offer and I’d suggest taking a look at Ben Hall’s presentation that he gave at QCon earlier this year.

Written by remark

March 31, 2010 at 5:15 pm

Posted in .NET, Architecture, Design, Events

Tagged with

Simple Configuration with IronPython and .NET 4

with 2 comments

Recently I posted a short article about how to do simple configuration with IronPython.  I figured that it would be easier with .NET 4.0 thanks to the dynamic support.  And it is.  Using Visual Studio 2010, create a new Console Application.  Add one file called and set the copy output property to Copy Always.  Here’s the Python code for that file:

configuration.Text = "Hello from IronPython"
configuration.Count = 4

And here’s the code for the Program class:

class Program
    static void Main(string[] args)
        dynamic configuration = ConfigureFromIronPython();

        for (int i = 0; i < configuration.Count; i++)

        Console.WriteLine("Press any key to exit...");

    private static dynamic ConfigureFromIronPython()
        dynamic configuration = new ExpandoObject();
        ScriptEngine engine = Python.CreateEngine();
        ScriptScope scope = engine.CreateScope();
        scope.SetVariable("configuration", configuration);
        engine.ExecuteFile("", scope);
        return configuration;

For that to work you need add references to IronPython and Microsoft.Scripting (there’s a CTP of IronPython for .NET 4.0 that you can get here.)  You’ll also need a few using statements:

using System.Dynamic;
using IronPython.Hosting;
using Microsoft.Scripting.Hosting;

The two things that make this work are the ExpandoObject and the dynamic keyword.  The ExpandoObject is a dynamic property bag that allows us to set and get members at runtime as needed.  The dynamic keyword means that .NET will resolve the properties at runtime (rather than the traditional behaviour of checking at compile time.)  The result is (I think) more simple and elegant than the configuration code to which I’ve become accustomed.

Written by remark

September 28, 2009 at 12:53 pm

Posted in .NET, c#, Design, Python

Simple configuration using IronPython

leave a comment »

I’ve just posted an article on how to use IronPython to configure an application – read it here.

Written by remark

September 14, 2009 at 4:49 pm

Posted in .NET, c#, Design, Development, Python

Adding mobility to an ASP. NET MVC site

leave a comment »

I’ve posted a short article about how I added mobile support to the iWantGreatCare Proof of Concept.

Written by remark

April 16, 2009 at 5:35 pm

On the Origin of DeepZoom Mosaics

leave a comment »

The mosaic of Charles Darwin – made from the pages of On the Origin of the Species – intrigued me the first time I saw it and, having shown it to quite a few other people, I know I’m not alone. It was built by Shoothill in collaboration with Shropshire Tourism (UK) Limited and the world renowned Darwin expert Dr. John van Wyhe and was part of Scott Guthrie’s keynote at Remix UK 08. I caught up recently with Rod Plummer, the Managing Director of Shoothill, to find out a bit more about it. I figured there’d be others apart from me interested and Rod was kind enough to agree to me publishing an interview with him:

Let’s start with a brief overview of Shoothill.

Three years ago my business partner and I were inspired to form the company to exploit the exciting opportunities presented by the Microsoft Virtual Earth platform. We secured a few contracts fairly quickly and took the decision to continue to invest in growing the firm. We are now up to 8 staff and are in the process of moving to bigger offices to accommodate our expansion plans for 2009.

Since getting involved with VE development we have been increasingly exposed to other MS Live technologies and one part of Silverlight (Deep Zoom) particularly interested us.

When did you first see DeepZoom?

I first saw Deep Zoom (then codenamed Sea Dragon) in 2006 at a demo given by a Microsoft employee showcasing the entire King James Bible being read aloud. Although the product was still in its early stages then, I was instantly struck by the endless possibilities of this technology.

What do you think is the ideal application of DeepZoom?

The power of being able to view massive images without having to download them to a local desktop and only view those pixels that you need to lends itself naturally to document / image storage and repository retrieval functions. I could also see immense possibilities for Deep Zoom in the fields of advertising, creative marketing and enabling the construction of highly engaging, immersive experiences in order to convey corporate, commercial and public sector messages, and it is within these fields that Shoothill has been most successful.

What DeepZoom work have you done?

We have done a few things in DeepZoom, most notably the Silverlight Mosaic for the 200th anniversary of the birth of Charles Darwin made up of digitized scans of the pages from the first edition of On the Origin of the Species. We recently completed a project for The Sun, (the UK’s most successful tabloid newspaper), during the Christmas of 2008 which certainly got our team in the festive spirit.

You’ve done some interesting mosaic work with DeepZoom. How do you go about creating a mosaic?

Mosaics have been around since the 4th century BC and are basically attempting to do the same thing: – make base images (cells) combine to look like the master image when placed in a pattern. A mosaic in digital imaging is a collection of non-overlapping images, arranged in some tessellation (cell shape). A photo mosaic is a picture made up of various other pictures in which each "pixel" is another picture.

Traditionally large digital / photo mosaics have been virtually impossible to distribute across the web due to the huge file sizes involved and the consequential time lost in attempting to download them. For example, if you were to create a mosaic made up of images of 300 x 400 pixels and you wished to have the mosaic itself made up of say 50 x 50 images, then the resultant file would equate to an image of 12000 x 15000 pixels and around 1GB.

So the first thing to think about is what is your master image that you wish to make into a mosaic. If it is too complicated and ‘busy’ the result will be disappointing (unless you go for a massive image) so try to use a relatively simple image as your master.

The second thing to think about is how big do you need the cell images too be (too big and the mosaic will be huge, too small and the cell images will be of such poor quality that you will not be able to view or read them. However if you reduce the size or quality of either the target subject or the content images to overcome this then the net result is overall poorer quality. The best method is to select a group of cell images and then use some batch software to get them down to approx 300² pixels before you begin to build the mosaic.

Let’s talk stats. How big is the DeepZoom Darwin image? If I were to create a physical version of it, how big would it be?

The actual size of the Darwin image is actually 860MB and should you wish to print it out it would take 381cm x 508cm of paper and that equals around 1500 pieces of A4 paper!

As I said earlier the size of the image is the crucial element of building Silverlight mosaics and we have compiled images of nearly 5 GB and far bigger than the Darwin image. This is naturally processor intensive and painstaking work. The real challenge and skill in compiling mosaics is maintaining image integrity and quality whilst compressing them to a manageable size. Silverlight adds a great deal of value when bringing them all together.

Any advice for someone about to pick up DeepZoom for the first time?

Think before you start, about who the intended audience is and what are you trying to achieve and what is the end result your are looking for (i.e. in the case of a mosaic do you want the finished mosaic to remain true to the original master or are you happy to lose some of this quality in order to gain better cell images?).

Next, try and be original and come up with something that is intriguing to the eye (for example to help the user understand the Darwin image a little better we offset the pages of the book (very slightly) so that the end user would see straight away that there was more to the image and it was worth zooming into it further

Finally I would also say that although Deep Zoom is fantastically versatile and incredibly powerful it does have certain limitations as to file size (both in total number of pixels per image and actual / physical file size) and so you need to get to a happy balance between all three of the variables (i.e. Master image, cell image size and Deep Zoom limits).

Naturally we are more than willing to help on projects, too. If you have a Deep Zoom project that you need help on please email us at

Written by remark

April 6, 2009 at 10:48 am

Half Life of a Diagram

leave a comment »

I’ve spent the last two days in an Architectural Design Session during which we naturally used the whiteboard.  Looking around the room now I can see a variety of diagrams – all of which were incredibly useful at the time they were drawn.  Most of them still make sense.  But I know that if I came back in to the room this time next year I would struggle to understand them.  Which leads me to wonder what the half life of a diagram is.  I wonder if more formal diagrams half a longer half life, but take more effort to create.  If this is right, it suggests that whiteboard diagrams need to be converted into more formal representation if they are sufficiently important.  An alternative would be a lighter weight set of informal diagramming techniques.  This may be time for me to read The Back of a Napkin – although I figure for that to be effective we all need to read it.

Written by remark

November 26, 2008 at 6:19 pm

Posted in Architecture, Design

Tagged with