Solving Quadratics

I was kinda bored today and as I didn’t want to do my maths homework. My friend, who was on-task was trying to use MSN Search to solve a quadratic and complained it didn’t provide both solutions so I decided to write a little script to solve quadratic equations. Now this isn’t hard at all; it simply involves taking 4 inputs and using the quadratic formula:

Quadratic Formula 

So I wrote my little calculator using Javascript and turned up the font size to make it a little bit more "Web 2.0". I also added a little check which works out the discriminant value of the quadratic equation to determine whether it can actually be solved before solving. In all it took about 10 minutes; the main difficulty was working out the Javascript function to do powers.

Taking Plain Text 

Then I thought back to yesterday where I read a series of articles on Sitepoint about regular expressions which explained it all pretty well. I thought I’d put some of it into practice and create an improved version which allows the user to type in an equation and have the script automatically work out all the terms.

What it does is to take the inputted equation and split it in half on the = character. This gives two terms – one which is assumed to be a constant and one which is assumed to be the actual quadratic meat. This side is then split into it’s individual terms using the characters + and -. A regexp is then run on each term to determine it’s power, and it adds it all up. It took a while to get it to all work and it seems to work pretty well.

Here’s the improved version which takes a plain text input and works out the quadratic equation. It works well in Firefox and Opera. It’s about 70 lines in all and although I could have probably done it in quite a bit less, it works well.

Messenger Script

Now, I was getting really carried away so I decided to write a script which would allow my contacts on MSN Messenger to send me a quadratic equation and my computer would work it out and respond. In fact, the amount of times people ask me to help them solve quadratics is shocking so this could have saved a load of time.

This is mainly a copy and paste of the Javascript from the browser based calculator with a few modifications and hooks to make it work with Windows Live Messenger and Messenger Plus Live.

Get the script here

All in all, nothing particularly revolutionary or exciting, but an afternoon spent where I practised my Javascript, regular expressions and maths all in one. 

Creating Passionate Users – Blog of the Week

Creating Passionate Users is a really interesting blog which is aimed at software developers and speaks about how the brain works and how to create passionate users. It is a text-heavy blog and the entries do read more like essays but I find it really interesting and there are bits of humour.

As examples of articles I enjoyed see Why users don’t upgrade and Ease of use goes wrong.

The about page lists a lot of clever people who write articles for this blog. It seems like these guys have also written a series of books on Java. 

Every developer should read this blog.

Merry Christmas

It’s the 29th of September and there are still 86 days until Christmas but it seems like Christmas is already beginning. Christmas seems to be getting earlier every year.

Over the last few days I’ve heard an Argos advert on the radio which seems to have Christmas background music. Although it doesn’t actually mention Christmas; it does remind me of Christmas and I presume the idea of the advert is to subconciously remind people that Christmas is coming up and that we should begin to think about Christmas gifts.

A few days ago, I read an article somewhere about a town which has already put up their Xmas decorations already. Perhaps the world is just conspiring against me. Even Bill Gates is in on the act; Windows Media Player’s shuffle feature decided to play me 3 Christmas songs including a very strange R&B Christmas Remix.

Just earlier in IRC, there were a few guys discussing the last posting dates for mail to be sent if it’s to arrive by Christmas. And whilst tidying up a bit earlier, I came across a cool little Grinch freebie from McDonalds. It says Merry Christmas when you press it or something.

This all reminds me a little of when I went to Canada earlier this year on holiday. It’s a beautiful country but imagine my surprise seeing a well-stocked Christmas gift and decoration shop in August. It was a hot day; the sun was out and it was the middle of a heatwave. I decided to check out this Christmas shop armed with my short sleeve t-shirt and shorts. The shop had the air-conditioning on overkill; it was probably the coldest shop you could find in a mile radius. But it was a lovely shop with a huge range of Christmas decorations – trees, tinsel, other stuff for the tree and a whole load of different christmas ornaments from around the world. It really was quite strange being surrounded with all the Christmas music and decorations in the middle of August.

But maybe that’s not so odd – it’s September and already the retailers are beginning to get into Christmas mode. It’s feeling more like Christmas everyday. Perhaps it’s because the hot summer months are over, the weather is changing, and everybody is calling in sick with the cold and flu. And we need something to look forward to. 

Ease of use goes wrong

An interesting post over at Creating Passionate Users about when ease-of-use goes wrong. I really like the infographic at the top of the article and it gets across the point really well – sometimes people are looking for a dog but instead end up with a toy dog – more user-friendly and does it’s job well, but not what we wanted.

The article describes how user interface designers do need to think about end of use and usability but at the same time shouldn’t cripple their software or dumb it down. A program could be really powerful but too hard to use such that no one can find what they want to do. On the other end of the spectrum, it could be dead easy to use but also feature-less; once again the user can’t find what they’re looking for.

The whole "ease of use" thing has spread through the open source community recently after the huge success of Firefox. Firefox, for me, hits the nail on the head – it’s both powerful and easy to use. It doesn’t contain the esoteric features that only a few geeks are going to ever use. It contains enough features such that one can use Firefox without extensions and get their job done.

I’ll admit to jumping on the whole bandwagon – I’ve been a big fan of making open source software as easy to use as possible. I’ve made several posts critiquing the user interface of phpBB 3 and how it is overly-complicated and esoteric:

You’ve then got Vanilla which is on the other side of the bulletin board spectrum – it’s so simple and uncluttered. And the chances are that it’s got enough features for many people to run a forum happily. But at the same time they make the mistake of asking people to install extensions during the installation process. This shouldn’t be necessary.

In the world of Linux, I’ve always considered KDE applications to be too complex and many GNOME applications to be too simple. 

Creating Passionate Users suggests a few ways of how we can make sure the user interface is targeted at the right audience:

  • Different product editions each aimed at different groups (power users, beginners, etc.) e.g. Apple Garageband/Logic Express
  • Extensions e.g. Mozilla Firefox and soon
  • Advanced modes

It’s a really interesting read and very well explained. The following quote summed it up well for me:

There’s at least two different forms of easy: easy-as-in-natural-usability and easy-as-in-dumbed-down.

Dr Who & Stargate

A load of rumours floating around the science fiction world recently…

Doctor Who Movie

Digital Spy reports that producers plan to produce a Doctor Who movie with Billie Piper (Rose) who left the show at the end of last season:

The decision was prompted by the realisation that the show’s budget was constraining it in terms of sets and effects, according to the Daily Star.

A source told the paper that the proposed movie would also see assistant Rose Tyler, played by Piper, reunited with David Tennant.

It was reported only earlier this month that David Tennant was to leave Doctor Who for Hollywood so he could get onto the big screen. This movie is perhaps a way for the BBC to try and retain Tennant.

It isn’t clear to me whether they mean a TV movie or a theatrical production but I’m assuming the latter. I’m unsure whether there are restrictions on movies made by the BBC but I know that the BBC isn’t allowed to publish a book based on a television show and consider it canon because people should be able to follow the story with nothing more than the license fee. It’s possible the same could apply to a movie or maybe they can get around it by showing it on television.


After the cancellation of Stargate SG-1, there have been various campaigns on the internet to get the show back. It has now been reported that SG-1 will come back as a series of television movies. I’m really not sure whether this is a good thing; movies cost more and longer to make and you only get two hours or so of content, compared to a whole TV series which is some 14 hours.

Perhaps it’s time SG-1 came to a close; it doesn’t seem to have the same magic, fun or challenge about it. Or MacGyver.

Spoilers: Atlantis fans may be quite shocked to hear of a character death which is thought to happen in the second half of season 3. There is quite a lot of evidence for it and in some ways I think it is the right thing to do; but theres gonna be a lot of fan outcry.  

Online Office Suites

I really don’t understand this whole commotion about online office suites. There’s Google and the overhyped Writely/Spreadsheet and of course rumours of Microsoft creating an online version of their "Works" suite.

Let’s be honest – how much use is a browser based office suite? Is there any real benefit of having a browser-based office suite, or is this just another example of people doing things because they can?

You’ve got all the issues associated with an online browser-based office suite:

  • Slow, bad performance.
  • Stability – Browsers have to do all kinds of things such as run Java applets, cope with popups, etc. If one crashes, you could potentially lose all of your work.
  • Hard to develop for – different issues on different platforms.
  • Privacy issues – do we really want a copy of the document residing on Google or Microsoft’s server?
  • A web based office suite will never match a real one for ease of use (web based ones have to work with limitations ofthe browser) or features.
  • Network issues – there are many people with slow internet connections, network bottlenecks, etc. It’s bad enough when the internet goes down as it is; but I can still access and work on all of my documents and files from the hard disk.

The benefits of online office suites seem to be in short supply:

  • You can collaborate with other people.
    Well, you can but there is no reason why a traditional office suite couldn’t do this. It could do it even better.
  • Your documents are accessible from anywhere.
    A USB drive is actually a ton easier (faster; doesn’t require fast connection; doesn’t require network) and almost every computer has Microsoft Word or at least Open Office these days.

I’m sure that there will be some more but I really can’t think of any off the top of my head.

Besides, who wants to see adverts whilst their editing their spreadsheet document? Is it really hard to install a free copy of Open Office on a computer which provides a world-class office suite? What does one gain from instead using a web browser to edit their documents?

Messenger Screenshot Sender

As somebody who develops websites from time to time, I often want to show my friends screenshots of my work in progress; maybe sometimes sending 3 or 4 screenshots of similar designs with small differences to find out which is the best.

It’s not just webpages; screenshots are also a fantastic way of getting help with a computer problem and working out what to do next.

Historically, I’ve always used Messenger to send screenshots – it’s fast and efficient. You get an instant response and you don’t have to bother with the hassle of things like forums, blogs, Imageshack, etc.

Screenshot Sender 

The single Messenger plugin which has saved me so much time in this respect is Screenshot Sender (you’ll need Messenger Plus Live!). It allows you to easily take a screenshot of the whole screen or just the active window and send it to a contact without the hassle of having to whip out the image editor, save it and then manually send it.

To use Screenshot Sender, type "/ssactive 5" or "/ssfullscreen 5" in the message box. You’ve got 5 seconds to switch to the window you want to take a screenshot of (generally you’d want to minimize Messenger in this time). You’ll get shown the screenshot before it gets sent, so you’ll get a chance to cancel the transfer if it goes wrong.

I strongly recommend changing the screenshot format from PNG to JPEG. JPEG is a much better format for screenshots and sends a lot faster. You can do this by clicking on the Plus! icon and going to "Screenshot Sender 4 > Preferences". 

Surely You're Joking, Mr Feynman!


I’m currently reading "Surely You’re Joking, Mr. Feynman!" written by the physicist Richard Feynman. Feynman was involved in the development of the nuclear bomb at Los Alamos and also did a load of other physics work which led him to earn the Nobel Prize in Physics in 1965.

This book is really interesting and is a collection of anecdotes and personal experiences. It does read a little bit like an autobiography; it certainly isn’t technical or scientific, or for that matter, boring. 

According to Wikipedia:

It expounds upon his human side with a number of personal and mostly humorous anecdotes, detailing everything from his forays into hypnotism to his fascination with safe-cracking and his fondness for topless bars, as well as more serious topics such as the development of the atomic bomb and the death from tuberculosis of Feynman’s first wife, Arline Greenbaum. 

Notable stories in the book which come to mind include pranks he played on waitresses, how he managed to break into safes at Los Alamos and how he managed to fail a US Army test for psychiatric reasons.

Reading the book helps you appreciate how much of a genius the guy was. You pick up a bit of Feynman’s philosophy on understanding and persisting with solving problems. 

Recommended read!

Internet Nexus – Blog of the Week

Internet Nexus is the blog of Paul Thurrott of WinSuperSite fame. He just posts about generally interesting articles around the internet and sometimes reviews and posts pictures of non-Microsoft products. It seems like half the blog posts are about Apple, surprising for a Microsoft fanboy.

The blog is updated daily and has only recently had it’s 5th birthday. Thurrott wrote, "it [Internet Nexus] focuses on my interest in non-Microsoft technologies for the most part".

Web 2.0 Animated Loading Icons

I’m not Mr. Techcrunch and I don’t spend my time checking out every cool new Web 2.0 site. But I’ve been on my fair share of them to know what this icon means:


To me, that icon means the browser is busy doing something.

Today, I decided I’d give Google Analytics a go. I added the HTML to my site, returned to the Analytics page and clicked on the link to check the status of the site.

Then I sat there stone-faced for several minutes waiting for something to happen. Tick. Tock. Tick. Tock. 

Google Analytics

Why? This icon is used by everyone else to show that some AJAXy goodness is being done behind the scenes. The message is also not clear and makes it sound like data is being generated on the server and being delivered to the browser.

The loading indicator is the wrong icon for the job and the message only supports the expectation that something AJAXy is supposed to happen.

I think this is a great example of confusing non-standard use of icons and misleading the user into thinking something is going to happen.