Playing iPhone Music on a Motorcycle through a BlueTooth Headset

I use my iPhone with a headset during my motorcycle rides to and from work – it allows me to receive Cell calls. One thing that was bothersome was the lack of the ability to play music through the in-helmet bluetooth headset.
Now of course this is a headset aimed at voice so it uses the non-stereo, low-fidelity bluetooth so I am not looking at concert quality (i.e. this is *not* A2DP).
I saw some blog posts about how to use the Voice Mail feature to function as a work around.
Here is what you do: (1) Set up and pair up your bluetooth headset and make sure it works for phone calls, (2) Go into your iPhone iPod app and start playing something, (3) go into the phone app and go into voice mail – where it used to say “Speaker” it now says “Audio” – for me it just starts playing in the headset as soon as I am in the Voice Mail screen. I assume it routes audio-out to the headset so you can hear voice mail messages and until you play a voice mail message the music just streams to the headset. At that point do not press any more keys and you will hear your music.
It may be OK for a regular Bluetooth headset walking around – but in my motorcycle helmet the fidelity for music was so bad that it was almost pointless. However when I switched to a book on tape it was passable. So I will listen to all my books on tape on during my motorcycle commute.
My headset is a BlueAnt Interphone. I really love the headset – the microphone is amazingly good – the speaker could use a little noise canceling action – I have to put it pretty close to my ear to have a conversation at 70mph.
I cannot wait for the new iPhone 3Gs and its new voice dialing – oh yeah – when I buy it (after the lines to buy get shorter) – I will do a on-motorcycle review if the iPhone 3Gs+Blue Ant. I hope they don’t break the voice mail hack so I can listen to my books on tape while riding with no extra hardware.

Initial Hacking of Java App Engine on Macintosh

I started building my first Java App Engine Application. I added the plug in to Eclipse and created my first application. Make *sure* to uncheck “Use Google Web Toolkit” unless you really want it. If you are just making a simple servlet – you probably don’t want GWT.

Other than that, it is amazingly simple. When I skimmed the documentation it appeared that not much changed except for the addition of WEB-INF/appengine-web.xml file – and that was pretty much it. The rest is pretty much pure servlet. Sweet.

When you use the Run, option it runs Jetty which puts your application at / (i.e. not /servletname). Somehow, there is no way to stop Jetty when you need to recompile a class and want a full re-deploy. Now I don’t know how well Jetty does with hot-deploy – maybe you just recompile. But for us Tomcat refugees we want to restart once in a while.

Here is how I do it with my Mac:

ps -ef | grep geronimo | grep -v grep | awk '{print "kill " $2}' | sh -x

Then just run your app again from Eclipse.

The next thing that went wrong is something strange with the Mac Java VM and the harsh security confines of the App Engine – HMAC signing using a native library on the Mac – so you get this sweet traceback:

java.security.AccessControlException: access denied (java.lang.RuntimePermission loadLibrary.keychain)
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:264)
at com.google.appengine.tools.development.DevAppServerFactory
at com.apple.crypto.provider.HmacCore.(HmacCore.java:26)
at javax.crypto.Mac.init(DashoA12275)
at net.oauth.signature.HMAC_SHA1.computeSignature(HMAC_SHA1.java:74)

Now this is *not* a problem on a deployed Java Application on the Google production environment – but it makes testing kind of less fun. So the workaround is make the following setting:

Eclipse -> Propject -> Properties -> Run/Debug Settings -> select your target -> Edit -> Arguments -> VM Arguments

-D--enable_all_permissions=true

Now you might get in trouble because you end up with something working on your mac that fails on the GAE production because it bypasses the Java policies – but at least you can HMAC on your Macintosh.

Cool Mail Message – Creative Commons

I got this really cool mail message

Hello Mr. Charles,
As a member of Linux Kullanıcıları Derneği (Turkish Linux Users
Association) we are preparing a documentary called "Free Software in
the World and Turkey". We have a part about Apache in the script and I
wanna use a part of your "Internet and Web Pioneers: Brian Behlendorf"
at http://www.youtube.com/watch?v=23F70w3atsM
We will release the documentary with GPL and I need your permission to
use your video with appropriate license.
Thanks in advance,
Baris
Member of Turkish Linux Users Association

Of course I said “yes” and sent Baris a high quality copy of the video. This is what Creative Commons Attribution is all about!

Google Wave – 24 hours In

I am still absolutely loving Google Wave. I now have a a Wave with Victor Maijer were we were trying to figure out how he could speak Dutch using Rosy the robot and then he had to go to a meeting. Michael Sofaer made a robot so we could find folks since the lookup function is not all there yet.
In general I am loving it still and now when I use Facebook and Twitter – I just wish all my pals were in Wave now. I don’t completely like the UI – but the combination of collaborative editing and threaded instant messaging and a nice sorted inbox are nice – it just needs to somehow be rethought to give me what I want when I want it.
I looked more into group support and found this page:
http://www.waveprotocol.org/whitepapers/google-wave-architecture
It talks about groups – but comes up way short of the feature set I want. You can add a group (i.e. pure list of folks) to a wave. What I need is groups plus roles within group and I would a wave to be ownable by a group.
We also need ways to permit wave writing and reading (and perhaps a few other permissions) based on group membership.
I think that this an be made to work if (a) groups can be provisioned by robots, and (b) there is a finer grain permission scheme than “this person or this group is a member of this wave”.
It is funny – in the welcome waves they had to lock down permissions so we would not hack their “welcome waves” – they apologize that the software does not deal gracefully with attempting to edit waves that you cannot edit. Hmmm. Sounds like the Wavemeisters are quickly reaching the same requirements conclusion. So why not dive in and just add context, group, role, and permission across the board. Hee hee – once I get stuck on something I just keep saying it over and over.
I will also say over and over that Wave is sooo cool – with some rethink of the UI and some smart robots – Wave is the answer to a communications and document dashboard and lets us combine Facebook, Twitter, Email and IM together – Wave On!

Shipping a Laptop

Funny that Google cannot tell me how to pack a laptop for shipping. I tried all kinds of searches and as soon as I said “laptop” – Google gave me page after page of results which wanted to sell me something.
So here is how you ship a laptop. Go to Fed Ex and purchase a $10.00 laptop box – it is specially padded and very cool and adaptable to any sized laptop. Perhaps UPS has such a thing as well.
Here is a URL:
http://fedex.com/us/office/services/packandship/supplies.html
They won’t insure your laptop unless you use this box. At $10.00 it is a bargain – much cheaper than wrapping your laptop in bubble packing material putting it in a box.

Reducing Data Store Contention in App Engine get_or_insert

I was giving a demo at the Apple Academix Conference during a keynote where I use a Google App Engine application to simulate a clicker-like activity in a course. It is a simple multi-user number guessing game. Whenever the audience participation was too good and too many people started clicking on the application I would get errors – it made the demo in the middle of my talk lose a bit of credibility – but it was also funny.

I finally saw the error and spent a few hours to track the issue down. I was getting the following message:

TransactionFailedError: too much contention on these datastore
entities. please try again.

I had been using get_or_insert() pretty much with reckless abandon and wondered if it was smart enough to optimistically do a get() and see if the object was there before starting a transaction to do the get() and then put() if necessary. But given the behavior I was seeing – it looked like it was starting a transaction every time.

I had 20 participants and after the first click in the application, there were no new objects in the application and 20 people clicking within a 10 second interval were causing the error to occur. I suspect but cannot confirm that at some level the AE framework marks you as abusing transactions and then it takes a while before load drops down that it lets you once again use transactions.

So I decided to reduce my transaction abuse and build an optimistic get or insert that does the get() first and then if the record does not exist do the get_or_insert(). This way once objects start to exist there will be no more transactions. And yes, my next optimization is to use memcache.

So this was my approach.

Continue reading

Mac Air Hinge Problem – Reasonably Good Outcome (aka Mac Air Hinge-Whinge)

I have a Macintosh Air (first revision) that I purchased the day they were announced. I loved the unit – my only complaint was that the disk was a bit small. But the rest of it was so nice – it has been by my side constantly from the time I purchased it.
About a 2 weeks ago, it developed the dreaded “Dying Hinge Problem” – so I started to search the Internet and found that Apple is categorically refusing to repair these problems claiming that it is “abuse” and as such not covered under AppleCare. There are many vitriolic blog posts and a cool YouTube video where a guy stabs his Air with a knife (really) to kill it and then switches to an IBM ThinkPad.
I have been traveling since the problem appeared so I really could not deal with the problem until I got back. Whenever I was a bit bored I would Google more and kept coming to the same conclusion – I was screwed. Not only was I screwed – but I was going to have to have a bunch of really frustrating conversations with Apple as I tried to get the defect repaired – I kept running these imagined conversations over and over in my head in the Ann Arbor Apple store – and over and over I lost the conversation after much frustration and wasted time where I was mean to the employee and then went to the manager and shouted at the manager. I imagined making a fuss in the store to embarrass them into fixing their defect for free and failing to get my Air fixed – instead I just looked like a fool.
Now let me just say that this is a defect – the box was not dropped – I did not use my MacBook to shovel snow or remove roof shingles. Often my laptops get dropped once (and survive) but this one never was dropped. I have had 4 Apple Laptops over the past six years (and loved them all). Every single laptop ended up with a dead hinge except one. The mean time to hinge wear is 3-5 years – it just happens. It is *so* consistent that the only reasonable assumption is that the failure is engineered in to make sure that laptops don’t last forever – forcing us to upgrade. The only mistake in the first generation Mac Airs is that it gives up a year *before* AppleCare expires and not a year *after* AppleCare expires. A slight engineering mistake – best solved by simply telling everyone that if it failed before the designed-in 3.5 year failure period – then it *must* be abuse! So Sayeth Apple and we must obey!
Back to my story. I got back from England yesterday and was ready to start my battle with Apple – I decided to start online so I went to Apple Support online and typed in my serial number. And then I received the wonderful news that my laptop was not covered under warranty!
This made perfect sense – I had not purchased AppleCare when I bought the box (the $1799 edition) and thought to myself – “What might go wrong with this box that Apple would agree to fix?” Now that Apple insists on their service centers fixing things it is easier to simply characterize anything as abuse if they don’t want to fix it.
So when I calculated the things that Apple would fix and multiplied it by the probability that one of those (very few things) would go wrong and multiplied it by $1800 – I simply decided to keep my $250 and apply it to my next computer.
Damn – I was right – I am a genius! I am now sitting on a broken Mac Air with a defect that the Apple Borg would declare as abuse and waste *hours* of my time arguing about after which I would invariably lose anyways.
Not only did I save money with this decision – I saved time and peace of mind – an all around win! I do need a new laptop now because the Hinge problem (a defect) will just get worse – so I need to put this Mac Air into light duty.
Of course because of my wisdom, I keep my $250 and apply it to my next Apple purchase. I still love Apples and still will buy an Air as a replacement – the Rev 2 systems are faster with a larger hard drive anyways and I might just get a 13″ Aluminum MacBook anyways – a little more weight and a DVD and the ability to plug in audio cables without going insane and $400 cheaper and a larger hard drive and and and… Hmmm.
So here is my general recommendation to folks – keep buying Apples – if you get mad at Apple when they choose never to fix things and blame you – don’t switch to PC – just buy your laptops differently from Apple: (a) Buy the bottom of the line that you can tolerate – don’t buy that super-duper system and (b) don’t buy AppleCare! Perhaps if enough of us do that – they will get the picture.
This way you upgrade almost twice as often for the same price. Also those broken hinge computers make good servers or even desktop systems – you just need to stop hauling them around and opening and closing them. They last for *years* with the broken hinge.
P.S. The only computer of the four Mac laptops I have purchased that has *not* developed the hinge problem was the MacBook pro that was only 1 year old when I switched to the Air. Since then it mostly sits on a desk as my desktop.
P.P.S. The sad thing here is that this *is* a defect – it is exacerbated the more you use the system – lots of travel lots of security checks – working in airplanes – working in airports – working on a bus – make a laptop’s life rough. In a sense because the Air is so wonderful – we use the living crap out of them. It is sad that Apple can’t put a little more engineering into these boxes (hinges in particular) to support heavy use to insure these systems do last at least 3 years under heavy use conditions.
P.P.S. I am amazed at how solid my first-generation iPhone is. Prior to having the iPhone Generation-1 I had a series of Treo’s that never made it past 10 months before it looked like they had been through a war (I travel a lot). The iPhone gen-1 is over two years and there is almost no wear at all – very impressive engineering. Perhaps Apple should just make their next generation of laptops “hinge-free” and have a slide-out keyboard or on screen keyboard (or both!)

Sling/Sakai Building a Widget

Fresh off getting my first Sling Application finished last night – I came in and told Ian that I had nothing to do today. Of course he said “no” – I needed to build a widget for LTI as well. I said “what widget” and he said that the whole Slikai UI was there under http://localhost:8080/dev and I needed to write a Widget.

I started work at 10AM – with a quick tutorial from Nico and his HelloWorld example, I hacked away at it. After about 2 hours working by myself I had it doing settings and creating the resource. At that point Nico helped me do the actual launch iframe and a few nice bits like a cancel button and it was done and put some polish on it.

It was done three hours after I started – and this was my first widget since I tried back in July 2008. I was pretty pleased with the ease of figuring things out – maybe I just knew more about AJAX, jQuery, JavaScript, and FireBug after writing those chapters in the book. However and whatever the case – it came together quickly and the ability to use Sling to handle all my persistence needs instead of writing a service and plugging it into sdata made an amazing difference in ease of building my widget and getting it running.

So now I am done with today’s task. All is now checked into my SVN repo in contrib/csev/trunk/sling

So I told Ian that I was done with the widget and still had the whole afternoon free! So he told me to add Pluto 2.0 (JSR-286) to Sling/Sakai. That sounds like a good idea – but more than a three hour tour. So we will just draw pictures and call it good.

In summary, I continue to be pleased with the Sling/Sakai combination and eagerly look forward to its evolution.

The additional README bits are below. Again many thanks to Ian and Nico for their patient mentoring.

Continue reading

Playing with Slikai (Sling/Sakai) – First Experiences

I visited Cambridge this week to see what was up with the new Sling + Sakai (Slikai) work that Ian is working on. I figured that one way or another I would find a way to hack in IMS Simple Learning Tools Interoperability into it – after all I hack LTI into pretty much anything else. One day I will write a FORTRAN version of Simple LTI :).

I figured that in two days I would be a little pressed for time. Day one started out with Ian explaining Sling for about an hour and giving me some hello world stuff. It took me a while to hack each piece together. I started this morning knowning nothing about Sling and now this evening I have my first working application in Sling/Sakai.

Sitting 3 feet away from Ian meant I was never stuck for too long – I was just slow. But by the end of the first day, I am pretty much done – the code is checked in here:

https://source.sakaiproject.org/contrib/csev/trunk/sling/

All in all I am pretty impressed with Sling. Many important decisions are already made – most of the APIs we think of as “kernel” are in place. There is lots of value to be added – mostly in terms of “helper” APIs to lock down “Sakai conventions” within Sling and keep us from hard-coding convention too widely scattered throughout the code.

There is lots to do – so much more to do – but Sling feels like a great starting point. Performance is always something to worry about – but I am confident that Ian worries about performance even more than I do – so I expect that whatever we run into is solvable.

It was great fun to see this at an early state and to talk issues over with Ian and I look forward to the progress over the next few months and hope that we see some nice shiny stuff by the conference.

The README is below if you want to replicate my experiences.

Continue reading