Latest on twitter:

Brighton Marathon 2012

I decided a few months back that I would run the Brighton Marathon again. That’s right, for a second time. However I’m doing it with a difference this time around. I’m going to run the full 26.2 miles while carrying 15kg of weight.

Why on earth would I do that?

Our burdens, mental or physical, have a profound impact on how we live our life and those around us. Mankind support men (18+) who have experienced childhood sexual abuse and/or adult sexual assault at any time in their lives. Without that support a lot of men would more than likely try to struggle on keeping their experiences to themselves with potential tragic consequences.

So how does running with weight help?

To show a burden in an extremely obvious and physical way I’m going to run the entire marathon with 15kg bearing down on me. It’s going to be one hell of a challenge, one that I don’t know if I will be able to complete. However with my training and stubbornness I feel like I can give it a damn good shot.

Support needed

Last year everyone was fantastic in helping me raise over £800 pounds for St. Wilfred’s Hospice Eastbourne and I’m hoping that everyone can show me that same level of support this year.

I really hope I put enough emphasis above on how important support from Mankind is for those that need it. 3 in 20 men are affected by sexual violence, so there’s a high chance that someone you know would benefit from their help. Please show your support by donating generously.

If you don’t have any money to donate, please spread the word. It’s another way that we can help banish this taboo of men talking to others about their problems.

John

P.S. I’m also going to be blogging about my more interesting runs to show you what I’ve been up to. It’s a shame I’m doing this so late because you’ve already missed numerous blistersgrazes and saws. Including a 10 mile run while carrying 10kg which was very testing for my legs to take that extra weight.

26.2 miles with a bag of sand.

When I do Brighton 2012 I’ll basically be carrying one of these:

15kg - Bag of sand

Please sponsor me to raise money for ManKind, http://www.charitygiving.co.uk/johnharman.

If you’re actually after a bag of sand then Amazon can provide - http://www.amazon.co.uk/Childrens-Play-Sand-15kg-Bag/dp/B002ED5Y2K

DataAnnotations validation with ASP.NET MVC silently fails

Well I spent hours the other day trying to work out why my validation using the default DataAnnotations in ASP.NET MVC wasn’t working.
It turns out that my resource file was internal and not public so the model binder couldn’t access the resource file properties. It’s fair enough that it couldn’t gather the error messages but I really do think that it should throw an exception if that is the case.
I’ve added an issue to codeplex about this because a silent fail really doesn’t seem helpful to me at all. Will update if they take action on this or give a reason otherwise.

Tips to help write flexible and robust sites with CSS

HTML and CSS isn’t new but there are still so many people out there that mis-understand it. So I’ve come up with my own list of tips to help develop more robust and flexible pages.

Use a reset stylesheet

All browsers have their own defaults for paddings, margins and all sorts of settings which can make your life harder. So level the playing field by using a reset stylesheet to bring them all as close to each other as possible before you even start. Just Google around to find the one you want to use.

Use the right tool for the job

I won’t go into this too much as it should be obvious, it basically means that you should use HTML as it was suppose to be used e.g. use a table for tabular data, fieldsets to group logical form fields, a label to describe a field’s purpose (Read up on it, you may not know as much as you think.)

Don’t abuse your HTML

Adding HTML to the page so that it is easier to style it is a no no! e.g. adding an empty item in a list or empty paragraphs. Not only is the added HTML irrelevant and useless but you are making more work for yourself. Why? Because you have just tied your stylesheet directly to your HTML, if you want to change your styles then it’s likely you will have to change that HTML too. CSS was created to be separate from HTML so that’s how you should use it.

Misunderstood rendering

I see so much unnecessary CSS in stylesheets because a developer doesn’t understand that a div will fill up the full width of its parent or that a standard hyperlink can’t have padding unless it is set to a block. Have a read of this article (which I just found) which does a good job of explaining how blocks and inline elements work. Also check this bad boy which may clear a few things up what can or can’t be which type of display setting.

Avoid floats and widths

Floats are great but often over used, this goes the same for widths. Try to think of ways to styling the page without using either. There is a good reason for limiting the use of these, for floats it simply limits the number of issues you will have because lots of bugs often relate to floats whether that is an un-cleared item within it or even numorous bugs found within in IE6 (which is still going to be here for a year or two trust me!) As far as widths are concerned you can often let elements fill out the parent container, it’s a natural thing to do so let it do it. The bonus side effect is that the fewer widths you have the easier it is to update a site when it changes dimensions as everything just fills to the parent’s new size.

Natural flow of the document

If you view your page without any styles it should be easy to read and in logical order. e.g. main navigation near the top, content and then any sub-content and navigation. Don’t organise it around your styling, this is the wrong way to think about it. If you really MUST move HTML somewhere different for styling purposes then do it with JavaScript afterwards as an enhancement not a requirement.

Hope the above helps.

500 error IIS7 with blank page

So I went to fix a bug in a clients site the other day, loaded up visual studio as usual and went into debug to see if I could find the problem.

However no matter what I did I was getting the error “Unable to start debugging on the web server” Now considering I thought I hadn’t touched anything for some time I was surprised to say the least.

Next I tried to just load the site in the usual manor (as it is a legacy application as a website not a web application). On doing this I just received a blank page, after loading Fiddler to try and get a better look I still got nothing to tell me what was going on but Fiddler said a 500 error was occuring.

Anyway, after uninstalling various pieces of .NET and lots of Google searches. I went to add the logging features of IIS7 to help me out (for some reason they weren’t installed). I can’t remember what exactly but I also had to add some error options on.

Once this was done I was told the actual error message, basically that I didn’t have permission to read the web.config. Simple fix and away we go.

One word to sum up the entire ordeal, ANNOYING.

I thought I recognised the location and it turns out I lived there for a year! So enjoy watching Worthing at it’s best… probably…

NHibernate QueryOver

It’s a small thing but I’m really looking forward to NHibernate 3.0 with QueryOver.

Currently reading Lucene in Action, Second Edition through Manning’s early access program called MEAP. Great book so far, hoping to create a very quick reporting system with the information gleaned from it.

Currently reading Lucene in Action, Second Edition through Manning’s early access program called MEAP. Great book so far, hoping to create a very quick reporting system with the information gleaned from it.

Oooooo I can’t wait until this is out RT @CrypticAlivet: This gave me chills: http://bit.ly/cyDtvI