Tim Anderson’s ITWriting

Tech writing blog

June 11th, 2009

Local SQL support in Safari vs Google Gears: what is happening?

Today I installed Safari 4.0, and one of the features which caught my eye is its local database support. No, it’s not new, but perhaps has not received the attention it deserves. The feature lets you use a local SQLite database from JavaScript, both online and offline, and works on the iPhone 2.0 and higher (2.1 for offline support) and in Safari 3.1 and higher. The API is rather simple. windows.openDatabase returns a database object, and you then work with methods like transaction.executeSql, reading the results in a callback function. Security restrictions mean that access to the database is restricted to pages served by the domain from which it was created. Apple has more information in its Safari Client-Side Storage and Offline Applications Programming Guide. Safari’s local database features implement the HTML 5 W3C Web Storage API.

It’s a great feature, and strengthens Safari on the iPhone as an application runtime that avoids the hassles of the App Store. Does it have wider value? A problem is inconsistent support across other browses. Microsoft’s IE8 supports DOM Storage (key-value pairs), which is also part of the HTML 5 standard, but not SQL. FireFox also supports DOM Storage, but its SQLite support is restricted to components and extensions only.

A possible reason for the lack of wider SQL support is that Google has its own implementation in Gears, which works in Safari and FireFox on the Mac, in IE and Firefox on Windows, and in Firefox on Linux. One place you cannot install Gears though is on the iPhone. A possible solution is to create a wrapper API that uses HTML 5 on Safari and Gears elsewhere; Malte Ubl has done some work on this, for example.

Personally I’d like to see the HTML 5.0 specification more widely supported, since along with the iPhone issue, not everyone wants to install Gears. I would have thought it could be added to both Chrome and FireFox relatively easily; but would be interested to know what is planned.

Technorati Tags: ,,,,
June 10th, 2009

Will Microsoft respond to the JavaScript speed challenge?

While people argue about JavaScript performance in Chrome vs Safari vs FireFox, there’s one fact that is beyond dispute. Microsoft’s Internet Explorer 8 is hilariously slow in comparison. On Apple’s figures, IE8 is 5.9 times slower on its i-Bench JavaScript test and 7.7 times slower on the SunSpider test.

You may hardly notice this in normal browsing. It most likely takes longer to download the JavaScript than to execute it. In fact, download speed is still the most significant factor in browser performance, and changing your browser will do nothing to change that (though different approaches to caching might).

This could change though, if more web applications appear that make heavy use of JavaScript. Google Wave could be an example. In fact, this seems to be Google’s game plan: make the browser (backed of course by the Internet) the operating system. The larger these web applications become, the more difference that JavaScript performance will make.

Offline is another interesting case, enabled in Chrome by the Gears add-on. In this scenario, content is served locally so browser performance has a better chance to shine.

The big question: will Microsoft step up to the challenge and fix JavaScript performance in IE? The company could do so relatively easily, either by using one of the open-source engines (unlikely) or by applying its existing knowledge of just-in-time compilation, used to good effect in .NET and Silverlight, to JavaScript in the browser.

The horns of Microsoft’s dilemma: improve JavaScript and undermine the advantage of Silverlight, which runs code much faster. Don’t improve it, and see market share continue to decline in favour of faster browsers.

The right thing to do, of course, is to fix the JavaScript engine; but companies do not always do the right thing – and Microsoft may still be comforted by its 65% market share for IE. That’s false comfort; the share is in long-term decline.

Incidentally, I’ve noticed that Google, while not exactly taking the gloves off, is stepping up its promotion of Chrome. When I go to youtube, which is the 3rd most popular web site in the world according to Alexa, I now see this on every page, if not using Chrome:

I don’t always see an ad on the Google home page itself – Alexa’s number one site – though occasionally I do see this on the right:

All very low-key; but I reckon we’ll see Google step-up its campaign as Chrome itself gets better and the Mac version appears. With Apple, Google, Mozilla and of course Opera all gunning for Microsoft, it would take extraordinary complacency not to respond.

June 10th, 2009

Is Safari the world’s fastest browser? You need to test more than just JavaScript

Apple says its new Safari 4 is the world’s fastest browser:

Still the world’s fastest web browser, Safari outraces Firefox, Internet Explorer, and Chrome. On even the most demanding Web 2.0 applications, Safari delivers blazingly fast performance thanks to the industry’s most advanced rendering technologies.

Using the new Nitro Engine, for example, Safari executes JavaScript nearly 8 times faster than Internet Explorer 8 and more than 4 times faster than Firefox 3 based on performance in leading industry benchmark tests: iBench and SunSpider.

In addition to superior JavaScript performance, Safari offers top-flight HTML performance — the best on any platform — loading pages 3 times faster than Internet Explorer 8 and Firefox 3.

Adrian Kingsley-Hughes at zdnet has tested Safari vs Chrome and IE8, and says Apple’s claims do not stand up to scrutiny. In his tests, Chrome is faster. Unfortunately, he used a different build of Chrome than Apple – 2.0.172.30 vs 2.0.172.28. In addition, he is using a quad core processor, Intel’s QX9770, whereas Apple is using an iMac with a Core 2 Duo processor. Chrome is still work in progress on the Mac, so the results for this are on Vista.

ZDNet’s results certainly cast doubt on Apple’s figures. On the SunSpider JavaScript test, used by both, Apple quotes 609.07ms for Safari vs 870.00ms for Chrome, whereas zdnet has 808.8ms for Chrome and 846.2ms for Safari.

That said, JavaScript performance is not the same as browser performance. If you read Apple’s claim carefully, it talks about rendering technologies and HTML performance as well as the JavaScript engine. Focusing exclusively on JavaScript would be like assessing the performance of Windows vs Mac, for example, simply by timing some number-crunching operations.

In practice, what users care about is the time it takes to load a page and its responsiveness thereafter. Apple claims its best advantage over Chrome in i-Bench HTML, claiming that Chrome takes 40% longer. Unfortunately I cannot currently find the test which Apple used, but I’m presuming it tests DOM rendering speed rather than just non-visual JavaScript performance; an earlier i-Bench HTML used actual web sites.

Bottom line: I don’t trust Apple’s figures either, but I’m retaining an open mind. You need to compare like with like, and not focus exclusively on JavaScript, to test browser performance.

Update: Blogger Luca Filigheddu backs up Apple’s claims with some real-world tests.

May 28th, 2009

Spotify demos mobile music streaming with offline option – for Android

If you have any interest in the future of the music industry, I recommend taking a look at the following video:

There are a couple of reasons why this demo of streaming music to a Google Android mobile is interesting. First, if Spotify delivers the kind of performance and quality it has on the desktop, this will be a great facility for music fans. Second, it is interesting to see how it handles the offline problem, such as when you are in London and descend into the London Underground train network. Simple: just mark a track for offline use, and it downloads to local storage. I’m presuming this is encrypted in some way in order to prevent you from converting it to a standard MP3; but if it is always available anyway, who cares?

Will this be free, or a premium service? I’m guessing the latter but don’t yet have any more details.

Of course everyone is asking for an iPhone version. See for example this post:

It’s interesting that Spotify has chosen Android as the mobile debut, rather than iPhone – although it’s safe to assume the company is working on Apple’s handset too, among others.

Hmmm, I wonder what chance this would have of getting past Apple’s iPhone app censorship? It seems to me that what we are seeing is the beginning of the end for the iTunes download model.

May 22nd, 2009

Apple censors iPhone application, threatens developer livelihood

There is an alarming report here from James Montgomerie, who has developed an application for the iPhone called Eucalyptus. It displays public domain texts hosted at Project Gutenberg.

Apple has refused to allow his application to be placed into the App Store, which in effect means nobody can buy it or use it. The reason: one of the texts on Project Gutenberg is the Kama Sutra, which Apple’s assessors consider pornographic.

It’s doubtful reasoning. Eucalyptus is a client and does not contain the contentious text directly; it is no different in this respect from Safari, the iPhone’s web browser, which can also also display the Kama Sutra, or indeed many far more objectionable web pages.

Still, it’s the wider issues that are more interesting here. Montgomerie writes:

I suspect that no-one at Apple knows how genuinely torturous the app store approval process is for developers personally after a rejection. When they hold the key to the only distribution pipe for something you’ve spent a lot of your time on – in my case a year – something you’re hoping could provide you with a livelihood – and polite email enquiries are not replied to – not even with an autoresponder, it is extremely frustrating. I don’t think I’ve ever felt as powerless in my life (and I’ve had to deal with US immigration authorities…). I think anyone that knows me would confirm that I’m a very level-headed person, but this is the only thing in my adult life I can recall losing sleep over (although perhaps that’s also a consequence of being otherwise lucky in life so far).

Let’s do a bit of what-if. What if Microsoft exerted equal control over what applications were allowed on Windows? What if Apple extended its iPhone control to any Mac computers? Unacceptable, could never happen, you might think. Sure, but it if is unacceptable in that wider context, is it not unacceptable on the iPhone as well?

Apple is not the first company to lock down a platform. Locked mobile phones have done this to some extent for years. Games consoles like Xbox and Playstation do it. Apple is taking heat because of its success in creating a device that users want to use as a platform for all kinds of applications; potentially, in some future version, it may be able to do most of the things for which we currently use laptops. Therefore we should be concerned both about the way Apple is using its control over iPhone distribution, and more fundamentally that it has that level of control at all.

Fortunately Apple does not control the Internet; and Montgomerie has done the right thing by appealing to public opinion. Apple’s PR machine will take note and no doubt resolve the immediate case.*

Nevertheless, this story and others like it are a real concern. Perhaps your next phone should run Android?

*UPDATE this is exactly what happened:

Earlier today I received a phone call from an Apple representative. He was very complimentary about Eucalyptus. We talked about the confusion surrounding its App Store rejections, which I am happy to say is now fully resolved. He invited me to re-build and submit a version of Eucalyptus with no filters for immediate approval, and that full version is now available on the iPhone App Store.

See also: Friendly to users, hostile to competition: get ready for more app stores

Technorati Tags: ,,,
February 23rd, 2009

Squeezebox and Napster – the perfect combination?

I’ve just posted a review of the Squeezebox Boom, a lovely device that once set up is perfect for hiding all the computer gunk and letting you enjoy the music wherever you are in the house. During the review I noticed that Logitech’s Squeezenetwork, which aggregates a number of Internet radio stations and music services for use with Squeezebox, announced Napster support last week.

I tried this, and it is amazing, though you do need to subscribe to Napster; trial accounts are available. If I want to play any song or album in Napster’s vast library, I select Squeezenetwork as the music source on the Boom, select the Napster music service, search the Napster library, and play the music. No computer has to be running for this to work. Sound quality is good though noticeably worse than locally-streamed lossless FLAC; more radio than hi-fi.

I’ve also been spending time with Spotify. Like Napster, this makes a huge library available, plus it has a couple of advantages. Performance is better, with near-instant search results and playback; and best of all it is free, if you can tolerate occasional advertisements. Unfortunately Spotify does not integrate with Squeezebox yet, though users are clamouring for it.

The Squeezebox is a schizophrenic product with one foot in the old world of local media storage, and one foot in the new world of Internet streaming via Squeezenetwork. Squeezebox plus Napster is great; Squeezebox plus Spotify would be even better. Either one makes Apple’s iTunes purchase-and-download model look dated.

Technorati tags: , , ,
February 22nd, 2009

Spotify is the new Napster

I signed up today for Spotify. This is a music service that like all the best innovations can be explained in a few words. You download the client (Mac or Windows), which has a Mac-like user interface for searching and playing songs. You type in a search, double-click a song in the result list, and it plays. When it finishes, it plays the next one in the list.

So far it has worked flawlessly. Performance is the key. Searches are fast, and songs seem to start playing instantly – impressive. Now and again an advertisement plays in between songs – it’s not too intrusive, but for a ad-free experience you can sign up to a premium subscription, currently £9.99 per month or £99.00 per year.

A few technical details: according to the FAQ, Spotify uses both streaming servers and peer-to-peer connections. It also grabs up to 10% of your hard drive (user configurable) for local storage. The codec is “Ogg Vorbis q5 which streams at approximately 160kb/s.”

The selection of music is not comprehensive; last month a number of songs were withdrawn “…so that we implement all the proper restrictions that are required by our label deals.” Nevertheless, the selection is wide and includes many mainstream artists. The latest Lily Allen is there; so is the latest Morissey as illustrated above. A search for Beethoven revealed 9,302 tracks; Mozart 14,148. Most people will find plenty of music they like.

In 1999, Shawn Fanning created Napster, a peer-to-peer music sharing service that allowed users to share MP3 files. It was wildly popular and illegal, and introduced the download era to a mass market. Download is about amassing a collection of music files on local storage and playing them through a computer or over a network. Ripping a CD is really just another way of downloading it.

The company that has profited most from the download era is Apple, with its market-dominating iPod/iTunes combination.

But what is the point of downloading a song, if you can play it just as easily without downloading it? What is the point of “buying” a song, if you can already play it whenever you want? What is the point of ripping a CD in order to make a copy that is identical to copies made thousands of times already, when you can easily access a shared copy over the Internet?

There is none; and all-you-can-eat streaming is the natural successor to the download era.

That does not mean we are there yet. Format changes in recorded music are not instant; there is a long transitional period. You can still buy LPs today; CDs remain a major source of revenue for the music industry; Spotify will not kill iTunes overnight. Audiophiles will not be satisfied with Spotify’s lossy-compressed music format for serious listening.

Further, Spotify has some limitations. Playing on mobile devices is one problem that will not easily be solved, bearing in mind that while broadband internet at home is now widely available, fast mobile connections remain expensive and unreliable.

History also suggests that Spotify will not necessarily be the company that makes this a business success. The music companies might panic and remove their works from Spotify. Apple might buy the company, and/or transition iTunes to a similar subscription-based streaming service. You can be sure it will not stand by and watch as its music business become irrelevant.

Nevertheless, even a day with Spotify is enough to make the idea of only being able to play what you have already downloaded seem quaint and unnecessary.

Technorati tags: , , ,
February 2nd, 2009

What’s the deal with Flash and the iPhone?

An brief comment from Adobe’s CEO Shantanu Narayen quoted by Bloomberg suggests that Apple and Adobe are actually working on putting Flash on the iPhone:

It’s a hard technical challenge, and that’s part of the reason Apple and Adobe are collaborating. The ball is in our court. The onus is on us to deliver.

Deliver what? I’d have thought it would be straightforward for Adobe to implement some level of Flash on the iPhone. There are at least two reasons though why Apple might be blocking it:

1. Flash is a client runtime. Apple may feel that allowing applications to run within Flash could threaten its App Store lock-in and market.

2. One of the frustrations of Flash on devices is that it lags behind the version of Flash available on desktops, and is often hard to update. That’s frustrating for users. Apple may want to address that by giving iPhone users an experience that comes close to that on the desktop.

So what is Apple waiting for Adobe to deliver? Better mobile performance and usability? Or some other piece that might address the first of the above concerns?

The outcome of this has a significance that goes beyond the iPhone. Although iPhone and iTouch users form only a small proportion of those browsing the web, it is an influential group and one that will grow. The lack of Flash support makes pure HTML and JavaScript solutions more attractive to web developers.

If anyone from Adobe can give us more insight into what it is working on with Apple, I’m keen to know.

Technorati tags: , , , ,
January 12th, 2009

Apple Dock vs Windows 7 taskbar

Here’s the Apple OS X Dock (Leopard):

Here’s the Windows 7 taskbar (Beta 1):

Note: the running apps in the Dock are indicated by the small white dot in the reflection. The running apps in the taskbar are indicated by the extra illumination in the top left corner of the icon (IE, Word and Adobe reader in the example).

Technorati tags: , , ,
December 30th, 2008

Amazon MP3 store is much cheaper than Apple iTunes

The Amazon MP3 store has arrived in the UK, and I’ve noticed that it is much cheaper than Apple iTunes for many items, particularly when buying complete albums. Here’s an example: Day & Age by Killers. £7.99 on iTunes:

and £3.00 on Amazon:

That’s 62% cheaper. Amazon also sells the CD for £8.98. Since you get more for your money with a CD (no lossy compression, physical backup and sleeve notes, transferable rights) that strikes me as about right.

The MP3 format is also more convenient than iTunes AAC, since it is supported by more devices.

I’m intrigued though. Why is Amazon so much cheaper? A last-ditch effort by the industry to create serious competition for Apple?

Technorati tags: , , ,