Wednesday, 16 October 2013

Sending Error Mail from Elmah



As part of a recent release of a web application we decided that in order to make the best use of error logs being created by Elmah we should email these to stakeholders as and when they happen to improve the general response times. Here is how we set up ‘that thing’ in our .NET MVC4 application! The red sections indicate properties that were either added or edited to enable the email functionality and green section indicate those fields you will need to change to reflect your choice of smtp server.

Click here for the full blog.

Written by:  Conrad Rowlands, Senior Systems Architect and Developer, DSCallards,

Displaying Alternative Coloured Images in JQ Grid


RedAmberGreenWhilst coding up a recent .NET MVC application built heavily using JQGrid I came across a requirement which to be honest I struggled with at first . In short I wanted to, on a column by column basis, colorise the icons that were to be displayed. Now JQGrid supports a icon colorset which seemingly cannot be changed easily so in the end I had to resort to changing the styles. Here is how I achieved this, warts and all….


Firstly of course JQGrid uses the standard set of JQuery Ui Icons to provide its user interface. I say ‘Icons’ but this is of course provided as one image which is broken up into sprites of 16 x 16 pixels, more of that later. So the first step is to download the set of colour icons that you require…. JQueryUI.com provides a standard set of these icons rolled in every colour you can dream so its in fact very easy. The hardest part is arriving at your chosen colours!

Click here for the full blog.

Written by:  Conrad Rowlands, Senior Systems Architect and Develope, DSCallards


The Piece of Wood and Full Possession of the Facts


 Wood


Now I can’t lie to you, I’m not an insanely practical man….. When it comes to home repairs and the like I’d prefer to pay a man (or woman) who knows what they are doing to do the job; They won’t swear half as much, will generally get the job done without resort to every ill fitting tool in my toolbox, without the use of a calendar and they’ll also have an understanding of the problems that are likely to be encountered on the way. More importantly they’ll plan to avoid the potential issues. (in)Famously I once tweeted that ‘there are only so many ways that 15 pieces of wood can be put together to make a wardrobe, I know because I’ve tried all the others!’

I once knew a guy who was immensely practical, being a general builder for much of his life I asked, and he agreed, to assist me with repairing some windows as I wanted to learn; maybe I could become self sufficient in all my windowing needs and move onto doors and the like… possibly take over the world, I don’t know what I was thinking. Anyway we first needed some strips of wood to replace the pieces that we were going to have to break in repairing the window. How hard could this be? I mean it’s just a piece of wood right, so long as the dimensions are fine and it looks clean…. However I was aware of time passing as we stood in the local ‘shed’ looking at various seemingly identical pieces of strip wood. After he had discarded what seemed like the 7th identical piece I asked what he was doing… I don’t remember his exact response but I do remember that he was particularly keen to ensure that the grain of the wood was absolutely as he needed for a good deal many reasons. It was at this point that my practical life in windows was curtailed as there was clearly way more to think about that I had previously imagined.

I know what you re thinking….. no code snippets in a developer blog? The answer this week is a resounding No! Before one line of code can be written the problem MUST be understood in it’s entirety, you can’t code for a problem until you understand the problem and you can’t code a solution unless you understand how your chosen platform allows you to best solve a problem, well you could but like with the window if we’d used just any piece of wood it would likely have just broken midway through the job.

I guess you can sum this post up in one word ‘Experience.’

Written by:  Conrad Rowlands, Senior Systems Architect and Developer, DSCallards

Setting Default Data for Add New operation using .NET MVC JQGrid

Of late I have been working with the .NET MVC JQGrid control for a relatively simple project and have found myself asking all sorts of questions of the technology which do not seem to be easily and readily supported without resorting to hacking around in HTML. One such example came up recently where I needed to default the value for a column upon creating a new Company record. After posting on the forums I was directed to a ‘sample’ which actually showed me nothing even though the forum poster had responded with an answer that was meaningful. I thus decided to document the actual methodology so that you don’t have to!

In short I have a Responder object which upon creation needs the ‘ResponderType’ property to be primed with the value ’2′ to indicate what type of responder we are creating. I have included a full listing  of the ‘MVC’ components although only the items highlighted in bold red are actually pertinent to this blog post. The rest is provided for completeness (although as the code has been derived in reality from some abstracted classes there may be some errors, so apologies in advance).

Click here for the full blog.

Written by:  Conrad Rowlands, DSCallards, Senior Systems Architect & Developer