26th April, 2009

Ghosts in DTubes

I’ve been playing around with an idea for a few weeks. It’s evolved into something that I can actually hack on. The idea solves two problems

It may be complete UI-crack, but you’ll be the judge of that.

A ghost is a set of metadata about a file. For example, a photo has a thumbnail and a set of tags. I can download all the meta-data for my wife’s photo collection onto my laptop. Ghosts are represented graphically in some manner. For example, in the F-Spot UI ghosts of my wife’s photos could show up in greyscale at 50% transparency. You can imagine a similar UI for music files in rhythmbox. I imagine the actual files, that the ghosts represent, are downloaded on-demand by me. This solves my netbook probem (a problem I call “the subset problem”) by allowing me to easily download images and music to my netbook from my laptop.

Both of these problems can be solved by putting a server between me and my wife. But life’s too short for that. And there’s an existing set of cool technologies in Gnome which can be used to implement a p2p(ish) solution.

Maybe I’m not great at explaining the high-level stuff. If you don’t have a wife it may be difficult to understand that her photo collection and mine are actually the same collection. We just use our laptops to “interface” with the collection. We could use a site like Flickr to combine our collection. However, Flickr doesn’t allow me to share gigs of data. And the upload/download bandwidth is generally slower than our LAN speeds that we would achieve when we’re both on our home network. Also, if you don’t have a netbook it’s hard to understand what I’m talking about. Sometimes I’ll want to travel home to my parents and bring my netbook with only photos of my son and some Bach to listen to on the journey. I can’t fit my entire photo collection and music collection on the netbook.

Anyway…the solution currently passes Ghosts (only F-Spot photos at the moment) over a DTube. A DTube can be opened between two XMPP users (think Jabber or Google Talk) and you can pass arbitrary DBus objects over it. I’ve implemented Alice who shares her photo collection with the Hatter. The Hatter has a very crude Clutter based presentation of the Ghosts. The code is at the experimental-proof-of-concept stage. I’m now wondering how to further this. Should I implement a “ghost://” GVFS backend?

Code is here. It’s not pretty, and you’ll have to change the jabber id’s in the source. Helping to put the Network back into GNOME, one idea at a time :)

Posted at 9:17 pm | Comments Off

15th April, 2009

ternary operator blues

ISO/IEC 9899:TC3 Committee Draft — Septermber 7, 2007 WG14/N1256

6.5.15 Conditional operator

If both the second and third operands have arithmetic type, the result type that would be determined by the usual arithmetic conversions, were they applied to those two operands, is the type of the result.

i.e.

#include <stdio.h>

void SetLong (long foo)
{
    fprintf(stderr, "Got a long of %ldn", foo);
}

int main(void)
{
    int a = -10;
    unsigned int b = 10;

    /*int converted to long*/
    SetLong( a );
    /*unsigned int converted to long*/
    SetLong( b );
    /* int and unsigned int results converted to unsigned int,
       unsigned int then converted to long. i.e. totally different
       from if (1) SetLong(a); else SetLong(b); */
    SetLong( 1 ? a : b );

    return 0;
}

On 32bit Linux long and int are the same size, so it doesn’t matter and we get -10, 10, -10, on 64bit they’re not and so results in -10, 10 and 4294967286

Posted at 3:18 pm | Comments Off

13th April, 2009

DEV300_m46

DEV300_m46 callcatcher results, +32 to 1181 unused methods. (as against that, binfilter and chart2 have pending workspaces to strip them of a pile of methods)

Posted at 1:35 pm | Comments Off

10th April, 2009

casual code annotation

I want a sort of casual code annotation wiki-thing where I can annotate code in passing without having to check it in to a formal source repository,

Posted at 10:40 am | Comments Off