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)<test@test.com>

    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

    http://www.doogal.co.uk/ResourceExplorer.php

    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...