On further research, we found that the Prism framework is not quite ready for version 4 silverlight. The Prism team are currently revamping Prism to use MEF (Managed Extendability Framework) and while they have begun producing code drops (they are on Drop 3), these are still in alpha, so we can't use them yet.

So to bridge the gap while the Patterns team works towards full release, we decided to use the MVVM Light framework from Laurent Bugnion of Galasoft. It provides a simplified version of Prism's feature set, and has proven to be a great framework to work with.

MVVM light provides:

  • Commanding - RelayCommand object that can be used with Sivleright 4 button commands, and has an extension that bridges other controls that don't yet have commanding
  • Messaging - A great messenger framework for decoupling viewmodels from each other by sending messages instead of binding
  • Blend support - MVVM light has been built with Blend support in mind, and works very well with Blend. This gets around another deficiency in the current Prism implementation, which doesn't play well with Blend.
  • ViewModelBase - base class for viewmodels
  • Templates - for Blend and Visual studio. It also include some code snippets to help with code writing.

I would recommend using MVVM light if you are looking for a good, simple way of making MVVM easier and more clear to work with. It works extremely well with MEF - we have now refactored a complex Silverlight application to use MVVM light and MEF in less than a week.

Sean Wildermuth has a great 4 part example series on using MVVM light with MEF to build an MVVM based Silverlight application. The source included with the examples also has a fantastic error handling, status message and centralized IsBusy indicator setup that leverages the MVVM messaging framework.


We have been doing extensive development using Silverlight, and have run into some barriers with the design of the application we are working on. Some of the issues we were able to mitigate with MVVM pattern. However, as the app has become more complex, dependencies have crept in between the viewmodels and the parent application.We are also running into trouble managing commands and events associated with the application - how do you have several components subscribe to the same event set without having to connect viewmodels together?

The application's Xap file has also grown to be fairly large, and it will be necessary to split the application up into separate chunks that are loaded only when required. Our current structure will not allow this.

Upon doing research into how to address these issues, I discovered the Prism framework from the Microsoft Patterns and Practices group. This appeared to be a great way to address a number of the issues.

Prism is a framework for composing applications from separate modules. It contains an approach for injecting components into others using the Unity framework (also a patterns and practices framework) to eliminate dependencies. It also has a very nice looking commanding approach implemented through an event aggregator publish/subscribe mechanism.

However, during reading through commentary on Prism, I also found the Managed Extendability Framework, from a different part of Microsoft which looked initially like it was a competing approach to solve similar issues.

Microsoft often does things like this (take the whole Linq/ Linq-SQL/Ado.net entity framework/Windows Communication foundation maze as an example...) in which they come out with several almost the same but not completely technology bits that overlap. Inevitably one of the approaches will be adopted at the expense of the other, which forces developers who adopted the wrong one to refactor to the winner.

 (More)

We were interviewed by Craig Bator PM of the Quest for Canada's Smartest IT.

We talk about the philosophy we use at Matrix for building an agile IT and software development team that works directly with leadership to meet the ever changing needs of the business.

See it here: http://smartest-it.ca/craigs_chronicles.aspx


WCF is a great technology, but it is difficult to configure, and often the error messages are cryptic - if in fact you can get it to return exceptions at all.

Fiddler is a great way to debug WCF based services, but even that sometimes doesn't work if you are using the visual studio/cassini based web host.

Fortunately, adding the following code into your web.config file will put any exception information into a log file:

<system.diagnostics>

<sources>

<source name="System.ServiceModel"

switchValue="Information, ActivityTracing"

propagateActivity="true">

<listeners>

<add name="traceListener"

type="System.Diagnostics.XmlWriterTraceListener"

initializeData= "c:tempwcfErrors.svclog" />

</listeners>

</source>

</sources>

</system.diagnostics>

 (More)

We are now finally underway building the first version of what will become the Menome system.

One of the things we needed was a way of clustering points on a map. The idea is to reduce the number of points as the user zooms out by combining points together to keep performance up and to reduce map clutter.

The algorithm operates by creating a 'screen grid' and passing this to the server. As the user zooms and moves around the map, the boundary window they are looking at in lat/long, the height and width of the current window in pixels and the zoom level are passed to the server.

The first level of filtering happens on the SQL server by doing an intersection of the boundary window with the point geography stored in the SQL server.

Points inside the boundary are returned to the web server, where above a given zoom threshold (10 for now), they are passed through the clustering class. The clustering class works by creating a grid out of the current window. Two nested loops are created, which loop through the grid cells. Each points coordinates converted from lat/long to pixel, and checked against the current grid cell. Points found in the same grid cell are grouped together into a single point, and stored into the grid cell list indexed by the X and Y cell index multiplied together.

Fortunately, Johannes Kebeck has posted an algorithm for doing this on his fantastic blog The algorithm he presents is setup to return javascript, and is written in VB, so we changed it slightly to return a SiteLocationPoint object and to operate in C#, since that is the language we are using for the application we are building.

We have turned this into a class, which takes a list of points, and returns a list of clustered points. The main change we had to make to the algorithm itself was modifying the it to use a Dictionary to store the clustered points in the gridCells object instead of a jagged array, which cannot be declared dynamically in C#.

We used a dictionary with the X*Y grid cell as a key for storing/extracting points in a given grid cell. The other modification we need to make, which I will post once we figure it out, is a way of changing the clustering density.

Click more to get the source code.

 (More)

In order to produce a single view of GIS data derived from multiple sources, it is necessary to abstract the rendering of the data from the actual datasources. This is similar to the concept of a Services Oriented Architecture in which business data are rendered from their system domain to a domain specific language that suits the needs of the enterprise.

The term that is given to the systems required to perform the rendering function are called ?stacks? in the GIS world.
The Stack typically is composed of: Spatial Database, Internet Mapping Server (map services), Mapping Client, and Web Mapping Client.
There are a few different technology streams available for provisioning stacks. I have been doing research into the different stacks available for service enabling GIS data. (More)

I use a Macbook pro for doing all my software development. Since switching over to Mac, I can't imagine using any other computer to develop with. The combination of the OSX operating system with the power of the Macbook Pro makes for an unbeatable development platform.

I have also eliminated all windows machines from our house now as well. I have a linux server for my websites, an Imac for our 'TV', which also acts as our primary media server for music, photos and family media, and an old 17" Powerbook G4 that my wife uses. I have the three Mac machines backing up to a 1 terabyte Timecapsule.

The Timecapsule is a great innovation on Apple's part, and has already saved my life on a few occasions. Not only does it handle all my media etc. but with the new version of VMWare fusion, I am able to have automatic backups of my local development and document files that I use on the Windows side.

Time Capsule was easy to setup, and had run without an issue until a few weeks ago, when I started getting errors during backups on my Macbook Pro.

These were 'Backup failed - Error mounting volume', or 'Network error during backup'. After digging around a bit through various log files etc. I found that the likely culprit had nothing to do with the network, but was the fact that my hard drive had bad files and directories on it.

Resolving this issue involved booting up from the OSX CD and running the Disc Utiltiy Repair function on the Macbook Pro hard drive. Since doing this, Timecapsule is up and running again without a problem.

It would be nice if Time Capsule/Time Machine could produce a more informative message, or offer to take some kind of corrective action in the event of a failure like this instead of the misleading cryptic message it had generated. Thus this blog post so hopefully the next person who hits the problem will be able to fix it without having to dig through log files...


I recently completed an assessment and subsequent construction and deployment of a development management system for our software development team at Matrix

While Microsoft has brought out Team system for doing source control, automated build/test, its a fairly expensive product. It has the advantage of being an 'install and go' kind of thing, but the cost of it makes it prohibitive for smaller development teams.

There are also lots of great open source tools out there for performing these tasks that work very well. At Matrix where I work, I have assembled a set of tools that are doing a great job of letting us manage a very extensive set of code across a diverse team of people in a quick, easy and efficient manner. This blog post will review the tools we are using for this, and give examples of how to set it up.

 (More)

Configuring Silverlight to access a NT Authenticated WCF Services :
  • add .xap -> application/x-silverlight-app to the mime type in IIS to get IIS to recognize and transmit the mime type
  • add .xaml -> application/xaml+xml to the mime types in IIS to get IIS to recognize and transmit the mime type
  • add the clientaccesspolicy.xml to the root folder in IIS to get the cross domain working for wcf debugging
  • Ensure that you have the IIS virtual directory security set to use NT authentication only
If we modify or create new services inside the service class, it is necessary to make sure the URL is set correctly in the ServiceReferences.ClientConfig file in the Silverlight project when you update the service reference. It defaults to a value that is different than the value visual studio uses when the debugger is run, which causes an exception to be thrown when the silverlight call goes through to the service.

 (More)

While I am critical of Microsoft, its because I know they can do better than they have in recent years. If you put the dismal performance of Vista and the horrible marketing campaigns of late, Microsoft outside the consumer and platform sphere has created some incredibly innovative products for developers over the last few years. Linq, and WCF are just two recent examples - not to mention the new SQL server 2008 which is amazing as well - more on that in a later post...

Unfortunately, it is Microsoft business model that needs innovation - not their tools. It is mired in the world of PC software - often to the detriment of new and innovative ideas.

Fortunately, Silverlight looks like a breakthrough technology for Microsoft: mainly because it shows a change of attitude. Microsoft is finally getting serious about cross platform support, and the web as the application platform. I have often wondered why Microsoft has not made a .net VM host for other platforms - Mono aside. The obvious answer being fear of cannibalizing its windows franchise. I personally think Microsoft, if it were serious about this battle for the web, would make windows free for consumers, and instead shift its focus to a subscription service based model: say $50 a year for support for Windows or something to that effect. It would cost it a fortune initially, and would affect their stock price (could it get worse??) but would force the company to formally acknowledge what has already happened: Operating systems are a commodity.

Anyway - fantasy aside - It seems that Silverlight is at least a start at Microsoft opening its platform up to other operating systems.

Silverlight allows for .net managed code to run on any platform using Windows Presentation Framework. I am very excited about this, as many of the apps we are looking at building can then be made to run on any platform. It is of course possible to do this with Ajax, which I have done, but it will be nice to have the advantage of a full fledged debugger and a nice set of tools that finally is graphic designer friendly on the Microsoft side (Google of course has had this for a while with its GWT - I have never liked Microsoft's native implementation of asp.net Ajax - its complicated and messy).

I already have a version of a managed code graph written in C# using the open source Visifire control working in IE, Firefox, and Firefox on the mac (have to try linux next)... using the same code base. This graph gets its data from a WCF service that pulls data from our accounting system.

Here it is running in firefox on my MacBookPro:

d

Getting this working though was a bit difficult from a configuraion standpoint.

 (More)

Needed to set the style of a line in Virtual Earth.

This seems to be a bit of a hidden function, so took a bit of work to find:

Usage: shape.Primitives[0].symbol.stroke_dashstyle = "Dot";

Other line types:

Solid, ShortDash, ShortDot, ShortDashDot, ShortDashDotDot, Dot, Dash, LongDash, DashDot, LongDashDot, LongDashDotDot


Very exciting - we have setup SQL 2008 and I am now working on extending our syncrhonization system to incorporate spatial information....I will be making notes here as I work on figuring out the SQL spatial extensions. Some of these will be fairly simple to begin with, until I become familiar with the syntax.

To that end: one of our tables had lat/long information in it in standard floating point format. I needed a query to update this information into the new Geography column I created. The update query to do this:

update WaterWells set Coordinates =
geography::STPointFromText('POINT(' + CAST(LONGITUDE as varchar(50)) + ' ' + cast(LATTITUDE as varchar(50)) +')', 4326);


As noted in another post, I am using Dynamic Linq to build a generic query tool for a service layer I am constructing. In the process of doing so, I have run into the following error when I try to pass a query in for a Guid:

Operator '=' incompatible with operand types 'Guid' and 'String'


For the past 3+ years, at Matrix we have been evaluating smart phones for corporate use. For most companies, the selection of a smart phone device is a non-issue: its RIM's Blackberry product and associated BEZ (Blackberry Enterprise) server.

Being a Waterloo University engineering graduate, I certainly would have no qualms about going the Blackberry route for a corporate smartphone device. However, working through the evaluation process at the corporate level puts a different perspective on these devices.

The biggest issues are: cost (device, dataplans, setup), maintenance, usability (not always in that order) and finally farther down the list - application platform. By application platform I am referring to custom business applications that are outside of contacts, email and calendar. I suspect as time goes on the application platform item will become more important at Matrix, but right now its not a priority.

Matrix users at present though have very basic requirements for a smartphone - they want it to work well as a phone, and be able to use it as a tool for managing their calendar, contacts and email in that order.

The Blackberry excels at these, but its requirement for a server to enable corporate messaging makes it more costly than other offerings, when you factor out the device as an application platform.

While the Blackberry Enterprise Server provides more value in terms of features, the market it was designed to serve has changed since its inception. The security measures on other platforms, while not as sophisticated perhaps as the BEZ, are good enough to be effective (more about this later). The dataplan monitoring and restrictions were something that used to be important - but now that phone companies are being forced to provide more logical plans that offer data pooling and reasonable data limits, the requirement for centralized monitoring has diminished significantly. The BEZ acts as a platform for software development - but other platforms are now providing sophisticated developer tools as well.

Finally the BEZ requirement adds yet another server (albeit virtual) that requires licenses, maintenance, updates, expertise and attention. The additional requirement of a CAL for devices connecting to the BEZ add another layer of cost - especially when you consider that many companies already pay for Exchange CALs.

So at Matrix, the focused shifted to evaluating mobile devices that could directly connect to Exchange via the Exchange push mechanism - which narrowed the search to Windows Mobile based devices.

 (More)

Very exciting news - an article co-authored by Barry Lawrence of BSTGlobal and myself based on a system now in production at Matrix has just been published in the Microsoft Architecture Journal.

The article is on the subject of Enterprise Identity Synchronization and describes a synchronization pattern and associate system architecture for keeping enterprise identity data up to date between disparate systems. In effect - it is a system for replicating identity memes around an organization.

This has proven to be a fascinating project from a number of standpoints, and I have learned a great deal from the experience of being involved in designing and building a services oriented workflow architecture. The implementation of the system has also been very fascinating, and is a real case study in how systems, people and processes are inherently intertwined. I will write a number of blog posts on the outcome of this project over the next few weeks.