Sunday 21 June 2009

Bits of different stuff

This morning I went to Church with Moccle and Lad. After church I went on Animal Crossing.

After lunch I checked my email, Andy Rouse's blog, Moose Peterson's blog and The Luminous Landscape. After that I found that my custom XMP File Info Panel wasn't adding keywords from Hierarchical Keywords to an image properly. The problem was if the keyword already existed as part of a different keyword, then it wouldn't get added, e.g. if Begonias was already a keyword, then Begonia wouldn't be added.

The reason for this is that I was using indexOf() to check whether the keyword already existed. So I changed this to a regular expression, and this fixed it:
regex = new RegExp("\\b"+keyword+";","i");
if(!regex.test(keywords))
{keywords += keyword + "; ";}

After that I watched a John Wayne film. Weirdly he was mates with (American) Indians, and even had adopted an Indian as his son!?! He didn't even say much anti-women stuff. So it wasn't that funny, though there was a bit where John Wayne grabs a bloke, and the bloke says "Hey, I didn't do anything!". John Wayne says "Well, you should have!" and punches him. While the film was more politically correct than your average John Wayne film, it was still quite good.



I looked at Encyclopedia of Life again, and it seems that the Taxanomic hierarchy they use only uses the main Taxonomic ranks. I also noticed they have a an option to display Common names or Scientific names, the same as I'm planning to have on my site.

After tea I played on Animal Crossing for a bit. Then I found that my RegExp for extracting Hierarchical Keywords into normal keywords wasn't working. Eventually I figured it out - I had been using \b for a word boundary, but when you are writing a regex using the new RegExp() method, you need to escape the backslash with another backslash like \\b (I've corrected my code above).

After some more testing I found that if you have whitespace after a keyword, Bridge will strip the whitespace when saving the keyword, so I changed my regex to take account of this regex = new RegExp("\\b"+keyword+"\\s*;","i");

I did a bit more work on my website, then did a backup.

The weather today was mostly cloudy, with a bit of sun later in the afternoon, and a nice sunset.

Food
Breakfast: Strawberry jam toast sandwich; cup o' tea.
Dinner: Chicken dippers; pasta; weird chicken soup stuff. Pudding was banana with ice cream, chocolate sauce and toffee sauce. Coffee; 3 pieces of Sainsbury's caramel chocolate.
Afternoon snack: Scone with butter and strawberry jam; cup o' tea.
Tea: Ham with mustard and sweet & crunchy salad sandwich; apple; slice of madeira cake; Rocky; cup o' tea.

No comments: