elliot's blog

Books read 2013

I read 36 books in 2013. Here's the list:

Experiences with Firefox OS and the ZTE Open

Exit Galaxy S2

I had a Galaxy S2 for a couple of years, which was a brilliant phone. It's Android, so you are spoilt for choice as far as apps go: my main use of the device was for multimedia, watching Netflix, iPlayer, stuff on my NAS drive (via BubbleUPnp, the best Android UPnP client, by the way), Sky Go (it's one of a handful of compatible devices), listening to music and radio shows. Using the excellent SwiftKey virtual keyboard, typing was fast and easy, so I also used it for personal email, Twitter, Facebook etc. The camera was great; so good that I'd stopped using our digital camera in favour of the S2.

But problems started a few months back. The microSD card somehow got corrupted, so I lost a load of photos. The USB port (or the system's detection of it) got flaky, so sometimes it continued to behave as if it was charging, even when unplugged. I couldn't reliably connect the USB to download files from it. I couldn't update the operating system, so more and more apps were becoming incompatible.

Enter ZTE Open

Eventually I realised I was going to need a new phone, contract-free (I use giffgaff). Because I like a challenge, and I work in open source, and some of my friends and old colleagues work on it, and because it uses HTML5 for its whole UI, I went for a SIM-free ZTE Open running Firefox OS (£60 on eBay).

On paper, Firefox OS sounds like a great concept: fully open source, most of the userland apps in HTML5, extensive web APIs for third party developers to interact with system services. However, my disappointment on first trying the phone was almost palpable. In fact, my first impressions were so very bad that I contemplated selling it on eBay within about an hour of unwrapping it. I was going to write a thorough review explaining why, but then this Phones Show video summed it up. As a phone, this device is barely adequate, for all the reasons explained there. I'll summarise the salient points:

  • The capacitive screen is so unresponsive, it feels like a resistive screen.
  • The camera has no flash and is only 3 mega-pixels. I could have worked this out beforehand, but it never occurred to me that a phone would be sold without a flash in 2013.
  • The onscreen keyboard is unpredictable, fiddly and generally a very poor experience. I end up having to correct mistakes so often that I've practically given up using it for anything other than text messaging. Even then, the experience is about as good as typing on hardware keys 10 years ago (remember that?).
  • The user experience when using some of the applications is just dreadful. For example, if you use the Twitter app to follow a link, the link opens in a browser and the Twitter app disappears (closes itself, I'm guessing). You end up having to restart the Twitter app and scroll back to the place you'd got to in the status updates list.
  • The app-store is full of hobby projects or very thin wrappers around mobile websites. The quality is generally quite poor.
  • Some mobile sites don't recognise the phone, or think it's Android, or are so slow they're unusable. So iPlayer, Amazon Cloud Reader (there's no Kindle app), and Evernote are inaccessible. I'm guessing there are lots more. Other sites like GMail look like they did 5 years ago, as you get the default "we're not really sure which phone you're using" interface.
  • Because there's no widgets API as far as I can tell, you can't easily shortcut to tasks you might need to do often (e.g. change screen brightness: to do this, you have to dig into the configuration app, which takes a click, a scroll, another click, and a slide; I can't bear auto-brightness, as the screen brightness fluctuates madly in the British weather).
  • Setting up the email app for an IMAP server took me forever, until I realised that it was because the SSL certificate the email server was using was registered to a different domain name. Once I ping'ed the IP address and got the "real" domain name, and used that instead of the alias, it worked. I've never had this issue with any other email app, on Android or Linux or Windows or Mac, which will either carry on regardless or give you a decent error message about why they're hesistating. No normal user is going to know how to sort this out (though admittedly they'll probably be using GMail or Yahoo).
  • Setting up the weather app to show me the weather for where I live, automatically when I open it, took forever. I ended up going to the mobile site (instead of using the Accuweather app, which couldn't seem to remember my location), finding the weather for where I live, and bookmarking that instead. And of course there's no widget (see above) so you can see it at a glance.
  • The contacts app has no integration with Google contacts, only Facebook. It can import contacts from a SIM, though in my case they are a complete mess as I was maintaining contacts in Google contacts.
  • Updates failed for me for about a week. I kept getting a notification that there was an update, and when I tried to download it, I got a generic "update failed" message.
  • The web API has some big gaps which prevent you from writing certain types of apps (e.g. anything using udp). This is a bit developer-specific, but it puts a leash on how useful the phone is even to developers.

Within a few days of purchasing it, I realised it just wasn't going to do for general day-to-day use. I actually forked out for a very cheap (£50) Android (Jelly Bean) tablet from Amazon (I think I should have spent a bit more money, as the web browsing on it is a bit crap, but games and multimedia work fine; the screen is only adequate; and the system clock drifts incessantly, which is irritating).

Having said all this, the good points of the ZTE Open are:

  • It was dirt cheap.
  • The phonecall and text functionality are acceptable (I am using it as my everyday phone).
  • It integrates with Google calendars.
  • It is light and compact.
  • The battery life is excellent (though probably because I don't use it much).
  • I like the data usage monitoring (useful if you're on a capped-broadband or pay-as-you-go SIM).
  • Wireless works fine. I haven't had any issues with it on my wifi, unlike the chap in that video review. Though it does randomly drop off wifi occasionally.
  • Firefox is a decent mobile browser.
  • It is an incredible achievement to put together an operating system for a mobile device and get it to market. I have only admiration for the team that managed it.

It's also worth bearing in mind the context for the device. It's not a "first world smart phone", more a "developing markets first smart phone". In that context, it's great. I imagine even having internet access on a phone would be a massive boon in some countries (I remember how exciting it was when I got my first hand-me-down HTC phone a few years ago). Data usage monitoring is key in countries where phone companies are still developing infrastructure, and contracts are likely to be capped.


And, this isn't the end of the story from my point of view. Once I got over the initial disappointment of how incomplete, inadequate and substandard this device is as a phone, and ordered an Android tablet to take up the slack, the "pressure" was off the ZTE Open. I could lower my expectations because I didn't need it to be anything more than a phone. Any functionality on top of that was a bonus. With this new (more realistic) perspective, I could more easily see the possibilities. Here was a phone which I could develop apps for, using my existing skills and toolchain, without having to run cumbersome SDKs and emulators (I have tried Android development in the past, but it's not really my thing).

Recently, I've been downloading radio shows and podcasts, and listening to them while walking around, after dropping the kids off at school, picking them up, shopping etc. Firefox OS has a music player, which is OK though basic. But this app, like most other music apps, is focused on playing music: generally short pieces of audio that you might listen to in one sitting, from start to finish. By contrast, listening to radio shows is more like watching a film on Netflix or reading a book on a Kindle: you might listen to the first half hour, then switch it off, then go back to it later.

Most music apps don't cope with this use case, where you "pick up" an audio file for a while then set it down, so you can come back later. The main feature you need for this is to track progress through an audio file and persist it, so a user can return to the same point they reached earlier. (The way Netflix and Kindle do for movies and books respectively.) On top of this, I also wanted a music player that showed me the full title and album for a track without truncating it or scrolling it leisurely into view; group by album as the default (as the album for a podcast or radio series tends to be the important thing, rather than the artist). Other desirables features: a slider for scrubbing through a track, while being able to see where you are in it (the Firefox OS Music app isn't great for this); and skip buttons to jump over chunks at the start of an audio file (where they tend to put introductions and adverts). I also wanted standard music app features, like being able to quickly go back to the last thing I listened to. And I didn't want loads of other features that I rarely use or care about, like playlists and album cover art.

I started a project called Marconi, an audio player focused on audio rather than music. My first step was ripping some code out of the Firefox OS Music app for decoding the ID3 tags out of mp3 files (the beauty of open source, though it would be nice if audio tag reading was a service...). I then wrote a wrapper round the Firefox OS deviceStorage API, so I could read audio files from the phone's hard drive and get their metadata. Initially, I just had a very simple list view of the files as an HTML file.

Next, for testing, I installed and setup adb (Android Debug Bridge) and the Firefox OS simulator (as documented on the Mozilla developer network). Shortly, I got Marconi running in the simulator (once I'd recognised this bug was holding me up).

After that, it took me a while to figure out the steps I needed to be able to push stuff to the phone. For those of you who might be similarly struggling (it was the main barrier for me), on Fedora Linux the steps are:

  • Unplug your Firefox OS phone from your development machine.
  • On your development machine, close Firefox.
  • On your development machine, you need a rule so that udev will recognise your phone when plugged in via USB (at least, I think you do; I get so confused sometimes). Add a file /etc/udev/rules.d/60-fxos (owned by root:root, chmod 644) with this content:

  • Restart udev, probably sudo udevadm control --reload-rules. It all gets a bit vague here, but I just checked and this seems to work.
  • Kill any existing adb server instances.
  • Start adb as root. AS ROOT. You can probably do it as non-root, but will have to fiddle about with all sorts of permissions. I spent a while on this before giving up and resorting to root.
  • Run adb devices and ensure you see a line like "roamer2 device". If you get "Insufficient permissions", restart adb with your fingers crossed and/or a prayer on your lips and try again.
  • On your Firefox phone: make sure you have remote debugging enabled (Settings > Device information > More information > Developer > tick "Remote debugging"); and turn USB mass storage off (Settings > Media storage > untick "USB mass storage" so it is disabled).
  • Open Firefox, then the Firefox OS simulator.
  • Plug the phone into your development machine. Hopefully it will show up in the simulator tab. You should now be able to push apps to it.

One other thing which wasn't very clear from the docs: you will need a manifest file, called something like manifest.webapp (the .webapp is important) to be able to load your app into the simulator. It's explained in detail on the Mozilla developer site.

I continued developing the app, which uses Bootstrap 3 for most of the UI (I'm not 100% sold on it, but it's quite lightweight and looks pretty good), jQuery UI for the slider (it's the best HTML5 slider in my opinion), some media player code I wrote on a previous project (which wraps HTML5 <audio>), localStorage to persist progress data, and Stapes for event handling and the model layer. There are a couple of screenshots below.

Notes: the screen on the left is scrolled up a bit so you can see the progress bars for two files; the buttons are positioned so I can reach them with a thumb when holding the phone with one hand; the slider updates the progress text at the top as you slide, and you can slide it to reach right to the start or end of a track - difficult to do precisely with the default Firefox OS Music app; progress bars on the home screen update in real time as you're listening to a track; the top-right notes button takes you back to the "last played"/"currently playing" track.

Finally, after quite a bit of work, I have an app which does what I want, for now. It won't scale to thousands of files, only copes with mp3s, doesn't do playlists or album art; but it is optimised for me: it remembers what I listened to last, it tracks my progress through audio files, it shows me full album and track titles, and it has BIG UI elements and fonts which I can easily see and press while I'm walking around. Yes, it's fairly ugly, the proportions are all wrong, it's not perfect by any means, but it suits me very nicely.

The moral of this story is that while Firefox OS is terrible as a end-user phone in 2013 (well, about as good as the phone I had 10 years ago), it is great as a platform for experimenting with HTML5 web apps in a real mobile environment. I don't think of my ZTE Open as a phone so much; more as a custom media player which I wrote myself, with the phone functionality as a bonus. Which is a rewarding feeling to have.

Some git commands for amending commits and showing short logs

I noticed a friend of mine tweet about git commit --amend yesterday, and it occurred to me that some people probably haven't used git very much and are still learning the ins and outs. I thought I'd share some commands I find really useful.

The first thing to mention is that you can set up your own command aliases by editing a file called .gitconfig in your home directory. This is where I keep all my custom aliases. (I use them so often that I'm often lost when using git on a different system where my aliases aren't set up.) Here's an extract from my .gitconfig with some explanation of the aliases:

  # sets up your details so that commits carry the right user info;
  # I use my primary github email address for mail, so that
  # all my github commits are associated with the right account
  mail = <you primary github email address>
  name = <your real name>
  # turns on the default terminal colouring for git output
  ui = auto
  # A good resource on git aliases is https://git.wiki.kernel.org/index.php/Aliases

  # these are just shortcuts to full git commands
  st = status
  ci = commit
  br = branch
  co = checkout
  cp = cherry-pick

  # I use this one when I am working locally, miss some changes, then want to
  # add them onto the last commit I made; it stages all the files which have
  # changed (NB NOT new files or deleted files), merges those changes to HEAD,
  # and retains any existing comment from HEAD
  cim = commit -a --amend -C HEAD --reset-author

  # this is similar to the cim command, but instead of automatically adding any
  # changed files, it only merges staged files into the HEAD commit; this is useful
  # where you just want to add one or two files you've changed to the existing
  # HEAD commit, before making a new commit with the other changes
  fix = commit --amend -C HEAD

  # sl: short log showing author and changed files; useful for checking
  # what I've patched in each commit
  sl = log --format=format:'%h %s%n%an, %ar (%ai)' --name-status

  # author: Show all the commits a specified author has done
  # Usage: git author <email_address|name>
  author = "!sh -c 'git log --tags --source --oneline --author=\"$1\"' -"

  tool = meld
  keepBackup = false

  default = current

Note that I have others, but these are the ones I use most often.

Next, to give a flavour of how you might use them, here's an example session making use of these commands.

First I init a git repo and add a README file:

[ell@lp shiny]$ git init .
Initialized empty Git repository in /tmp/shiny/.git/
[ell@lp shiny]$ vim README
[ell@lp shiny]$ git st
# On branch master
# Initial commit
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
nothing added to commit but untracked files present (use "git add" to track)
[ell@lp shiny]$ git add README
[ell@lp shiny]$ git ci -m "Add README"
[master (root-commit) a2584b9] Add README
 1 file changed, 1 insertion(+)
 create mode 100644 README

Now I edit the README, but want to merge those changes into the existing commit. So I use my cim command:

[ell@lp shiny]$ vim README 
[ell@lp shiny]$ git cim
[master f4be9e7] Add README
 1 file changed, 3 insertions(+)
 create mode 100644 README

This adds my changes to the existing commit, keeping the commit message I've already laboriously typed in.

Now I show a short log of what's happened so far. I prefer this log format as it shows just the changes files, a short form of the git commit idedntifier, the author, and the comment:

[ell@lp shiny]$ git sl
f4be9e7 Add README
Elliot Smith, 2 seconds ago (2013-07-18 10:35:12 +0100)
A       README

Now I add a new file, package.json, then make an edit to README:

[ell@lp shiny]$ vim package.json
[ell@lp shiny]$ vim README 
[ell@lp shiny]$ git st
# On branch master
# Changes not staged for commit:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#	modified:   README
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#	package.json
no changes added to commit (use "git add" and/or "git commit -a")

I want to include my edit to README with the existing commit, then add a new commit for package.json. So I first stage the changes to README and use my fix command to merge them into the existing HEAD:

[ell@lp shiny]$ git add README
[ell@lp shiny]$ git fix
[master 71de8f9] Add README
 1 file changed, 5 insertions(+)
 create mode 100644 README
[ell@lp shiny]$ git sl
71de8f9 Add README
Elliot Smith, 32 seconds ago (2013-07-18 10:35:12 +0100)
A       README

Then I stage the changes to package.json and make a new commit for them:

[ell@lp shiny]$ git add package.json
[ell@lp shiny]$ git ci -m "Add package JSON"
[master b717cc8] Add package JSON
 1 file changed, 1 insertion(+)
 create mode 100644 package.json
[ell@lp shiny]$ git sl
b717cc8 Add package JSON
Elliot Smith, 2 seconds ago (2013-07-18 10:35:52 +0100)
A       package.json

71de8f9 Add README
Elliot Smith, 42 seconds ago (2013-07-18 10:35:12 +0100)
A       README
[ell@lp shiny]$ 

Notice that I almost automatically do git sl after each cim/fix/commit command, as it's so quick and easy to read the output.

Anyway, I might write some more if I feel so inclined another day. I make extensive use of interactive rebasing, for example, which is never really explained anywhere in simple terms, but which is massively useful (especially if you're making branches to turn into pull requests for other projects).

git can be a bit daunting at first, but after you've used it for a while I don't think you'd use any other version control system ever again, unless forced to.

grunt plugins for Tizen apps, creating zip files, and running mocha tests

The short version

I wrote some grunt plugins for managing Tizen application development and doing related stuff:

  • grunt-tizen: For pushing packages (or other files) to a Tizen device, installing/uninstalling them, and starting/stopping applications (via sdb).
  • grunt-zipup: For creating zip files with customisable, template-based filenames; as Tizen web apps are just zip files with a wgt suffix, it can also be used to create those.
  • grunt-mochaccino: For running mocha tests within a grunt build, using the mocha command line rather than the mocha API. This was developed for unit testing the above plugins, but can be used to run mocha tests for any project.

They are all available from github at the links above, or can be installed via npm (instructions in the READMEs).

They are all released under the Apache v2 license.

The long version

I've been working on Tizen-related applications (most notably some of the 01.org web apps) for a few months. (The Slider Puzzle I rewrote should work in very recent Firefox and Chrome.)

One aim was to get these applications to run on Tizen devices, partly as they are included as samples in the Tizen SDK. My colleagues have done some good work on the SDK, but, unfortunately, it doesn't yet support the Linux distribution I use (Fedora, currently version 17). So I had a requirement to install web apps on Tizen, but without the possibility of using the SDK.

Fortunately, one of the key tools for interacting with a Tizen device is sdb (Smart Development Bridge), which is a fork of the Android adb tool. It works over a network connection between the device and a developer machine, usually over a USB cable, enabling file transfer between the two and access to a shell on the device. sdb is very easy to build on Linux, so it wasn't long before I had a way to push web app packages to my device, get a command line on the same device, then use the Tizen package tools (wrt-installer and pkgcmd) to install the package, then running it in debug mode and remotely debugging it (via wrt-launcher).

As with all these things, I soon got bored with entering the same commands over and over, so I wrote some bash scripts to automate pushing the package, starting the shell, executing the command, and opening a debug session. One of my colleagues started using the same scripts, so I made them more portable and robust.

Alongside this, I was using the venerable grunt to minify my JavaScript/CSS/images etc. But this meant two build tools (bash scripts + grunt) in use at once, which would never do. So I started integrating the bash scripts with grunt, and gradually replacing calls to command line programs where possible with grunt plugins.

The result is the three plugins mentioned at the start of this post. They've been tested on Fedora Linux and Windows 7, and are hopefully fairly easy to use (I spent quite a bit of time on documentation).

Please try them, and, if you're so inclined, contribute via github (pull requests and issues).

Top tracks 2012

The hits just keep on coming!

Here's my other annual taste-making, floor-shaking list of stuff: top tracks 2012! The rules are: no artist more than once, and each track listed was listened to at least 5 times. They are listed in order of number of listens, so Her Fantasy was my most-listened to track in 2012.

You could look at my 2012 Jam Odyssey for a more interactive overview of what I was listening to.

Here's the list:

Books read 2012

I bet you were all thinking, just after Christmas: "Where oh where is the list of books Elliot read in 2012? It really brightens up the festive season."

Well, worry no more! Here it is, finally:

  • The Marvelous Land of Oz by L. Frank Baum
  • The Chrysalids by John Wyndham
  • A Mirror for Observers by Edgar Pangborn
  • Lilith by George MacDonald
  • First Love by Ivan Turgenev
  • Dandelion Wine by Ray Bradbury
  • The Year of Our War by Steph Swainston
  • The Possessors by John Christopher
  • The Giant Under the Snow by John Gordon
  • The Bane of the Black Sword by Michael Moorcock
  • Greenwitch by Susan Cooper
  • Flow My Tears, the Policeman Said by Philip K. Dick
  • The Quest for Tanelorn by Michael Moorcock
  • The Elfish Gene: Dungeons, Dragons And Growing Up Strange by Mark Barrowcliffe
  • The Champion of Garathorm by Michael Moorcock
  • Count Brass by Michael Moorcock
  • The Secret Life of Bletchley Park: The History of the Wartime Codebreaking Centre by the Men and Women Who Were There by Sinclair McKay
  • Invitation to a Beheading by Vladimir Nabokov
  • The Dispossessed by Ursula K. Le Guin
  • The Wood Beyond the World by William Morris
  • Elidor by Alan Garner
  • The Curse of the Blue Figurine by John Bellairs
  • The Island of Dr. Moreau by H.G. Wells
  • Mockingbird by Walter Tevis
  • Choices by Christopher C. Teague
  • Osama by Lavie Tidhar
  • The City by Jane Gaskell
  • The Houses of Iszm by Jack Vance
  • Finn Family Moomintroll by Tove Jansson
  • A Clash of Kings by George R.R. Martin
  • The Pendragon Legend by Antal Szerb
  • The Tooth Fairy by Graham Joyce
  • After Silence by Jonathan Carroll
  • Silverlock by John Myers Myers
  • TNT by Doug Masters
  • Chorale by Barry N. Malzberg
  • Thunder on the Left by Christopher Morley
  • All The Bells on Earth by James P. Blaylock
  • Strange Evil by Jane Gaskell
  • Atlan by Jane Gaskell

Of those, I love the Jane Gaskell books, always like Barry Malzberg, really enjoyed The Possessors, Moorcock is always great, love Jack Vance, and Dandelion Wine had the best opening sequence. Lilith and The Wood Beyond the World were really heavy going.

Only 40 books. After going into hospital last September, I found it really difficult to read anything for some reason. I still haven't quite recovered my enthusiasm for books (I've only read 3 so far this year).

Running the Tizen SDK Simulator on non-Ubuntu Linux

This explains the steps you need to get the Tizen web-simulator working on Linux. Also shown is a small example of how to exercise some of the HTML5 APIs in Tizen to demonstrate how the web-simulator does its stuff.

The aim here is to get a working Tizen dev environment, without having to download and run the full Tizen SDK (a 1Gb download), and on platforms which aren't officially supported (only Windows and Ubuntu are supported, but I use Fedora). It's not the recommended or official way to develop for Tizen (see https://developer.tizen.org/sdk for that), but it is a way to use a bit of it. I also can't vouch for whether it's a sensible thing to do as I've only tested small applications with it so far. But it is fun.

The web-simulator is actually a fairly small (5Mb) Chrome extension, which is based on a fork of Ripple:

"Ripple is a multi-platform mobile environment emulator that runs in a web browser and is custom-tailored to HTML5 mobile application testing." (http://ripple.tinyhippos.com/ ; NB the company that developed it has been acquired by RIM).

The web-simulator extends Ripple with stubs for the APIs which are specific to Tizen, but not necessarily present in other HTML5 environments (e.g. sensor and messaging capabilities). This enables you to build applications which use those APIs if you don't have access to Tizen hardware. (The other alternative is to use the full Tizen SDK, which provides an emulator that runs "real" versions of the APIs; however, this is a big install and only works on Ubuntu and Windows.)

Also note that the web-simulator has decent end-user documentation, explaining what the UI does.

The steps:

1. You can get the web-simulator code from the project's git repo: https://github.com/01org/web-simulator

The master branch is way behind ongoing work (by about 5 months); so you might have better luck with the "next" branch, which seems to be where work is ongoing.

To clone the project and get onto the right branch:

$ git clone https://github.com/01org/web-simulator.git
$ cd web-simulator
$ git checkout next

2. Now you have the source code for the web-simulator. We're just going to use a part of this to set the simulator up to work with Chrome.

The piece we need is in this location (relative to the directory you made the clone from):


So copy those files somewhere else to make them easier to get at:

$ mkdir ~/tizen-simulator
$ cp -a ./pkg/web/* ~/tizen-simulator/

Take a look to check you have the right files:

$ cd ~/tizen-simulator
$ ls
beep.wav           cache.manifest  index.html    ripple.css 
browserCheck.html  images          package.json  ripple.html  ripple.js     themes

That's all the code you need for the web-simulator.

3. Open up Google Chrome (a recent version; I'm using 20.0.1132.3 dev) and type the URI for the web-simulator in the address bar, i.e.:


(replace "user" with your Linux account username)

You should see the web-simulator UI with a blank "phone" in it.

4. You need a project to test against, so make one like this:

$ mkdir ~/tizen-messaging-test

Then add two files to this directory.


<!DOCTYPE html>
    <meta charset="utf-8" />
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0,
                   maximum-scale=1.0, user-scalable=0, target-densityDpi=device-dpi">
    <meta name="description" content="Tizen web app"/>
    <title>messaging test</title>

  <p>Tizen web-simulator running on Linux.</p>
  &lt;script src="main.js"&gt;&lt;/script&gt;

(you need to use real script tags, but I can't put them in here as the Drupal editor removes them...)

and ~/tizen-messaging-test/main.js:

window.onload = function () {
  var errorCb = function (err) {

  var successCb = function (services) {
    if (services.length === 0) {
      console.error('could not get email service');

    var service = services[0];

    // listen for message changes; NB when the message is sent below,
    // it appears in the OUTBOX folder and a notification is logged
    var messagesChangedListener = {
      messagesadded: function (messages) {
      messagesupdated: function (messages) {},
      messagesremoved: function (messages) {}


    // send a message
    var msg = new tizen.Message("messaging.email", {
      'to': ['bingo.barry@bogus.com'],
      'subject': 'hello email from Tizen web app',
      'plainBody': 'hello'

      function (recipients) { console.log(recipients); },

  tizen.messaging.getMessageServices("messaging.email", successCb, errorCb);

See the Tizen developer docs for more information about the APIs supported. Also note that I'm not suggesting this as a sane pattern for structuring an application.

5. Open the web-simulator at your new project by entering the address in Chrome:


(replace "user" with your Linux username)

Note that the URL of the project is passed as a url=xxx parameter to the Tizen simulator.

Also note that things don't work so nicely if you run the web-simulator and the application on different domains (you get cross domain errors), even if the Simulator is a Chrome extension with permissions set to allow requests to any domain (I tried). The easiest thing to do is run both from file:// URIs.

You should see the index.html page in the "phone" with the message:

"Tizen web-simulator running on Linux."

Like this:

Next, Ctrl+Shift+j to see the console output. You should see something like:

Ripple :: Environment Warming Up (Tea. Earl Gray. Hot.)   ripple.js:27588
TIZEN :: Initialization Finished (Make it so.)            ripple.js:27588
OUTBOX                                                    main.js:11
["bingo.barry@bogus.com"]                                 main.js:28

"OUTBOX" is the name of the folder containing the sent message (i.e. it's queued and ready to go); ["bingo.barry@bogus.com"] is an array of the recipient names to whom the message was successfully sent. This proves that the web-simulator's API stubs are working correctly.

One other thing you might notice is that if you click the refresh button inside the simulator to reload the project, you get this in the console:

Uncaught ReferenceError: tizen is not defined                                 main.js:41
TIZEN :: -----------------------------------------------------------          ripple.js:27588
TIZEN :: Pay no attention to that man behind the curtain.                     ripple.js:27588
TIZEN :: Environment Warning up again (Set main batteries to auto-fire cycle) ripple.js:27588
TIZEN :: Initialization Finished (Make it so.) ripple.js:27588
Uncaught TypeError: Cannot call method 'log' of undefined                     main.js:11

I haven't tracked down the source of this, but if you refresh the whole window, it seems to resolve itself.

That's it. You can continue developing your application with whatever JavaScript libraries take your fancy.

Free SF, science fiction, horror, fantasy and weird ebooks for the Kindle and others

What is this?

This is my very biased overview of free ebooks for the Kindle. It only covers books I'm interested in: mainly old Fantastic fiction - gothic novels, horror, ghost stories, surrealism, sword and sorcery, lost worlds, and other odd books. There are tons more classic SF&F books out there which you can get hold of.

Sources of free e-books


This is an excellent site which aggregates various free books, mainly from Project Gutenberg but covering various other outlets, with a decent summary page for each book and author; it enables you to generate downloadable ebooks for each book, as well as read and create book reviews.

There is also a mobile site at mnybks.net, which you can browse directly from your Kindle.

Note: when browsing the full site via Kindle, I've found that the only downloads which work properly are Amazon ones - if I try to do mobipocket downloads, they don't work. Strangely, mobipocket files downloaded from there via a PC or laptop then sent to the Kindle (via email or USB) do work properly.


This is particularly nice, as any content you buy at Amazon will sync to any device where you have a Kindle app (e.g. a phone).


I think the content in here is pretty much covered by manybooks.net, but there may be places where a gutenberg ebook isn't on manybooks.net.


Australia has slightly different copyright laws from the US, so some books may be available here which aren't on the US Gutenberg site.


Canada also has slightly different copyright; the site is likely to have more titles in French than the US site.


The Internet Archive has some items which aren't held by Project Gutenberg.

Converting various formats for use on a Kindle

I tend to get or make .mobi files; Kindle's own format is .amz.

If you can find a book in PDF or HTML format, you can convert it in the following ways:

  • Kindle
    You can send PDFs and HTML files to Amazon for conversion and later download to your Kindle.

You should have an email set up for your Kindle first. They tell you about the paid one, but you should have a free one in the format <your name>@free.kindle.com.

Once you've done that, do the following to convert the PDF:

  1. Send an email to <your name>@free.kindle.com
  2. Set the subject line to "Convert"
  3. Attach the PDF or HTML file(s)

The converted file will automatically be sync'ed to your Kindle.
You can also send .mobi files direct to your Kindle at the @free.kindle.com address: just miss out the "Convert" subject line

  • Online ebook converter
    This works pretty well, and is especially useful as you can change the author and title of the output book. However, for some PDFs, I found the output was a bit of a mess. I ended up using the Amazon email conversion mostly (see above).
    The one place where I did use this was for converting .lrf files to .mobi, as the Amazon converter won't do this.
  • kindlegen
    This is a command line program (works on Linux) you can use to convert HTML files to Amazon ebooks. Can be useful if you want to iteratively edit your own HTML and test how it looks, without having to send it via email to your Kindle. Get it from the Kindlegen page on Amazon.

A big old list of books

The links below point either at a page where you can download the book in one or more formats, or to a PDF or HTML version of the book. Where the source is HTML or PDF or something else, I've marked it; otherwise you can assume there's a mobipocket (.mobi) or Kindle (.amz) format version available (Project Gutenberg and ManyBooks both provide these types of Kindle-compatible file).

I've also made zero attempt to organise alphabetically or by date.

Free sf / fantasy / horror / supernatural books

The Master and Margarita - Mikhail Bulgakov (1940)

http://justcheckingonall.files.wordpress.com/2008/03/master-and-margarit... (PDF)
(translation released under Creative Commons licence)

The Worm Ouroboros - E.R. Eddison (1922)

(I've read this - it is hard going, but worth reading if you're interested in the history of fantasy and like archaic English)

The Works of Edgar Allen Poe (5 volumes) (19th century)

Volume 1: http://www.gutenberg.org/etext/2147
Volume 2: http://www.gutenberg.org/etext/2148
Volume 3: http://www.gutenberg.org/etext/2149
Volume 4: http://www.gutenberg.org/etext/2150
Volume 5: http://www.gutenberg.org/etext/2151
(obviously very important in the history of various genres)

Clark Ashton Smith short stories

http://www.eldritchdark.com/writings/short-stories/ (HTML)
(these are in HTML format, but pretty easy to convert to an ebook; I used a bit of scripting to spider the website, munge the HTML files into one big file, then convert the result into a mobipocket ebook)

The Wood Beyond the World - William Morris (1894)

(an early and influential fantasy novel)

The Green Child - Herbert Read (1934)

(apparently quite surreal)

Lilith - George MacDonald (1896)

(a very early, and influential, fantasy novel)

The Marvelous Land of Oz - L. Frank Baum (1904)

(I picked this one as it's the one I loved when I was a child)

The Great God Pan - Arthur Machen (1894)

(an influence on H.P. Lovecraft; I read it, it was reasonably good)

The Three Impostors - Arthur Machen (1895)

(some opinion claims this is one of his best books)

She - H. Rider Haggard (1886)

(I loved King Solomon's Mines when I was younger, so thought I'd try this; it was a pretty good read)

Jurgen - James Branch Cabell (1922)

(infamous fantasy novel which caused a scandal on its publication)

Fantômas - Pierre Souvestre (1915)

(about a master criminal)

The Wallet of Kai Lung - Ernest Bramah (1900)

(set in China)

The Man Who Was Thursday - G.K. Chesterton (1907)

(I read this one: very odd, very readable, amusing, worth a read; reviewed by someone else at http://www.sfsite.com/fsf/2009/cur0901.htm)

The Club of Queer Trades - G.K. Chesterton (1905)

(mystery short stories a la Sherlock Holmes)

The Napoleon of Notting Hill - G.K. Chesterton (1904)


A Strange Manuscript Found in a Copper Cylinder - James De Mille (1888)

(reviewed at http://www.guardian.co.uk/books/2009/oct/03/strange-manuscript-de-mille-...)

A Voyage to Arcturus - David Lindsay (1920)

(apparently very odd and a fantasy classic)

Don Rodriguez: Chronicles of Shadow Valley - Lord Dunsany (1922)

(you can't get The King of Elfland's Daughter (his masterwork) legally in the UK as an ebook, but you can get this, which is meant to be nearly as good)

Nightmare Abbey - Thomas Love Peacock (1818)


Goslings - J.D. Beresford (1913)


The Inner House - Walter Besant (1888)


The Amazing Marriage - George Meredith (1895)

(one of the books Michael Moorcock likes to give away)

Household Tales - Brothers Grimm (1884)

(saw this mentioned by Sarah Waters as a favourite book from her childhood)

Descent into Hell - Charles Williams (1937)

(Williams is mentioned in 100 Must Read Fantasy Novels - he was an associate of C.S. Lewis, and wrote what T.S. Eliot called "supernatural thrillers" - this novel is considered one of his best)

The Place of the Lion - Charles Willians (1933)

(I've read this one: not the easiest read I've ever had: shifts mood very abruptly, has long passages of Christian mysticism, and characters you can't really associate with; but thoughtful, with great imagery, and some genuine moments of psychological horror; has to be read to be believed, really)

War in Heaven - Charles Williams (1930)

(given I enjoyed The Place of the Lion, I thought I'd try this, which is meant to be more straightforward: a Holy Grail thriller with supernatural elements)

The Hour of the Dragon (Conan the Conqueror) - Robert E. Howard (1936)

(the Conan books were the first fantasy books I read when I was about 10; time to revisit them)

Atlantida (aka The Queen of Atlantis) - Pierre Benoît (1919)

(early Atlantis novel - I just finished The Serpent by Jane Gaskell, which ends in Atlantis, so thought I might follow the theme)

The House on the Borderland - William Hope Hodgson (1907)

(I've read this one: an intense weird/horror/supernatural/occult tale)

The Night Land - William Hope Hodgson (1912)

(supposedly very long and hard-going, but considered his best by many)

The History of Caliph Vathek (aka Vathek) - William Beckford (1787)

(proto-Gothic novel)

The Castle of Otranto - Horace Walpole (1764)

(another proto-Gothic novel)

Knock, Knock, Knock, and Other Stories - Ivan Turgenev (collected 2004, 19th century)

(supernatural/mystery tales)

The Witch, and Other Stories - Anton Chekhov (collected 2006, 19th century)


Weird Tales (2 volumes) - E.T.A. Hoffmann (1885)

Volume 1: http://manybooks.net/titles/hoffmannet3137731377-8.html
Volume 2: http://manybooks.net/titles/hoffmannet3143931439-8.html
(Volume 1 includes The Sandman, one of the oddest and most unsettling stories you're likely to read)

Hunger - Knut Hamsun (1890)


Herland - Charlotte Perkins Gilman (1915)

(early feminist sf classic)

The War of the Worlds - H.G. Wells (1898)

(most of Wells' work appears to be available from Project Gutenberg)

The Island of Dr. Moreau - H.G. Wells (1896)

(as recommended by China Miéville in http://www.guardian.co.uk/books/2002/may/16/fiction.bestbooks; will probably read this first out of the H.G. Wells books I have)

Edgar Huntly - Charles Brockden Brown (1799)

(I've seen his work compared to Borges)

The Green Odyssey - Philip Jose Farmer (1957)

(I'm a fan of his stuff, and this novel is public domain)

In the Penal Colony - Franz Kafka (1919)

(don't need to say much about his work, I guess)

The Trial - Franz Kafka (1925)


Metamorphosis - Franz Kafka (1912)


A Princess of Mars - Edgar Rice Burroughs (1912)

(very topical, what with the John Carter film)

The Enchanted Castle - E. Nesbit (1907)


Uncle Silas - Sheridan Le Fanu (1864)


Zuleika Dobson - Max Beerbohm (1911)


The King in Yellow - Robert W. Chambers (1895)

(horror short stories)

The Twilight of the Gods, and Other Tales - Richard Garnett (1903)

(often included in "best fantasy books" lists)

The Coming Race - Edward Bulwer-Lytton (1871)

(lost world story)

Across the Zodiac - Percy Greg (1880)

(early Planetary Romance sf)

The Hampdenshire Wonder - J.D. Beresford (1911)

(child prodigy sf)

The Lost Continent - Charles John Cutcliffe Hyne (1900)

(an early Atlantis story)

The Beetle - Richard Marsh (1897)


The Inheritors - Joseph Conrad and Ford Maddox Ford (1901)

(Conrad's only sf novel)

Greener than You Think - Ward Moore (1947)

(he wrote Bring the Jubilee, considered an sf classic; wonder if this is any good?)

The Monk - Matthew Gregory Lewis (1796)

(proto-Gothic classic)

Dracula - Bram Stoker (1897)


Ghostly Tales (5 Volumes) - Joseph Sheridan Le Fanu (1853 - 1871)

Volume 1: http://manybooks.net/titles/fanujose1169911699-8.html
Volume 2: http://manybooks.net/titles/fanujose1170011700-8.html
Volume 3: http://manybooks.net/titles/fanujose1175011750-8.html
Volume 4: http://manybooks.net/titles/fanujose12641264712647-8.html
Volume 5: http://manybooks.net/titles/fanujose1259212592-8.html

Present at a Hanging and Other Ghost Stories - Ambrose Bierce (collected 2003)


Ghost Stories of an Antiquity (2 volumes) - M.R. James (1904, 1911)

Volume 1: http://manybooks.net/titles/jamesmonetext058jgst10.html
Volume 2: http://manybooks.net/titles/jamesmonetext068jgs210.html

After London (or Wild England) - Richard Jefferies (1885)


Pledged to the Dead - Seabury Quinn (1937)


The Sign of the Spider - Bertram Mitford (1896)

("an adventure of cannibals, slave traders, man-eating crocodiles, fighting off hordes of Zulus and a terrifying spider-beast" - how can I resist?)

The Metal Monster - Abraham Merritt (1920)

(this chap is considered one of the great pulp sf writers; I read The Ship of Ishtar, which was a rollicking good adventure)

Widdershins - Oliver Onions (1911)

(contains The Beckoning Fair One, considered a classic ghost story, which I've never read)

The Tower of Oblivion - Oliver Onions (1921)

(reviewed at http://www.sfsite.com/fsf/2001/cur0105.htm - sounds good)

Where the Blue Begins - Christopher Morley (1922)

(reviewed at http://www.sfsite.com/fsf/1999/cur9906.htm; quite a peculiar book about an anthropomorphised dog who works in a department store)

The Pathless Trail - Arthur O. Friel (1922)

(mentioned at http://www.strangehorizons.com/reviews/2011/01/2010_in_review-comments.s...)

Wuthering Heights - Emily Bronte (1847)

(never read this, but meant to be good and gothic)

Modern Creative Commons / free books

Agent to the Stars - John Scalzi (1999)


Down and Out in the Magic Kingdom - Cory Doctorow (2003)

(much (all?) of Doctorow's work is Creative Commons, though I've yet to read any, I'm embarassed to say; full list at http://manybooks.net/authors/doctorow.html)

Painkillers - Simon Ings (2000)

(I've read some of his short stories, and thought this might be worth a punt)

The Ware Tetralogy - Rudy Rucker (2010)

(comprising Software, Wetware, Freeware, and Realware; I read one of his novels years ago (I think it was Software), and keep meaning to read these)

The Hollow Earth - Rudy Rucker (1990)

http://www.rudyrucker.com/thehollowearth/rucker_hollow_earth_cc_jan_17_2... (HTML)
(steampunk - see http://steampunkscholar.blogspot.com/2009/07/interview-with-rudy-rucker-... for an interview where Rudy Rucker discusses this novel)

Glimpses - Lewis Shiner (1993)

http://www.lewisshiner.com/liberation/glimpses.pdf (PDF)
(this one one the World Fantasy Award in 1994; Creative Commons Attribution-NonCommercial-NoDerivs; more of his work for free at http://www.lewisshiner.com/liberation/index.htm)

Move Under Ground - Nick Mamatas (2004)

http://www.moveunderground.org/ (HTML)
(Cthulu mythos story written from the perspective of Jack Kerouac - got to be worth a look; Creative Commons Attribution-NonCommercial-NoDerivs 2.5)

Accelerando - Charles Stross (2005)

(Creative Commons)

Magic for Beginners - Kelly Link (2005)

(recommended by China Miéville in http://www.guardian.co.uk/books/2002/may/16/fiction.bestbooks; Small Beer Press are to be applauded for making some of their titles available under Creative Commons licences)

Items available in other countries

If you are lucky enough to live in the US, Canada or Australia, you have access to a few more gems:

Bright of the Sky - Kay Kenyon (2007)

(available for free for Kindle in the US)

The Nose - Nikolai Gogol (1836)

http://www.gutenberg.net.au/ebooks06/0602381h.html (HTML)
(absurd classic; public domain in Australia)

The King of Elfland's Daughter - Lord Dunsany (1924)

http://www.mobileread.com/forums/attachment.php?attachmentid=21611&d=123... (PRC)
(public domain in Canada)

Consider Her Ways - Frederick Philip Grove (1947)

http://gutenberg.net.au/ebooks02/0201151.txt (TEXT)
(public domain in Australia)

Collected Stories - H.P. Lovecraft (collected 2006)

http://gutenberg.net.au/ebooks06/0600031.txt (TEXT)
(public domain in Australia - the same as the Kindle edition you can buy for 72p from Amazon in the UK...suspicious...)

Orlando - Virginia Woolf (1928)

http://gutenberg.net.au/ebooks02/0200331.txt (TEXT)
(public domain in Australia)

The Ship of Ishtar - Abraham Merritt (1924)

http://gutenberg.net.au/ebooks06/0601941.txt (TEXT)
(public domain in Australia; pulp classic)

The War with the Newts - Karel Čapek (1936)

http://gutenberg.net.au/ebooks06/0601981h.html (HTML)
(public domain in Australia)

Last and First Men - Olaf Stapledon (1930)

http://gutenberg.net.au/ebooks06/0601101.txt (TEXT)
(public domain in Australia)

Melmoth the Wanderer - Charles Robert Maturin (1820)

http://www.gutenberg.net.au/ebooks07/0700551h.html (HTML)
(public domain in Australia)

The Haunted Woman - David Lindsay (1922)

http://www.gutenberg.net.au/ebooks06/0608401h.html (HTML)
(public domain in Australia; a "dark, metaphysical fantasy novel" according to Wikipedia - http://en.wikipedia.org/wiki/The_Haunted_Woman)

Thunder on the Left - Christopher Morley (1925)

(public domain in Canada; not sf or fantasy, some consider it marginally a ghost story, but an odd, interesting and melodramatic read)

Books read 2011

Rather belatedly, here's a list of books I read in 2011, 77 in number. The ones with '*' are the ones I particularly enjoyed.

  • The Other City by Michal Ajvaz
  • The Broken Sword by Poul Anderson *
  • Three Hearts and Three Lions by Poul Anderson
  • Satyrday by Steven Bauer
  • Talking Man by Terry Bisson
  • The Other Side of the Mountain by Michael Bernanos *
  • The Stars My Destination by Alfred Bester
  • The Last Starship from Earth by John Boyd
  • A Confederate General from Big Sur by Richard Brautigan
  • The 39 Steps by John Buchan
  • Rogue Moon by Algis Budrys
  • The Hearing Trumpet by Leonora Carrington *
  • A Child Across the Sky by Jonathan Carroll
  • Outside the Dog Museum by Jonathan Carroll
  • White Apples by Jonathan Carroll
  • The Marriage of Sticks by Jonathan Carroll
  • The Man Who Was Thursday by G.K. Chesterton
  • The Death of Grass by John Christopher
  • The Hunger Games by Suzanne Collins
  • Over Sea, Under Stone by Susan Cooper
  • The Dark Is Rising by Susan Cooper
  • The King of Elfland's Daughter by Lord Dunsany
  • Sum by David Eagleman
  • The Worm Ouroboros by E.R. Eddison
  • The Fahrenheit Twins by Michel Faber
  • Under the Skin by Michel Faber *
  • The Circus of Dr. Lao by Charles G. Finney *
  • The Unholy City by Charles G. Finney
  • The Ghosts of Manacle by Charles G. Finney
  • The Weirdstone of Brisingamen by Alan Garner
  • The Moon of Gomrath by Alan Garner
  • The Serpent by Jane Gaskell *
  • The Inheritors by William Golding
  • The Spire by William Golding
  • She by H. Rider Haggard
  • Shit My Dad Says by Justin Halpern
  • The Lion of Boaz-Jachin and Jachin-Boaz by Russell Hoban
  • The Story of the Stone by Barry Hughart *
  • Bridge of Birds by Barry Hughart
  • The Hermit by Eugene Ionesco
  • The Mortmere Stories by Christopher Isherwood and Edward Upward
  • Comet in Moominland by Tove Jansson *
  • Moominpappa at Sea by Tove Jansson
  • The Gunslinger by Stephen King
  • The Drawing of the Three by Stephen King
  • Wizard and Glass by Stephen King
  • The Waste Lands by Stephen King
  • A Wizard of Earthsea by Ursula Le Guin *
  • The Tombs of Atuan by Ursula Le Guin
  • Galaxies by Barry Malzberg
  • The Great God Pan by Arthur Machen
  • A Game of Thrones by George R.R. Martin
  • The Box of Delights by John Masefield
  • All the Pretty Horses by Cormac McCarthy
  • The Forgotten Beasts of Eld by Patricia A. McKillip
  • Ombria in Shadow by Patricia McKillip
  • The Riddle-Master of Hed by Patricia A. McKillip
  • The Ship of Ishtar by A. Merritt
  • In the Penny Arcade by Steven Millhauser
  • The Sword of the Dawn by Michael Moorcock
  • The Runestaff by Michael Moorcock
  • The Weird of the White Wolf by Michael Moorcock
  • The Steel Tsar by Michael Moorcock
  • Jirel of Joiry by C.L. Moore
  • Where the Blue Begins by Christopher Morley
  • Altered Carbon by Richard Morgan
  • 52 Ways of Looking at a Poem ed. by Ruth Padel
  • Duke Cosimo by Akbar del Piombo
  • Stirk of Stirk by Peter Tinniswood
  • The Languages of Pao by Jack Vance
  • The Ice Palace by Tarjei Vesaas
  • Mistress Masham's Repose by T.H. White
  • The Place of the Lion by Charles Williams
  • A Haunted House and Other Short Stories by Virginia Woolf
  • Jog Rummage by Grahame Wright *
  • Howl's Moving Castle by Dianne Wynne Jones
  • Nines Princes in Amber by Roger Zelazny
Syndicate content