Surmise

Welcome to blogs.surmise.co.uk, the place for random technical ramblings. Enjoy.

MattF's ramblings

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.id, this.src, options]); }; Media.prototype.stopRecordWithSettings = function() { Cordova.exec(null, null, "AudioRecord","stopAudioRecord", [this.id, 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 } mediaRec.startRecordWithSettings(recordSettings); // Stop recording after 10 sec var recTime = 0; var recInterval = setInterval(function() { recTime = recTime + 1; setAudioPosition(recTime + " sec"); if (recTime >= 10) { clearInterval(recInterval); mediaRec.stopRecordWithSettings(); } }, 1000);
  8. A list of the valid audio formats can be found within the AudioRecord.m file or with some more explanation at http://developer.apple.com/library/ios/#qa/qa1615/_index.html
Other References:

David's Blog

Started sorting out my email today, I am quite the hoarder keeping 3 copies of every email I've received for over a decade. It turns out that Thunderbird isn't up to the task of deleting quite so many emails in one go, so I ran Mutt on the server to do the job. Thanks to https://wiki.engr.illinois.edu/display/~mussulma/mutt+and+Exchange for this tip: Mutt tricks Tag messages in a folder older than 30 days and then delete tagged messages, then purge deleted messages T ~d >30d ;d $ Also useful: http://www.mutt.org/doc/manual/manual-4.html I particularly like the look of ~z [MIN]-[MAX] messages with a size in the range MIN to MAX *) for deleting old, large attachments.

MattF's ramblings

So, I'm finally going to take the plunge; first with a test, local site, and then with mattbirgit.de. Only found one point to watch out for, in addition to the clear advice at:  http://drupal.org/node/570162: 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.

MattF's ramblings

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.

David's Blog

I'm currently trying to set up mallard with a proper ssl certificate (free ones are available from www.startssl.com). The authority requires some sort of client certificate form of authentication to login to their site. Unfortunately Chrome from Linux doesn't yet support this properly. After much googling I found that I could export my certificate from Chrome and then import it into Firefox: pk12util -o certfile.p12 -d sql:$HOME/.pki/nssdb -n The certificate's name is obtained running certutil -d sql:$HOME/.pki/nssdb -L (Source: serverfault)

MattF's ramblings

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: http://gmail.com/app/v1.0.0/en/gmail-g.jar http://gmail.com/app/v1.0.0/en/gm-Generic-Advanced_MIDP2.jad 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: http://www.handango.com/catalog/ProductDetails.jsp?storeId=2218&productId=140968 http://www.handango.com/catalog/ProductDetails.jsp?storeId=2218&productId=140997 http://www.handango.com/catalog/SearchResults.jsp?storeId=2218&Ntt=ibm 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...

David's Blog

There is a bug in the f-spot facebook extension included with Ubuntu Gutsy and Intrepid (F-Spot crashes during authorization exporting to Facebook if friend IDs are large).  Didn't want to wait until Jaunty to upload pictures to Facebook, so I've compiled FacebookExport.dll using the upstream patch and copied it over /usr/lib/f-spot/extensions/FacebookExport.dll (making a backup of course!).  Works for me, but no gaurentees.

Matt's Blog

Simple Answer Use Right-ALT + 3 to type a # on Linux using a UK Apple Mac Keyboard. The Slightly Longer Answer The UK Apple keyboard layout does not have a Hash (#) key on it, and in mac it is typed by pressing ALT+3. This didn't appear to work in Xubuntu, until I ended up mashing the keyboard with anger and found out that you need to use the right alt key, then it works. No, it's not that interesting, but if someone is as silly as me, and googling for an answer, I hope they find this :)

David's Blog

ntpd is now working on mallard (so the clock is nolonger 3min slow). Apparently restrict -4 default ignore was to strict to actually synchronise with other servers, but restrict -4 default noquery nomodify nopeer notrap seems to work.

Max's Blog

Guitar geeks might be interested in this. Finally finished my first all valve amp. It's basically a 70s Marshall 2204 JMP Master Volume (which then became the original JCM800 in the early 80s) with a couple of tweaks to the tone stack and a power amp direct in so I can use my JMP1 pre amp with it if i ever desire to. The wooden box was made from an old door that was kicking about my dads garage. Not sure if i'm going to leave it pure wood or paint it/tolex it. I'll have to see. The mains transformer is a weird one and seems to be giving pretty high B+ and heater voltages on its output (about 7.2V rather than 6.3). From what I can tell, it warms the tubes up alot more than usual, which means more electrons will be dissipated from the cathode which will either mean earlier saturation or MORE VOLUME! It will mean a shorter tube life, but I think I can live with it. Can't really do a thorough test as my neighbors and house mates are sleeping but watch this space for sound clips.. In a bit.. M wires! Done!Top Down