Notes from the trenches.

Mind Programming, or How I Learned To Stop Fearing The Unknown and Get on with My Life

Posted: June 3rd, 2009 | Author: admin | Filed under: personal, social, tech | Tags: , , , , , | No Comments »

Collecting quotes from the web and books that I think are profound or funny is a hobby of mine. A simple sequence of words can change the way a person thinks. I find this fascinating and I’m not alone.

Read the rest of this entry »


Let’s take a shortcut

Posted: May 19th, 2009 | Author: admin | Filed under: code, personal | Tags: , , , , , | No Comments »

I’ve been working with a lot of new developers lately and have noticed that there’s a lot of useful keyboard shortcuts in Visual Studio that I never bothered to learn. Now I always stick with the default configuration unless it’s absurd or something I really like (for example turning hard corded strings yellow) because customisation doesn’t propagate.

Read the rest of this entry »


Hacking My Life

Posted: April 2nd, 2009 | Author: admin | Filed under: code, personal | Tags: , , , , | No Comments »

I’ve been in a bit of a slump recently. Life is good, but my personal development has been suffering due to my active social life and burgeoning fitness addiction (more on that later). I always feel a bit down when I’m not running at full revs on my personal development.

So what am I doing about it. Well I have a plan. A learning plan and a structured one at that. I’ve still been reading blogs and keeping up with the newest tech as much as I can but I find this doesn’t really give me that much. The plan then, is:

1. Reduce intake of useless blog information
2. Stop procrastinating on music, cartoons, youtube
3. Make a spread sheet for each topic to learn
4. In each spreadsheet put between 1 and 10 things to learn about the topic ending in a specific goal
5. Complete at least 5 items per week.

learning spreadsheet

learning spreadsheet

Simple plan, but is it going to work?

Last night I started writing a WordPress Theme for the first time, and I started getting excited again.

The first step was to mock it up and I discovered can still write a decent looking 3 column layout in pure CSS. The next step is to come up with a pretty design in Photoshop, something I’ve never done before!

Other topics I’m looking at are:

  • Revisiting ASP.NET MVC
  • Design
  • F#
  • WPF
  • TDD
  • PHP
  • Some Misc topics that I’ve wanted to do such as writing a Ubiquity command
  • Guitar
  • French

There’s also a couple of side projects on the go at the moment which are helping to drive this.

Watch this space for a new theme with my name on it!


Improving in 6 minutes

Posted: February 24th, 2009 | Author: admin | Filed under: code, personal | No Comments »

Just read a post over at secretGeek on how to become a better programmer in 6 minutes. Leon explains a few quick activities that you should do to improve yourself.

My favourites are:

2: Make hard-coded strings look ugly.

I learnt this from Joe Cooney.

Go to your favourite IDE, and set it so that literal strings stand right out — for example a yellow background with a red font. Make ‘em ugly. Damn ugly. This will encourage you to perform less hard coding, and to notice when you are embedding strings in your text.

3: Pick an ‘obscure’ keyword and master it

Do you fail to yield?. Is there a keyword you never use?

Every keyword has a purpose. Learn to master those mystery keywords and your powers will become extraordinary.

Here are lists for a few .net languages: C#, VB.net, F#.

4. Increase code-coverage by 1%

Don’t kill yourself striving for 100% coverage of code with automated unit tests. But take a few minutes to increase your coverage by 1%.

Most likely, that means going from 0% to 1%. And that’s the biggest improvement of all.

Find a particularly ghoulish regular expression. Or a critical piece of business logic. These things can’t be trusted without tests.

7. Pick an ugly method to refactor

You know the method. That method you’re particularly ashamed of. That one that’s long and ugly and horrible. And it’s crucial to the whole application.

You don’t have to polish it from a turd to a diamond, but just neaten it up a little. Rename a variable. Hoist part of it out into a separate method. Start simple. The momentum will increase. Watch out.

These are all great little things you can do in those little time pockets where you’d usually just randomly click on stuff until an email comes back or someone responds on IM. I’ve got one more to add.

Automate a process
You know that thing that takes a few minutes and you sometimes have to do twice because you miss a step? You know the ones I’m talking about! The little oddity in your build, or that annoying service/api project, editting a version number for the latest build and putting it back into source control. Well, honestly you could probably do it with a script that you could write in under 6 minutes. I just wrote one to build and install a service for debug:

   1: @ECHO OFF
   2: CALL "C:\Program Files\Microsoft Visual Studio 9.0\Common7\Tools\vsvars32.bat"
   3: msbuild "C:\Development\Solutions\Solution.sln"
   4: installutil /u "C:\Development\Solutions\Soution\bin\Debug\Soution.exe"
   5: installutil /username=IOC-DEV-UK5\Administrator /password=*** "C:\Development\Solutions\Soution\bin\Debug\Soution.exe"

Now I can get my service ready for debug in 1 click rather than openning the Visual Studio command prompt, typing in the folder structure, realising I’ve forgotten to do "Run as administrator" every bloody time!

You’ll be amazed how much time you save and the satisfaction you get from solving a little problem like this.


Experiences with Unity

Posted: February 18th, 2009 | Author: admin | Filed under: code, personal | Tags: , , , , , , , , , | No Comments »

I’ve been very busy over the last few weeks. The new RSinteract beta is due out at the end of this month (several clients are currently using it with no problems) and it looks sweeeet! Pretty proud of my contribution to that particular project and kind of sad that I’m no longer working on it. I’m now involved on a new project involving a certain sporting event taking place in 2012. It’s quite exciting and I’ve been given a fairly important part of the architecture to work on.

Finally, lots of new technology and challenges to overcome for me. One of these is dependency injection using an IoC container. I’ve worked on projects that have used it them and have understood the general principles but never have I had full control of it – it’s always been there already. This time I’m learning it properly myself. The technology that has been chosen is Microsoft’s Unity 1.2 which ships with the Enterprise Library 4.1 (Oct 2008 release). At first glance Unity appears overly complex because the documentation for it is – as Microsoft love to do – overly complicated and tries to show you everything on one page. For example:

   1: <?xml version="1.0" encoding="utf-8" ?> 
   2: configuration>
   3:  
   4: configSections>
   5:  <section name="unity"
   6:            type="Microsoft.Practices.Unity.Configuration.UnityConfigurationSection,
   7:                 Microsoft.Practices.Unity.Configuration, Version=1.1.0.0,
   8:                 Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
   9: /configSections>
  10:  
  11: unity>
  12:  
  13:  <typeAliases>
  14:  
  15:    <!-- Lifetime manager types -->
  16:    <typeAlias alias="singleton"
  17:         type="Microsoft.Practices.Unity.ContainerControlledLifetimeManager,
  18:               Microsoft.Practices.Unity" />
  19:    <typeAlias alias="external"
  20:         type="Microsoft.Practices.Unity.ExternallyControlledLifetimeManager,
  21:               Microsoft.Practices.Unity" />
  22:  
  23:    <!-- User-defined type aliases -->
  24:    <typeAlias alias="IMyInterface"
  25:         type="MyApplication.MyTypes.MyInterface, MyApplication.MyTypes" />
  26:    <typeAlias alias="MyRealObject" 
  27:         type="MyApplication.MyTypes.MyRealObject, MyApplication.MyTypes" />
  28:    <typeAlias alias="IMyService"
  29:         type="MyApplication.MyTypes.MyService, MyApplication.MyTypes" />
  30:    <typeAlias alias="MyDataService"
  31:         type="MyApplication.MyTypes.MyDataService, MyApplication.MyTypes" />
  32:    <typeAlias alias="MyCustomLifetime" 
  33:         type="MyApplication.MyLifetimeManager, MyApplication.MyTypes" />
  34:  
  35:  </typeAliases>
  36:  
  37:  <containers>
  38:  
  39:    <container name="containerOne">
  40:  
  41:      <types>
  42:  
  43:        <!-- Type mapping with no lifetime – defaults to "transient" -->  
  44:        <type type="Custom.MyBaseClass" mapTo="Custom.MyConcreteClass" />
  45:  
  46:        <!-- Type mapping using aliases defined above -->  
  47:        <type type="IMyInterface" mapTo="MyRealObject" name="MyMapping" />
  48:  
  49:        <!-- Lifetime managers specified using the type aliases -->
  50:        <type type="Custom.MyBaseClass" mapTo="Custom.MyConcreteClass">
  51:          <lifetime type="singleton" /> 
  52:        </type>
  53:        <type type="IMyInterface" mapTo="MyRealObject" name="RealObject">
  54:          <lifetime type="external" />
  55:        </type>
  56:  
  57:        <!-- Lifetime manager specified using the full type name -->
  58:        <!-- Any initialization data specified for the lifetime manager -->
  59:        <!-- will be converted using the default type converter -->
  60:        <type type="Custom.MyBaseClass" mapTo="Custom.MyConcreteClass">
  61:          <lifetime value="sessionKey"
  62:                    type="MyApplication.MyTypes.MyLifetimeManager,
  63:                          MyApplication.MyTypes" />
  64:        </type>
  65:  
  66:        <!-- Lifetime manager initialization using a custom TypeConverter -->
  67:        <type type="IMyInterface" mapTo="MyRealObject" name="CustomSession">
  68:          <lifetime type="MyCustomLifetime" value="ReverseKey"
  69:                    typeConverter="MyApplication.MyTypes.MyTypeConverter,
  70:                                   MyApplication.MyTypes" />
  71:        </type>
  72:  
  73:        <!-- Object with injection parameters defined in configuration -->
  74:        <!-- Type mapping using aliases defined above -->  
  75:        <type type="IMyService" mapTo="MyDataService" name="DataService">
  76:          <typeConfig extensionType="Microsoft.Practices.Unity.Configuration.TypeInjectionElement,
  77:                                     Microsoft.Practices.Unity.Configuration">
  78:            <constructor>
  79:              <param name="connectionString" parameterType="string">
  80:                <value value="AdventureWorks"/>
  81:              </param>
  82:              <param name="logger" parameterType="ILogger">
  83:                <dependency />
  84:              </param>
  85:            </constructor> 
  86:            <property name="Logger" propertyType="ILogger" />
  87:            <method name="Initialize">
  88:              <param name="connectionString" parameterType="string">
  89:                <value value="contoso"/>
  90:              </param>
  91:              <param name="dataService" parameterType="IMyService">
  92:                <dependency />
  93:              </param>
  94:            </method>
  95:          </typeConfig>
  96:        </type>
  97:  
  98:      </types>
  99:  
 100:      <instances>
 101:        <add name="MyInstance1" type="System.String" value="Some value" />
 102:        <add name="MyInstance2" type="System.DateTime" value="2008-02-05T17:50:00"  />
 103:      </instances>
 104:  
 105:      <extensions>
 106:        <add type="MyApp.MyExtensions.SpecialOne" />
 107:      </extensions>
 108:  
 109:      <extensionConfig>
 110:        <add name="MyExtensionConfigHandler"
 111:             type="MyApp.MyExtensions.SpecialOne.ConfigHandler" />
 112:      </extensionConfig>
 113:  
 114:    </container>
 115:  
 116:    <!-- ... more containers here ... -->
 117:  
 118:  </containers>
 119:  
 120: </unity>
 121:  
 122: </configuration>

(Note this documentation is from 1.1)

Now I’m unit testing from the ground up. I don’t care about most of this stuff. I need the simplest implementation to start with. So all I really need in my config file is: the unity section declaration, a type alias and the container.  Like so:

   1: <?xml version="1.0" encoding="utf-8" ?>
   2: <configuration>
   3:   <configSections>
   4:     <section name="unity"
   5:                type="Microsoft.Practices.Unity.Configuration.UnityConfigurationSection,
   6:                  Microsoft.Practices.Unity.Configuration, Version=1.2.0.0,
   7:                  Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
   8:   </configSections>
   9:   <unity>
  10:     <typeAliases>
  11:       <!--IService-->
  12:       <typeAlias alias="IService"
  13:                  type="Project.Services.Contract.IService,
  14:                  Project.Services" />
  15:       <typeAlias alias="MockService"
  16:                  type="Project.Mocks.FakeService,
  17:                  Project.Mocks" />
  18:     </typeAliases>
  19:     <containers>
  20:       <!--Service is Mocked-->
  21:       <container name="UnitTest">
  22:         <types>
  23:           <type type="IService" mapTo="MockService" />
  24:         </types>
  25:       </container>
  26:     </containers>
  27:    </unity>
  28: </configuration>

That’s it. (Obviously any types referenced here need their assemblies referenced in the unit test project). Why isn’t there a good tutorial that points this out? It seems like Microsoft tripping themselves over again. I’ve found this with other parts of the Enterprise Library too. Thank god for StackOverflow!


Cities I visited in 2008

Posted: January 6th, 2009 | Author: admin | Filed under: personal | Tags: , , , , , , , , | No Comments »

Bit of a generic post but meh! It’s fun to make lists! So here goes…

  • London, UK
  • Sheffield, UK
  • Leicester, UK
  • Birmingham, UK
  • Muscat, Oman
  • Bangkok, Thailand
  • Phuket Town, Thailand
  • Manchester, UK – doesn’t really count because I live here.

Wow that was boring….I think I just found a new New Year’s Resolution! Here’s ninja cat:


Book Meme

Posted: November 18th, 2008 | Author: admin | Filed under: personal, social, web | Tags: , , | No Comments »

“She seems more angry and shaken than worried by the intrusion”
Accelerando – Charles Stross

via James Simm

Book Meme:

  • Grab the nearest book.
  • Open it at page 56.
  • Find the 5th sentence.
  • Post the text of the sentence on your blog along with these instructions.
  • Don’t dig for your favourite book, the cool book, or the intellectual one: pick the CLOSEST.

Happened to have Accellerando in my bag but haven’t actually started reading it yet! I wonder what the intrusion is?


Post FOWA 2008

Posted: October 19th, 2008 | Author: admin | Filed under: personal, social, web | Tags: , , , , , , , , , | 1 Comment »

After experiencing FoWA for the second time, I felt it was a bitter sweet conference. The talks were not as compelling as last time around overall but there were plenty of them and a few gems in there. The real suprise for me was Ben Huh. His talk about keeping users interested in your site was fantastic and his interactive choose-your-own-presentation-ending idea was inspired.

Photo by James Simm

Read the rest of this entry »


Future Of Web Apps 2008

Posted: September 25th, 2008 | Author: admin | Filed under: personal, social, tech, web | Tags: , , | 1 Comment »

It’s that time of year again (I can’t beleive I’ve had this blog for a year and only written 6 things, including this!). The UK’s premier web conference – The Future of Web Apps, is coming back to London in 2008. I was there last year for all the Halo and Diggnation madness! It was brilliant. This year it’s even bigger and better with heavyweight speakers including Kevin Rose, Jason Calcanis, Mark Zuckerberg (!) and even Ben Huh from I Can Haz Cheezburger!. Should be very interesting.
Read the rest of this entry »


Ideas, Motivation, Goals and Fish

Posted: September 12th, 2008 | Author: admin | Filed under: code, personal | Tags: , , , , , , , , | No Comments »

Lately, I’m finding it hard to get excited about work. What’s that I hear you cry? No one gets excited about work! I’m not just talking about work to get paid I’m talking about work for fun, work in your spare time. This may be just post-travelling wind down, but it feels deeper and I think I know what the problem is: I have no goal. Without a goal you’re just treading water and that doesn’t get you anywhere.

Read the rest of this entry »