_CrtDumpMemoryLeaks() and related fun

Welcome to the 1990s….

So, I have a new application that is resolutely non-MFC and non-ATL. Why? Because it's a GINA DLL that can be running on a machine going back to early 2001 (not quite the 1990s of the previous line but close enough!) where we have no idea whether it is running on XP SP0, SP1, SP2 or SP3.

This app has a lot of malloc and a lot of new object() calls in it. Are these all cleaning up after themselves?

Surprisingly(!), the C RunTime Library gives us an easy way to check; you can call _CrtDumpMemoryLeaks()

It ain't as easy as that though (obviously). To be effective, you need to bear in mind the following;

_CrtDumpMemoryLeaks() only understands the context of its own [...]

Silverlight 4 and data-bound combobox - the answer

=========================================================================================

Update: 10th August 2010; Sorry, folks, this continues to be as complex before. What follows works ~95% of the time but will occasionally fail because the lookup data source is not available when the main data source is queried.

This really should not be difficult, but it appears that it really is.

I think that the solution is to move to an MVVM model, where the ViewModel presents the primary data source as well as the lookup data sources. Better; it provides dependency linking so that when the lookup lists change, then dependant views are updated.

You may now be thinking "WHAT!? It can't be that complicated, surely?!?!?!?". Well, I thought the same, and it seems that it really is that complex

It's [...]

Silverlight: how to decode a uri and pass the arguments to your method

The problem is that you need to pass your parameters to your Silverlight class and hopefully deal with them. First and foremost, how do you recognise that you’ve been called? Well, via the OnNavigatedTo event… this event is fired for every Silverlight page.

OK, so we captured the OnNavigatedTo event. What next? Well, next we try to decode the uri that was passed to the SilverLight app. Let’s pretend for a moment that we were called via “http:<YourSource>?title=myTitle&search=special”

We now have two session variables set; title=myTitle and search=special

So, how do we decode these? The easiest way is to use the SilverLight libraries to query the NavigationContext object;

if (this.NavigationContext.QueryString.ContainsKey("title"))                 this.Title = this.NavigationContext.QueryString["title"];

if (this.NavigationContext.QueryString.ContainsKey("search"))                 searchType [...]

So, why?

So this came about because I am writing a hobby app around a new CMDB. New what? Don’t worry… I’m just playing…

Anyways, I’m learning a whole load of new technology as I blossom from an amateur to a hobbyist level programmer. In particular, I’m getting to grips with NHibernate (database abstraction), MVC and a fabulous framework for tying it all together at SharpArchitecture from Billy McCafferty.

Stick with me for a trip into the [...]