Tuesday, July 31, 2007

Ooh, clever!

Wendy's, an American fast food chain, doesn't want to list nutritional information on its menus in New York, in compliance with a new law. So, because the law says that only chains which already provide nutritional information through other means have to comply, Wendy's has put a warning on their site saying that the nutritional information isn't for New York customers.

Are there no depths to which those companies dependent on ignorant fat people will not stoop?

They're also making legal threats at the Center for Science in the Public Interest, presumably just on general principles. (Actually, said group had the cheek to demonstrate that it was possible to incorporate the requisite information into their menus.)

Monday, July 30, 2007

Wordpress DB Query Review - Why, exactly, is it so bloody slow?

Wordpress is a very popular PHP-based blogging platform, which uses a MySQL database. It has a certain reputation for slowness, but still sees a lot of use.

Last year, someone looked into what queries Wordpress (1.5) uses in preparing pages; article here. I thought it would be interesting to see how things have changed, so I got the latest version of Wordpress (2.2) and installed it on my desktop, with MySQL set to log all queries.

Now, before I start I should mention that for a couple of years I used Wordpress for this blog. I was never enormously irritated with it, but I did start having considerable speed problems as the blog grew. I was able to deal with some of these by adding appropriate indexes to database tables; however, in the end, it became more trouble than it was worth. I switched to Google Blogger, and have had no trouble since.

Now, on with the query review. Please note that I am by no means a database expert, and that I may have made mistakes.

On displaying a page, Wordpress first finds the site URL in the options table. It then loads all records from the options table which have 'autoload' set to yes; note that the site URL row is one of these. Next, it loads 'widget_text' and 'widget_rss'; neither of these exist on my installation.

It gets the user's details; this is an improvement on 1.5, where, as noted in the above article, it loaded details for all users. This was particularly concerning as some larger blogs allow their commenters to log in as low privilege users to comment; the amount of data retrieved could, then, be considerable.

Oddly, there is no index on the 'user_login' column; this both allows, potentially, for duplicate users (although I'm sure that this is guarded against in the application itself) and means that if you really have a lot of users, it may have to do a fairly large table scan. This won't be a problem for most Wordpress blogs, though. It then gets data for that user from 'wp_usermeta'; this could have been done as a join, but is, at least, done on an indexed column.

Interestingly, it initially looked for a rewrite option in the options table at this point. When I enabled URL rewriting, however, this query vanished, presumably because it got it in its first read of the options table. This seems odd; if it didn't get it the first time 'round, why try again?

The next query finds the last ten posts, and downloads all data on them in the 'wp_posts' table. Fine, although there are no indexes on any of the constraints it uses (even the date!) so this really isn't ideal for a big blog. The one after that, though, is an oddity. It looks up a mapping between posts and categories. This is the sort of thing that I would really expect to have been done with a join; I can't imagine that avoiding a join saves them any runtime, and it's an extra query. The query after that gets all category data, and the query after that all metadata for the posts. All of these except for the category lookup could have been done in one query.

The next three queries retrieve settings for the (default) template. I really don't feel that this is the sort of thing that should be done in the database, but see comments below on configuration data.

Next, pages are retrieved; Wordpress has a separate, non-blog-post type of page. Oddly, all of these are retrieved, with full text, even though they're never going to be displayed on this page.

The next step is to find what months there are posts for, and how many. Again, un-indexed fields are used as constraints, and counts are done. I'd be inclined to store this data in a separate table and only update it when new posts are posted.

Next, categories are found (again, but in a specific order this time) and posts associated with each discovered; again, insufficient indexes. Following that, categories are retrieved again. That's the third time, mind you. It would seem to make more sense to just get them once and perform the ordering in the (PHP) client, but whoever wrote Wordpress doesn't seem to think like that.

Links for the sidebar are retrieved, with a constraint based on the time of day used to find recently added ones. This will, I'm fairly sure, prevent the results of the query being cached, and could be determined in the client code anyway. Oddly, a join is used here.

Mercifully, that is it. The index page is loaded and all is well in the world. "But wait!" you say. What about comments? What, indeed?

Well, to see comments, we'll have to click on a post. Pop! Queries fly high into the air!

First, we have more options and user stuff. Fine. Next, we get the appropriate post. All seems more or less sane so far. Again, less than ideal separate queries, but it was hardly likely that that'd be different here, links notwithstanding.

A little more weirdness; the previous and next post are found (a query each) and then retrieved in full (another query each). I can't fathom the thinking behind this.

Finally, we get to comments. Mercifully, except for the order by date clause, indexes are used here. Big blogs can have a lot of comments, and it would be mad not to have indexes on them.

Similar madness is involved in retrieving posts for RSS feed; a potential concern because popular sites can be hit by thousands of RSS feeds a day.

Interestingly, throughout, there are occasionally '1=1' clauses in the queries. This isn't really a problem in itself, but indicates something weird going on, possibly. I can't face reading the code to find out; I do so dislike PHP!

So, what is my conclusion? Clearly, things have gotten better since the above article was written, but they don't seem to be all the way there yet. There seems to be a general reluctance to use indexes, and complete willingness you use very large numbers of queries. While using large numbers of queries mightn't sound like a big problem, each does take time to parse, and if you're on a shared server you're likely to be contending with other people to submit queries; best get the job done in as few as possible. Some shared hosts actually limit customers to a certain number of queries per day. The multiple options queries, in particular (about eight or ten per page) are odd; they could easily be done in a single query per page.

Putting options in the database is itself a strange move; I suppose the reasoning behind it is to expose the user to as little messing with file permissions as possible, but it is certainly non-ideal from a performance point of view.

At this point you may wonder why I don't fix the problems I see. That is, after all, the dreary cry that people who criticise open-source software in any little detail are honoured with; "go and fix it yourself then". Well, first off, as I say, I am no database expert. I am also no PHP expert, and would prefer to keep it that way, if you don't mind too much.

But besides that, and here, I feel, may lie a large part of the roots of the problem, the Wordpress community (not, I would like to stress, the developers, rather the people who use it) seem to be, largely, extremely offended by criticism. If you look at the Wordpress forums, you will see that people are very much inclined to blame any speed problems encountered on hosts, configuration, or, in a few cases, the sheer alleged awfulness of MySQL!

I just can't understand how, with such a popular but clearly deficient product, these problems haven't been fixed.

If you are one of these people who is very attached to Wordpress, please refrain from hunting me down and killing me. Thanks.

Twitter and Greenpeace

Twitter, noted Web 2.0 thingy (my Twitter account is here; I don't really use it though), mentioned on its blog today that a Greenpeace person would be using it to report on undersea exploration. I can't help feeling a bit amused; Twitter has recently, if I recall correctly, been attempting to solve its speed problems by throwing lots of extra servers (energy-hungry servers, I'll wager) at the problem.

Mind you, Greenpeace also has a foothold in Second Life, the silly virtual reality environment, where each user apparently uses as much energy as the average Brazilian.

If they were to stick to their principles fully, of course, Greenpeace would probably have to address the Internet through machines powered by hippies (vegan ones, naturally) on treadmills.

The Joys of Wordpress

Ben Goldacre's Bad Science blog can be a fascinating read. It has but one problem.

Every time there are more people drawn to it than usual, it goes down in a blaze of MySQL errors. This is because it's using Wordpress, a blogging engine which insists on assembling each article from data in a database each time it's requested. While this is okay for a small blog, and there are a few, heavily optimised, large-scale examples, it really isn't ideal. I used to use Wordpress at one time, and if, for any reason, a large number of people visited my blog at about the same time, the whole thing slowed significantly.

I really don't understand the popularity of Wordpress, though. Whenever you happen across a blog which has gone down due to excessive load, it's almost always Wordpress. This is, I suspect, because Wordpress is about the only mainstream solution to opt for generation on every request, with no caching. Most others work by generating static files, or, in the case of Blogger, working through Google magic. While a site serving static files will slow down under great load, it is far less likely to stop.

(Update: investigation of MySQL query oddities here.)

LOLCODE in Lolcats

A Lolcat, as anyone who has ever used the internet should know, is a picture of a cat with a (generally funny) caption.

Lolcode is a spoof programming language written in the style in which Lolcat captions are often written.

And now, from the author of such wonderfully useful software as the Woodhousian Aunt Generator comes the Lolcode Annotator. Simply give it a piece of Lolcode, and it will produce a n appropriate Lolcat. Currently, there aren't very many cat images, but it will try to match those that it does have to appropriate lines of code.

As with most of my recent silly web things, it's written in Common Lisp, using the Hunchentoot webserver.

If you have any comments or suggestions please do leave them here!

Sunday, July 29, 2007

Things I didn't know about my Mac

One thing that's always vaguely annoyed me about my Mac is that it was not (I thought) possible to turn off the (Mac-supplied) monitor without turning off the machine as well; when you press the off button on the monitor, the computer tries to switch off.

Turns out that there's a setting in the System Preferences Display console, of all places, to switch this behaviour to actually switching off the monitor. Boy do I feel silly now.

No, thank you very much

As I was going to be going out on Friday night, and it was raining extremely heavily, I decided to get lunch from the chipper that resides just below our office. Quite nice, really.

There was just one item on the menu that worried me a bit.

Donor kebab. Yes, spelled like that. Argh. Now we know what happens when no-one needs a transplant...

Saturday, July 28, 2007

Americans, don't vote for Hillary Clinton

Clinton has said that her administration will not go ahead with Yucca Mountain, the US's planned long-term nuclear waste storage facility. If Yucca Mountain isn't built, the future of nuclear power generation in the US will be in jeopardy, and you'll be seeing coal power plants popping up all over the place.

She's also, of course, unwilling to rule out torture. I'd like you, at this point, to try to drive the image of Hillary and Bill engaged in sadomasochistic activities from your mind. Did that work? Thought not.

Friday, July 27, 2007

Warcraft Gone

Recognising that World of Warcraft could actually very well be pretty addictive, I deleted it.

Never again.

Consumer Hell

I popped into Maplins (an electronics shop) today to buy a new mouse and a USB -> serial converter. The new mouse was needed because me old one went to the place where good mice go, and the USB serial thing is because modern computers tend to lack serial ports.

I had no trouble finding what I wanted. I got a Microsoft mouse, and a random USB -> serial thing.

Then, I tried to pay for them. I got asked did I want to buy a USB hub, a screwdriver, a half-price catalogue (Maplin charge for their catalogues) and asked did I want to be posted coupons. It took about ten minutes to get through the gauntlet of questions and actually pay for the damn thing.

I don't really understand how this sales strategy is meant to work. I never had any intention of buying a screwdriver, and I'd avoid them in future, going for somewhere where I was less likely to be harassed to buy USB hubs.

Thursday, July 26, 2007

World of Warcraft Again

So, this morning, the download finished. Installation took half an hour. And then, when I started the game, it let me logged in, then started downloading a 400mb update. At this rate the trial will have run out before I get to use it...

World of Warcraft

With all the fuss about World of Warcraft, I decided to download the free trial and give it a go. Two hours later I am still downloading. Not the greatest of first impressions. Does it really need to be three and a half gigabytes?

Wednesday, July 25, 2007

http://news.bbc.co.uk/1/shared/spl/hi/pop_ups/04/a...

http://news.bbc.co.uk/1/shared/spl/hi/pop_ups/04/asia_pac_tokyo_views_on_masako_and_marriage/html/5.stm

http://news.bbc.co.uk/2/hi/asia-pacific/3699516.st...

http://news.bbc.co.uk/2/hi/asia-pacific/3699516.stm

Fun with Adium Extras

I found something wonderful. Adium is a popular (or the popular) instant messaging client for MacOS. Various people have produced addon icons and sound files and so on for it, and they are available on the AdiumExtras site.

Now, one or two of the items in each category are generally beautifully done. They're not the interesting ones. You'd be far better advised to take a look at the many, many shockingly ugly ones, and read the comments, and the attempts at defending the horrible icons (or whatever) by their designers. Great fun.

Who'd have a celebrity as a parent?

Noted large-breasted person Jordan recently gave birth to a child. Now, last time such a happy event occurred, she decided to call it 'Junior'. Yes, that's the child's actual name. Stupid, sure, but tame by celebrity standards. This time 'round, the gloves were off. This child is called 'Princess Tiáamii'. It gets worse. The reason that she didn't call it 'Tinkerbell' is not that 'Tinkerbell' is a bloody stupid name for a child, but that too many celebrities have called their dog that. You have to wonder does this woman read the papers and cringe when she sees what nonsense she's been spouting.

The whole stupid name thing has become almost standard in the last few years for children of celebrities. Have the parents even vaguely considered, though, how the children will get through life with such egregiously stupid names? Form of child abuse, if you ask me. Their children will suffer in the future so that the parents can get into the paper for a few days with their oh-so-clever names.

And you know the worst of it? Jordan won "Celebrity mum of the year" a while ago. I hate to think what less optimal celebrity mums are like...

Tuesday, July 24, 2007

Blogger FeedBurner Integration

Feedburner, the handy RSS stats and processing system, was recently acquired by Google. One of the first things they've done is to add a feature to Blogger to allow you to change Blogger's feed autodiscovery tags to point to your Feedburner feed. Previously, you had to do this manually by editing your template. Just go to 'Settings' -> 'Site Feed', and fill in your Feedburner URL in ' Post Feed Redirect URL'. It also redirects its default feeds to Feedburner. This is handy because it allows you to easily consolidate all your subscribers on Feedburner, and thus you get correct statistics for them.

I'm quite pleased that they've done this, as it prevents a lot of template messing. No doubt the next step will be full integration.

Apparently, my site's very popular in Lesotho

I was just checking the Alexa ranking for FindMeATune.com, and look what I saw! I'd imagine it's some sort of freak event; I doubt there are really that many internet users in Lesotho. Fun, though...

Obvious Nutritional Information

My carton of apple juice has little bullet-points enumerating its features. Most are of the 'no added sugar' variety, but two are interesting; apparently this apple juice is fat free, and is suitable for vegetarians.

And there was me thinking that it had a little lard mixed in for flavour.

Also, it apparently becomes lethal on the 24th of the 1st, 2008, at 20:12. This seems oddly precise.

One laptop per consumer?


The OLPC (One Laptop Per Child) thing is launching about now, at about $150, for orders by governments and such. There's talk of selling them for a profit to Western consumers and using the profit to fund more laptops in the developing world. I'd be tempted to buy one if this happens; in many ways they beat conventional laptops. They're lighter, smaller, more durable, they have an e-book reading mode, and have far greater battery life. You could use one on a train. And it's all in a good cause! (I hate that phrase; it reminds me of horrible Katy Grin from Absolutely Fabulous.)

Laser Trucks!

The American military is apparently looking into rolling out trucks with lasers mounted on them, to be used to blow up incoming shells. All sounds terribly impressive, but don't military technicians have a reputation for utter incompetence? Soldiers with large holes burned in them would be particularly bad press, right now...

Ad-tastrophe


In a place clearly intended for (and generally occupied by) a 'skyscraper' (narrow and tall) adblock, a banner adblock has appeared instead, skewed to the site. Oops. No doubt The Register will lose a few pounds on that...

I've seen this sort of thing on small sites before, but never on a big one (particularly not on one big enough to get customised AdSense, like The Register does).

Monday, July 23, 2007

Web development jobs don't pay what they used to

Interesting wanted ad seen on a technology website:


I initially thought that this was an error of some sort in the ad display, but clicking through, the salary offered is the same.

The ad copy, by the way, was written by one of those people who enjoy using capital letters inappropriately; "They have a current requirement for an experienced .NET Developer to join their Growing team."

I'm sure that they'll be simply flooded with applicants.

NASA's naming leaves a bit to be desired

There is currently a bit of a fuss about a weather satellite which is nearing the end of its life, with no replacement planned. It will effect ability to predict hurricanes near the US, and monitor climate change.

The name of the satellite? QuickScat. Now, honestly, does that bring to mind a weather satellite or a particularly awful fetish pornography site?

Sunday, July 22, 2007

The best thing since sliced bread

The first loaf-at-a-time bread slicing machine was built in 1917, destroyed in a fire (no doubt prompting conspiracy theorists to suspect a plot by Big Knife), and went into commercial operation in 1928.

The wikipedia entry on sliced bread say the following: "America's entry into World War II prompted a ban on sliced bread starting in January 1943." Anyone caught slicing bread in the kitchen would be electrocuted for sedition! Or possibly, of course, they just mean pre-sliced bread. This is the sort of thing countries do during major wars, you see; restrict and ban random things for no readily explicable reason. As noted in Wikipedia's comment page, it's not clear that the ban was ever actually listed; possibly some of those people in Guantanamo Bay are there for buying sliced bread.

You do find fascinating things on Wikipedia. I don't, of course, but I'm sure you do.

Garfield for Fundamentalists

Jack Chick is a cartoonist with a difference; he draws bizarre little cartoons about issues that he thinks are of religious importance. They're not funny, or anything; they're just conveying a (generally wrong) moral message.

He seems to have discovered Harry Potter:
Note the emphasis on 'millions'; ordinary italic emphasis, like this, was not good enough for this extraordinarily important issue related to a children's book, special bold italic, like this was required if we were not all to lose our souls to Satan (Lord Voldemort in some areas; void where prohibited).

The worst of it is that somewhere out there there is someone who, rather than seeing these sorts of cartoons as a source of inane silly fun, actually takes them seriously, and believes the highly important not-at-all-psychotic messages contained within. Hopefully, this person is too stupid to comment on blogs.

I don't think I want to know...

This is a little web game where you have to think of the name of either a dictator or a sitcom character, and it will ask you yes/no questions in an attempt to figure out who you meant.

That, in itself, would be fine.

However.

I thought I'd have a go, so I picked 'Stalin', and answered about five questions correctly. At which point I was presented with this:
Needless to say, I collapsed in laughter.

Friday, July 20, 2007

Comments and Dave Winer

Here's the newest post on Joel on Software, a popular technology blog. I will confess that I am linking to it largely because of the wonderful line:

Even if you never read a single thing Dave Winer wrote in his 439 years of blogging,

A little cruel, perhaps, but funny.

As for the topic itself, I personally quite like recieving comments, though, of course, I could see that it would be a problem for people with very popular blogs. I can't really imagine a situation, though, where I felt that my freedom of expression was threatened by negative comments; if people wish to disagree with me, then that it their business, but I wouldn't generally feel that I'd moderate what I was writing to avoid offending people. My piece on the hysteria over Madeleine McCann, which I still feel to have been largely unjustified, for instance, drew mostly negative comment, but it wouldn't put me off writing about similarly controversial topics in the future.

I do, however, agree to an extent on the issue of anonymous commenters; I don't see any reason that people shouldn't say who they are when leaving a comment, and people who don't often seem to contribute the least in their comments.

In any case, I do get a number of comments from completely mad people, and those tend to be great fun.

Welcome Datacomp!

A number of years ago, a company produced a third-party keyboard for the Apple Mac. Not in itself a particularly unusual or interesting occurance, I suppose. However, this was a keyboard with a quirk. Every now and again, completely without provocation, it would 'type', or send to the computer, the words "welcome datacomp". This was, presumably, a debugging value of some sort which mistakenly got into production.

The fun bit is that you can occasionally spot the phrase inserted randomly into older websites and newsgroup postings.



Sadly, the keyboard never became very common, and there are no modern examples.

moon-tastic

http://news.bbc.co.uk/2/hi/science/nature/6908190.stm

qqw

http://news.bbc.co.uk/2/hi/africa/6904640.stm

The Alexander Abian of Telecoms?

Go here, and search for 'JPA'. It's someone who claims that he's patented a method of very cheaply providing broadband Internet, commenting on the fact on a news site. Hmm....

Thursday, July 19, 2007

I'm a Complainer. I complain about things

(Title is from Saturday Night Fry, in which Stephen Fry interviews a woman about something, and asks her what she does; "What do you do? What? What is your job? Oh, I'm a complainer. I write letters to the BBC to complain about things. I shall probably be complaining about this show if I hear it; even if I don't!")

A couple of months ago, I wrote a short article about the Madeleine McCann hysteria that was, at the time, filling the British and Irish media.

The Joys of Vista


This happens to my Windows Vista machine at work about once a day. 'Nuff said, really.

I'm going to write a bit more about Vista soon. It's not actually as bad as I had expected it to be, but it clearly was not really ready for release at the end of last year. It's still only barely beta-quality.

A Dilemma for Dell

Dell has for some time been notorious for providing trial versions of many, many pieces of useless trial software ('crapware') on their computers. These range from ISP installation things, to games, to CD writer tools, to crippled antivirus software. My experiences with a Dell machine which came with a crippled McAfee virus thing, whose un-install program managed to more or less kill Windows, are here.

Anyway, the company has been under fire on this issue for some years now, and has finally started moving towards dealing with it. Most of the crapware (though not the dodgy antivirus or the browser toolbars) is now optional on their higher-end offerings. And this month, they came out with a new line of laptops and desktops for the small business, called 'Vostro'.

Vostro's major claim to fame, as you may have gathered, is that it is crapware free. However, Dell can hardly say this in their advertising material; it wouldn't look good on the rest of their consumer and small business lines. It would also more or less admit guilt in the whole heaping-disruptive-crap-on-innocent-customers-for-money thing. I mention this because I saw an ad for Vostro today. It simply read "We've done what you asked for" or similar, entirely without clarifying what that might be, exactly.

As you can see, their website is slightly more willing to admit that customers hate 'trialware'; possibly the equivalent screen in their consumer machines section claims that customers love it.

The question in my mind, though, is how Dell will make up the money they'll lose on this, and where the crapware vendors will peddle their wares now that such a huge market has been closed off to them. Perhaps the new low-end consumer Dells (where crapware is still mandatory) will just get more and more until eventually the machine EULA comes in multiple volumes.

Wednesday, July 18, 2007

Microsoft's love affair with IRC

It may or may not be news to you that, at one time, Microsoft was a leading producer of IRC clients. Microsoft Comic Chat, which came with Internet Explorer 3 (the first vaguely usable Internet Explorer), was a particularly bizarre example; it depicted an IRC chat room as a comic strip, complete with characters for each participant. Said characters had a variety of different emotions; you could change your character's emotion, and this would be signalled to other users via an unreadable code. This, obviously, annoyed people using less exotic clients; I'm sure it gained a lot of market share simply by forcing people to adopt it so that they wouldn't have to see it spam codes all over the place.

It looked like this:

Looks like great fun, eh?

Then there was Microsoft V-Chat. It was rather similar, but used a 3d virtual world. It was more or less universally deemed ignorable, and vanished without a trace shortly after launch.

Today, V-Chat is six feet under, but Comic Chat still has a few devotees. According to Wikipedia, the Internet's premier site for Comic Chat is Mermaid Elizabeth's Microsoft Comic Chat Resources Link Page. Oh, she has all sorts of wonderful things; a list of chat rooms which still tolerate the offending app, a program for censoring character packs, and, of course, the now-mandatory link to her blog. "This site is for political comments from Mermaid Elizabeth and anyone who wishes to participate. For years Mermy's political comments have been smoldering within her." Yay! Her 'political comments', by the way, tend towards the 'kick out the scary foreigners' variety, much as one would expect from a grandmother who obsesses over an obsolete chat program.

I do love finding the blogs of clearly horribly unhinged people! There should be a centralised listing somewhere.

Tuesday, July 17, 2007

Eclipse Update Oddity

Eclipse, the popular Java-based IDE thing, has quite a nice update system, which lets you automatically download and install updates for the package itself and for any plugins you may have; it also allows you to install new plugins.

This really is surprisingly good. There is but one problem.

Where would you put such a utility, if you were designing the UI for Eclipse? Would you put it under the Help menu? Eclispse's designers would!

Zunetastic!

Remember the Zune? Yes, that Zune. Microsoft's dodgy MP3 player, the one chiefly famous for (a) not working on Vista (fixed now, I believe) and (b) being the first piece of consumer electronics of the 21st century to come in brown. After much fanfare at launch, it appears to more or less have faded into obscurity.

Anyway, it turns out that some people still love it, brown or not. Here is a guy who has had not one, but two, Zune tattoos. (Please note that you click that link at your own risk; it ain't a pretty sight.) He has also been invited to visit Microsoft. Now, if I were him, I really would think twice about this; when it comes to it, if Microsoft don't want this to be a marketing coup for Apple, their only real option is to have him killed. He just looks too perfect next to those Apple ads depicting operating systems as people.

Shortly thereafter, he left the highly important crappy MP3 player forum in a huff.

By the way, the whole website is a bit weird, as are most forums devoted to worshipping a particular brand of consumer product.

Please note that lots of people also have Apple tattoos, but they're generally a little more svelte.

Saturday, July 14, 2007

None