Compare cheap car insurance quotes at Google. Save money!

October 26th, 2012

Just renewed my motor insurance. I got a renewal quote from my current insurer (AutoNet) for £480 pounds. Typed “car insurance” into Google and spotted a funny little ‘sponsored’ box at the top of the results:

Google compare car insurance

I don’t usually click on the sponsored ads, expecting prices from sponsoring companies to include premiums that make promotion worthwhile. Still, I expected Google to have made a good job of motor insurance comparison and it was a clear and simple process to follow. I got a best quote of £273 pounds – a considerable saving.

I didn’t take that quote. I phoned my current insurer and told them I’d found a better price. They did a re-quote for me (I had typed greater Voluntary Excess amounts into Google’s system, and chosen Third Part Fire and Theft). We noticed between us that my best quote did not include Legal cover. The best Third Party quote was substantially more than the best quote from Google, but there was a Comprehensive policy that included Legal cover from an insurer I’d heard of for £269.

So there you are. It was well worth a visit to www.google.co.uk/compare/carinsurance for me. I hope you find it useful too.

Meccano Metal Robots Model 2 / 891400B

October 26th, 2012
Meccano metal robots 892400B

Meccano metal robots 891400B

Jess came back from a shopping trip today with a treat: a little toy robot construction kit. I think she’s still a bit disturbed by how pleased I am with it. It’s just a statue of a robot, but it’s beautiful!

Mine doesn’t look quite like the picture on the tin because the instructions are missing (it was in a charity shop window). In the finest spod tradition, I built it first and then went looking for the instruction sheet which is on Meccano’s website.

Getting a multi-language page on a Chinese search engine

October 26th, 2012

I made a multi-language page for Lolyco.com recently that switches between language based on the Accept-Language header sent by the User-Agent or by setting a session variable. There’s an English version (the default), a Malay version and a Chinese version. I’ve had sites online before that are aggressively crawled by (for example) the BaiDuSpider but never seem to appear in search results, even when they contain Chinese content.

Sogou.com logoThe Lolyco page not only changes its content but also sets its Content-Language and Vary response headers. Returning different content on the same URI is not something I’m entirely happy with, but returning content tailored to User-Agents is not uncommon.

The page has so far been crawled by obviously Chinese crawlers BaiDuSpider, YodaoBot and Sogou Spider. In place of a logo, ‘Lolyco’ is a h1 element whose content is changed for Chinese-requesting user agents to ‘络立科’ (In pinyin “lùo lì kē”: no meaning, just sounds like “lo ly co”). After a few days, I can see Sogou is returning a result for lolyco.com and has a cached copy of the Chinese page. Soso also has a result for the new Lolyco page, though no sign of the Soso spider in the log. Nothing yet at Baidu nor Youdao.

Soso.com Chinese searchA problem with doing it this way is that Google won’t crawl the non-English pages because for one thing it does not send an Accept-Language header and for another it does not use cookies. Those are some sensible crawler design choices. The Lolyco page defaults to English in the absence of an Accept-Language header. What Google needs (and I’m not a great fan of web standards being imposed by Google’s business requirements) is one URL per indexable entity.

The same issue exists with non-English search engines. A little twiddle of my Apache (I use it as a proxy) LogFormat to add on the Accept-Language header value to my log lines tells me that Sogou Spider requests “zh-cn” content. Sogou has the Chinese content in its results, but will never see the English or Malay content.

I reluctantly added a list of anchors to the Lolyco page that override the Accept-Language header with a “content-language” query parameter. The list is made invisible to human visitors with a CSS display:none, but should allow crawlers to fetch the other language versions of the page.

I’m not entirely confident I’ll be able to get search results from all search engines in all languages. Some of the crawlers seem to be restrictive: the zh-cn Accept-Language header on some Chinese crawlers makes me think they are only looking for Chinese content. Google doesn’t specify the header so will probably index the 3 languages indifferently. If you believe the hype then Baidu is the major Chinese search engine, which makes me wonder why its developers (if there are more than one) have chosen to send an Accept-Language header of ‘en-US’.  为什么百度?

Making the skype: URI scheme work on Ubuntu/Debian for Firefox/Chromium etc

October 19th, 2012

Firefox doesn’t know how to open this address, because the protocol (skype) isn’t associated with any program

SkypeI added some skype buttons to lolyco.com recently and seemed to hit a brick wall. While there seemed to be plenty of others running up against the same problem, I couldn’t find a working solution. I didn’t even try some of the more complicated looking ones – something as basic as registering a handler for an URI scheme couldn’t possibly require compilation of code, could it? Ideally I’d like a solution that worked the same for all the browsers I have installed:

I found the answer to the more generic problem of registering any scheme handler at stackoverflow. The solution that works for me is to use the FreeDesktop.org‘s database of handlers for MIME types. What’s nice about this solution is that all software on your desktop that works with this database automatically gains skype URI-handling ability.

There are just two steps:

Create a file called ‘skype.desktop’ in ~/.local/share/applications/ that contains this:

[Desktop Entry]
Name=skype
Exec=skype %u
Type=Application
Terminal=false
Categories=System
MimeType=x-scheme-handler/skype

Next, run the application update-desktop-database on the folder containing the desktop entry files:

update-desktop-database ~/.local/share/applications/

That’s it! As long as you have skype installed so that it can be run by typing ‘skype’ at a command prompt, compatible browsers should JustWork™ with (for example) the Skype Echo / Sound Test Service.

The man pages for update-desktop-database and the post from ‘Mark’ at stackoverflow show semicolons after some lines in the desktop entry. I found adding a semicolon to the Exec= line will stop skype launching correctly. The skype application will launch, but I’m guessing the semicolon is passed to the application which then fails to see the “call” query part.

Happy skyping!

Lame problem encoding MP3 “Warning: unsupported audio format”

July 25th, 2012

An old site that I’ve been meaning to renovate for too long gave me this problem today. For the first time in a more than a year I tried to upload an audio clip and it didn’t work. What’s supposed to happen is the user uploads images and sounds for flashcards in whatever format they happen to have them in and the server transposes them into a standard format, sanitising them at the same time. The image handling code seemed to work, but I wasn’t getting anything back for the MP3 clip I uploaded.

Frog

Frog

I saw the “Warning: unsupported audio format” in the server logs and immediately decided that I’d forgotten some corner cases of sound formats that just didn’t work. After trying a few different formats, I tried to run the shell script that does the conversion on some of the old uploads (the original media is saved, but not accessible to web clients). Lame gave the same error message for those too.

A search for the warning message led me to this page at unix.com. I needed the –mp3input argument because I save user uploads with a generic name, not their original ‘content-hinting’ extension. The shell script had been working just fine way back when I added the content that’s already there, so perhaps lame’s behaviour has changed in the interim. It’s certainly made explicit in the man documentation:

–mp3input
Assume the input file is a MP3 file.
Useful for downsampling from one mp3 to another.  As an example, it can be useful for streaming through an IceCast server.
If  the  filename  ends in “.mp3” LAME will assume it is an MP3.  For stdin or MP3 files which do not end in .mp3 you need to use this switch.