The tax man!
Thursday, July 7th, 2005I saw this today in the local papers. Quite an accurate depiction don’t you think?
I saw this today in the local papers. Quite an accurate depiction don’t you think?
What has happened today in London is terrible. My thought goes out to all those people affected.
Whoever did this - what are they trying to achieve?
Last night I was working on my tooltips script, when I realised unless I specified exactly how wide the tooltip was, the contents of the tooltip will not wrap within the tooltip div.
And if I did specify a width, then the tooltip would not resize to shorter content, ie. it would retain that specified width.
I tried a CSS rule using max-width, but that did not work consistently across browsers (or at all).
After much thought, I decided to use regular expressions (regexp) to wrap long lines. This was a last resort for me, because I find all the regexp rules to be quite cryptic, but I thought I might as well dive in and learn it better.
To cut a long story short, after much banging-of-head-against-wall I came up with this regexp:
/(.{1,79})(?:\s|$)/g
Short isn’t it? It was headache to work out though.
Here’s the breakdown:
I could have achieved the same result using split() and looping through the resultant array, but being the purist that I am, I opted to spend the next hour or two pulling my hair out to come up with a “loopless” regexp.
Of course this solution is much shorter and more elegant, albeit a bit more cryptic. It also relies purely on the regexp engine to do it’s pattern matching.
Following is some sample code for those of you who are curious to see it at work.
You can change any of the values in the text box, then press the “Demo” button to test it.
It’s been hard to leave comments lately because there was an error in one of the files that dealt with comments. Essentially, no one could leave comments due to this error. It’s been fixed.
I’ve also changed the CAPTCHA system to a plugin that I’ve just written. Hopefully, now the CAPTCHA code is a little easier to read for humans and just that little harder for OCR programs. Frankly, even I found the old CAPTCHA code a headache to read.
The Gravatar site has been down, so it was an opportunity to fix the broken image icon, and replace it with something a little more aesthetically pleasing to the eye. So, now instead of a broken image icon there is some whitespace. Maybe I’ll think of something better later.
This site now uses UTF-8 character encoding for it’s pages and feeds. You can find out about what UTF-8 is all about here.
I’ve also managed to set up a WAMP server at home, which makes development and testing so much easier. And on that note, I’m looking forward to releasing a plugin or two soon. Really.
An amusing piece of artwork I came across at deviantART by SubterfugeMalaises titled: PACMAN: Forbidden Love.
Computer games don’t affect kids, I mean if Pac Man affected us as kids, we’d all be running around in darkened rooms, munching pills and listening to repetitive music.
Fancy a game of Pac-Man?
It’s been a while, but finally I’m releasing KCA 1.7 into the wild. You might notice I’ve skipped a few versions, but that’s because quite a few versions were near release, before they were changed in some drastic way.
Anyway, it’s released and that’s what matters.
What is KCA? Well, KCA is partly responsible for the tooltips you see popping up everytime you mouse over a link on this page.
Head on over to the Plugins page to find out more about what KCA is and to download the plugin. Get it while it’s fresh!
I’d be happy to hear what you think of it.
Ever tried reading email on a mobile phone? The mobile phone is not built for reading long emails, so usually if you want to read email you’d have hop on the pc. Well, now there’s a solution from Motorola.
Emails for small screens
It’s pretty infuriating to receive a long email on a cellphone or PDA with a small screen. But Motorola has come up with an answer – software that automatically creates a synopsis of the long text.
The new summarising software first discards sentences that are less than 5 words or more than 50. Then it looks for sentences containing words that frequently crop up in the text, or which the owner has added to a preference list.
Finally it sifts sentences which contain telltale words and phrases like “all in all”, “so to sum up” and “for example”. The few remaining sentences that fit all the criteria are pulled from the long message, stitched together and shown on screen.
But one risk if the system doesn’t perform as people expect is that important messages could be deleted without being fully read. “By the way, you’re fired,” might slip through the net, for example.
I’d hate to miss out on any important bits the algorithm misses.