OSGalaxy

published on 2009-11-23 23:07:29 in the "writing" category
Davyd Madeley The GNOME Women edition of GNOME Journal has been released, including an article by yours truly on Telepathy and MC5. Check it out.

ask dr opus


> Read More... | Digg This!

published on 2009-11-21 23:31:15 in the "traffic" category
Davyd Madeley I missed something I wanted to go to yesterday, because I opted to wait for the bus that was coming in 5 minutes, and thus be early, rather than walk and only just make it on time.

The bus companies in Melbourne seem quite small, they only run a couple of lines each. Most shifts seem to be a driving the same line back and forth. The problem is when there is a delay on a route, driving the same route back and forth leads to that delay stacking and stacking. A technique I've seen to combat this is having buses change routes at the end of every route, effectively driving in circles around the area. This hopefully gives them an opportunity to make up the lost time. Of course, it requires bus routes that terminate in the same place and bus companies that operate more than just a couple of routes.

For what it's worth, a lot of yesterday's angst could probably have been avoided if the City of Yarra had bothered to tell someone it was closing part of Johnston St. Simply adjusting the traffic light sequences for the detour would have been a huge win, instead of having a traffic light that gave you but 15 seconds to turn down the next road, backing traffic up for 15 minutes.

> Read More... | Digg This!

published on 2009-11-20 02:43:00 in the "recap" category
Davyd Madeley It turns out that PlanetPlanet starts to ignore you if you make four blog posts in quick succession, so in case you missed it yesterday:


> Read More... | Digg This!

published on 2009-11-19 06:04:29 in the "art" category
Davyd Madeley [Apparently today is one of those days where a lot of blogging happens.]

Recently, Sydney Rd (the road that runs through the middle of Brunswick, once upon a time the road to Sydney, and to the goldfields) business were exhibiting local art in their windows. A couple of the pieces, by an artist called Lynette Joy Weber, really caught my eye. Specifically, I was fond of a piece called Little Raven. So we got in touch with her to buy one. Unfortunately, when I went to meet her, she wasn't able to liberate that piece of artwork from the shop it was in, so she was showing me some of the other pieces in her collection. I also fell in love with a piece called Friends. Because I'm like that, I ended up buying both of them.

'Little Raven' by Lynette Joy Weber'Friends' by Lynette Joy Weber

They're now hanging in our entry hallway, outside my office. They make me smile when I see them. Most people are unimpressed; too poppy and too commercial, they say. I don't care, because I really, really like them.

Going to a concert band rehearsal tonight.

> Read More... | Digg This!

published on 2009-11-19 05:07:21 in the "work" category
Davyd Madeley It seems, even though we talk about Telepathy a lot, that there are still people out there who believe that Telepathy is really just a reimplementation of libpurple, just with an annoyingly retentive specification, and D-Bus.

The big thing to understand about Telepathy is not that it's platform independent (even though it is, and that's pretty neat). Or that it's modular (even though it is, and that's also pretty neat). The neat thing about Telepathy is that it's a service. Telepathy provides communications as a service.

What does this mean? This means that Telepathy is not just a library for enabling communications in Empathy, or Kopete. Telepathy can enable communications in everything. Any program can listen to and interact with Telepathy. This means that you can send a user files, straight from Nautilus; or share your desktop with Vinagre/Vino, via a Telepathy Tube; all without having to set up your accounts in each of these programs (this information is stored in the Account Manager, a session-wide Telepathy service responsible for maintaining accounts and connections — Empathy's accounts dialog is just a user interface to this service).

Telepathy components on the bus

Because the information you need is available everywhere, this allows communications features to be integrated into places where they make the most sense in your desktop, rather than implemented in your contact roster (like another chat client does). For instance, mail notifications that Telepathy learns about from webmail services such as MSN and Yahoo (note: not yet implemented) could be plugged into the existing mail-notification applet, or into Evolution to hint when to pull from IMAP. GNOME Shell could provide an embedded GMail-like chat-UI, with popout chat-windows provided by Empathy. All of this is possible without those applications having to have their own preferences dialog for your accounts.

telepathy-glib provides classes for talking to the the Account Manager and Channel Dispatcher, setting up channels and handling contacts. In the future this will be expanded to make it much easier to develop Tube clients and other common tasks (note: avoid libtelepathy and libmission-control, they are deprecated traps and not to be used). Hopefully soon there will be a telepathy-gtk to provide common, reusable GTK+ widgets that applications can use. Telepathy-Qt4 has made it's first shared-library pre-release for those who prefer the other toolkit. If you're interested, I've been working on the Telepathy Developer's Manual.

> Read More... | Digg This!

published on 2009-11-19 03:20:53 in the "python" category
Davyd Madeley How often in Python have you written something like:
d[k] if k in d else "Default"
Admittedly this has gotten a lot shorter since the inclusion of ternary operators in Python, but did you know that Python provides a get method for dictionaries that allows you to provide a default?
d.get(k, "Default")
I only found out today when reviewing code. Exciting!

> Read More... | Digg This!

published on 2009-11-19 03:12:43 in the "clutter-gtk" category
Davyd Madeley Some time ago I wrote about my work on Clutter-GTK. Well, I finally got around to rebasing this branch so it could be merged and ebassi merged it for me last night.

There are still bugs in the code that I've not fixed, but many eyes make all bugs shallow, right?

The code includes a number of examples of how to do things.

If you're going to use these classes, you should understand how they work. There are caveats. Certainly I wouldn't base your entire toolkit around the interchanged use of GtkClutterActor and GtkClutterStandin.

GtkClutterActor takes a GtkWidget, rendered offscreen to an XPixmap, and paints it onto a GL texture which it draws on the Clutter stage. As a result, it can draw that texture anywhere, at any stacking level, and do things like taking events and sending them back to GTK+. Updating of the offscreen pixmap is done using Damage events, and things are generally peachy.

GtkClutterActor Implementation

Things basically work like you expect. Although there are some performance issues where widgets that draw using two expose events will sometimes have a delay between the two Damage events that I've not yet explained, which can cause a visual rip.

If GtkClutterActor lets you embed a GtkWidget into a Clutter stage, then GtkClutterStandin goes the other way around, allowing a ClutterActor to be placed within a GtkContainer; but the implementation is different. The ClutterActor is not rendered into offscreen memory, and then copied into an XPixmap and blitted into GTK+, this would now allow for all of those exciting animations you want to do.

Instead what happens is that GtkClutterStandin reserves space within a GtkContainer for the actor it proxies and then places that actor on top of the texture containing the widget contents.

Bugs should be filed in the Opened Hand Bugzilla.

> Read More... | Digg This!

published on 2009-11-13 21:22:03 in the "ideas" category
Davyd Madeley So, I quite like the idea of Bump, a technology that enables data transfer by matching a bump read by your phone's motion sensors along with information like your GPS location. However, it does require sending all of your contact information to a 3rd party server, maybe that's fine? Maybe it's not.

It seems like this is exactly the sort of thing you could achieve using telepathy-salut (link-local XMPP) and Telepathy Tubes. You would have a MUC (multi-user, many-to-many) D-Bus tube where people's devices announced bumps, when clients found a match. Clients could then open up a 1-to-1 tube to transfer their data. Matching it slightly easier, because you'd only have to look at bumps on your MUC (plus you have the bump sensor reading + GPS)

Unfortunately this idea does full down with one problem. Multicast (as used in link-local XMPP) requires you to be on the same network segment, which it not something that can always been ensured, especially for phones and especially if there is no wireless network around. If the radios were also joined to an ad-hoc network for finding people nearby, this could work. Some wireless chipsets can multiplex their radios onto several networks, but you probably wouldn't be able to do this portably across many devices.

> Read More... | Digg This!

published on 2009-11-08 06:27:34 in the "python" category
Davyd Madeley This is a crazy idea I had; that I want to share with people.

When you're implementing an object in dbus-python, you decorate your published method calls like this:
class ExampleObserver(dbus.service.Object):
    ...

    @dbus.service.method(dbus_interface=telepathy.interfaces.CLIENT_OBSERVER,
                         in_signature='ooa(oa{sv})oaoa{sv}',
                         out_signature='')
    def ObserveChannels(self, account, connection, channels, dispatch_operation,
                        requests_satisfied, observer_info):
        ...
The input and output signatures are incredibly easy to get wrong. The thing is, most D-Bus APIs (e.g. Telepathy) have a specification that contains these arguments. Some APIs (e.g. Telepathy-Python) provide generated code including interface names and constants. So why can't we do something more like?
class ExampleObserver(dbus.service.Object):
    ...

    @telepathy.decorators.Telepathy.Client.Observer.ObserveChannels
    def ObserveChannels(self, account, connection, channels, dispatch_operation,
                        requests_satisfied, observer_info):
        ...
With a decorator factory that looks up the parameters and then wraps the dbus.service.method factory.

Well, I just wrote a proof-of-concept. It looks something like this:
class Decorators(object):
    methods = {
        'org.freedesktop.DBus.Properties.GetAll': [ 's', 'a{sv}' ],
        'org.freedesktop.DBus.Properties.Get': [ 'ss', 'v' ],
        'org.freedesktop.Telepathy.Client.Observer.ObserveChannels': [ 'ooa(oa{sv})oaoa{sv}', '' ],
    }

    def __init__(self, namespace):
        self._namespace = namespace

    def __getattr__(self, key):
        return Decorators('%s.%s' % (self._namespace, key))

    def __call__(self, func):
        iface = self._namespace.rsplit('.', 1)[0]
        in_sig, out_sig = self.methods[self._namespace]
        return dbus.service.method(dbus_interface=iface,
                                   in_signature=in_sig,
                                   out_signature=out_sig)(func)

    def __str__(self):
        return self._namespace

decorators = Decorators('org.freedesktop')
Obviously in the real version, it would have a generated map of functions, or map of interfaces each with a map of functions, and a way to handle signals, but neat huh?

> Read More... | Digg This!

published on 2009-11-04 04:41:56 in the "traffic notice" category
Davyd Madeley Not sure what's happened, but the intersection of Sydney Rd and Albion St in Brunswick is currently closed off with police barricades. Police and Fire in attendance. As well as two news crews and about a zillion bystanders. It looks like a building has collapsed, it's taken out the #19 southbound tramstop.

> Read More... | Digg This!

published on 2009-10-31 05:46:10 in the "stuff to do" category
Davyd Madeley If you're a vegetarian/vegan in Melbourne, come to World Vegan Day at the Abbortsford Convent. It looks like it's going to be a blast, with 54 stalls, talks, music and veg*n speed dating (I kid you not).

Steph and I are going to eat food, hang out with some of our new Melbourne, veg*n friends and eat more food.

the remnants of a chocolate milkshake


Speaking of things to do in Melbourne (and other Australian cities), there is a marriage equality rally on November 28th. Australians can sign the petition online.

> Read More... | Digg This!

published on 2009-10-27 01:16:52 in the "noms" category
Davyd Madeley The weather has been so nice, it's been inspiring me to eat summery foods. This was yesterday's throw-together lunch (and might also be today's):

tofu and salad wraps

For treats, Steph made this awesome hedgehog slice:

hedgehog slice


> Read More... | Digg This!

published on 2009-10-22 01:01:37 in the "pulseaudio" category
Davyd Madeley So, being back in Australia, the sun is shining, I'm sat on my sofa and I can't help but feel like I'm on summer holidays. So I want to crank some Uh Huh Her on the stereo.

We have an Airport Express, but using would require using Steph's computer, or the computer downstairs. So instead I thought I'd give the support in PulseAudio a go.

It's pretty easy to set up. Install the (Debian/Ubuntu) packages paprefs pavucontrol pulseaudio-module-raop pulseaudio-module-zeroconf (Fedora packages might have different names). Run paprefs and tick the option to discover Airtunes devices.

paprefs

Then using pavucontrol you can set the output device for an application.

pavucontrol

It's not perfect yet, it can sometimes get stuck skipping, and you have to move the stream to your local computer and back to the Airport (apparently the buffering is just implemented using windowing, but maybe needs to be smarter?), but it's working pretty good. Still, it's insanely neat, and because it's in PulseAudio, you can redirect any stream you like (not just from your music player).

It's not just Airtunes either. You can stream to other PulseAudio servers (discovered over mDNS) as well as UPnP media renderers.

> Read More... | Digg This!

published on 2009-10-20 09:24:57 in the "laptop" category
Davyd Madeley Upgraded to Ubuntu Karmic pre-release today on my Thinkpad X200s. Had two issues:
  1. machine wouldn't prompt for the key to unencrypt the hard disk so it didn't boot. This seems to be Launchpad bug 446591. I followed this fix.
  2. forgot that I had downgraded my Intel graphics driver to v2.4, causing my consoles to break, suspend to RAM to break and only support a broken version of EXA. apt-get install xserver-xorg-video-intel fixed this.
Things seem much better now than the mess I had this morning.

> Read More... | Digg This!

published on 2009-10-17 20:04:06 in the "listen to your tools" category
Davyd Madeley I don't know why, but there is a class of software programmer who seem to believe that compiler and runtime warnings are somehow optional, or something that can be cleaned up at a later date. This class of programmer is very common in the commercial software world.

I've never really been sure why people think these warnings can be ignored. Compilers are pretty smart these days, and if a the compiler says you have a type-mismatch for your pointer assignment... there's a good chance you did something silly.

Library developers don't just add all of those pesky assertions to their methods for fun. If your code is outputting critical warnings, you probably shouldn't be surprised that it's crashing shortly afterwards. Something clearly went wrong.

So what can you do? Compiling your code with warnings-as-errors when developing it is a very good step (-Werror in gcc). For runtime warnings, you can probably set an environment variable to make the program abort when reached (e.g. for GLib you can export G_DEBUG=fatal-warnings or fatal-criticals) — this allows you to attach a debugger when the warning is reached.

Simple steps for much better code.

> Read More... | Digg This!