You appear to be using Internet Explorer 6 or lower, which this site does not support. I recommend you upgrade to a more recent browser, such as Firefox or IE7.

October 2007

Monthly Archive

Browsers are weird…especially Internet Exploder.

Posted by Sam on 13 Oct 2007 | Tagged as: Web development

Some more updates to the site:

  • About page finally has something decent on it – blurb about me (strangely enough) and a personalDNA swatch script, slightly modified to fix an annoying gap in my swatch and to ensure the output validates.
  • Minor menu tweaks
  • Minor CV tweaks
  • Minor SST page tweaks, example tables now look and play nicer.
  • Fixed a couple of obvious silly errors
  • Fixed Copyright element adjustment script for small pages in IE7 and Opera

The last item on the list was interesting. For some odd reason, my JS that worked perfectly well in Fx and Safari was failing miserably (without an error) in IE7 and Opera. The script basically just retrieves the following element with getElementById:

<p id=”copyright>Copyright ©2005-2007 Sam Maister, All Rights Reserved.</p>

…before adding extra padding (via inline CSS) to ensure that it is at the bottom of the page, if the content is too small to push the element to the bottom. So I tried a few things out such as changing the element to a div, removing the existing applicable CSS rules, using ye olde document.all.getElementById, etc. None of these worked, and I quickly realised that the existing method did actually work, just not on that particular element. So I tried a couple more things before changing the id of the element from ‘copyright’ to something arbitrary; I didn’t expect this to work at all, but work it did. To test my theory, I changed the id of a different element to ‘copyright’ and that element was now immune to the script…bizarre; for some reason IE and Opera (maybe through some misguided attempt to be more IE-like?) seem to ignore any attempt to retrieve an element with an id of ‘copyright’ through getElementById. Googling it came up with nothing, but whatever. Now I have ‘copyright_notice’ and everything is peachy.

Here’s a simple testcase:

inline JS – var copy=document.getElementById(’copyright’);
var notcopy=document.getElementById(’this_copyright_bug_is_stupid’);
copy.style.color=’red’;
notcopy.style.color=’red’;

Clicking here should change both of the following text lines red. Click here to reset the colours:

I have an id of ‘copyright’.
I have an id of ‘this_copyright_bug_is_stupid’.

Edit: Another reason I should really be using jQuery for all of my JS stuff; this bug doesn’t occur when you use $(”#copyright”).css(”color”,”red”); instead of the clunky code above.

Blogtastic…once more

Posted by Sam on 11 Oct 2007 | Tagged as: Life, Web development, Work

Ok…so I’ve been rather silent here. I’m still alive, currently living in Edinburgh with my new lady (who is the best thing to happen to me in a very long time). The MSc and DoD (Dissertation of D0000000m) have ended and I am sans job. I’m involved in a concerted effort to get a position in web development as I’d like to work in an area that

  • I’ve always been fascinated by
  • I actually enjoy
  • Isn’t science (I’m fed up with research after the DoD and want to see what else there is)

The site has come along a great deal since I last wrote something here, with eleventy billion bug fixes and extra features, and some actual design work has happened to ensure that it doesn’t look like a pile of junk. It’s far from finished – I have several little bits yet to do, along with the mildly irritating task of getting it to look nice in the abomination that is IE6. In fact I would have done the IE6 testing already if M$ hadn’t made it impossible to run it in Vista; as it is, I have to install 1.5+Gb of virtual OS (XP SP2) to get anywhere near IE6. So I’ve decided not to bother and to gopher the prettiest Linux ever (Kubuntu) and WINE instead. After these job applications. Job > IE6 compatibility.

Anyway, here are the main recent improvements to the site:

  • Cool PHP breadcrumbs script added to generate crumbs from directory structure
  • Even cooler browser-specific, dynamic PHP generated CSS and JS files – this was a lot easier than I thought it would be to implement. I’m sure this puts a hefty load on the server, but I can’t see it causing any problems, unless I start getting lots more hits.
  • Tutorial for my scrollable, sortable table – hopefully *fingers crossed* I can get my GridView tutorial up here too. I also have some Perl scripts to put up, just data juggling stuff but some budding computational chemist out there might find them of use
  • Clicky-sprouty hidden JS divs for code and suchlike – sadly not yet working in Opera, but that’s not so bad (sorry, Opera users)
  • Vastly improved menu
  • Much better Smarty code, making it far easier to change (and add) pages to the site
  • Smarty templates seamlessly hooked into blog files through some carefully placed PHP includes – again a lot easier to do than I anticipated
  • Nicely formatted CV page that kicks the bottom of my existing CV – I will back-port the changes to the document version shortly and put it up here for download
  • Contact page that works and works well, I’m sure the JS validation script can be improved but it’ll do for the moment.

The Wordpress update to 2.3 didn’t work (both 1-click & manual) so I’ll stick with 2.2.1 until I figure a workaround (probably best backing up, deleting and re-installing). More to come.