IMG_5535s

Ninject Session Scope

0
Here’s an implementation of InSessionScope(). I fall back to Singleton scoping when session isn’t available (mainly to make testing easier): If we need to synchronize session between MVC and Web API, we need to add the following to the Global.asax:
IMG_4550s

NinjectControllerActivator for Injection in ASP Web API

0
We need to replace Web Api’s default controller activator with a custom implementation that uses the Ninject kernel. This happens in the Ninject bootstrapper code: The custom controller activator:
IMG_6207s

SQLBITS XI, Nottingham

0
Second day here, and it’s going well (despite having a cold). Highlights were yesterday’s training on SSDT, courtesy of Jamie Thomson and an interesting session today on Hadoop and Microsoft’s HDInsight offering.
IMG_6491s

Ranking Functions in Linq

1
My starting point for this exercise was to apply a simple racing-rank to a list of integer values. Here’s my list… 8, 4, 5, 6, 6, 3, 5, 9, 10, 1, 0, 6. And this is my expectation… 0 = 1st 1 = 2nd 3 = 3rd 4 = 4th 5 = 5th (there are two items in 5th place) 6 = 7th (there are three items in 7th [...]
IMG_9686s

Deleting problem folder

0
Annoyingly, Microsoft updates dumped the the software pack files for one of its updates on my removeable drive recently. Subsequently, I was having all sorts of issues trying to delete (take ownership) of the file. Command-line did the trick… takeown /f <foldername> /r /d y icacls <foldername> [...]
IMG_9686s

Unravelling TargetInvocationException

0
I use Moq for testing. This framework (along with others) uses Castle.Core to create it’s proxy instances. A problem you run into is trying to assert for specific exceptions thrown from the proxy’s constructor, as Castle likes to wrap these in a Reflection.TargetInvocationException. In order to get [...]
IMG_9612s

Mapping Dictionary Values to Class Properties

0
Here is some code that I wrote to map values Dictionary to properties on a class. I have since realised that the JavaScriptSerializer provides a ConvertToType<T> method that achieves the same thing. As I was already working with Json serialization making the change was trivial.
IMG_7634s

Keeping it simple with Trello

2
I’ve adopted Trello at work as a general purpose organisational tool for our team, and we’ve been using it for a little over 1 week now. It’s a beautifully simple execution of the ‘list’, and has all the features you’d want from a basic online organisational [...]
IMG_6625s

Friends don’t let friends … Use IE6

0
I loved this official Microsoft site when it appeared earlier this year. I am still being regularly asked to build web applications that are backwards compatible with IE6… please… for the love of all you hold sacred… stop using IE6!
IMG_6491s

Automate GhostScript in C#

1
This example demonstrates how to send source to GhostScript on the stdin stream, and capture the result on the stdout stream. Test Program In this basic test example we start with a simple “Hello World” PostScript document, call the PostscriptToPdf function, and get the resulting PDF document in a [...]
Go to Top