Thursday, 26 November 2009

Code formatting

Wrote a while back about not using Windows Live Writer as it was a pain and the code formatting was poor etc. well I’ve started using it again the past month due to being able to start multiple posts and edit them all at once etc etc. I’ve needed to post some source code recently (which I’ve not actually posted yet) and I went on the hunt for another plug in to make the code nicely formatted and came across Code Formatter for Windows Live Writer. Downloaded, extracted the files to the live writer plug in folder and fired up windows live writer and seems to work fine. :-)

Some demo code as an example:

public class HomeController : Controller
public ActionResult Index()
"Message"] = "Welcome to ASP.NET MVC!";

return View();

public ActionResult About()
return View();

Will let you know how I get on with it when I post a more in depth post :-)

Sunday, 22 November 2009

Naming convention rant (no. 2)

I know it comes down to personal preference when it comes down to naming and I know it has been ingrained into me due to the people I have worked with over the past few years, but why do some people continue to do such things in this day and age.


Everyone who codes should know what an enum is, if they don’t then they either don’t code much or never use much if any of any frameworks which are out there. Either way then they should be looked and used; they are good!

Anyway, when someone writes their own enum to use instead of special strings or numbers then why prefix the enum with the string ‘enum’.  It’s not a enumOrientation it’s Orientation! etc. etc.

Class Names

I know this comes back to my rant the other week about the use of namespaces, however I came across another example with class names in another project which all the names of the classes where prefixed with the name of the last part of the namespace they where in.

So for example it was for a twitter app, and the namespace was <blah>.Twitter, and one of the classes was called TwitterRequest. I know this doesn’t sound bad in itself, but the fully qualified name of it would be <blah>.Twitter.TwitterRequest. This shows the issue I’m trying to portray. If its a Twitter request, then it should be in the twitter namespace and called Request. If it’s not a request to do with Twitter then it shouldn’t be in that namespace. Hope I’m making sense.

I just don’t understand why someone would do this? I think I might just be turning into a naming obsessive :-)

If you can’t think of a good name for one of your new classes then why don’t you try the class namer :-)

Wednesday, 18 November 2009


Ever had to setup a local SMTP server when you’re developing some functionality but don’t want the emails being sent out by accident?

I’ve had a couple of systems which I’ve written over the years and been a little paranoid each time that some test emails will be sent out to a live email address. This stems from a project I worked on a while back and had to send the system to the company development team so they could do some in depth testing/debugging and they ended up sending over thousand emails out to the client ;-)

Any how …

I went to setup an SMTP server locally to do some testing today and found out that Windows 7 doesn’t have a built in SMTP server option anymore so went on a Google hunt. After doing some searching I came across a few free server options, but the one which caught my eye was on Codeplex. My initial thought was “Woo, can see how they wrote it if I want to” and the description was spot on …

Project Description
Dummy SMTP server that sits in the system tray and does not deliver the received messages. The received messages can be quickly viewed, saved and the source/structure inspected. Useful for testing/debugging software that generates email.

Anyway, I downloaded the latest build of smtp4dev as it seemed to fill all my requirements; a) does not deliver email and b) doesn’t interfere with anything else. 

The description was spot on, and so far so good it works as required. Will post an update once have used it a bit more.

Hope it helps others out in the future. Let me know if this helps you!

Asp.Net MVC 2 Beta released

After checking my morning blog feeds the first one in the list which was of interest was Phil Haack’s post about the release of Asp.Net MVC 2 Beta for VS 2008. I was going to put off downloading it and updating until later but after the teaser about nuclear facilities in the Eula I had to investigate …

This was the full Use rights which he was referring to:

a. Because the software is a pre-release version, and may not work correctly, you may not use it, alone and/or in conjunction with other programs in hazardous environments requiring fail-safe controls, including without limitation, the design, construction, maintenance or operation of nuclear facilities, aircraft navigation or communication systems, air traffic control, and life support or weapons systems.

I should read EULAs more often; Genius!

Tuesday, 10 November 2009

Windows 7 Aero snap shortcuts

I was browsing through my regular blog feeds this morning and the tweets which had happened over night this morning and I came across the following link. It’s posted in the context of Visual Studio 2010 Beta 2, however it works for any window which is currently selected.

As I use a duel screen setup at work and manually dragging/snapping the windows to the side of the screen only work at the far edges of the entire desktop real estate these short cuts enable halving both screens spot on.

The short cuts which are starting to be high up on my most used list are:

Dock to Screen Left : Windows + Left Arrow
Dock to Screen Right: Windows + Right Arrow

I’m lovin’ Windows 7!

Monday, 9 November 2009

Have people not heard how to use namespaces?!?!

I’m trying to work out how something works and it’s over mulitple dlls. This is fine in the grand scheme of things. They aren’t large dlls either and the names of them gave me hope that it would be well designed. One has the data access code, one with common code and one with the business rules. Three projects working together isn’t large at all. I’ve worked with Visual Studio solutions with almost 100 projects in, so how hard could this be … ?!

So far so good …

That was until I started looking at the names of the class definitions. This is the point when I wanted to bang my head on the desk!

In the data access dll, it has a data access namespace, yet all the class definitions are prefixed with ‘dal’.


In the business rules dll, it has a business rules namespace, yet all the class definitions are prefixed with ‘br’.

No seriously, why?

And to top it all off, the data entities are in the the 3rd dll, all post fixed with ‘Data’ … this in itself isn’t bad, except the namespace is ‘Data’ so that kinda makes the post fix redundant.

And don’t get me started on the name of the dll … and no it doesn’t even have the word ‘data’ in it (see the opening paragraph ;-))

Why would you do that?!?!


I’m on Twitter!!

I’ve signed up to the revolution, you can follow me @WestDiscGolf.

What are you up to today? :-)

Wednesday, 4 November 2009

Visual Studio 2010 Beta 2 initial thoughts

Just thought I’d post a small brief entry about my initial thoughts of Visual Studio 2010 Beta 2. So far so good I like it, the layout is nice, the tooling improvements are good, the response speed of the IDE has improved quite a lot … however, I won’t be using it full time until there is a version of Resharper which works with it; I’m lost without the R# power!