Saturday, December 30, 2006

Deadpool 2007

It's that time of the year again when I have to submit my list for the Deadpool game. If you're one of the celebrities on this list, don't panic. I haven't come close to winning in the several years it's been running. I always keep the same list except for any additions, a strategy that has been spectacularly unsuccessful. 

  • David Rockefeller, 1915, Very rich, very old
  • Denis Healey, 1917, Old Labour
  • Billy Graham, 1918, time to meet his maker
  • John Glenn, 1921, It could be one space mission too many
  • Hugh Hefner, 1926, Viagra overdose? 
  • Boris Yeltsin, 1931, A popular choice, with good reason
  • Larry Hagman, 1931, Already on his second liver
  • Alex Higgins, 1949, Snooker player with throat cancer, apparently
  • Shane MacGowan, 1957, Singer with a soon to be non-functioning liver
  • Holly Johnson, 1960, Frankie Goes To AIDS Clinic
  • Monday, December 18, 2006

    Displaying a tick mark in HTML

    This afternoon's challenge was to get a tick mark to appear in a HTML file. Not too taxing I thought. I'd already done it, using the HTML entity ✓. But this didn't properly in all browsers. I initially thought the problem was some kind of encoding problem but it seems that unfortunately it's one of those HTML things that works in 'modern' browsers but doesn't seem to work in IE6 (this ✓ should be a tick mark, if you're one of the lucky ones). Given that most people are still using IE6, it's not really an ideal solution.

    So what to do? I thought I'd search for a fairy common font that had a tick mark available. WingDings does and although it's a Windows font, I thought it would be available on enough computers to suit my needs. Unfortunately, as this page shows, FireFox doesn't display WingDings fonts at all, even when they are installed on the computer. Most odd, although it seems that this is how browsers should work...

    You may be asking why I didn't plump for the simplest solution, displaying an image? Unfortunately I'm generating a web page on the fly on the user's PC and I don't want to be generating extra images if I can avoid it. Life could get very complicated if they already have a file with the same name on their PC. I guess they wouldn't appreciate me overwriting it.

    So my not very neat solution was to use a standard checkbox, <input type="checkbox" disabled checked>, . This wouldn't be too bad if I could apply some styling to it to make it look less like a checkbox, but CSS for a checkbox is ignored so I'm not very happy with the resulting output. If anybody knows of a better solution, let me know.

    Addendum - Since quite a few people are finding this page, you might be interested in the follow-up posts, which have a potentially better soluton to this problem

    Sunday, December 17, 2006

    Another way to get more hits to your site

    I guess like most sites the Random Pub Finder gets most of its hit through Google searches. But a drunken chat with a friend led to another way to drive more traffic to the site. I've uploaded all the pub images to Flickr and added links to the reviews on the site. So far results have not been spectacular but it means we have deep links into some of our pages so their PageRank should improve. And who knows, it might work for you.

    Thursday, December 14, 2006

    Setting a display from: address using CDONTS

    Since it took me so long to find the answer to this problem I thought I'd post it here (and also so I don't need to look it up again). Not sure if this applicable to other ways of programmatically sending email but I guess it probably is. To show a friendly display name when setting the From: address of an email using CDONTS just use the following syntax -

    (Test address)<>

    Wednesday, December 13, 2006

    Testing, testing

    Just testing out Windows Live Writer with the new version of Blogger... And it works, hurrah!

    Tuesday, December 12, 2006

    Reading embedded resources in C#

    Reading embedded resources in .NET isn't particularly hard but since I always forget how to do it, I thought I'd write it down for my own benefit. 

    First thing to do is set the Build Action property of the file you want to embed to 'Embedded Resource'. Next download my Resource Explorer from

    After building the assembly, inspect it with this little utility to find out the name of the resource. If you're clever you can probably work out the resource name for yourself but I'm lazy and/or stupid (depends which day it is).

    Finally, the code to read it is something like this.

    Assembly assem = GetType().Assembly;   
    using (Stream stream = assem.GetManifestResourceStream("resource name"))
      stream.Position = 0;
      // read data from stream

    Thursday, December 07, 2006

    Visual Studio 2003 on Vista

    OK, I should have known better. I'd read about the lack of support for Visual Studio 2003 on Vista, but then I read another article claiming all I needed to do was turn off UAC. I was planning on doing that anyway, since UAC seems like the biggest PITA of all time (and I seem to avoid any kind of virus/malware without it). So I went ahead and installed Vista. And Visual Studio 2003 falls over all the fecking time... I can't edit any of the code-behind files in one of my websites.

    Fingers crossed Microsoft will release a version of VS2003 that actually works on Vista. If it means turning off UAC, I'm cool with that. Their excuse is that they want to use their scant(!) resources on the next version of Visual Studio. Even if I believe they haven't got the resources to get VS2003 to run on Vista, can't they slow down a bit? .NET 1.1 does most of the things I want to do pretty well, .NET 2.0 adds a few nice things, but nothing mind blowing, I don't even care about .NET 3.0 yet, so I care even less about the next version. The thing is I have a job to do and that job is to get working stuff to clients, they don't care what version of .NET I'm using and certainly don't want to be paying for me to upgrade to the latest and greatest version every other day... 

    Currently listening to 'Nothing' by 'No-one' from the album 'My soundcard doesn't work on Vista'

    Monday, December 04, 2006

    Reflector insanity

    I spent a couple of days at a conference last week, which was fun. What did I learn? A few things, but the weirdest thing I learned was about Reflector's crazy behaviour. Often when Reflector starts up it informs you there is a new update available. Generally I'll let it do its thing and download the update. But it turns out if you don't download the update when you exit Reflector it deletes itself from your hard disk...

    Wednesday, November 29, 2006

    Liking Vista, mostly

    I've got no sound, Visual Studio 2003 is a bit unsure of its new environment, it took me an hour to fix up my source control installation due to Vista clobbering file permissions, UAC is crap (I have turned it off and turned off the warning telling me to turn it back on) and SonicWall VPN Client doesn't work but... Vista is actually pretty good. Search works quickly for the first time ever in Windows (and searches emails as well!), the new UI is actually quite beautiful (something that could never be said about the XP Fisher-Price look), IIS 7 is a damn fine upgrade (although it took a while to get my ASP.NET 1.1 apps up and running) and performance seems to be pretty much the same as XP, which is quite remarkable given all the visual additions and extra services that have been added.

    No doubt the Mac did it better two years ago but the Mac doesn't have any apps I need. My Mac OSX box sits unloved in the corner with nothing to do...

    Sunday, November 26, 2006

    Vista headaches

    I'm a bit of a fool when it comes to new software, if I can get a copy of something cool for free I'll probably install it. So, since the company I work for now has an MSDN license I thought I'd give Vista a spin.

    So I pretty much ignored the warnings the installer gave me about the problems I might have and went ahead and installed it. And the warnings were pretty much spot on. I now have no sound and I can't play videos. I have no idea why but I guess it's a driver problem. Hopefully Dell will fix the problem PDQ because sound is kind of important for me since I use Skype all the time...

    Other than that Vista seems to work fine. I'm not sure at this point whether the upgrade was worth it, nothing has jumped out at me as an aboslutely must have feature.

    Saturday, November 18, 2006

    FireFox and IE differences

    Often when I'm reading up on support for particular HTML or CSS features, I'll see something along the lines of "Most modern browsers support this feature, Internet Explorer doesn't". A loose translation of this could be "if you use this feature it won't work for 80% of your users".

    I do most of my testing in IE then go over to FireFox to make sure it looks OK and probably because of this it always seems to be the other way round, FireFox doesn't support a lot of stuff that IE does.

    FireFox doesn't have a way to render text vertically. OK, there's no official way to do this, so IE has come up with it's own CSS attribute, but I'm kind of surprised that FireFox hasn't come up with some way of doing it, it seems like quite a common thing to want to do.

    Another problem is hiding and showing rows in a table. FireFox kind of supports using 'display:block' but the row gets taller and taller with each hide and show. So I have to use 'display:table-row', which doesn't work in IE. Not sure which is standards-compliant but 'display:block' seems like the more consistent approach.    

    Friday, November 17, 2006

    XSLT not completely insane

    I've played with XSLT before and never quite got to grips with it, but over the last few days I've finally got a basic understanding of what it's all about. It still seems like it was designed by somebody who was an XML/HTML addict and could only think in terms of tags when developing a programming language. Like the old saying goes, when the only tool you have is a hammer, every job looks like a nail. But the thing is if you have an XML document and you want to transform it to some other flavour of XML or HTML then XSLT is a fine choice. I'm still not sure if my XSLT is any good or not, I've not seen any coding standards for it anywhere. Should I be splitting things out into multiple templates? Should I be doing anything in particular to make my XSLT more maintainable? Dunnow. But I've got 1000 lines of it and it produces quite a nice HTML document so that's good enough for me at the moment.

    Currently listening to Love Less by New Order from the album Technique

    Wednesday, November 15, 2006

    Well done Ken

    Chelsea Tractors are going to be hit by another tax soon, as the London Congestion Charge will be increased to £25 for band G vehicles. Well done Ken!

    Tuesday, November 14, 2006

    Breaking news: No-one buys Borland's IDE tools

    However they try to spin it, it's fairly obvious that Borland were unable to find a buyer for their IDE business. So my prediction was right. Is it good or bad news for Delphi and their other tools? It doesn't look great but at least they can hopefully stand on their own two feet and won't have their income sucked away to finance the ALM business.

    Currently listening to The Only One by Billy Bragg from the album Workers Playtime

    Crude awakening - Peak Oil

    Found a couple of interesting videos about peak oil and some of the possible solutions

    Part 1

    Part 2

    Saturday, November 04, 2006

    IE7 take-up

    IE7 hasn't been released as part of Windows Update yet, but its usage is up to 6% of all IE users on the Random Pub Finder. Saying that, FireFox 2 is being used by 38% of all FireFox users. I reckon that is down to the techy nature of most FireFox users. Funnily enough 20% of our visitors are now using FireFox, which is pretty astounding. I'd guess we've had quite a few techy people visit recently due to the coverage we've had.

    Thursday, November 02, 2006

    Build it and they will come

    After five years, the Random Pub Finder has finally become an overnight success. Google seems to have started re-indexing pages, although there's still a random nature to its indexing. We were up to 300 pages indexed, now we're back down to about 150. But the main reason for the sudden surge in traffic has been appearing at Programmable Web. Thanks to that, we've been covered on a couple of other sites. We've never had so many hits.

    Now I'm actually getting traffic here as well, thanks to this post. Seems I'm one of the top results on Google if you search for directmailchat. Clearly I'm not the only one suffering from this spam.

    Tuesday, October 31, 2006

    I am a sex god

    I've been getting a lot of emails like this recently

    Hope I am not writing to wrong address. I am naice, pretty looaking girl. I am planning on visiting your town this month. Can we meet each other in person? Message me back at

    Today was different, it came from somebody called Johnathan...

    Makes you wonder how successful these kind of spams are, with a To: list of several people, a From: address that doesn't match the address they've asked me to reply to, a load of spelling mistakes and apparently coming from a girl with a boy's name.

    Monday, October 30, 2006

    Hurrah for Richmond Council

    Richmond Council are introducing increased parking charges for high-polluting vehicles. This brought all the usual rubbish from the 4x4 drivers. Lets go through the points one by one.

    4x4s are efficient

    If your 4x4 is efficient then it won't be charged very highly. The charge is based on CO2 emissions, not car size.

    I need a big car, I've got 4 kids

    Presumably it was your decision to have 4 kids. Having kids is expensive, you have to feed and clothe them, house them. You wouldn't expect these to be subsidised would you? It's not like we have a shortage of kids on the planet.

    Climate change is just a theory

    Even though the vast majority of scientists agree that temperatures are rising and we are at least partly to blame, this line still gets trotted out. Can someone explain why I've still got bees flying round my garden at the end of October?  This isn't normal. But let's assume climate change isn't in fact happening. Cars produce pollution at a local level, are noisy and generally reduce quality of life, particularly in cities like London where there isn't enough space to accomodate them. Not only that, but fossil fuels will run out, some time. So it seems like a good idea to reduce our dependence on them.

    It's undemocratic

    The motoring dinosaur Jeremy Clarkson claimed the whole thing is undemocratic. How's that then? The council were voted for by the people of Richmond. If the residents don't like it, they can vote them out again.

    What I like about this scheme is that it shows we can do something about climate change at the local level, we don't have to wait for the government or, even worse, the international community to do something. Since we live in the neighbouring borough and our council is also run by the Lib-Dems, I'm going to be lobbying them to introduce the same scheme.

    Currently listening to Have A Day / Celebratory by The Polyphonic Spree from the album The Beginning Stages Of... [UK]

    Friday, October 27, 2006

    iTunes and Windows Live Writer love-in

    For the past few months I've been using my Toshiba Gigabeat to listen to music in my office, but something has been bugging me about it for a while. The random play functionality is completely whacked out. It seems to be random based on the artist, so if you've got one track by an artist, that artist will get as much coverage as an artist with 100 tracks.

    So I decided to move my MP3 collection on to my new PC and use iTunes instead. That in itself was a bit of a pain. The Gigabeat converts MP3s into a file with a SAT extension so you can't just copy them back across, since nothing but the Gigabeat knows what a SAT file is. But if you plug it in right, Windows recognises it as a media player and knows what to do with the files and does the conversion on the fly. All seems a bit odd really, but I could now listen to my MP3s through iTunes.

    And now I've found a very nice plugin (well two actually) that lets you insert the track you're currently listening to into your blog post. Perhaps it should be called 'Completely Pointless Vanity Plug-In' but I like it.

    Couple of things to note. The Apple website doesn't seem to be correct when it tells you where to put plug-ins for iTunes to pick up, it says they should go under 'My Documents' somewhere but I had to put it in C:\Program Files\iTunes\Plug-ins.

    The Live Writer plug-in goes in C:\Program Files\Windows Live Writer\Plugins but by default the plug-in will insert 'Nothing playing', you need to update the HTML template to something like <P>Currently listening to %t% by %a% from the album %al%</P> to get it to work.

    Currently listening to Carrion by British Sea Power from the album The Decline of British Sea Power

    Tuesday, October 24, 2006

    Disabling the Dell malware

    When I purchased my new PC it came with a whole host of crapware that I didn't want. Most of this could be removed but one piece of software remained, an extension for IE that brought up a Dell search page whenever a website failed to load. I've never tried to get rid of this because it's never caused too much harm but today it began interfering with my work so it was time to get rid of it. IE7 makes it pretty easy to disable pointless or dodgy add-ins. If you have the same problem as me, go to Tools/Manage Add-ons/Enable or Disable Add-ons and disable CBrowserHelperObject object. No more 'helpful' Dell search page, yippee!

    Sunday, October 22, 2006

    Google Sitemaps improvements

    I'm not sure when these changes were introduced to Google Sitemaps but there are now some useful little graphs that tell you how often your site is crawled and how responsive your site is. Go to the Diagnostic tab and click on 'Crawl Rate' to see it. You can even tell Google to crawl more often if you like (not sure if their bot will actually take any notice of this request or not). Overall, I like it a lot.

    Saturday, October 21, 2006

    So how quickly will IE7 be adopted?

    Apparently IE7 will be distrbuted as part of Windows Update, so I wonder how quickly it will replace IE6? Looking at the stats for the Random Pub Finder, of the 85% who used Internet Explorer to visit this month, 4% were using IE7. I'm guessing it will take about 2 months for the majority of IE users to have switched. Lets wait and see... 

    Thursday, October 19, 2006

    Somebody listened

    OK, probably not to me, but the silly error message no longer appears in the final released version of IE 7

    Wednesday, October 18, 2006

    IE7 Stupidity

    Internet Explorer 7 is mostly a good experience. Yeh, it's ripped off some of Firefox's features, but that's what Microsoft do well.

    But what on earth is this dialog box about? I tried to paste into a field in Google Maps and it popped up. I understand that Microsoft is getting a little paranoid about security these days, but of course I want to allow the webpage to access my clipboard, I just hit CTRL-V! Oddly enough this doesn't happen on all websites, so perhaps Google Maps is doing some odd scripting when I do a paste. Who knows, but please someone fix it!

    Exciting new website

    In their ongoing attempts at SEO, BetterDeal have got a new site (New Car Showroom) and they want some inbound links. Where better to get them than from here, with my huge number of visitors and massive PageRank?

    Monday, October 09, 2006

    Hello World for ZX Spectrum lovers

    When I was a young lad, there was nothing I liked more than going down to my local Dixons after school and typing my very own Hello World application into the nearest ZX Spectrum. But the Hello World apps I see today just don't match up to the beauty and elegance of that original version, so I've written one for C#

    using System;
    namespace HelloWorld
        class App
            static void Main(string[] args)
                 line10: Console.WriteLine("Doogal is cool!");
                 line20: goto line10;

    Who says goto is evil? I think I might adopt this style for all my applications...

    Sunday, October 08, 2006

    Bid on my birthday present

    My brother has given everybody the opportunity to bid on my birthday present. Looks like he'll send it to me, even if somebody else outbids me, but any proceeds go to charity, so get bidding!

    Thursday, October 05, 2006

    Google have cocked up again

    It looks like Google has cocked up its data update again. The PageRank updates it started a few days ago look like they are being rolled back, so the Random Pub Finder is back to PR 0. More worryingly, if I do a site: search, all URLs bar three are now shown as supplemental. But If I do a search for particular keywords, other pages on the site are returned and aren't marked as supplemental. Go figure.

    Wednesday, October 04, 2006

    How to have a reasonably successful website

    I can't pretend to know a lot about making a website a huge success, none of the sites I've been involved with have been massively successful, but I've kind of worked out how to get a reasonable number of visitors to a site without any kind of massive outlay. Here are a few of my thoughts.

    Don't spend a lot of cash

    Websites are pretty cheap to run. Even if your website is your business, you can probably keep it running with no visitors and no income for a pretty long time. Blowing any money you do have on advertising before you're even sure your site is up to scratch is a sure fire recipe for disaster. Better to get just a few visitors in who'll give you a good idea if you're heading in the rifgr direction and you can fix any problems you have before too many people spot them.

    I think advertising in the old media is pretty much a waste, it's very expensive and it's hard to see if it's been a success. You can advertise using AdWords for next to nothing, giving you the chance to see if it works at all and also trying out different advertising approaches.

    Don't ignore SEO

    Google is fond of saying that you should optimise for the end user, not the search engine. I can understand where they are coming from but essentially this is pretty much untrue. If end users can't find your site, whether the site has been optimised for users or not is pretty much irrelevant, they'll never see it. Chances are search engines will be the biggest source of traffic to your site, so of course you need to optimise for them. I managed to triple the number of visitors to the Random Pub Finder just by applying some simple SEO, all completely above board and not impacting on the end user at all. I found this free download a very useful read.

    Design isn't too important

    There are many examples of butt ugly sites being pretty damn successful (craigslist being the most obvious example) and plenty of examples of beautiful sites that have crashed and burned ( comes immediately to mind). The fact is if the idea behind your site is appealling, people will come back. If the idea doesn't appeal, it doesn't matter how good looking it is, people will go elsewhere.

    One company I worked for redesigned their site about 4 times in one year, in an attempt to get more conversions. I've no idea how much they spent in total but the effect on conversions was pretty minimal, so it was pretty much wasted cash. Every redesign brought a host of new problems that needed fixing, along with pages stored in search engines that no longer existed. Not only that but time spent on those redesigns could have been spent refining and improving what was already there.

    Keep focussed

    I've never really stuck to this advice (this site covers whatever I can be arsed to write about) but if you want to get people coming back to your site it sure helps if your site covers a single topic, or a few related topics.

    Iterate and watch

    I come from a software development background and I've always practised a kind of iterative development technique. And I use the same approach when developing websites. Make a small change, see if it works, move on. Unlike software development, when developing websites the 'see if it works' stage doesn't just mean 'make sure it runs OK'. it also requires looking to see how it has affected traffic, so the iterative cycle can be somewhat longer. and to see if it works, you need to have some data. The cheapest tools (i.e free) for this job are Google Analytics and Google Sitemaps, which tell you how many visitors you're getting and what keywords are driving them there, along with heaps of other information.

    Take advantage of free advertising

    There are plenty of opportunities to get more hits on your site that cost nothing. When I post to a forum and I'm given the opportunity to provide a URL I always do. Of course, posting randomly to forums just to get a link to your site is generally considered as spam and will likely cause more harm than good. Sites like Technorati and digg can drag in more readers and directories related to your site can help pull in yet more eyeballs.

    Wait, and wait some more

    I have no knowledge of the search engine algorithms but I'm pretty sure, all other things being equal, a site that has been around for 5 years will rank higher than one that's been around for 1 month. So if you just hang around doing nothing, your site should start to get some more hits. I've never really done anything to get hits to, but I now get about 200 visitors a week.

    Monday, October 02, 2006

    PageRank update

    I've just noticed that Google seems to have updated PageRanks across my various sites. And finally The Random Pub Finder has got some PageRank! It's been PR0 for about a year, now we are up to PR3. My home page and this blog are both up, wahey!

    Wednesday, September 27, 2006

    The Great Australian Survey are spammers

    I signed up with the Great Australian Survey (www<dot>aussiesurveys<dot>com<dot>au) to see where BetterDeal were mentioned and I started getting the usual crappy offers from them. Kind of expected that, but the emails had an unsubscribe link at the bottom. I've clicked on that twice now and ticked the relevant boxes on their site but I'm still getting the emails. Either they are completely incompetent (why on earth are they sending emails to a address anyway?) or they are spammers.

    Thursday, September 21, 2006

    Working from home is different

    Working from home is certainly different to the usual office environment. In most offices I've worked in I didn't have a window to look out of, never mind looking out to see a fox, who seems to have taken a liking to lying on my shed's roof in the afternoon sun.

    Wednesday, September 20, 2006

    The changing face of spam

    The Random Pub Finder has been getting a lot of spam reviews recently. This isn't a big deal, the reviews go straight to my inbox and don't appear on the site until I put them there, but the weird thing is the content of these spams. Many of them are bacon-related. Here's an example

    "a rasher ( and reland), or a slice ( orth merica). raditionally the skin is left on the cut and is known as bacon rind. indless bacon, however, is quite common. n the"

    I just can't work out what on earth they are trying to achieve.

    On the other hand, email spam seems to be getting more sophisticated. I'm now getting quite a lot of spam emails that contain a single image offering whatever penny stocks I really need to buy, followed by some text that isn't related and is obviously being added to get through the spam filters. How can we ever defeat that kind of spam?

    Sunday, September 17, 2006

    Saturday, September 16, 2006

    Dell vs HP

    I've got a new computer from Dell and now my HP DeskJet 5550 doesn't work. Funnily enough the reason I've got the printer is because my de-facto mother-in-law bought a Dell computer and the printer wouldn't work for her either. Who's to blame for this I wonder? I've been fiddling around with it for most of the day and can't get it to work. I can print out the HP test page but any other page refuses to do very much except throw out a blank sheet of paper. Based on my experiences with the new computer that have been mostly positive (except for the shitload of rubbish software it came installed with) I'm going to blame Hewlett Packard.

    Do you ever need to do a complete rewrite?

    Joel Spolsky's article about rewriting software has always struck me as a very well reasoned argument for never rewriting software from scratch. He mainly talks about Netscape's attempt to rewrite their browser from scratch. You might claim this was a reasonable success in some respects since it led to FireFox, which now has a pretty decent share of the browser market (about 10% I guess). But compared to the market share Navigator had before they started their rewrite it is still pretty miniscule. Of course they may well have lost a lot of that market share anyway, since MS was installing their browser on every new machine that was sold. But MS stopped developing Internet Explorer after they achieved almost complete ownership of the browser market, which gave FireFox a chance to gain ground. So basically we'll never know what would have happened if Netscape had continued with their old codebase.  

    So I was somewhat disturbed to find out one of my previous employers had decided to rewrite one part of the software product they sell. I could say who it is but I don't really want to have them getting their legal dogs onto me. I worked on this part of the system for over six years and it is pretty large (with third party code it's over 500,000 lines of code) and pretty central to the whole product. It is written in Delphi and the rewrite will be in C#. As a developer, you always want to work on the latest cool technology and always think the legacy code you're working on is a complete mess, so I'm sure they are happy to be involved on a green field project like this but I'd hope the people in charge would have a very good reason for wanting a complete rewrite, but frankly I can only think of one. It's probably getting increasingly difficult to get hold of good Delphi developers. The market is shrinking and from what I can see the good Delphi developers are moving onto other things, like C#.

    I've heard they have a team of five people working on this and it is planned to be done in a year. OK, here's my guess on how long it will take. Whilst I worked there, there were probably on average about 2 developers working on this bit of the system. I'm guessing it continued with the same level of manpower after I left. When I started they already had a working product, if a little rough round the edges, so say that took 2 man years. I started in '98, 8 years ago, so we have another 16 man years of work, 18 in total. Divide that by 5 people and we have about 3.5 years to write a piece of software that has the same functionality as what they currently have... Lets hope they have five really good developers...

    As an aside, it has to be pointed out you'd need to have very good reasons to want to get to C# anyway, whether through a rewrite or a migration. Whatever people say, Delphi is still a fine choice for Win32 desktop applications. OK, it is missing some of the nicer features of .NET like reflection and the availability of 3rd party controls is drying up but it still produces small, quick native apps. And if you have a stack of Delphi code, throwing it away is a very expensive thing to do.

    But is there any other way? I thought about this when I worked at the company. Like any developer I wanted to move onto new technology so I had a long hard think about how to get from the Delphi codebase we had to C#. One choice was Delphi for .NET, but this looked like a pretty painful route, especially with the number of 3rd party controls (many no longer supported) we were using. My though in the end was the best route to take would be to componentise what we had using COM. OK, this wouldn't really be a step forward, more a step sideways, but once you've got those components in place you could start to replace each bit piece by piece.

    But I hear you saying, that would take even longer, since you still need to rewrite each bit and you have the overhead of separating them into COM components in the first place. And you'd have to use that horrible COM Interop stuff as well. All true, but the major advantage of this approach is that you will always have an application in a state that is ready to ship, or very close at least. A complete rewrite means there will be a very long period of time when you can't ship anything at all, unless you want to add new features to the old codebase at the same time as adding them to the new codebase, which will be even more expensive and painful.

    So I wish them good luck with their development. I really do hope it works out, because my livelihood now depends on their software...

    Wednesday, September 13, 2006

    ASP.NET State Service crashes on shutdown

    Am I the only person to suffer from this? Can't find anything on the web but whenever I shut down my machine the ASP.NET State Service crashes. I thought it was caused by my old machine but my new machine has exactly the same problem. No big issue since the machine still shuts down but odd that nobody else seems to be suffering with it.

    Tuesday, September 05, 2006

    We are all doomed

    There are still people who claim climate change is only a theory, just like there are people who think that evolution may not be correct or the Holocaust never happened, but there seems to be pretty much total consensus amongst scientists that it is happening and we are to blame. But even if climate change isn't happening, there is another problem awaiting us, which certainly can't be ignored. Fossil fuels will run out and, more importantly, we will pass the maximum level of production, possibly quite soon. And once that happens, if demand continues to increase, the price will rise pretty quickly. And oil is fairly fundamental to our economy, due to the amount used to produce and transport goods. I was pretty stunned when I noticed some apples in our local supermarket were being imported from New Zealand...

    But running out of oil was bound to happen at some point in the future but unfortunately we have completely failed to address the issue, so we head into an uncertain future where "the Thames estuary is the most vulnerable place in northern Europe to major storm surges", which could affect me fairly directly.

    I'd always thought that computers would help out here. I'm doing my part by working from home but unfortunately it turns out that growth of the Internet is actually sucking even more power from the grid, so perhaps that isn't part of the solution either. So, as the post title says, we are all doomed.

    Monday, September 04, 2006

    100th Post

    So somehow I have managed to reach 100 posts on this blog. I was presuming that by the time I reached this point I would be a major web celebrity with millions of readers and I'd be rich beyond my wildest dreams through the adverts on-site. But it hasn't quite panned out that way and I have to say I'm disappointed in you all. Where are you and why are you choosing to read some boring old shite rather than the riveting stuff here? I feel like this kid...

    Friday, September 01, 2006

    The Apostrophe Protection Society

    Some people seem to have a real problem understanding where apostrophes should and shouldn't be placed so I was pleased to find the Apostrophe Protection Society, who were set up "with the specific aim of preserving the correct use of this currently much abused punctuation mark in all forms of text written in the English language". Their site explains all the rules which are generally pretty easy to understand, except for the occasional edge case.

    Thursday, August 31, 2006

    Metastorm e-Work 7 and DEP

    I've already written about Metastorm e-Work 7, so I was quite excited when I got hold of the CD and immediately started to install it on a test machine. That is until I read the Installation Guide which said "Before attempting to install Metastorm BPM ensure the Data Execution Prevention (DEP) feature is disabled.". Er, excuse me? I read on and was dumbfounded to see that I had to turn off DEP for the whole machine before I could install version 7. I ignored the advice and tried to install anyway but the Installation guide was telling the truth. I couldn't install because DEP was enabled.

    What is DEP and why should you worry? Applications on your computer have a code section and a data section. Executable code is contained within the code section and any other data required by the application is within the data section. Most applications will only ever execute code from the code section but until recently nothing stopped you from writing an application that ran code from the data section. This could be potentially useful if you need to write self-modifying code, but there is a very small minority of applications that would ever need to do this. In fact the overwhelming number of applications that do execute code in the data section are viruses, trojans and other malware. So Microsoft have recently introduced DEP that will stop applications executing code in the data section. There are two flavours of DEP, software and hardware. The hardware version only runs on the most recent processors but other than that I'm not sure of the differences. But one thing is for sure, DEP is a good thing! It is just one line of protection for your PC but an important one. Disabling it is asking for trouble.

    So why does e-Work 7 require me to disable DEP? To be blunt, the software has a bug. Clearly Metastorm thought disabling DEP was an easier option than fixing the bug. What I do find odd is the fact that it is possible to disable DEP on a per-application basis, so I don't understand why they didn't go down this route. I would certainly consider installing the software if this was how it was set up. As it is, e-Work 7 will be remaining on my shelf. If I was Metastorm I'd be somewhat concerned about the possibilities of a lawsuit caused by a server being compromised due to DEP being disabled...

    Wednesday, August 30, 2006

    Delphi the best tool for .NET? Er, no

    Nick Hodges is doing a fine job of evangelizing Delphi which makes me think Delphi may have some kind of future but in his latest post, he suggests that Delphi is the best choice for .NET development. Delphi is certainly still a great choice for native Win32 application development but it just can't compete in the .NET world. There still isn't a version that supports .NET 2 so Delphi developers don't get to play with all the new features. Delphi is always likely to be playing catch-up in this respect. Also, almost all .NET code examples on the web are in C# or VB.NET which would make life more difficult for anyone developing in Delphi for .NET.

    There are situations where using Delphi in a .NET environment makes sense. If you have a large Delphi code base that you want to get to .NET, rewriting in C# or VB.NET isn't likely to be the most cost-effective solution. If for some reason you need to target Win32 and .NET, Delphi would also be a good solution, in fact probably the only solution.

    Finally, looking round at new applications coming out, we are now starting to see .NET managed desktop apps appearing. How many of them are written in Delphi? I don't know of one. In the world of ASP.NET I guess it's harder to know what language is being used for the development but I'd guess the vast majority of them are in C# or VB.NET. Compare this to the world of Win32 development where there are quite a few high quality apps being actively developed in Delphi and it's clear that .NET developers also don't think Delphi is the best tool for the job. 

    Sunday, August 27, 2006

    Getting into MySql with PHP

    Our host for the Random Pub Finder has been providing MySql integration for a while. I've been holding off using it for a while because I was thinking of converting the RPF to ASP.NET. But I eventually decided that was going to be too much like hard work and would break any links in. OK, I could probably do some URL rewriting to get round that but again it seemed like a lot of bother and PHP does pretty much everything we need.

    Anyway, I signed up for the MySql integration and I've been pleasantly surprised with how good the phpMyAdmin web interface is. RPF has been running off several text files for the last five years so I had to make quite a few changes to our code but getting the data in to MySql was pretty straightforward (phpMyAdmin will suck in any kind of delimited text file). Setting up phpMyAdmin on my local machine was pretty straightforward. OK, it's not MS easy, but then this is a free bit of software developed by people in their spare time. So I had to tweak a few text config files to get it working and I couldn't get it to play with PHP 5 but PHP 4 is fine for our needs. And now it's working I'm presuming I won't need to touch it again.

    Updating the RPF live site is now much simpler, I just insert a new row in a table and a new pub appears on the site. Previously I had to update one of our text files and email it to myself, run to my other half's laptop, download the email and FTP it to our host via a phone modem, because they won't let me connect to the FTP site via our broadband connection. I guess that's because their business model is based on getting revenue from phone calls... 

    So, in conclusion, a thumbs up for PHP, MySql and phpMyAdmin. Perhaps I'll stop being an MS fanboy and become a open-source zealot. Time to grow a beard...

    Programmable Web

    Just found this site, which looks like a useful resource for knocking together Web 2.0 (God I hate that term) mashups (God I hate that term)

    Thursday, August 24, 2006

    What is the point of Second Life?

    Apparently it's very popular with the young uns but I'm failing to understand why. I've been wandering around for a while and there just doesn't seem a great deal to do, except check out some butt ugly buildings. If I want to live in a fantasy world I want to be able to do some fantastic things, like wield big guns and blow up things, not just socialise...

    Worst of all, I seem to have to download a new version every time I log in. 

    Wednesday, August 23, 2006

    Google Maps and the Random Pub Finder

    OK, I got bored waiting for a response to my queries about ripping off people's code so the Random Pub Finder London Map has gone live. Trying not to be too big headed, I think it's superb. None of it would have been possible without phpcoord and overplot. If programming is an art form then the old adage 'good artists borrow, but great artists steal' must be true...

    Solving the Google Maps performance problem

    Google Maps has a nice API to create your own map interfaces on a website. Unfortunately it has some serious performances problems when you add a large number of markers. In my case, I have about 500 markers and both IE and Firefox grind to a halt on my page. I've seen various suggested solutions, the most common being to reduce the number of markers by only showing one marker when there are several clustered together when zoomed out. I'm sure that would work but I wasn't too keen on the idea because it just sounded like too much work. Fortunately somebody has come up with a nice solution that works well for me. thanks to the wonderful open source nature of the web, I can happily rip off his code. Just need to get approval from him before I show off my new page to the world...

    Sunday, August 20, 2006

    Pompous rock star is hypocrite shocker

    This is old news but apparently Chris Martin, lead singer of Coldplay and a man known for mouthing off incessantly about environmental issues, owns a BMW X5. This Chelsea Tractor will be doing approximately 15mpg as he drives near his central London home. Nice one!

    Thursday, August 17, 2006

    More Windows Live Writer

    A comment to my previous post from Spike Washburn (of the Windows Live Writer team no less!) suggests image uploading won't be supported until Blogger improve their API, which is a shame. So Blogger, get your finger out! And apologies if it appeared that I was suggesting Windows Live Writer deliberately wasn't supporting image uploads to Blogger.

    A couple of other points about Writer. First, I'm very pleased to see it is a managed application. Great to see MS dogfooding the .NET Framework and proving it's possible to produce professional apps using WinForms. 

    Second, it's great to see developers from MS responding to blog posts from little old me. Fact is I'm a Z-list blogger that no-one reads but I've had two lots of feedback from MS people. That kind of communication will really help build a good feeling towards MS in the IT community.

    And yes, I'm using Writer to write this post.

    Windows Live Writer

    Just playing around with Windows Live Writer and it's mostly pretty cool. The first problem I've encountered is the lack of image support on Blogger, which is pretty much a showstopper. Odd really, because Blogger does support images, but I guess this is a beta...

    More fun with <noscript> tags

    The guys at BetterDeal wanted to know why their website didn't rank as highly as some of their competitors. Short answer is inbound links, which seems to be the prime ranking decider used by Google. To illustrate I did a link:www<dot>carbroker<dot>com<dot>au search (replace the <dot> with ., don't want them getting anymore inbound links), which is one of their competitors. The odd thing was that one of their inbound links came from a penis enlargement site. Penis enlargement doesn't have a lot to do with new cars, other than the obvious psychological enlargement for men who buy big red Ferraris. Looking at the source of the penis site (purely for research of course) showed up the reason. The link was hidden away in a <noscript> tag. Car Broker are also the guys who have <noscript>betterdeal</noscript> hidden away in one of their pages slagging off reverse auctions, which is why they rank pretty highly for a search on "BetterDeal reverse auction". Although Google know about this, they haven't done anything about it and their algorithm still doesn't seem to handle <noscript> tags too well...

    Tuesday, August 08, 2006

    Borland goes Turbo

    So Borland have revived their Turbo range of products. The originals came out before I did any real programming (the ZX Spectrum probably doesn't count) so I don't how revolutionary they were at the time. But the question remains whether this will help revive Borland/DevCo's fortunes. Microsoft moved the goalposts when it released its Visual Studio Express range for free, and Borland had no choice but to respond by releasing free versions of its own development tools. But free and academic versions don't bring in a lot of revenue and although they may drag people in Borland's direction who may start to pay for products later, that's likely to be a long term effect. For Microsoft, development tools are a loss leader, they don't care if they make money so long as they keep people using Windows. For Borland/DevCo it's essential these products make money or else they're out of business. On another note, although the Delphi community seem to be very excited about these new developments, will the rest of the world care? The people who Borland seem to be aiming for, i.e. new developers, probably don't have a clue what the Turbo range was and because of that the new website probably doesn't look retro and nostalgic, it just looks naff. Saying all that, I am pleased to see Borland/DevCo making some positive moves to sell their development tools, it certainly makes a change from the last few years.

    Monday, August 07, 2006

    Land Rover's misplaced marketing

    Today I received a letter from Land Rover, offering me the chance the test drive their latest model. Whilst I'm sure it would be fun, there's no way I'd ever think about buying a new Land Rover so why are they sending it to me? I'm not sure where they got my address from but I think they need to do some better filtering of their mailing lists. First, I can't afford a new Land Rover. Second, I live in the middle of the largest city in the UK, why on earth would I want to buy a car that has 'authentic off-road ability'? Third, I'm concerned about this environment thing. Why would I want to buy a car with a 4.2 litre engine that does approximately 13 miles to the gallon with CO2 emissions of 374g/km??? It's nice to see their letter was printed on paper from sustainable forests, but perhaps they need to sort out their massive gas guzzling machines as well? To be fair, the original Land Rover is a design classic and before I realised the environmental damage owning one would do, it was near the top of my list of cars to own. Any way, the real reason for this post is to point out there is a way to stop receiving all this junk mail. MPS Online claim that they will stop unsolicited mail coming to your door. I only signed up a week or so ago so it hasn't stopped yet but fingers crossed it will do soon.

    Sunday, August 06, 2006

    Richmond Park

    Truth be told I don't much like London. When hearing this, people will often trot out the usual Samuel Johnson line, but the fact is Johnson lived in an entirely different London to the one I live in now. But one of the great parts of London has to be Richmond Park (although some people will claim this isn't really part of London, because it's in zone 5). When cycling around its huge area, I can almost forget that I'm anywhere near the busy, unfriendly city I know.

    Thursday, August 03, 2006

    Lots of new posts

    Just copied across the interesting posts from my old blog, enjoy!

    DesignerSerializationVisibility attribute

    When writing .NET components, often you don't want properties to appear in the Property Window. This is well documented and is achieved with the following [Browsable(false)] But what you also generally want to happen is for the property not to get persisted to the form in the InitializeComponent method. Unfortunately the Browsable attribute doesn't do this part of the job, but thanks to one of my colleagues, this is how you achieve that. [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] Perhaps there are occasions where these would be used separately but I can't think when they'd be

    Use the tool, tool part 8

    OK I lied, the last post wasn't my last post on .NET tools, there's one more. NAnt is a handy tool for automating builds. Although it's possible to drive Visual Studio.NET from the command-line, NAnt does lots of other things, like running your unit tests and zipping up files etc etc via an XML configuration file. I haven't used it a great deal myself, but I will be shortly.

    Use the tool, tool part 7

    Right I have one more .NET tool to recommend and then I'm done. And that is FxCop. This will analyse your assemblies and tell you all the problems it finds. And my word, does it find a lot of things. The fact is a lot of the rules are just plain anal, but it still finds stuff that could be a problem. And whats more, you can add your own rules, although I can't say I've ever done this.

    Use the tool, tool part 6

    Documentation is a right pain the behind, or at least it used to be. C# simplifies it a great deal by providing in-built support for it. XML tags can be added to your source code as you go along, so that 2 week task at the end of the project can be avoided. So once you've tagged all your code, what next? Download NDoc and you can generate help files just like the ones in Visual Studio. If it hadn't been for this tool, I'd probably never have got round to releasing a little project of my own into the wild. Another useful tool for generating documentation is GhostDoc, which automatically generates a first attempt at the documentation based on parameter names and method names. It doesn't always get it right, but it's often good enough.

    Use the tool, tool part 5

    I haven't covered the most useful .NET tool yet, the wonderful Reflector. If you haven't got this yet, download it now. One of the great things about Delphi development was the fact that Borland provides the source to the whole component library, which really helps tracking down weird bugs and work out how their stuff works. Microsoft don't provide the source to the .NET Framework, but with Reflector it doesn't matter. It can reverse-engineer any .NET assembly and you can see how it works. Yes, some class library developers obfuscate their libraries, but Microsoft don't and that's the most important library. Reflector also has several add-ins that do useful things like reverse-engineering a whole assembly which is useful for, er, more nefarious deeds. There are also plug-ins to generate Delphi code and other languages. So, as I said before, if you haven't got it, get it NOW!

    Use the tool, tool part 4

    If you've written some unit tests, the next thing to find out is how much of your code is covered, since you want to get as close to 100% as possible. This is where AQTime comes in. This profiler does all kinds of profiling but the coverage profiler is what you'll want to use here. AQTime may cost quite a bit of cash but it's worth every penny. Another use of AQTime is to track down performance problems. If I have a performance issue in some code, the first thing I do is turn to AQTime. Some people will think about what is causing their performance problems, but frankly what's the point? The theories they come up with are invariably wrong, because more often than not, the actual problem is caused by some poorly implemented algorithm, that manual analysis completely missed. Performance analysis should always be undertaken with the help of a profiler, since not only will it tell you the cause of the problem, but will also tell you exactly how much time you'll save by fixing it.

    Use the tool, tool part 3

    According to 'Working effectively with legacy code', any code without unit tests can be considered legacy code. That means pretty much every piece of software I've ever worked on is legacy code. Before .NET, writing unit tests was hard. In my Delphi days I tried to use DUnit but the language didn't lend itself to writing a tool that was simple to use. In .NET, attributes and reflection make it much easier. So we have NUnit, which has been the tipping point for me writing unit tests. As well as testing functionality, unit testing also helps validate the design of a system. If it's hard to write tests for your classes, chances are the design isn't too great. It suggests too much coupling and cohesion between the classes. Unit tests are always mentioned in the context of agile development, but there is no reason why they can't be used without adopting the whole philosophy. I have my doubts about some of the agile approach but I still believe unit tests are worthwhile. In the short term, they certainly add time to the development process, but I believe in the long run they save time and improve code quality. Of course management are often more interested in the short term (understandably since in the short term bills have to be paid), so unit tests may be a hard sell.

    Use the tool, tool part 2

    OK, before I get onto .NET tools, a bit of a diversion first into the realm of web based tools and HTTP. Fiddler is a great tool to see the traffic between IE and any web servers it's talking to. I've used it to track down performance problems and to see what cookies applications are using so I can hack them (meaning interact with them in a non-supported manner rather than steal credit card details...) If you're interested in HTTP calls that are made through some other app than IE, then TcpTrace is the tool for you. It's a little bit harder to set up than Fiddler (but not exactly difficult) and the UI isn't quite as polished but it gets the job done. It also supports any protocol, not just HTTP.

    Use the tool, tool part 1

    OK, the title is pinched from an article by Malcolm Groves, but I like it. After a week of having to work on an XLA written in the worst development language of all time, VBA, I suddenly realised the importance of using the right tools. You can be the best programmer in the world, but if you're using crap tools, your solution will still be crap. So here is the first in an occasional series of articles highlighting what I reckon are the best development tools. I spend most of my time doing .NET development, so I'm going to concentrate on that side of things. The first and probably most important tool is your IDE. And the clear choice is VS.NET 2003. OK, it falls over occasionally but I've very rarely lost any work. The choice is also easy just by a process of elimination. VS.NET 2002 was essentially a 1.0 product, so best avoided. VS.NET 2005 is a beta, so best avoided. And is just me, or is it one of the most butt ugly pieces of software ever? Delphi 2005 is, by all accounts, flaky as hell. Note, I still think Delphi is the best development language for Win32 client-side development, but for .NET forget it. SharpDevelop has one thing going for it, it's free, but other than that, it's pretty poor. So, almost by default VS.NET 2003 wins. Next time, more .NET tools

    Wednesday, August 02, 2006

    BPM software comparison

    Over the coming days/weeks/months (depending on when I get bored) I'm going to take a look at some Business Process Management (BPM) software and see if it's any good. What is BPM software? Good question. I'm in no position to give a definitive answer to that and I'm sure a BPM expert would give a different answer but to me it's all about automating all the boring repetitive crap associated with any business so workers can get on with more interesting stuff. Or alternatively workers discover they aren't needed anymore and get shown the door... The BPM market is growing and there are heaps of vendors out there producing software so I'm only going to look at products that meet one criteria, they have to provide a downloadable demo version of their software I can play with. If a company doesn't have the confidence to provide a demo then I am deeply skeptical of their software. So the vendors I'll be looking at will be (in no particular order) Savvion, Fuego, Metastorm, Tibco, Fujitsu and Microsoft. I may cover some more if I find they have demo versions I can download. Keep reading!

    Monday, July 31, 2006

    House price crash? I hope so

    When we bought our first flat in 1998, it cost us £99,950. At the time I thought it was a huge amount of money and I thought house prices couldn't rise any more. How wrong I was. Two years later we sold it for £175,000 and bought our current house for £220,000. Again I thought house prices couldn't rise any further and again I was way off the mark. In both cases I wasn't particularly concerned with house prices, since I never thought of buying a house as an investment but rather somewhere to live. Buying was (and still is) cheaper than renting for us since we were lucky enough to buy at a good time. Now our house is worth over £300,000 and by all accounts still rising, although the price rises have certainly slowed down. If we were starting over and looking to buy a place now we couldn't afford to, certainly not where we bought our first flat. I do wonder who can afford to buy somewhere now. But rising prices don't help us either. If we ever did want to move house, chances are anywhere we bought would be over the magic £250,000 mark, meaning our fees would be about £10,000. I can think of lots of things I could do with £10,000 and handing it over to the government doesn't seem the most appealing option. The guys at House Price Crash have been predicting a crash for some time, but they are still waiting for it to happen. The sooner the better as far as I'm concerned.

    Friday, July 28, 2006

    Windows Live Local vs Google Maps part 2

    So I tried to switch to Live Local but my first problem with it is a bit of a showstopper. The map doesn't show tube or train stations, so for getting round London it's completely useless. Back to Google Maps... Windows Live Local 1 - Google Maps 1

    Wednesday, July 26, 2006

    Windows Live Local vs Google Maps

    It all started with a trip to the wilds of Lincolnshire. We'd been there before but I didn't know the way too well, so thinking Google has the answer to everything I thought I'd use Google Maps to give us directions. Turns out the directions it gave us weren't too hot, causing much screaming and shouting between me and my other half who was trying to decipher the instructions. Admittedly where we were didn't help, all the roads and countryside looked the same. In the end we had to call the people we were visiting and ask for their help. Somehow they worked out where we were and guided us in. So for my next little trip I thought I'd give Windows Live Local a try. I was dropping my brother off at Heathrow airport so searched for directions for that. It's been a while since I've used the MS mapping stuff and it has certainly improved, in fact I think it may well have moved ahead of Google Maps. Google may have been first with the whole draggable map thing but they don't seem to have done a great deal since. But back to Heathrow, Windows Live gave sensible driving instructions and printing was completely customisable. Google Maps on the other hand suggested a completely insane route, via the M4. For the reverse trip it suggested a completely different insane route via the M25 and M3. Looks like Google thinks motorways are super fast which in the case of London certainly isn't the case. Final score, Windows Live Local 1 - Google Maps 0

    Cunts are still running the world

    Jarvis Cocker is back with a new ditty that won't be getting much airplay I guess. Not a great song but I can't help agreeing with the sentiment.

    Tuesday, July 18, 2006

    An unobjective review of Metastorm BPM 7

    First the disclaimer, I used to work for Metastorm, I use Metastorm e-Work/BPM most days for my job and I'm a techy so may not be interested in the same things as a business user of the software. Finally I haven't got my hands on the software yet, so can't comment on stability etc. And because of all that, this review will be completely unobjective and uninformed. First up, and possibly the least important new change, the name. To my mind, e-Work was a good name, if only because my boss's company ranks highly on the search term 'Metastorm e-Work'. BPM on the other hand doesn't set the software apart from every other BPM product out there. It's like Microsoft calling their word processor software 'Word', what they did? OK, perhaps I'm wrong... Having had a quick look at the webinar, there are quite a few new features. Metastorm seem to be making a lot of fuss about the SharePoint integration, I'm not hugely interested in this but if you're a SharePoint shop already it looks pretty sweet and much improved over the previous ActiveX implementation, perhaps not in features but certainly in acceptability in the corporate world. The Designer gets a makeover, going down the Visual Studio route with dockable windows, which should be pretty useful in terms of screen real estate. There are new icons, but they look pretty ugly to my eyes. There are a few new features (including the ability to specify roles in a library which made me laugh since this used to be possible until it was pulled out of the product for some reason). You can now find which procedures use which libraries in the database, which is most welcome. Internationalization has improved but is not complete. It also hasn't been added to the Outlook client which is a shame and perhaps signifies the Outlook client may be coming towards the end of its life. There is a new Integration Manager, although I'm unclear what this is for, integrating with the bought out CommerceQuest stuff I guess. Overall I'm pleased to see there has been a reasonable amount of time spent on the core product, rather than features required to be buzzword compliant (anybody using that rules engine integration?). My personal bugbear with the product is the e-Work scripting language that just isn't powerful enough as a scripting language. Unfortunately the integration with other scripting languages still needs improving and it looks like these two issues haven't been addressed at all.

    Friday, July 14, 2006

    MMC RIP?

    I never quite understood the point of Microsoft Management Console. It is a framework for building administration tools that allows end users to create their own admin environments by adding together as many 'snap-ins' as they like. But the cost of this is that any snap-ins have to fit into the MMC framework, which is fairly inflexible and forces an Explorer style interface on every snap-in. And who actually uses the customisation facilities provided? I certainly don't and have never seen a machine where the admin tools have been customised. So I was intrigued to see that the main admin tools in SQL Server 2005 are no longer MMC-based, they are just standard Windows applications (written in .NET methinks). So although Microsoft continue developing MMC (version 3 is coming out soon with support for .NET based snap-ins) it seems to me that the end may be nigh for MMC. As an aside, I helped develop an MMC snap-in for some software I worked on. Although they are generally pretty tricky to develop, Colin Wilson has written a great Delphi component set to help with the job if you really must develop one.

    Friday, July 07, 2006

    How to choose colours for a website

    With my grade E in GCSE Art, my art skills have never been up to much. So my website colour choices have always been pretty ugly. I was therefore very pleased to find Colour Blender, which makes the choices for you.

    Wednesday, July 05, 2006

    Ajax.NET Professional

    As always I'm late to the party, but I've finally got into some AJAX development. Since the project I'm working on is an ASP.NET 1.1 website, Atlas is no use to me, so I was pleased to find the free Ajax.NET toolkit. It makes development of AJAX based websites really simple. Add a line to web.config, add an attribute to a server-side method and then call it from client-side Javascript, it's that easy. The lovely thing about it is the way it copes with classes as well, my server-side method can return a class that can then be used in my client-side code. It may not actually be using magic but it sure feels like it.

    Sunday, July 02, 2006

    England suffer completely predictable World cup exit

    It came as no great surprise to see England getting knocked out of the World Cup yesterday. As ever, the first time they had to play a decent team, they failed to progress. But what made this worse than previous efforts was that we appeared to have a squad capable of making a real challenge. Unfortunately our manager was clueless and decided to only bring 3 strikers (OK 4 if you count Walcott who Sven was clearly never going to select), 2 of whom were not fully fit. That meant when Owen was injured we were forced to play a formation that clearly didn't work. If we'd been able to play a more attacking formation, we might have got a goal that we could have protected when we went down to ten men. But with two strikers, Rooney would probably not have been so frustrated in the first place and might have been on the pitch for the whole match.

    Friday, June 30, 2006

    How to rescue a Delphi project

    Delphi has been around a long time and there is a lot of Delphi code around but there aren't so many people around to work on it anymore. Developers are moving onto more modern technologies. To me it looks like the people who continue to maintain this code aren't always the most technically proficient so due to this and the fact that the code is getting long in the tooth means projects are becoming a bit of a mess. These days if I'm asked to look at some Delphi application, it is invariably in a bit of a bad state. So how to deal with this situation? How can these ill projects be rescued? These are the steps I've been taking with the latest bit of code I've been asked to look at. First up, I added all the source to source control. Without source control, you're doomed. There are plenty of source control products around, many of them free. I've been using SourceGear Vault, because it's free for a single user and does averything I need. Next, I attempted to compile the project. The main problem here was libraries I didn't have. Fortunately these were all available free, so I could compile it quite easily. Now it was time to see what the code was actually like. Unsurprisingly it was a bit of a mess. Compiling with hints and warnings on generated several hundred warnings and this was before I noticed somebody had put the {$WARNINGS OFF} compiler directive in several files... Warnings are there to help and can generally be fixed pretty easily, so don't hide them! Fixing these errors took some time but helped to learn about the code. I'd recommend removing all code that is never called and all commented out code, there is no point learning about code that is never actually called. And it's always recoverable from source control. Also searches through the project that throw up commented out code are generally pretty annoying. Another great tool for finding problems in Delphi code is Pascal Analyzer, which finds lots of things that the compiler will miss. Even the trial version has enough functionality to be useful. Reading the code can give you clues about a few things as well. Given that the developers of this code had a habit of leaving in lots of commented out code, my guess is they didn't use any source control. I'm also guessing they started work on this a long time ago, with lots of pointer based operations and references to WinTypes and WinProcs (which if I remember correctly was removed after Delphi 1). So this is where I'm at now. What I need to do now is take this Windows application and convert some parts of it into a web service. This is where it could get interesting...

    Tuesday, June 20, 2006

    What is System.RuntimeType?

    I was trying to get the metadata for a query coming back from SQL Server. I'm not interested in the data, I just wanted to know what the columns were in a particular table. So I was executing a query like so - 'SELECT * FROM blah WHERE 1=0'. When I executed it, I took the DataReader returned and used GetName to get the names of the columns and GetFieldType to find out the types. Perhaps there is a better way to do this but I'm unaware of it. But weirdly, GetFieldType returned System.RuntimeType for every column. I thought WTF is that? A quick Google then a quick Yahoo and quick MSN didn't show up anything useful. The only thing I could find was the comments from the MS Rotor source which said

    "RuntimeType is the basic Type object representing classes as found in the system. This type is never creatable by users, only by the system itself. The internal structure is known about by the runtime. __RuntimeXXX classes are created only once per object in the system and support == comparisions."

    But this still wasn't much help. So I thought I'd have a hack around. The reason it isn't documented and doesn't show in many searches is because it's an internal class, which makes it a bit surprising I'm seeing at all. But it does have a useful property called UnderlyingSystemType that returns the type I'm interested in. Of course because it's internal I can't access that property. The way round this is via the best thing since sliced bread, reflection. So here is the litle snippet of code I came up with to do just that.
    object val = reader.GetFieldType(index);
    Type runtimeType = val.GetType();
    PropertyInfo propInfo = runtimeType.GetProperty("UnderlyingSystemType");
    Type type = (Type)propInfo.GetValue(val, null);

    Update - As mentioned in the comments (only took me three years to respond!), this code is actually pointless. The thing I hadn't noticed is that RuntimeType inherits from Type, so although it isn't possible to deal with an instance of RuntimeType directly, you can just treat it as an instance of Type instead.

    Sunday, June 18, 2006

    The construction of a disco shed

    Here are some photos of the construction of my disco shed. I'm very pleased with the final outcome and I learnt a few things on the way. First I discovered that air-raid shelters are very difficult to pull down, especially when the bolts are all rusted in. Cutting through them with a hacksaw takes a flipping long time. Then I learnt that laying a concrete slab is a pretty big job. When I calculated I needed 68 bags of ballast (which is sand mixed with gravel) I thought I'd made a mistake. In fact it turned out I actually needed more. A cement mixer was pretty much essential as well. Also, getting the base level is quite important. Mine is a little bit out so my chair rolls down the slope when I'm sat at my desk. Not so bad that I fly out the door, but if I'd made more of an effort to get the base exactly level I wouldn't have the problem.
    Finally, a disco ball is absolutely essential for the modern disco shed...

    Thursday, June 15, 2006

    The story of an SL-1210

    When I was 17, my main ambition in life was to own two Technics SL-1210s and be a world famous DJ. The SL-1210 is a design classic. It has been around in one form or another for over 30 years and it is built to last. Everything about it is industrial strength, except the tone arm which by its nature has to be pretty fragile. The most impressive thing is when you lift up the platter and there isn't any kind of belt, just what looks like a magnet and some coils. I think this was the first direct-drive record deck and although it has been imitated many times, the SL-1210 is still the de facto standard in the world of DJing. But this design comes at a cost. When I was looking to buy one, they cost £400. I scrimped and saved and finally got together the money. In fact I only paid £360, since I was paying in cash. But I only had one, which was pretty useless when you want to be a DJ. Which is where Ali comes in. Ali was a friend of mine at school. I don't remember when he told me he was HIV positive but it was pretty soon after meeting him. He was a haemophiliac and had contracted HIV from a contaminated clotting factor injection, before testing for HIV had begun. The government had compensated all those who had contracted HIV, so Ali was a well-off young man, though one with a potentially terminal illness. So Ali bought himself two Technics decks and even got them put in flight cases, for the professional DJ look. We weren't great friends at shool but we ended up at the same university (Newcastle) doing the same degree so ended up becoming good friends. We also started DJing together, after getting an amp and some very big speakers. We were a good pairing, he did bang bang dance music and I did Indie pop with some mainstream pop music. When I finished uni after four years, Ali had missed a year due to illness and was still trying to finish his degree off. He never got the chance to though. I last saw him during the Christmas holiday of '94. He was in bed and was unable to come out for Christmas drinks, but I presumed it would be another passing illness, like the ones in the past. But not long after he was dead. At his funeral, Ali's dad told me that Ali had left me his decks. After leaving uni, DJing had dried up, not least because Ali wasn't around to get the contacts, since he was always much more gregarious than me. But I obviously wasn't going to say no. So now I had three decks, which was too many even if I was still DJing. So I gave my SL-1210 to another of Ali's friends and kept the other two for myself. Time went on and the DJing thing was obviously never going to happen so I gave one of the decks to my brother Simon, with the proviso he didn't sell it on eBay. And the other one has been mostly been doing nothing but gather dust for the last ten years. CDs and MP3s have replaced records in my life. And now I have a shed and space to spare, so out has come the SL-1210. I cleaned it up and threw on one of my ten-year old records and the deck still works perfectly. So thank you Technics and thank you Ali.

    Saturday, June 10, 2006

    HTTPS and stupid error messages

    Ever seen this dialog box appear in Internet Explorer? Chances are you have. And guess what, most people who see it don't have a clue what it means and just get scared that the website they are on isn't as secure as they thought it was. And know what else? It's wrong most of the time when it appears. It will appear when there is a standard link to a non-secure page. Yeh, the other page may not be secure but the user isn't looking at any content from that page. Since it will appear whenever there is a link to a non-secure page, it's very easy to accidentally add stuff to your page that will cause this to show up. I wonder how much time has been wasted by developers getting rid of this? And IE7 doesn't fix it either...

    Wednesday, June 07, 2006

    Server-side view state

    There was a reason for adding the user-agent string to my ASP.NET error handling code, some errors are browser specific. One bug that has been biting me is view state getting corrupted. View state is a big chunk of base-64 encoded data that gets passed from the server to the browser in a hidden field. The browser does nothing with it (or at least it shouldn't) except pass it back to the server in a post-back. Unfortunately it seems some bug in FireFox causes the data to get corrupted for some of our pages which then causes our app to blow up when the data gets posted back. But more weirdly, there doesn't seem to be any mention of this bug when I Google for it. The conspiracy theorist in me thinks this may have something to do with the geek community not liking to say anything bad about FireFox, but it's more likely that this is is just a very uncommon bug. Anyhoo, there seems to be a pretty good fix for this. This article describes how to store view state server-side. Not only does this solve the problem, it also reduces page size quite dramatically. Of course the downside is that server memory usage is increased.

    Monday, June 05, 2006

    Handling errors in ASP.NET

    It would be nice if my sites never crashed, but unfortunately they occasionally do. First off I don't want users to see the ugly ASP.NET error page, so I add this to web.config. <customErrors mode="RemoteOnly" defaultRedirect="error.html"> <error statusCode="404" redirect="index.aspx" /> </customErrors> I redirect to a HTML page, just in case ASP.NET is so ill it can't display an ASPX page (although whether it will be able to redirect at all is open to question). The exception to this is 404 errors which are redirected to the home page. The code below is what I use to handle unexpected errors. This is added into global.asax. Some people will say log errors to the event log but I prefer logging to the database because it's easier to configure. By default, the ASP.NET user can't write to the Application event log. You can set up your own event log, but again this requires some configuration. Most projects have a database back-end, so I just need to add another table. I also send out an email so if there is a serious problem, I get notified pretty quickly. Note, the error also includes the full URL so if a test server or development machine starts sending out error emails, it's clear it's not a real problem. You could also configure this from web.config. Update - Now logs more information about the error, such as the type of browser making the request and any session data. Any objects being stored in session data must have a sensible ToString() implementation
    public static void LogError(string errorMessage)
    // log error to database
    using (SqlConnection connection = new SqlConnection())
    connection.ConnectionString = ConfigurationSettings.AppSettings["connectionString"];
    using (SqlCommand command = connection.CreateCommand())
    command.CommandText = "INSERT INTO Log VALUES (GETDATE(), @Error)";
    command.Parameters.Add("@Error", errorMessage);
    // send email
    SmtpMail.Send("", "", 
    "IniTech web server information", errorMessage);
    protected void Application_Error(Object sender, EventArgs e)
    // log exceptions
    Exception ex = Server.GetLastError().GetBaseException();
    StringBuilder errorMessage = new StringBuilder();
    errorMessage.AppendFormat("An unexpected error occurred{0}", Environment.NewLine);
    errorMessage.AppendFormat("Type: {0}{1}", ex.GetType().ToString(), Environment.NewLine);
    errorMessage.AppendFormat("Source: {0}{1}", Request.Url.AbsoluteUri, Environment.NewLine);
    errorMessage.AppendFormat("Message: {0}{1}", ex.Message, Environment.NewLine);
    errorMessage.AppendFormat("Browser: {0}{1}", Request.UserAgent, Environment.NewLine);
    errorMessage.AppendFormat("Stack trace: {0}{1}{2}", Environment.NewLine, ex.StackTrace, Environment.NewLine);
    errorMessage.AppendFormat("Session data: {0}", Environment.NewLine);
    foreach (string key in Session)
      string val = string.Empty;
      if (Session[key] != null)
        val = Session[key].ToString();
      errorMessage.AppendFormat("  {0}: {1}{2}", key, val, Environment.NewLine);

    Friday, June 02, 2006

    Skype rocks

    OK, so I'm about 12 months late but I've only just got round to using Skype on a regular basis and it's great. Most importantly it just works. I've had long conversations with people in the US and Australia and it drops out very rarely. Compared to my experiences with Yahoo Messenger (where conversations tended to consist of 'what was that?', 'you still there?', 'I'll call you again, see if it's any better', 'can you type out whatever you're trying to say', 'I give up, I'll call you on the landline') this is very pleasing. Any negatives? Sending files can sometimes be very slow (but this is still better than MSN which sometimes just refuses to accept files) and I can't seem to find a way to search through past chats. And it's written in Delphi, so perhaps there is life in the old dog yet.

    Tuesday, May 30, 2006

    DCOM from .NET

    It's not well advertised but it is possible to use DCOM from .NET. It may not be as popular as the more recent RPC mechanisms but I still need to use it occasionally. So here's some C# code that should do the trick. The COM type library must be registered on the client machine. ComObject is the type of the COM object that you've imported into an interop assembly.
    Type type = Type.GetTypeFromProgID(progId, serverName);
    if (type == null)
    throw new Exception("Unable to find the object, ensure the type library is registered");
    Object objTest = Activator.CreateInstance(type);
    ComObject comObject  = (ComObject)objTest;

    Thursday, May 25, 2006

    Apple finally gets it

    Apple have always annoyed me. Many many years ago the original Mac was ahead of its time but slowly Windows caught up and eventually the old Mac OS was looking pretty dated. But still the Apple zealots would ramble on about how great Macs were. We had one of the original iMacs but it just wasn't very reliable, even though it looked quite photogenic. Which was another reason for not liking Macs. Even though 95% of the worlds' computers were Windows PCs, every film with a computer always had a Mac. I recently upgraded that old iMac to MacOS X and was quite impressed. Of course the problem was all the software I wanted to run was Windows software so it wasn't much use to me, so it is still languishing in the loft. But first Apple decided to switch to Intel processors (and seem to have admitted in the process that they are much better than the old PowerPC processors). Then they released software to allow Apple computers to run Windows XP, which solves the major problem for anybody coming from the Windows world. And now they've released a laptop costing as little as £749, which solves one of the other major problems with the Mac, the price premium. It's still there but it's much less than it used to be and I have to admit that if I do ever purchase a laptop, I will now consider an Apple. And that iMac in the loft will be moving into my new office very soon.

    Sunday, May 21, 2006

    A better link: search

    I've known for some time that Google lies when I do a link: search to see which sites link to my sites. Even though I know of sites that link to mine, Google doesn't list them. So I was very pleased to discover that it's possible to use @: instead of link: and many more sites are listed, although it still doesn't show some sites I know link to mine.