Syncing your Bluetooth phone with Evolution on Ubuntu

I finally got fed up of my Sony Ericsson K700i losing random phone numbers (well, not random – it’s always the phone numbers I’ve used recently, which thankfully means that most of the time, searching for unrecognized phone numbers in the call history list works) to do something about it.

There are some HOWTOs and forum discussions out there, but most of the ones that refer to Ubuntu refer to earlier versions, and a lot of the steps mentioned are probably not needed anymore.

As it turns out, these are all you need:

apt-get install multisync libmultisync-plugin-irmc-bluetooth libmultisync-plugin-evolution

Modify /etc/bluetooth/hid.conf . This is the crucial step! In /etc/bluetooth/hcid.conf, change the local device class from

class 0x3e0100;


class 0x100100;

Now set up multisync and follow the instructions – should be quite straightforward. The only thing to note is that by default, Multisync does not preselect any calendar, address books etc., since you can have more than one. Make sure to pick the ones you want to sync.

Effectively functional: swapping tree leaves with streams

(Thanks to Roshan for posing the task)

Given two binary trees, and a depth-first-search traversal ordering of the leaf nodes, produce two new trees with the same structures as the originals, but with the leaf nodes swapped. If there are more leaf nodes in one tree than the other, the remaining leaf nodes are copied unchanged.

So (swap-leaves ‘(1 . (2 . 3)) ‘(a . ((b . c) . d)))
=> ‘((a . (b . c)) ‘(1 . ((2 . 3) . d))

Continue reading