Uncategorized

August 14, 2024

Granular Named Item Locking in C#

A couple of times recently we have had a requirement to lock on a named item. We have not required a distributed lock (either between app domains or between servers), simply an in memory lock on a specific item. There is no standard way to achieve this in .Net and getting the details correct is surprisingly difficult (as with all multi-threaded code) so I will share the two versions we came up with. Version 1 uses a standard Dictionary of […]
August 14, 2024

Unit Testing BizTalk Maps – External Functoids

We have been busy with BizTalk 2013 recently and like all good programmers we like to test, test test! BizTalk 2010 made this quite a bit easier as you can enable unit testing on your schemas and maps. However, we hit a problem with the supplied TestableMapBase class whilst testing maps with external function calls. I will run through the process from start to finish to demonstrate the issue and the fix. We have a very simple schema and map […]
August 14, 2024

CRM Email Router – Emails Stuck at Pending Send

I have just been setting up some new workflow generated emails in CRM 2011. This was largely an exercise in frustration as the rich text editor is pretty flaky. Getting your fonts and spacing correct is very hit and miss. Happily, this area is getting an overhaul in CRM 2015: Microsoft Dynamics CRM 2015 Release Preview Guide The new Email editor provides marketers with the ability to select from pre-defined templates or create an Email from scratch using an interactive […]
August 14, 2024

Dynamics CRM Paging Part II – Lazy Paging

Following on from Dynamics CRM Paging Cookies – Some gotchas!, here is a helper class we use for all our paging needs. An example of its usage: [sourcecode language=”csharp”] const string fetchXml = @” <fetch mapping=’logical’ count=’5000′ version=’1.0′ page='{0}’ {1}> <entity name=’account’> <attribute name=’name’ /> </entity> </fetch>”; var accounts = new PagedRetriever<Tuple<Guid, string>>( entity => Tuple.Create( entity.Id, (string)entity.Attributes[“name”]), (page, cookie) => String.Format(fetchXml, page, cookie)) .GetData(service); [/sourcecode]   The utility class has a couple of nice features: Laziness – Extra pages […]
August 14, 2024

Word Redundancy Factors

“Studiously” – 369,000 google hits “Studiously ignored” – 85,500 google hits “Studiously ignores” – 59,700 google hits Here at TrueNorth we like words almost as much as programming, well I do anyway. I have been looking for a good example of this phenomenon for a while, where a regular english word becomes so attached to its partner that it may as well not exist on its own.   I think ‘bated’ is one of the best: “bated” – 1,230,000 “bated […]
August 14, 2024

The Importance of Code Reviews – Shared Responsibility

Just wanted to share a story from university that taught me early on the importance of peer reviews and your responsibilities as a reviewer. The situation was a group practical during which we were designing a toy 4-bit microcontroller. The whole thing was mainly built out of MOSFETs if my memory is correct (my electronics is definitely rusty ~15 years down the line!). These were plugged together into basic logic gates, logic gates into half-adders and latches and so on. […]
August 13, 2024

Don’t Burn your Free Azure Credits, or Max Out the Corporate Card

Please note, this can be scheduled with azure automation To set up creds to connect see Authenticating to Azure using Azure Active Directory At TrueNorth we try to get the most out azure. We use it for Development, PreSales, Testing infrastructure architectures, Performance testing and more. It so easy to forget to turn a VM off and then you find yourself trying to navigate the site on your mobile to deallocate your VM. So, we have created a PowerShell script […]
August 13, 2024

Dynamics CRM Paging Cookies – Some Gotchas!

If you want to page query results in dynamics CRM then the recommended way is paging cookies: http://msdn.microsoft.com/en-gb/library/cc151070.aspx Sounds straightforward, we get a paging cookie back on each resultset, and we simply add this to our request for the next page. What doesn’t seem well documented is that these paging cookies do not work for a lot of queries, even though they are returned on the first page. Let’s set up a simple example to demonstrate this. First we will […]
August 13, 2024

An Adventure with Tiny Types and Tuples

Here at TrueNorth we love functional programming and if you code in this style you will end up using lots of tuples, and tuples of tuples and…. you get the idea. A lot of bread and butter business software coding is just manipulating sets of data, grouping, selecting, filtering, joining etc… Often whilst transforming your inputs to your outputs there will be some intermediary structures involved. There are a few options for representing these structures:   Wrapper Classes Pros: readable, […]