Can’t upload a Word document? You need to close it first.

If you are a savvy web developer, you almost certainly won’t allow users to upload any old file to your site in case it’s a virus or other malware. You’ll probably use MIME types to restrict which files people can upload.

The trouble is the for some reason, when you have a Word document open, it reports a different MIME type than when it is closed, which will scupper your upload routine.  Since the type reported makes it look like an executable file (and therefore potentially dangerous) your code probably won’t allow it, and rightly so.

The solution, therefore, is for your user to close the document before they try to upload it.

I’m not sure whether this is specific to Windows/IE (I wouldn’t be surprised) but if you have trouble uploading Word docs, this could provide to solution.  (When I have time I’ll test how other document types behave…)

Monday, May 10th, 2010 Uncategorised No Comments

It was late. I’d been up for 21 hours…

… and I was halfway through this article before I realised what they were up to. Do they have a special commissioning department for this stuff?

Thursday, April 1st, 2010 Uncategorised No Comments

Yes, you could get in trouble for that

I presume you’ve seen this:

And you may have read this.  But did you spot this?

Williams then alerted the emergency services on her mobile phone. “I wasn’t on hands-free, but I figured I wasn’t really driving the car,” she said.

Now I know why she didn’t come forward immediately; probably getting legal advice…

Tuesday, March 23rd, 2010 Uncategorised No Comments

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:


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 eBusiness, Technology, Web Development 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 1 Comment

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