Author Archives: mattf

About mattf

I work on transportation and mobile applications at work and even sometimes at home. The stuff that googling didn't 100% solve gets documented here when I have time.

AudioRecord plugin on Cordova/Phonegap 1.9.0

Phonegap’s Media.startAudioRecord on ios records 16 bit stereo uncompressed WAV. Not exactly ideal for uploading afterwards. The AudioRecord plugin for ios allows full access to the available Core Audio encoders. The installation instructions are less than required, so after piecing together some items from across the web, here are some edited instructions (if I knew my way around GitHub, I would try to add this directly to the plugin’s page):

  1. Make sure your PhoneGap Xcode project has been updated. [comment: whatever that means, I did not do this]
  2. Add the .h and .m files to your Plugins folder in your project, by dropping them into the folder in XCode itself
  3. Add the .js files to your “www” folder on disk, and add reference(s) to the .js files in your html file(s). [This is not necessary, as we will do the link differently]
  4. Add the following to your onDeviceReady() function:

  5. Media.prototype.startRecordWithSettings = function(options) {
    Cordova.exec(null, null, "AudioRecord","startAudioRecord", [, this.src, options]);
    Media.prototype.stopRecordWithSettings = function() {
    Cordova.exec(null, null, "AudioRecord","stopAudioRecord", [, this.src]);

  6. Use this as a framework for modifying your existing media.startAudioRecord() and media.stopAudioRecord() usage – the file supplied should be .caf and not .wav

  7. var recordSettings = {
    "FormatID": "kAudioFormatAppleLossless",
    "SampleRate": 44100.0,
    "NumberOfChannels": 1,
    "LinearPCMBitDepth": 16

    // Stop recording after 10 sec
    var recTime = 0;
    var recInterval = setInterval(function() {
    recTime = recTime + 1;
    setAudioPosition(recTime + " sec");
    if (recTime >= 10) {
    }, 1000);

  8. A list of the valid audio formats can be found within the AudioRecord.m file or with some more explanation at

Other References:

Upgrading Drupal 6 to 7

So, I’m finally going to take the plunge; first with a test, local site, and then with

Only found one point to watch out for, in addition to the clear advice at: It really is important to update to the current Drupal 6 before upgrading; that isn’t just ‘in case’ some assumptions are not fulfilled; the update script refuses to even start without it.

Playing music in track order on the Samsung S5230 Star

I received this phone in order to test the Deutsche Bahn “Touch and Travel” system (the phone has NFC, and lets you buy tickets by touching little masts when you enter and leave various trains). By now, they figured out that not everyone will ever have NFC, and embraced QR codes in addition. Quite an expensive experiment. But in any case I have a free phone which I don’t actually need for calling anyone. I use it to take videos and photos when on the move, and I wanted to use it to listen to music (since I’m carrying it all the time anyway and my iPod was stolen in 2010, and the iRiver we had is a brick and has some weird power issues). Occasionally, I even buy a train or subway ticket.
Any music you put in the phone’s or SD card’s memory (up to 8GB is supported) will be indexed by the MP3 player. It uses the tagging information. But it ignores the track numbers. They are not and cannot be used to sort the music (as far as I could tell). The songs are sorted by alphabetical order. I generally listen to albums, so this was a real pain. The solution I found is a bit of workaround, but works. I use iTunesAgent to sync a selection of iTunes music to the phone. Then I use mp3tag (yes, it deals with MP4 tags aswell) to batch remove all Title Tags from all files. As iTunes names its files with the track number first, and (as you might expect), the phone is forced to use the filename instead of the Title Tag, I end up with tracks in track order. mp3tag can also batch rename files based on the tag information, so if your music isn’t named this way you should be able to fix that too. The only tiny disadvantage is that the name of the track includes a number when displayed.

iPAQing kicking the iPhone’s ass

I thought I’d go for a provocative title, but let’s say from the outset that the iPhone is clearly better in many, many ways than the device I’m about to ‘ramble’ about…

My girlfriend, Birgit, has an iPhone. What’s more, she has a contract where you can pay €30 once, and you get a second SIM card. A second sim card, with unlimited data plan!? Now this seems like too good an opportunity to miss. My original motivation for this was receiving a new laptop that had a sim card slot, for mobile internet (my workplace is not quite so kind as to put something in it…). Part of the motivation too was the length of time it took to get internet in my apartment (its hard when there’s no telephone socket…). At first I put the sim card in and had a lot of fun. A little too much fun: T-Mobile SMS’d Birgit to say her usage was unreasonable and they were reducing her bandwidth.

Of course, seeing this iPhone all the time got me thinking… in America I could use a little bit of free WAP from T-Mobile, but I’d inherited Birgit’s old American Nokia which claimed to do real web browsing. Also, knowing a tiny bit about phones, I knew there were these things called data cables and that maybe I could get mobile phone internet and mobile laptop internet all at once. This had the slight disadvantage that I had to use another phone/sim card to actually phone, otherwise I’d be calling on Birgit’s number. I’ll spare you the fun of how this all worked out, suffice to say:

  • The Nokia web browser was unbelievably slow
  • It was missing the radio band that T-Mobile use outside of cities… so it wasn’t much good for my frequent train journeys
  • Don’t underestimate how capable your old phone might be with a data cable and a data plan – if it hadn’t have been for this band issue I might have been happy

At the same time, Birgit didn’t need her old iPaq anymore – after all she had an iPhone now (but actually I’d used it long before she had the iPhone, she is someone who firmly believes that everything should be in one device instead of two, so the idea of carrying a phone and a PDA didn’t appeal).

Now, this iPaq is quite old – no wifi, no sim card slot, no camera, and the Bluetooth profiles don’t support connecting to the internet over an access point, but they do over a connection to another phone. But… the Nokia didn’t have Bluetooth. One can browse the internet if you use activesync over bluetooth… but that isn’t exactly mobile. There were initially two options I considered. One was to build a cable to match the serial ports (lots of signal conversion that has to be done), and the second was to buy an extension pack to take a sim card and turn the iPaq into a phone. The former was complicated (though I didn’t rule it out) and the second was difficult because the packs are few and far between: to buy them new/refurbished was approaching $299, and the Ebay opportunities usually involved buying an iPaq with them, which seemed a bit silly!

So, after realizing I really liked the Windows Mobile platform, some more pondering and automated ebay searching, I picked up a much newer iPaq (Windows Mobile 2003 instead of 2002) for around €50. This particular model (an hw6510) was usually selling for much more than that, and the one I got was in a real state – dirty, and the screen doesn’t show green. After some cleaning it was a lot less disgusting, although the green was still missing(!) Apart from that it worked great, as a modem, as a note taker (it has a built in keyboard, with real keys), a radio listener, and as I recently discovered, a GPS-powered Google Maps navigator, just like an iPhone!

The main subject of this post is about getting Java working on the phone, not because that’s the most interesting thing necessarily, but because it involved so much googling that I felt I should archive the steps and useful info somewhere so I don’t forget them. It’s also a vaguely interesting issue in general for mobile technology, because Java ‘MIDlet’ packages were a really good way for services to provide cross-platform applications for phones. However, the future now looks quite bleak. Microsoft never supported them explicitly, the iPhone doesn’t support them, and the Blackberry provides extra classes so that the system still works as a delivery mechanism, but only for a Blackberry. The big supporter of MIDlets is Nokia.

So, my iPAQ didn’t want anything to do with MIDlets. The previous one had come with a 3rd party JVM called Jeode, but my new iPaq didn’t come with a CD, and the internet suggested the CD that would have come with it did not contain the wealth of goodies that the old one possessed (for example, a Sega Game Gear emulator!). And alas, the old software would not run on the new iPAQ.

For a good overview of what the options are, I refer to this pretty comprehensive post. The conclusion is that most available JVMs have some defficiencies, but that Esmertec Jbed is the best, but only if you have Windows Mobile 5 or better. Next one down, and basically the only option for me, is the IBM J9. Jeode appear to have disappeared completely off the radar.

Obtaining J9 is a little tricky, unless you’re willing to part with $25 (or possibly $5.99, I can’t tell which version I’m supposed to buy) and hope that it works (again, I can’t tell which one I’m supposed to buy…!). I’m not sure if IBM have removed it completely or if its just for people outside of the US (I believe its the former), but it was never designed to be free as such. IBM gave it away as part of a 30 day trial of a larger development package which included software for mobile device deployment, WebSphere Everyplace Micro Environment MIDP 2.0. Some might already call it a grey area, but out of curiousity and fear that it wouldn’t work, I searched for provision of the necessary files elsewhere. Eventually I was successful (that part I won’t link to here… ) and after a lot of pain with a .cab file that wouldn’t work (I had to expand the files and add the registry keys manually), it worked!

So… why!? I thought I’d leave this part to last. There is one main reason people try to get this working on their phones: Opera Mini. As opposed to Opera Mobile, which is also a great browser, it is free, and the webpages are compressed and formatted via Opera, so it runs very fast. Of course in some cases you might not want pages to be squished into one column, but there are many cases where you might, and for pages already formatted that way, all you see is a speed/phone bill advantage. So far I also found a few other cool MIDlet apps: GMail, Mobile GMaps and RMV2Go (which will only be of interest if you live in Frankfurt). The links for GMail are below, as they don’t tend to direct you to it anymore:

A little tip: with the IBM software, it will accept .jar files directly aswell as .jad, and if you want to installed directly from the phone (which is sometimes easier), use file:/// (with 3 slashes!) then the path on the phone. Markus Brosch’s blog gives a nice background/history using the J9 software, and also gives some example of how to create a link in the Programs menu to launch a particular app directly. I’m still seriously considering buying a copy, if I knew exactly what I should buy – the Handango links below all claim the software isn’t compatible with my device:

So in conclusion, why does the iPAQ kick the iPhone’s ass? Well, it doesn’t really, but here’s a few advantages I’ve found so far:

  • The main topic of this post: I can run software, any software that someone cares to write, such as a JVM. It sounds like SUN have a JVM ready for the iPhone, but they are prohibited from releasing it.
  • Apps run in the background automatically, so I can tune in to the radio on Windows Media Player and then go do something else
  • Syncing with Outlook is easy
  • Tethering is easy, in fact it will now be prohibited on Birgit’s phone on iPhone OS 3.1, even though she is one of the early customers who are actually allowed to do it (and getting it working on OS 3.0 wasn’t easy either)
  • I can access any part of the file system
  • I can insert SD cards
  • I can access Bluetooth access points (though this is hardly an advantage when you consider I can’t access wifi access points without a plug in card…!)
  • I have a REAL keyboard as well as a touchscreen (though not multitouch, of course)!

I think I’m still finding this last one the biggest difference. As for the coolest thing, I’m still finding the GPS incredible, its one of those things I never thought I’d need, but it makes finding things in a city I don’t well very easy…


And so it is, the neverwhere of the day after Boxing Day. That day when you know you really should start doing some real work, but you can’t, either because you’re too full of Christmas cheer, or recovering from being poisoned by dodgy German-Chinese food.

So I figured I’d do some more PHP/web stuff, and that seems to be the kind of thing people on this site write about, so its somewhat fortuitous (Ian loves that word) that Matt (the other one) introduced me to this site.

The project is to allow feedback on images/vides posted on my image management site, fire-flash. Fireflash the site does exist, but it doesn’t work, so don’t go there. The PHP backend however has been fixed and put to good use on, in a fairly generic way. I’m preparing it (using the aforementioned site as a testbed, bad, I know, especially for someone who co-owns a server… ) for use on, a site that might look like its using some sort of automagic video-adding system, but isn’t, its all static apart from the video player. The video player, will in turn make it into the main fireflash code. Eventually then, I will have something entirely generic that can be dropped into any site anywhere, by which time someone or some group of people will have done something 10 times better, but such is life. A conversation I had with someone about a year ago made me think this might still be worth doing, so I’ve been slowly persevering ever since. And as they say, there’s only one way to learn…