Insights and outlooks on software development


Including SyntaxHighlighter on a Blogger blog

Sunday, August 24, 2008 by Thomas L

I've been meaning to do this once and for all; documenting the proper way to include SyntaxHighlighter on a blogger-powered blog. This is what you need to do. (Adapted from and, among others.)

  1. Download the syntaxhighlighter code
  2. Place the code somewhere public; it is meant to be accessed by your readers. I chose to start a new google code project and place it there.
  3. Go to blogger and navigate to the tab where you edit the template's HTML
  4. Add references to the syntaxhighlighter javascript files
    <script language='javascript' src=''/>
    <script language='javascript' src=''/>
    <script language='javascript' src=''/>
    <script language='javascript' src=''/>
    <script language='javascript' src=''/>
    <script language='javascript' src=''/>
    <script language='javascript' src=''/>
    <script language='javascript' src=''/>
    <script language='javascript' src=''/>
    <script language='javascript' src=''/>

    The important thing here is the reference to shCore.js. It also needs to be referenced before any other SyntaxHighlighter script. Add other references for the languages you'll need. The references should be added inside the <head> part of the template.
  5. Add the contents of the file syntaxhighlighter.css to the styling in your template.
  6. At the bottom of your template, just above the </body> tag; add the following javascript. The script makes sure that any row breaks inside the highlighted code isn't converted to a <br /> tag
  7. <!-- last thing: include the syntaxhighlighter javascript -->
    <script class='javascript'>  
    function FindTagsByName(container, name, Tag)  
            var elements = document.getElementsByTagName(Tag);  
            for (var i = 0; i < elements.length; i++)  
                if (elements[i].getAttribute("name") == name)  
        var elements = [];  
        FindTagsByName(elements, "code", "pre");  
        FindTagsByName(elements, "code", "textarea");  
     for(var i=0; i < elements.length; i++) {  
      if(elements[i].nodeName.toUpperCase() == "TEXTAREA") {  
       var childNode = elements[i].childNodes[0];  
       var newNode = document.createTextNode(childNode.nodeValue.replace(/<br\s*\/?>/gi,'\n'));  
       elements[i].replaceChild(newNode, childNode);  
    else if(elements[i].nodeName.toUpperCase() == "PRE") {  
       brs = elements[i].getElementsByTagName("br");  
       for(var j = 0, brLength = brs.length; j < brLength; j++) {  
        var newNode = document.createTextNode("\n");  
        elements[i].replaceChild(newNode, brs[0]);  
      //clipboard does not work well, no line breaks  
    //  dp.SyntaxHighlighter.ClipboardSwf = "";  
  8. Save the template and try it out. Chances are it doesn't, so make sure you have Firebug ready for action.

Testing new syntax highlighter plugin

Tuesday, August 19, 2008 by Thomas L

// NOTE: If you change the interface name "IMsmqService" here, you must also update the reference to "IMsmqService" in App.config.
public interface IMsmqService
    void SendMessage();

The previous Windows Live Writer plugin for SyntaxHighlighter I've used this far used a kind of old SyntaxHighlighter version. So this is a test for a new plugin plus a way on how to include syntaxhighlighter in Blogger (I hope to be able to post this info in a little while if this works good).

Is scaling that hard?

by Thomas L

This weekend I attended the 10 km running contest Midnattsloppet ("The Midnight Run"). As I prepared for the contest I was going to check if there were any last-minute information that the contest management had put out on their web page. It wasn't that easy; the server was overloaded so there was a static page saying "we can't handle the load right now, please come back". Quite annoying.

My result? Check it here.

Technorati Tags:

A light-weight maturity model for software development

Wednesday, August 6, 2008 by Thomas L

I started thinking somewhat about the projects I've worked in and with, and how they line up against each other regarding engineering practices and how the software is being developed. I noticed that when thinking and talking about these things it's quite hard to quantify the level of sophistication a specific project has, and there are no really good measurements of this thing.

Sure, CMMI is a method of quantifying this, but to be a bit unfair that's more aligned for consultants in suit and tie than for developers or managers wondering how sophisticated the development environment is. Also, CMMI and other ISO certifications are way too document centric, instead of being people centric. With this I mean that the level of sophistication you are at the moment often is based on how nice procedures you have written and placed in binders. I'd rather have this quantification based on what you actually do in your project, and the factors to base the level upon should be on how much you've embraced good engineering practices and agile thoughts.

So I started thinking about this, and come up with some examples of different levels, somewhat like the Nokia Test for Scrum is a litmus test on if you're doing Scrum or not. Notice that these things shouldn't be seen as a prescriptive "do this or else you are doing it wrong", but rather as a pointer upon how far you've come in optimizing your software development process.

Level 1 - Ad-hoc

  • Source code is on a shared server or a dev's box
  • Releases are done on an ad-hoc basis and is made from private builds on the developers' machines
  • Deployment is made by replacing some files on a server or changing code on the server by hand
  • The debugger is often used when developing new code
  • Small or no thought is given to application design or architecture
  • Bugs are tracked in a Excel/text document

Level 2 - Managed

  • Source code is handled in a SCM tool
  • Some test code is written; mainly smallish unit tests and/or some error-prone integration tests
  • Automated tests is done with point-and-click program (e.g. Mercury QTP)
  • Test code often has dependencies which aren't provisioned in the test setup code (e.g. database contents etc.)
  • Measurements are made of test coverage
  • The debugger is used when bugs arise
  • Everyone in the technical team sit by each other in an open room
  • Bugs are tracked in some sort of system (Bugzilla, Team Foundation Server etc)
  • Thought are given to splitting major releases into iterations

Level 3 - Continuous improvement

  • A long-term plan for the SCM exists (> 2 major releases + minor and patches)
  • The team uses TDD
  • There is a high percentage of test case coverage
  • Tests are both on unit level and integration level
  • Deployment to test environments is automated
  • Incoming defects are validated by writing tests
  • The domain expert works closely with the team, and meets with them regularly
  • There are iterations in the development
  • A retrospective is being done after each iteration

Level 4 - Optimizing

  • When test case coverage decreases there will be questions raised during daily standup meeting
  • There is Osmotic Communication within the team (both business and IT representatives)
  • Acceptance tests are automated
  • Smoke tests are run after (the automated) deployment
  • The debugger is frowned upon
  • Deliveries are made frequently; there is thus seldom need for developing a patch

Now, dear reader (if you've come this far), what do you think of this idea? Could it be something to develop a bit more? Are there more than four levels? Should we divide this horizontally into different categories ("test", "requirements gathering" etc)?

NAnt won't run on .NET 2.0

by Thomas L

When trying to use NAnt 0.85 that came distributed with TreeSurgeon, I got the darndest error message. It said that I needed .NET 1.0, 1.1 or 2.0. Quite strange, since I already had .NET 2.0 installed on the machine.

It turns out that NAnt 0.85, which is the latest non-beta release, is quite old, and as .NET 2.0 was in beta state at the moment it was released, it's linked against a .NET 2.0 beta release. So what I needed to do was install the .NET 1.1 runtime on the machine. This error took quite long time to diagnose; I didn't notice the revision number when I got the error message. Strange.

Regarding MSMQ on Windows

Monday, August 4, 2008 by Thomas L

After looking through other alternatives, I decided to go with the mainstream. A small windows service reading from the queue, implemented using WCF, and the client using WCF for adding messages to the queue.

One thing though, make sure that you configure a mex endpoint in the WCF service, otherwise it's hard to add a service reference. And the service should have a host tag as well.

Net Start and Error 5 - easy solution

by Thomas L

So there I was, humming along with my newly written windows service and all. After installing it with InstallUtil.exe, I tried to start the service with "Net Start MyService" and I got the error

System Error 5 has occurred
Access is Denied 

This link has info about the problem, suggesting that this is due to security issues. And, well, it was. 'Cause I have my dev environment in C:\Users\{myuser} and, well, that's kind of locked for the Network Service account. A small copy to c:\ before installing, and problem solved.