An elegant regular expression for finding URLs

so you can turn them into hyperlinks automatically…

A while ago I needed to write some code which would automatically recognise a URL in plain text, and turn it into a hyperlink.  Being a lazy sort, I turned to Google, and found this article on DevX.  The regular expression it gave there was not perfect, but worked reasonably well:

\w*[\://]*\w+\.\w+\.\w+[/\w+]*[.\w+]*

At the time, I was sufficiently rushed off my feet that I forgave its flaws and implemented it.  Over time, however, it’s been bugging me, and as the service it’s implemented on gets more traffic, so the need to improve it has become greater.  And so it came to pass that this evening I bit the bullet and tried to write a better one.  After a couple of hours of testing various permutations, here it is (after the jump):

Continue reading »

Thursday, January 21st, 2010 Web Development No Comments

What on earth was Google thinking when it added the fade effect?

I am totally confused on this one: Google, so often a shining beacon of good interface design and elegant functionality, has for some unknown reason added an apparently unneccessary fade effect to its homepage.   It starts off sparse, then the rest of the content appears once you move your mouse in the window.

Check out my tasty simulation after the jump.

Continue reading »

Wednesday, December 9th, 2009 Uncategorised No Comments

How websites reward ambition

In a nutshell: Because they scale really nicely.

This was brought home to me recently when I was drawing up a proposal for a client who plans to set up a new business networking group, or more accurately, a network of networking groups.  Our M.O. involves a lot of upfront business analysis, so it was clear that the optimum solution involved much more than a simple website with some card payments for bookings.

Continue reading »

Wednesday, November 18th, 2009 Technology, Web Development, eBusiness No Comments

Never give up

This made my day.

Russel McPhee, a stroke victim paralysed for 20 years, has been able to walk again after injections of Botox. Apparently, Botox is comonly used to treat the muscle stiffness experienced after a stroke, but usually shortly after the episode, not two decades later.  The difficulty is that Botox relaxes the stiffness, but also the muscle tone, which makes controlling the newly relaxed muscles very difficult.

But here’s the bit that really grabbed me:

Crucially, Mr McPhee had repeatedly, over the years, attempted to get out of his wheelchair and stand on his own.

He was not successful, managing at most a few seconds on his feet before he collapsed.

“Often I would lie on the floor for hours, just hoping that someone might drop by so they could pick me up again,” he said.

Those repeated, heart-breaking attempts to stand built up a core muscle strength on which his doctors and physiotherapists were able to work.

This is a guy who simply refused to give up.  Even though bitter experience, built up over 20 years, must have told him that attempting to stand unaided would lead to failure, that walking was impossible, he never stopped trying. This immense willpower, sheer bloody-mindedness really, meant that when modern medicine came up with the tools to unlock his body, he had the core strength to make the most of it, and finally walk again.

Thursday, June 4th, 2009 Uncategorised 2 Comments

What makes you happy?

This article, and the underlying study, is so good that I almost don’t dare talk too much about it here.  You really should just read it

In a nutshell: for the past 72 years, a sample of 268 men have been followed and their entire history - medical, familial, physical, emotional, mental - recorded in great depth.  The study is coming to end, mainly because only half of the original group are still alive, and they are in their late eighties.  It has a huge amount to teach us about how our lives shape our personalities, and vice versa.

Continue reading »

Sunday, May 17th, 2009 Uncategorised No Comments

Mixed Day for April Fools

The Guardian absolutely nails it with news that they are soon to be the first newspaper to publish exclusively via Twitter, a story that balances absurdity with just enough plausibility to cause a double-take.  Their famous stories rewritten as twitter posts (tweets) are very well done, and they even manage to squeeze in a proper snark:

At a time of unprecedented challenge for all print media, many publications have rushed to embrace social networking technologies. Most now offer Twitter feeds of major breaking news headlines, while the Daily Mail recently pioneered an iPhone application providing users with a one-click facility for reporting suspicious behaviour by migrants or gays.

Sadly, it’s all downhill from there; The Telegraph have a story about migrating salmon being used to generate electrivity, while The Times can only manage this tame effort.  They are joking, right?

UPDATE: The Guardian’s efforts just keep getting better and better

Wednesday, April 1st, 2009 Uncategorised No Comments

If you’re going to rehash an old argument, at least pick good examples

Hadley Freeman, writing in the Guardian today, tries out a variation on the classic “Isn’t Hollywood misogynistic for pairing older men with younger women?” routine, although she steers clear of the ‘mismatched love interest’ angle – at least for the first two-thirds of the piece. 

This time, she targets onscreen mothers who are in reality only a few years older than the actors playing their sons.  The classic example is Alexander; Angelina Jolie, playing the mother, is just one year older than Colin Farrell, her ’son’, but others include The Graduate (OK, not his mother exactly) and North by Northwest (strangely overlooked in the article).

However, sadly Hadley sticks a pin in her argument when she cites Back to the Future (Lea Thompson/Michael J Fox) and Forrest Gump (Sally Field/Tom Hanks); two terrible examples.  In both films, the actresses are required to play younger women for a period, during which time their sons (if they have any) are played by children.

Continue reading »

Wednesday, March 25th, 2009 Film Club 2 Comments

How much does a website cost?

Ed posts a typically thoughtful and balanced meditation on this key question. Turns out our prices are reasonable, by Ed’s reckoning, which is always good to know.

Friday, March 20th, 2009 Uncategorised No Comments

Growing in a recession

I know there’s a recession on, and we’re all supposed to be hiding under blankets waiting for it all to be over, but the problem I’ve been facing for the past 6 months is that Prominent Media has been busier than ever. I have a couple of ideas as to why that might be, based on conversations I’ve had with new and existing customers over that period. 

Continue reading »

Monday, February 23rd, 2009 eBusiness No Comments

How to print one A4 page as two A5 pages in Microsoft Word

It’s a common problem: you have written your article, poster, flyer or handout on an A4 page in MS Word, and you suddenly think to yourself, “I could do with printing two of these per page at A5 size”.

Initial A4 Page

Figure 1: Initial A4 Page

Continue reading »

Tuesday, February 10th, 2009 Uncategorised 32 Comments