Specialising a General Application

Currently our application at work is used by all employees - sales staff, legal team, marketing, accounts etc. This means we have one very large, and general fit application. It covers everyone’s needs just, and the largest group of users (sales in this case) have an application which closely matches what they need. This is at the expense of the other teams having an application that is not quite right - close, but could be better....

February 2, 2014 · 2 min

Analysis of Frames in World of Warcraft

In this post we will be looking at how the Frame and associated objects are (probably) constructed behind the scenes. This will all be done via inspection in lua from the games scripting engine. The basic display item in Warcraft is the Frame. Frames are not only use for displaying data, but used to listen to events in the background. Another interesting characteristic of a Frame is that you cannot destroy them....

November 17, 2013 · 4 min

Creating a FubuMvc website

Add new Empty Web Application to your solution PM> Install-package fubumvc Add folder Features Add folder Features\Home Add Features\Home\HomeInputModel.cs Add Features\Home\HomeViewModel.cs Add Features\Home\HomeEndpoint.cs Add Features\Home\Home.spark Setup application (ConfigureFubuMVC.cs) Actions.FindBy(x => { x.Applies.ToThisAssembly(); x.IncludeClassesSuffixedWithEndpoint(); }); Routes.HomeIs<HomeInputModel>(); Routes.ConstrainToHttpMethod(x => x.Method.Name.Equals("Get", StringComparison.OrdinalIgnoreCase), "GET"); Routes.IgnoreControllerNamespaceEntirely(); //removes /features/home/ from the start of urls Routes.IgnoreMethodSuffix("Get"); //removes the trailing /get from our urls HomeViewModel.cs: public String Message { get; set; } HomeEndpoint.cs: public HomeViewModel Get(HomeInputModel input) { return new HomeViewModel { Message = "Dave" }; } Home....

August 26, 2013 · 1 min

Checking a Type for an Attribute

I needed to be able to detect at run time if an Enum has a specific Attribute on it. Generalizing it, I came up with this: Calling: var hasFlags = typeof(EnumWithFlags).HasAttribute<FlagsAttribute>(); Implementation: public static Boolean HasAttribute<T>(this Type self) where T : Attribute { if (self == null) { throw new ArgumentNullException("self"); } return self.GetCustomAttributes(typeof(T), false).Any(); } It may only be two lines, but it is very useful none the less.

November 2, 2012 · 1 min

SqlDataReader.HasRows Problems

For the last 6 years or so at work, we have had an intermittent bug. In this case, intermittent means around once in 6 months or so. A little background to the problem first: Our data access is done via what was originally Microsoft’s SQLHelper class, passing in a stored procedure (and parameters), and our entities use the reader to load all their properties. Pretty straight forward stuff. The problemis, on the live system, every few months a sproc will stop returning results, for no apparent reason....

October 30, 2012 · 2 min

Winforms Design Time support: exposing sub designers

When writing a UserControl, it is often desired to expose one or more of the sub-controls design-time support to the user of your control. It is reasonably straight forward to do, and here is a rundown of how: We start off with our UserControl, in this case the imaginatively named TestControl: The code behind looks like this: [Designer(typeof(TestControlDesigner))] public partial class TestControl : UserControl { public TestControl() { InitializeComponent(); } [DesignerSerializationVisibility(DesignerSerializationVisibility....

October 29, 2012 · 2 min

Designing the EventDistributor

When it comes to developing a new class, I don’t tend to use TDD (Test Driven Development), I favour something I have named TAD - Test Aided Development. In other words, while I am for Unit Testing in general, designing something via writing tests sometimes feels too clunky and slow. I always write classes and methods with testing very much in mind, but I do not generally write the tests until later on in the process....

April 23, 2012 · 7 min

Model View Presenters: Composite Views

Table of Contents: Introduction Presenter to View Communication View to Presenter Communication Composite Views Presenter / Application communication … When working with MVP, it won’t be long before you come across the need for multiple views on one form. There are several ways to achive this, and which you choose is really down to how you intend to (re)use your views. The first method for dealing with the sub views is to expose them as a property of your main view, and set them up in the main view’s presenter:...

March 29, 2012 · 3 min

Model View Presenters: View to Presenter Communication

Table of Contents: Introduction Presenter to View Communication View to Presenter Communication Composite Views Presenter / Application communication … Communicating from the View to the Presenter is a reasonably straight forward affair. To signal something happening, we use an Event, but one with no parameters. We pass no parameters, as we are not going to be using them anyway, so what is the point is raising an event every time with OkayClicked(this, EventArgs....

January 31, 2012 · 3 min

Model View Presenters: Introduction

Table of Contents Introduction Presenter to View Communication View to Presenter Communication Composite Views Presenter / Application communication … What is MVP? I first came across MVP in Jeremy Miller’s Build Your Own Cab series, and have been using and improving how I work with this style ever since. Model View Presenters tend to come in one of two forms: Passive View, and Supervising Controller. I am a fan of the Passive View variety, primarily for the testing aspect, but also as I find it provides me with the best level of separation....

January 26, 2012 · 1 min