Leon Handreke

Computers. Code. Philosphy. Random thoughts. My Life.

Automatically switch to Bluetooth headset with PulseAudio

I recently bought a brand-new pair of Philips SHB 9100 Bluetooth headphones. I like them a lot; They are relatively compact and light, not too expensive and offer sufficient audio quality for my mobile audio needs.

After having convinced the Gentoo system on my beautiful Thinkpad X220 to talk to my shiny new gadget, I wondered if there was a way to get PulseAudio to set the headphones as the default output automatically as soon as I switch them on. Turns out there is!

Even though this feature does not seem to get a lot of attention, it’s there, all that is required to enable it is to add the following to your /etc/pulse/default.pa:

# automatically switch to newly-connected devices
load-module module-switch-on-connect

Now, if only PulseAudio and Empathy would talk to eachother to switch between high-quality audio mode (A2DP) and telephony mode (HSP/HFP) automatically like my iPad does…

XMPP - yet another chat protocol?

Before I get started with my rant, I would like to make clear that I am not an expert on XMPP - some of the things I say could be wrong. Also, this is only my perception of the status quo, although I’d love to hear what you think about this topic. My email address can be found at the top.

XMPP is awesome

Ever since I learned about the Telepathy framework and the magic it does on the Nokia N900, I’ve been a supporter of XMPP. Of course Telepathy does a lot more and is protocol-agnostic, but a lot of the really neat features such as detailed presence status, voice and video calling, Telepathy tubes and even location awareness are specifically developed for and only work with XMPP.

Most XMPP clients suck

However, all of these exciting features are not really being widely implemented. Sure, the N900 had great Telepathy integration, but the N900 is dead and it’s successor, MeeGo, has yet to ship in any real, usable device. It doesn’t look much better for the various other contenders in the mobile space either - on iOS, XMPP is a total disaster because IM applications are limited to 10 minutes of running in the background. Android is a bit better, with Google Talk being well integrated into the system, but as the name already implies, limited to Google Talk.

It doesn’t look much better in the desktop space. I don’t know much about Windows clients, but last time I checked about half a year ago, most of the clients tried to differentiate themselves through integration of more protocols, platforms, social services and the rest of that mumbo jumbo.

Mac OS X has Adium, which is nice for chatting but doesn’t have very many advanced features. As far as I can see, development is happening at a very slow pace, audio and video chatting have been “coming soon” for ages.

On Linux, the situation is a bit better. GNOME has Empathy, a nice chat client based on Telepathy. It supports a lot of XMPP extensions like audio and video chat, location reporting and things such as screen sharing through tubes. It’s got integration with gnome-shell which works very nicely and hopefully, the GNOME Contacts application that is coming up will also fit in with the existing chat experience. Apparently KDE is also working on deeper system integration of Telepathy and I’m excited to see what they have coming up.

Most XMPP servers suck

But why is the client situation so bad? With Facebook Chat, XMPP is shaping up to quickly become the most used chat protocol on the planet. It would seem like IM, a tool that millions of people use every day, would be a top priority for every operating system vendor, both in the desktop and the mobile space, to integrate tightly into their software product.

I don’t think it’s because people don’t care about these “advanced features” that I’m talking about - many people use weird web-based location services like foursquare, gowalla or Facebook Places. People use Skype every day for voice and video chat. FaceTime has been one of the main selling points of the iPhone 4 (which has been selling well, so I hear). There clearly is a demand for diverse IP-based communication.

The main problem that I see at the moment is the quality of the servers that most people use. Although Facebook is based on XMPP, they’ve created their own little chat network with no possibility to benefit of the distributed nature of XMPP. Also, as far as I can tell they don’t support any of the advanced features that I would like to have and that are available on many other servers.

I can haz fix nao?

So how do we escape this dilemma? Well, I don’t think there’s a good way to fix the current situation. People are lazy, they don’t switch to another chat provider unless they are forced to. Facebook already had millions of users and therefore became a relevant IM service overnight. jabber.org or jabber.ccc.de? Not so much. The best option at this point in my opinion would be for Facebook to fix their servers. New, better XMPP clients would be written overnight and everybody would be happy - except of course those like me who don’t really want their chat network tied to a huge monster that is the Facebook platform. But I guess we would just have to tolerate that and benefit from the distributed nature of XMPP by using different servers to communicate with those trapped inside Facebook. At least we would have a feature-rich, omnipresent distributed communication protocol to communicate with all of our peers at last!

TL;DR Most XMPP clients suck because the biggest provider, Facebook Chat sucks. If Facebook fixed their servers at least we’d have a universal IP communication protocol.

I hate storing data. I really do. I don’t think there is a future for storing music collections when the internet is around, ready to serve any song at any time, wherever you are. However, there is still a problem: This market is a giant vacuum at the moment, with a few smaller companies doing a good job at providing services solving this problem, but not for every usecase, not in every country.

One example: Spotify. Let’s disregard that I can only buy it by telling a friend in the UK with a credit card to buy a gift certificate for me, their service is just not good enough. There is conflicting information about how many employees they have and how they are doing business-wise, but what I see as a costumer is that their service has not at all improved over the last year. Still the playlist-based syncing approach for the mobile app, still the same closed-source library for 3rd party developers that discourages client development on other platforms. If they can’t fix the most obvious usability flaws in their mobile app, I don’t think that they can survive in the long run.

Enter Grooveshark. Half as expensive, same usability flaws in their mobile application, desktop application is even worse than Spotify’s, their music library is a mess and they’re having “licensing issues” that prevent them from getting into the iPhone app store. Need I say any more?

Next up: Rdio. Reasonably priced, it looks like they are the only ones with an iPhone app that simply offers an iPod-like interface for all your music collection and cached music (is that really so hard?) with the option to add new things to it with search. Their cross-platform desktop app looks more like a small helper application, with the web interface remaining the main way of managing music, which is fine if done properly. Also, they might have a better desktop client coming up for Linux in the near future. Not available outside the US yet, so it’s not the omnipresent solution I envision either yet.

It seems like this business needs a big player like Apple or Google to jump in, face the music labels and tackle the engineering challenges associated with creating a good listening platform to make this way of consuming music the norm rather than the exception here in the western world. Of course, all the startups would be dead instantly if something like this happened, but at least I would have a decent music streaming service available.

snowy - the road ahead

5 months ago I traveled to Boston to discuss the future of snowy, Tomboy Note’s online companion application. We made lots of plans and talked about how we wanted to implement note editing, sharing and loads of other cool things.

Looking back over these 5 months, we’ve managed to implement some of if; Jeff has made progress on implementing note sharing and I’ve redesigned the theme quite a bit. Brad has managed to crank out a non-regex-based parser for snowy-flavored markdown (which I was convinced nobody would ever be able to write, but it seems I underestimated Brad’s ninja-skills) and Natan Yellin added support for associating multiple OpenIDs to one account.

Even though a lot has happened, we’re clearly not where we wanted to be after these 5 months. The note editor and the mobile application are two things that are very high on our priority list and are not yet finished.

Recently, Sandy stepped down as the maintainer of the tomboy and snowy modules and I totally understand his decision. You can read his announcement on tomboy-list. I’d like to thank him as a maintainer for reviewing my patches and playing an important role in getting me involved in GNOME.

A killer-feature

However, this lead me to rethink the next steps of snowy. With only two active free-time developers, running after a generously-funded startup like Simplenote or an established platform like Evernote is both unrealistic and unmotivating for me as a volunteer. But we already have a feature plan that sets snowy apart from other notes platforms: Encryption, privacy and freedom (whatever that means…). I think that putting the focus on the ability to install snowy on any computer, being able to store encrypted notes on the GNOME servers and maybe even sharing encrypted notes with other people would be a worthy goal to achieve and a good reason for people to choose snowy over other services.

What also partly motivates me as a developer is that building an all-javascript mobile web application with offline capability is fun and hip. Everybody (even Gruber!) is talking about webapps, so I think trying to make one would be fun!

Short-term: Make snowy more useful

That said, in the short term we really have to tackle note editing and the mobile client. Without them, snowy is more of an online backup service for notes rather than an online version of Tomboy Notes. That said, I think that implementing these features in their most basic forms is not too much work. The difficult part will be to support some of the more advanced features of the Tomboy note format on both the desktop as well as the mobile browser client.

Once we actually have a product that is being used by many Tomboy users, maybe we can get some more contributors involved - from my own experience I know that it’s a lot more fun to work on things that you yourself want. After all, the goal is to build a product that shines beyond the borders of GNOME and its fantastic community!

Fighting the “Internet Killswitch”

As you may have heard, Egyptian networks were recently disconnected from this global network that we call “the internet”. Immediately, internet activists jumped out and alerted everybody to the threat of the same thing happening to us if we are not careful about what we pass through our parliaments. Large technical as well as non-technical news websites (and probably also newspapers and magazines) followed.

I support their goals of a free, distributed and open internet, and I also think that any law that gives the government the power to shut down critical infrastructure is nonsense.

But the situation in Egypt is totally different: A dictator that has been in power for 30 years, a near-civil-war-like situation on the streets, burning buildings, injured and dead protesters and police. Does anybody really think that under these circumstances, the junta in Egypt still cares about whether or not they have the legal authority to suspend critical infrastructure (like the internet or the railway services)? I think that given a high enough level of urgency, any government could suspend the data links in and out of the country within a few hours or at least days.

Trying to stop symbolic laws like the “Kill Switch” bill in the United States is obviously a good cause, but it isn’t a solution. To prevent what happened in Egypt to over happen to us, we have to work on weaving our mesh even finer to create a more democratic, decentralized, independent and global data network of the people.

Recipe: Buy all vegetables available. Cook.  (Taken with instagram)

Recipe: Buy all vegetables available. Cook. (Taken with instagram)

It’s been almost a week since I returned from the snowy hackfest in Boston, MA. Thinking back, it was a really fun 4 days of socializing, hacking and discussing the future of snowy.

I departed Karlsruhe on Thursday around noon. Fast forward 17 hours and I’m in a hotel room in Boston. Air travel still feels like a miracle to me.

Friday we spent the day in Brad’s flat discussing the goals for the hackfest and laying out the work for the coming days. Meeting everybody in person was a really interesting experience, because even when communicating via IRC or bugzilla, I build a mental image of what a person might be like.

Saturday was the first day of the Boston Summit which was going on at the same time as our hackfest. This was really great because we as a group were able to use the excellent MIT infrastructure (blackboards and huge rooms with super comfortable seats. I wish they had these kind of seats at my university) but also slightly disctracting at times - with so many interesting sessions going on the at the same time. Luckily, I managed to stay focused for most of the weekend and partiticipate in the hackfest instead of the Summit.

One of the things we discussed was what the mobile experience in snowy should be like. We took some time to figure out how to transport all the features of the Tomboy rich-text editor over to a plain-text format that would be editable on a mobile device. In the end, we agreed on a variant of the markdown format that has a few extra syntax additions that make it fully compatible to the Tomboy format.

Another lengthy discussion revolved around note sharing - how to build an interface where users can share their note with “friends” without building a full-blown social network. We decided to use email addresses as an identifier for finding and inviting people to share a note with. Jeff Schroeder is now busy implementing this - once this is done, showing a note to other people will be really easy. What makes it awesome is that it syncs - you edit a note in tomboy on your desktop and a few moments later, whoever you shared it with will be able to view your changed note on the web!

We also spent some time discussing a new design for snowy with Jeff Fortin, who had posted some mockups in advance of the hackfest. We came up with some great ideas on how to make snowy a joy to use even with big collections of notes and also rethought the login page (which is currently dominated by an OpenID URL field - not user-friendly).

Apart from the many discussions we had, I spent the remaining time hacking on getting the snowy API to speak markdown so that conversion from the tomboy format to the markdown format suitable for editing could be done on the server. But on monday at lunch, while talking to Sandy about this, I realized that this would not work for encrypted notes (which will hopefully land soon) - needless to say I was not pleased because I had put a few hours of work into this over the weekend.

At first I was really frustrated but I soon realized that the primary reason for me to come to Boston was not to write code. The reason to come together and physically meet was to talk about things, make decisions, do things that are just not possible or at least a lot more difficult to do over IRC. We discussed a lot of things that needed to be discussed, we decided things that needed to be decided and assigned coding tasks to be done after the hackfest.

In addition to getting stuff done, the hackfest was also a really fun experience for me. As a relatively new member to the GNOME community, I was pleasantly surprised about how welcoming and friendly everybody was to me and how fast people that I had never met before became friends. Meeting all these great people really reinforced my feeling that GNOME is the right project to contribute to.

Jeff Fortin took a lot of photos along the way. You can ready his blogpost about the hackfest here: http://jeff.ecchi.ca/blog/2010/11/12/snowy-hackfest-boston-summit/. He has also got a great video up which captures my feelings about the hackfest very well. Go ahead and watch it now. (I agree with his assessment of the shower UI - I showered with cold water for 2 days until Paul Cutler explained the confusing interface to me. Refer to Jeff’s blog for pictures).

I would like the thank the GNOME Foundation for sponsoring my travel to Boston. It’s a long way from Germany, but I think it was definetly worth it. I know I will be thinking back a lot to the great days I had in Boston, spending time with friendly people doing the thing I love: writing free software. Thank you!

Man, this moment is just the way I like it. I’m sitting in the ICE to Munich cutting through the night at high speed (Frankfurt - Munich 3:14), listening to the Chilled House Session, reading Die Zeit. I’m returning from an exciting week of digging for stone age artifacts near Bad Homburg. When I arrived I had such a deja-vu as I realized I had been there before with @adsized. Good memories… The excavation was tremendous fun, even though the weather was rainy. We found plenty of stuff that archeologists will now try to piece together into something that makes sense. I’m hoping to return next year for some deeper investigation of the site.

In the meantime, I’ll be studying. I moved into my room on Friday, got keys, internet and made some new friends. Already visited the university Mensa (the place where you eat) and got some tips about how to best survive student life. All I can say is that I’m really looking forward to starting a new life in Karlsruhe.

Somehow, high-speed rail always gets me blogging (remember last time I blogged about the party ICE?). I’m now slowly rolling out of Aschaffenburg, soon I’ll be home. Life is good.

im 18 now god dam it i wish i was around in the 80s imagine growing up as a teen going to clubs listening to bullshite modern rnb like little wayne hell i tells ya.

Great idea: A party ICE, from Munich via Frankfurt to Berlin. Remove sound insulation to hear and be heard - maybe even add a panorama roof? Going top speed all the time, great DJ’s all night, a new DJ at every station. I would be the driver and I would choose Scooter to be the conductor. Just imagine him saying “Thank you for traveling with Deutsche Bahn. Good bye!” (or rather “Over and out”?). High speed rail is so much fun…

Fast forward

2 and a half months ago I was going to school, like I had done for the last 11 years of my life. Now I am sitting here in Rosenheim in a dark room, writing this blog post. Let me explain how I got there.

By the way, the music recommendation for the rest of this post is “Seven Days In Sunny June” by Jamiroquai: http://www.youtube.com/watch?v=1tNWdockvZk

The first month is quickly explained. I studied. I looked out for airplanes on the sky (I noticed only in the last few days of living in this house that the corridor to LHR passes right above me - spotted quite a few A380s!). I studied some more. And every once in a while I went to school to do an exam.

That went on until July 1st when I got my baccalaureate certificate. The most difficult thing that day was leaving from that party with all of my friends, sitting in the sun in the garden and chatting, happiness and relief all around. It’s dazzling how after years of seeing and talking to them every day, I just had to say goodbye to all of them, knowing that most of them I would never see again. Just like that. A sudden end. Thanks for making my school life awesome guys!

After that, I went on a cycle trip to Ameland, via Amsterdam. Would have liked to have had a bit more time and company in Amsterdam, but I guess I will have to wait until next time for that. Overall, the 2 weeks were really fun. After that, I went on a cycle trip across the alps with my good friend @adsized. It was a true blast. Freely living the motto “Blow as much money as you can” (not quite, but we certainly spent a lot on food - but it was really good!) we went from Mulhouse in France to the Lago d’Orta in Italy. Once there, we met my whole family and had a really fun week.

Then, I went home. My new home, that is. I now live in Rosenheim, Germany. The house is still in chaos but it’s brand new and very nice. I went to visit @salkinium for a week, which was also a lot of fun. Lots of productive coding, lots of hours watching YouTube, even more hours watching Fringe. I just got back today, had to transfer trains 4 times, luggage consisted of 24” screen and a computer computer including all the stuff that goes with it and a bike, so no ICE for me. Still, I think it’s a lot of fun going through Germany by train, even if it’s by Regional Express. Flying through the landscapes gives me such a feeling of relaxation and satisfaction, I think I could spend a whole holiday just doing that…

It feels really weird living in Germany for the first time in my conscious life. Nevertheless, I really feel at home here. More than in Belgium? Don’t know. I guess I just felt at home in both places. I’d probably feel at home almost anywhere this part of the world right now. Because this is just an incredibly exciting time of my life.

Fast forward 2 months. What’s it going to be?

Getting user attributes with python-openid using sreg and ax

User attributes are actually a pretty neat feature of openid. Add a few extra fields to your POST request and the provider replies with a slew of user data. This can make the user registration process way easier - the more fields are filled in already, the more time users have to actually use your application.

Turns out it’s not quite that easy. Basically there are two schemas for data exchange - sreg and ax. Google uses ax. Everybody else uses sreg. This makes the whole thing more complicated than it has to be.

Request

from openid.extensions import sreg, ax

# create the openid_request here

# add sreg extension
openid_request.addExtension(sreg.SRegRequest(optional=['email', 'fullname', 'nickname']))

# create the ax fetch request
ax_request = ax.FetchRequest()
ax_request.add(ax.AttrInfo('http://axschema.org/namePerson/first', alias='firstname', required=True))
ax_request.add(ax.AttrInfo('http://axschema.org/namePerson/last', alias='lastname', required=True))
ax_request.add(ax.AttrInfo('http://schema.openid.net/contact/email', alias='email', required=True))
# add the ax extension
openid_request.addExtension(ax_request)


Response

from openid.extensions import sreg, ax

def attributes_from_response(openid_response):
attributes_dict = {}

# the try's are there in case one of the keys is not returned by the server
# if there is a better way to handle missing keys, please tell me!
try:
sreg_response = sreg.SRegResponse.fromSuccessResponse(openid_response)
if sreg_response:
attributes_dict['schema'] = 'sreg'
attributes_dict['username'] = sreg_response.get('nickname')
attributes_dict['email'] = sreg_response.get('email')
attributes_dict['display_name'] = sreg_response.get('fullname')
except:
pass

try:
ax_response = ax.FetchResponse.fromSuccessResponse(openid_response) if ax_response: attributes_dict['schema'] = 'ax'
# use firstname+lastname as the username
attributes_dict['username'] = ( ax_response.get('http://axschema.org/namePerson/first')[0] + ax_response.get('http://axschema.org/namePerson/last')[0]).lower()

attributes_dict['email'] = ax_response.get('http://schema.openid.net/contact/email')[0]

attributes_dict['display_name'] = ( ax_response.get('http://axschema.org/namePerson/first')[0] + " " + ax_response.get('http://axschema.org/namePerson/last')[0])
except:
pass
return attributes_dict


You can see this code in action in the snowy project. I tested this with google and myopenid as providers - others should work as well. I couldn’t find any other decent documentation on this, so I hope this helps out fellow developers googling for answers.

Over the past days and weeks I have been thinking about getting another mobile device in addition to my iPod. Why? I don’t know. A natural urge of my capitalistic mind I guess. But only thinking about it has lead me to an important realization tonight.

When other people buy a computing platform, they buy it to do things for them; Play a movie, check their email, browse the web, edit a document. For me, however, programming computers is a hobby. Just like other people like to watch movies or play football in their free time, I like to tinker around with computers.

I realized that this is the real reason I switched to Linux as my main OS. I could probably “get my work done” just as well with any OS. But I prefer Linux because it adapts best to my hobby of writing code for personal and public opensource projects.

This is also the reason I won’t buy an iPad - it’s not the right device for what I want to do. I might buy a cheap $100 Chinese android tablet. I have several ideas for cool things I could do with one that I think could be fun to hack on. But I’ll probably end up buying nothing at all.

Though I have to admit, I am very tempted by the iPad.

Now that my school life is coming to an end I am learning to appreciate it more and more - just like everybody always told me I would and I always claimed I wouldn’t. 

I am especially thinking of my trip to Sweden last year - no doubt it was the best school trip I ever had. I am thinking back to the cold weather and the clear sky, much like we are having here in Belgium these days. I am thinking of how awesome it was to visit the city, enjoy the free spirit of Stockholm. I am thinking of the trip to the almost deserted island we did. I am thinking of the awesome vegan dinner we had in the great restaurant near Slussen with a view over the bay. I am thinking of our geocaching tours through the city, roaming even the less touristic quarters of Stockholm to find yet another microcache. I am thinking of all the fun we had together travelling the world. Because it’s about the best thing you can do in life.

Listening to O Saya from the Slumdog Millionaire Soundtrack will help you grasp the feeling: http://www.youtube.com/watch?v=vHUQht1HRmY

Now that my school life is coming to an end I am learning to appreciate it more and more - just like everybody always told me I would and I always claimed I wouldn’t.

I am especially thinking of my trip to Sweden last year - no doubt it was the best school trip I ever had. I am thinking back to the cold weather and the clear sky, much like we are having here in Belgium these days. I am thinking of how awesome it was to visit the city, enjoy the free spirit of Stockholm. I am thinking of the trip to the almost deserted island we did. I am thinking of the awesome vegan dinner we had in the great restaurant near Slussen with a view over the bay. I am thinking of our geocaching tours through the city, roaming even the less touristic quarters of Stockholm to find yet another microcache. I am thinking of all the fun we had together travelling the world. Because it’s about the best thing you can do in life.

Listening to O Saya from the Slumdog Millionaire Soundtrack will help you grasp the feeling: http://www.youtube.com/watch?v=vHUQht1HRmY

Dort wo man Bücher verbrennt, // verbrennt man auch am Ende Menschen.

Almansor, Vers 243f, Heinrich Heine (1797-1856)