[Google]

OAuthcalypse

So, I have a twitter/status.net app that I use to consolidate all the micro-blogs I’m on and produce a single timeline in a sidebar of my news page. It was originally written as a python plugin for pyblosxom, which runs the rest of the site. It turns out that this causes huge delays in producing the page though and I eventually rewrote it in javascript.

This is really nice because it all runs client-side and can take its sweet time to pull in the feeds without affecting the rendering of the bulk of the page. It grabs the friend feeds so it needs to login to the various sites, and it uses http basic auth for this. Nice and simple.

I’ve just learned of the coming OAuthcalypse though, where the basic auth method is going to be disabled, and this presents me with a quandary. I need to update my app to use OAuth, there are three ways I could do this:

1) Implement OAuth in javascript. This is a really bad idea. OAuth uses a secret key, and as javascript has to be sent to the browser in plain text it wouldn’t remain secret for long.

2) Move the app back server side and implement OAuth in python. Again this is a bad idea, I moved it client side for a reason, and putting it back server side would give me unacceptable performance.

3) A hybrid approach where the OAuth is done server side, and the requests themselves remain javascript on the client. Having had a brief look at how OAuth works I think this might be possible. It will still slow things down, but it might be good enough. It’s going to be a pain in the arse to implement though.

Well, at least I know what I’m doing with my Bank Holiday.

New toy.

Posting from my lovely new HTC Desire. Had it a day so far and am very impressed, especially with the virtual keyboard. I thought I might have trouble with it but I can type much faster on this than I could with the T9 ones on my old cheap phones.

I’m learning to trust the autocorrect more too, which speeds things up considerably.

Sod the iPad, I love my Android. (Amazed that it just auto capitalized iPad for me).

Backporting new code to Debian packages

I like Linux distros packaging systems, especially Debian’s. It makes it trivial to install, remove and change to different versions of programs. The only problem is that sometimes there is a delay in packaging the latest version of an app.

Never fear though, if you are willing to do a little bit of work you can shoehorn the latest code into a package yourself without needing any special knowledge of how to create packages. Note this will only work with programs that already have been packaged since it re-uses the old packaging info with the new code.

I refer to Debian, but the exact same procedure will work on any deb based distro, such as Ubuntu.

Before starting make sure you have the devscripts and build-essential packages installed. These will install all the tools needed to build debian packages.

First download the source package of the old version.

apt-get source $NAME

Then, as a sanity check cd into the created directory and run

debuild -i -us -uc

This will probably complain about missing packages needed for building, so go ahead and install them with apt-get or aptitude or whatever. Then re-run the build command. Assuming that works you should end up with some .deb files in the parent dir.

Now grab the code for the latest version from its website. If it is not already in a tarball you’ll want to make one from it with

tar czf application_version-1.orig.tar.gz applicationdir

If it is a tarball already then just rename it to match the formatting application_version-1.orig.tar.gz. For example when backporting mesa I name the tarball mesa_7.7.0-1.orig.tar.gz.

Next copy the debian dir from the old application directory to the new one.

cp -a application-debianversion/debian application-newversion/

Then cd into the new directory and run

debchange -v version-1 "Updated code to latest version"

It is vital that the version number used in this command matches the naming of the .orig.tar.gz file you created earlier. For example for mesa I use 7.7.0-1. This is the magic that will make everything work.

The final step is to build the new package.

debuild -i -us -uc

and tada! With a bit of luck your shiny new version should be packaged up and ready to be installed.

Firefox 3.5 startup problem (solved)

Firefox[1] 3.5 has been out for a while now, but I’ve only recently managed to switch due to the program not starting up unless I use a weird command line hack.

By using the strace command I found it was hanging on a futex call, starting in safe-mode and even deleting .mozilla didn’t fix it. I found a forum thread on the mozilla forum that shows I’m not the only one to come across this. There was a fix described in a post linked from there, but it only worked by editing the launch command, and I’m not prepared to dig through the OS and replace every instance of the launcher to make it work.

Yesterday though I found the real culprit, it was padsp! A long time ago I had set Firefox to use padsp in order to get flash sound to work correctly with pulseaudio. I had totally forgotten I had done this, because I had made the change in /etc not in my home folder.

So if you find Firefox 3.5 won’t start on linux even though 3.0 works fine then check if you have a FIREFOX_DSP (or ICEWEASEL_DSP if on Debian) set somewhere. For me the fix was this:

In file /etc/iceweasel/iceweaselrc:

# which /dev/dsp wrapper to use
ICEWEASEL_DSP="padsp"

See the ICEWEASEL_DSP line, delete it or comment it out and Iceweasel starts working. If you are using vanilla Firefox then obviously replace every instance of the word iceweasel with firefox to implement the fix on your system.

Hope this helps someone. Oh and flash now works fine with pulseaudio without the padsp thing too.

[1] I’m actually using Iceweasel but it is Firefox in all but name so I’ll call it that here

Control your Music player via bluetooth

I don’t need no steenking iphone with its fancy apps. I have a fairly low end phone, a Motorola RIZR Z3 but it can run Java J2ME apps. The other day I found an awesome one that lets me control my music player MPD via bluetooth, with a nice little GUI and everything (it also apparently works for XMMS and Winamp).

I was going to twitter about it, but it is so frickin awesome that it deserves more than 140 characters about it. The app is called JAM SE and it looks like it will run on just about any phone that supports J2ME and has bluetooth.

There is a Debian package for the computer-side which makes installing on Debian/Ubuntu a doddle. For others you can grab the program from its own site Bemused-MPD bridge.

With a little bit of extra work I can even get it to control the other music playing computers in the house (all running MPD), mpdproxy on the laptop with the bluetooth connection will redirect all MPD clients to my currently active server.

It is so cool to be able to control my music playback from anywhere in the house just by whipping out my phone, geektastic. :-)