Category Archives: Uncategorized

Essential Tools

Insipired by Scott Hanselman’s blog post on the subject, I’ve decided to compile a lit of the tools I’ve added to my new developer machine.  Most of these are producivity enhancements, but some are just for fun.

These are just the Windows apps.  I use a MacBook at home, but haven’t got around to compiling a list of utilities I use there.  Maybe some day…

Productivity tools

  • Paint.Net - .Net based image manipulation package.
  • 7-Zip – Archive management utility
  • NotePad 2 – Fully featured text editor, with (some) syntax highlighting.
  • Windows Grep – I do a lot of work with text files, and missed the Unix Grep command.  Here’s an alternative for Windows.
  • Tail for Windows - Another unix utility port for Windows.
  • CodeRush & Refactor! - Arguably, this should have been top of my list, but since they are paid-for software I’ll leave them languishing down here.  They get used every time I’m in Visual Studio, though.
  • Snippet Compiler - Great for very small proof-of-concept testing.
  • Lutz Roeder’s .Net Reflector – Not going to link to this since it is now full of advertising and other nastiness. The original is out there – check through Google.

Fun Stuff

I’m sure there are many more that I’ve missed, but I’ll add them when I remember about them. :)

ASP.NET MVC – Helpers

This is the third in a series of posts about things I found out while learning ASP.NET MVC. Today : Helpers.

Helpers are, as their name suggests, helpful things. If, for example, you want to add the current assembly version information into a page, you are likely to run into a problem or two. ASP.NET MVC doesn’t create code-behind pages for you to do this kind of useful operation in. Instead, you have to fall back to the old Classic ASP technique of coding directly into the view page. That is far from ideal. For one thing, the following code snippet doesn’t produce the correct reult directly from a page.

<%= System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(); %>

My experience of that was that it would, if you were very luck, print “0.0.0.0” rather than the current version.

So, how did I achieve it? I created a helper. Basically a helper is a static class, containing static methods (including extension methods)

Here’s an example of my SiteWideHelper.cs file

using stuff;

namespace Helpers
{
    public class SiteWideHelpers
    {
        public static string SiteVersion()
        {
            return System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();
        }

        public static string CurrentController(this HtmlHelper helper)
        {
            return (string)helper.ViewContext.RouteData.Values["controller"];
        }
    }
}

The helper class contains one “vanilla” method and one extension method to the HtmlHelper class. The first method, SiteVersion, simply treturns a string of the current assembly version. The second method, CurrentController, returns the name of the current controller by querying the extended HtmlHelper class.

Both of these methods may now be called, and their output rendered directly to the page. (Actually, I use the Currentcontroller method to determine which bits of sub-navigation are displayed on the master page.

<span>Web site version: <%= Html.Encode(SiteWideHelpers.SiteVersion()) %></span>

Don’t forget, instead of haveing to reference the fully qualified name of your method / class, you can import the namespace into your view

<%@ Import Namespace="Helpers" %>

I’m sure I’m missing some concepts here that would make development so much simpler, but for astarting point, this is working for me

Moving to a new PC – Migration checklist

OK, so I have been given a new machine at work (more RAM, faster processor, more disk space) and I’m in the middle of migrating all my old data to the new box.

I’m the kind of person that will forget to move something across before blowing an old PC away, only to remember it about 30 minutes after losing it forever. For this reason, I’m putting together a list of the important things that one should copy over.

So far, I’ve copied the obvious* :

  • My Documents
  • IE, Chrome and FireFox bookmarks
  • Local MSDN image files
  • Drive-level data folders (e.g. c:\ImportantStuffForProcessXYZ)

But I was hoping someone else could suggest anything else I may have missed. Either leave a comment here, or send me a tweet and I’ll update the post for future reference.

* This is not an exhaustive list – nobody really want to hear about an obscure folder that contains my todo list, do they?

Found the first thing in Refactor! that I don’t like

So far, the latest versions of CodeRush and Refactor! have been pretty impressive.  Unfortunately, I’ve just found the first bit of behaviour that I’m not too keen on.  Take the following snippet…

foreach (MyProvider provider in lps)
{
  Console.WriteLine(provider.AccountStatus);
}

  
Fair enough. Old Skool way to write a loop, but nothing too extreme. Refactor! prompted me that I may like to “Introduce ForEach Action”. I decided to take its advice, and it turned the routine into

Array.ForEach(lps,
delegate(MyProvider provider)
{
  Console.WriteLine(provider.AccountStatus);
});

 
OK, still does the same thing, but I hate the way it looks. It’s kind of a half-way house between old-skool and lambda. This was even pointed out by Refactor! – it suggested that I “Compress to Lambda Expression”.

So I did. The result was much more pleasing.

Array.ForEach(lps, provider => Console.WriteLine(provider.AccountStatus));

Lovely.

All I’d like to see in Refactor! is the ability to go from the first snippet the the last without having to take a detour through Uglytown. Is that too much to ask?

Windows Azure

I’ve just got back from Devweek at the Barbican in London, and the last session I attended was something of a revelation.  You know what it’s like at a conference – it’s the last day, you’re ready to pack up and go home, but you feel you have to attend at least one more session.  In my case, that session was by Microsoft’s Eric Nelson  on Windows Azure (Developing and Deploying your first Cloud Service).

Like pretty much all windows developers these days, I’d heard of Azure and cloud computing, but my initial opinion was “Meh! Not for me”.  Then I attended this session.  There’s obviously been a lot of thought put into this by the teams at Microsoft and, although there’s still a way to go, there are some very compelling features.  I’m not going to go into any detail here (visit the website above for more details) but the standout feature for me is the fact that if you already have the knowledge to develop a web application, you can develop an Azure service. (Yes, there are a couple of gotchas around storage and so on but nothing that can’t be overcome with a little thought and learning)

I didn’t think I would, but I’ve just signed up for the CTP – if nothing else, I can play with the technology a little.  If you want to get in on the ground floor for this tuff, I’d suggest you do too.

(By the way, big thanks to Eric for a couple of great presentations this week.)

…with Bells On

I don’t know if this is just a clever marketing pitch, or if this is genuinely worthy of the attention, but I’m blogging about it anyway.

Morris : A Life With Bells On looks like it could possibly be the next massive British film to come out of left field.  It has pretty much all the elements of a great story.  And morris dancing.  I know – it sounds awful, but if you head over to the site and watch the trailer, maybe, just maybe you’ll agree with me that it looks great.

Unfortunately, the release isn’t quite what the makers hope.  It seems to be available only in a select few cinemas mostly around the south-west.  There’s a petition on the site, though, hopefully to get a nationwide release.

I’ll tell you one more thing – if I am being caught up in some kind of elaborate hoax and this film doesn’t actually exist outside the trailer, then it damn well should.

*UPDATE*

Come on, distributors!  Someone take a chance on this film and get it out nationwide.  Stop being so afraid of “niche”!

Twitter – the new crack?

<aside>I can’t believe I used that as a subject for this post, but it is oddly appropriate.</aside>

I’ve been getting into Twitter more and more recently.  Not just since the inestimable Stephen Fry (@stephenfry) talked about it on his appearance on the Jonathan Ross (@wossy)) show – I started following him long before that, and was able to read about the process of filming the show, too.  It’s hard to describe why it is so addictive to hear what someone you’ve never met is up to, what problems they’re having on the way to the airport, or how they’re snowed in.

I guess the best description I’ve seen is by Scott Hansellman in his post How to Twitter – First Steps and a Twitter Glossary

I recommend you have a read and see if tweeting is for you, but be warned, you may never want to leave!

iLife ’09 – a quick first look

Yesterday evening I picked up a copy of iLife ’09 from my local Apple store.  I’d been waiting for it to be released since the keynote earlier in January, and now it was finally in my hands.

Installation was as simple as you’d expect from an Apple product, but it does completely blow away any previous versions of iLife.  If you want to downgrade, make sure you have the original media in order to do so.

I only really use iPhoto and GarageBand, and as a result, these are the only two components I looked at last night.

iPhoto: The latest version of iPhoto supports a couple of nice new features – locations and faces.  When you first start up the app, it converts your old iPhoto library into the new format, and then scans each picture for faces.  It actually does a pretty good job of detecting and grouping faces – I was particularly impressed that it managed to keep track of the growth of my nephew from a few month old up to his current age of around 20 months.  Tag one photo of the person, and all others with the same face are also tagged.

The mapping feature is also pretty cool.  If your camera supports GPS data, iPhoto will read this data and associate the photos with locations on a (Google-provided) map within the application.  If it doesn’t support GPS, you can add the location data manually.  Searching for a location is very easy, just type in a city and it will suggest all the possible matches.  Even better, you can specify more specific locations (e.g. “Sea World, Orlando”) and these will (mostly) appear along with the correct location on a map.

Garageband: I didn’t have much time last night to delve into all the new features here, but I had a quick poke around with the new tutorial elements.  The much-vaunted celebrity lessons are available from launch day, with UK pricing for this premium content initially set at £3.99 per lesson.  Pretty good value if you want to learn one of the ten songs available from the original musicians involved.  Also available are quite a few more general guitar and piano lessons.  These are free of charge.

Tonight, I hope to play with some of the new guitar amp and stompbox effects that come with the product, so I’ll hopefully be able to post about them in the next day or two.

Overall, my first impression of the upgrade is very favourable.  The interface is familiar enough to not cause concern while also giving access to the new features.  As you’d expect from Apple, it’s very intuitive and gives a helping hand where it thinks you may need it.

Initial score : 10/10, but what do I know?  I’m just a user. :)