Home Contact

X

Coder, not artist.

News

All code on here is free, but as a consequence it's up to you to check it, ha! If you have any questions, please use the contact button!

Twitter












Archives

Post Categories

Image Galleries

Syndication:

C#


C Sharp

ImageResizer, AzureReader2 and well… Azure (duh!)

So, as part of my on-going project I’ve recently made the decision to shift all my images (uploaded by ME and my USERS) to Azure Blob Storage, instead of the quite frankly ridiculous ‘unique folder system’ ™ that I had been using. Now, originally I’d been using ImageResizer which was working well, buut, it didn’t work (the way I was using it) with Azure Blobs (at least not in an efficient way). So. I do the standard of searching for ‘ImageResizer Azure’ on google, and first on the list: AzureReader ......

Extending Expression Blend 4 & Blend for Visual Studio 2012

Just getting this off the bat, I presume this will also work for Blend 5, but I can’t confirm it… Anyhews, I imagine you’re here because you want to know how to create an addin for Blend, so let’s jump right in there! First, and foremost, we’re going to need to ensure our development environment has the right setup, so the checklist: Visual Studio 2012 Blend for Visual Studio 2012 OK, let’s create a new project (class library, .NET 4.5): Hello.Extension The ‘.Extension’ bit is very very important. ......

Mocking ITable<T>

I have to do some mocking of an ITable to be able to test some of my code, as you may imagine this is the point where we’re crossing the data boundary… Now, ITable is a total bugger to mock, I’ve tried on (at least) 3 separate occasions to get it mocked, and have only now, finally achieved an 80% solution. (Nothing is ever 100%) I’m not using any mock framework, they just take too long to setup (in this case) and instead have a concrete class that implements ITable and uses an IList as it’s base. ......

InitParams in Silverlight – passed via MVC

The old skool way of passing InitParams in aspx is well documented, adding a: <param name="initParams" value="<%=InitParams%>" /> which is accessing the public ‘InitParams’ member in the code-behind file, which is inevitably set up via the ‘Page_Init’ handler. All well and good, but not practical in MVC, so… how to do this? (NB. This is just how I’ve done it, it’s not the only solution) There are a few things to change: 1. The Model I’ve created a SilverlightHostModel, it only has one ......

Comprehensive redesigns

So, last night I realised that I’d made some bad decisions with the database, structure and naming, so… I’ve now refactored it all, and I’m feeling… hmmm… meh about it. I suspect I will redo it all later, but for now it will do…. I’ve also come to the conclusion that I was maybe trying too much for the initial release, so as a consequence I have removed one part of the project… (which, by-the-by, I intend to have published in a month or so – and yes Andy, that is one month longer than I mentioned ......

MousePath

A while ago, (and by that I mean over a year ago now) I was catching up on the blogs I read and came across this post: http://blog.iso50.com/14644... I thought – Awesomeness! I’ll give that a go… downloaded the app, and ran it, all good – but only on one monitor… :( I work with two monitors, and found that a lot of the time I’d end up with a no lines as I was on the other monitor… So, I thought I’d give it a go and write one myself… I actually had a working version pretty ......

It’s ok to throw System.Exception…

No. No it’s not. It’s not just me saying that, it’s the Microsoft guidelines: http://msdn.microsoft.com/e... Do not throw System.Exception or System.SystemException. Also – as important: Do not catch System.Exception or System.SystemException in framework code, unless you intend to re-throw.. Throwing: Always, always try to pick the most specific exception type you can, if the parameter you have received in your method is null, throw an ArgumentNullException, value received ......

Unknown C# keywords: params

Often overlooked, and (some may say) unloved, is the params keyword, but it’s an awesome keyword, and one you should definitely check out. What does it do? Well, it lets you specify a single parameter that can have a variable number of arguments. You what? Best shown with an example, let’s say we write an add method: public int Add(int first, int second) { return first + second; } meh, it’s alright, does what it says on the tin, but it’s not exactly awe-inspiring… Oh noes! You need to add 3 things ......

Deploying, but without those pesky test files!

Silverlight testing is great, we all know that (don’t we??), we’re expected to do it as part of the development process, but once we’ve got an awesome application written and we come to deploy it, we don’t want the test files going out with it… You might be like me, have the files in a Web project – let’s face it, that’s how we’re pushed into doing it… So let’s stick with it! Now. I’m deploying via the wonders of the Web Deployment shizzle, but this also applies to the classic ‘installer’ project ......

Enum driving a Visual State change via the ViewModel

Exciting title eh? So, here’s the problem, I want to use my ViewModel to drive my Visual State, I’ve used the ‘DataStateBehavior’ before, but the trouble with it is that it only works for bool values, and the minute you jump to more than 2 Visual States, you’re kind of screwed. A quick search has shown up a couple of points of interest, first, the DataStateSwitchBehavior, which is part of the Expression Samples (on Codeplex), and also available via Pete Blois’ blog. The second interest is to use ......

Full C# Archive