October 12th, 2005

diesel, learning, evil, sweeti

Subverting my code

I've been really bad about putting my personal code in a version control system. When I've been working other projects like Siesta or the Bot stuff then I'm fine but my stuff has largely been archived by, err, CPAN. NORTY Simon! No Cookie!

So clearly the right thing was to grab everything from BackPAN and sling it in as tags. It's not perfect but it's better than nothing. Fortunately somebody has already thought of the hard part of getting stuff into Subversion for us and Leon has done Parse::BACKPAN::Packages so it's fairly trivial.

I made sure that svn_load_dirs was installed. If not you can get it here and manually change the path to your svn binary.

Then I wrote this script.

    use strict;
    use Date::Parse;
    use LWP::Simple;
    use File::Remove qw(remove);
    use Parse::BACKPAN::Packages;
    my $p = Parse::BACKPAN::Packages->new();
    my $user = shift || die "You must pass a pause id\n";  $user = uc($user);
    my %dists;
    foreach my $dname ($p->distributions_by($user)) {
        foreach my $dist ($p->distributions($dname)) {
            push @{$dists{$dname}}, { version=>$dist->version, time=>$dist->date };        
    foreach my $key (sort keys %dists) {
        my @versions = map { $_->{version} } 
                       sort { $a->{time}<=>$b->{time} } 
        print "$key - ";
        print join(", ", @versions)."\n";
            my @dirs;
        for my $version (@versions) {
            my $name = "$key-$version";
            # should really use Archive::Tar here
            `tar -xvzf $name.tar.gz`;
            push @dirs, "$name";
        my $dir = join " ", @dirs;
        # at some point in the future I should turn this into a module
        `svn_load_dirs --no_user_input https://example.com/svn simon/$key \
                              -t 'simon-releases/$key/\@\\d+\\.\\w+\@' $dir`;
        remove map { "$_.tar.gz" } @dirs;
        remove \1, @dirs;

Several minutes later I had a shiny new RichardC hosted subversion repository which can be found at https://unixbeard.net/svn/simon with releases in simon-releases. Shiny!

diesel, learning, evil, sweeti

It's delicious it's light it's ... delight!

Bot::BasicBot::Pluggable has a gen-u-wine third party plugin - Bot::BasicBot::Pluggable::Module::Delicious from Franck Cuny. In fcat it has two, he also did the slightly scarily named Bot::BasicBot::Pluggable::Module::HTTPIRCGW.

Apart from slightly weird vars setting stuff they look cool. I guess I should have released my version earlier - it's been lurking around since the start of August. I should release the Jabber plugin too I suppose.

diesel, learning, evil, sweeti

London Perl Workshop

I managed to herd three large (huge! even) corporate cats sufficently to organise a conference call in which, and this shocked me too, they agreed fairly rapidly to all hire Mark Jason Dominus for a day each to talk about Higher Order Perl

Why did I attempt to do this madness? Because he agreed that if i could get him 3 days worth of consulting in London he'd speak at the London Perl Workshop.


Except that I can't find a venue. My first two hopes - Imperial College Union and St Mary's both fell through. My current hope is the appropriately named The Conway Hall. Fingers crossed.

diesel, learning, evil, sweeti

Ticking off EventQueue TODO items

Everything I wanted to do with EventQueue is done. Except the UI. As previously mentioned I have all the design skills of a de-oculated swamp donkey and whilst I could hack something up to add and modify events it would look ugly and I'd actually like this to success and I think that's far more likely if it's a slick experience right from the get go.

The usual suspects are currently otherwise engaged so I may have to spread the net wider and start calling in favours.

Apart from that I'm quite chuffed with it. The caching seems to be making it pretty speedy (when kanga isn't running like a dog), the different Views work fantastically and themes work. I particularly like the NTK styled theme. Installing should be a doddle too due a nifty installer (err, just type eventqueue in a directory) and there's some developer docs that tell you how to write new themes, views and handlers.

Now where are those bloddy HTML monkeys ...

diesel, learning, evil, sweeti


And the third big ticket item for Data::ICal::DateTime was some refactoring of the recurrence-id stuff. I moved the stuff for unifying RECURRENCE-ID stuff into a seperate function collapse() which means that in EventQueue I can have a function which gathers all the events from all the providers and then collapses them where necessary. This is useful because that means I can add notes to other people's calendars for example.

    # $span is a DateTime::Span
    # $period is something like 'hour', 'day', 'month' etc etc
    my @events;
    foreach my $provider ($self->providers) {
        push @events, $provider->events($span);
    @events = Data::ICal::DateTime::collapse(@events);
    @events = map { $_->split_up($period) } @events if $period;
    return @events;
diesel, learning, evil, sweeti


Graham also noted that he had a barfage coming from this line


Which, of course, turns out to be valid. And trivial to fix. Hurrah.

diesel, learning, evil, sweeti

Floating events

Graham Gough got in contact to say that Data::ICal::DateTime was barfing on an export of his Palm pilot calendar to .ics and saying

    Couldn't find end *or* duration:                                                  
    DESCRIPTION:Check 2341 assessment\n##F@@@@@@@@@@@@@@@@\n                          
    SUMMARY:Check 2341 assessment                                                     
    UID:palm-datebook-007f9a18-000076ef-Graham Gough@rpc204                           

Which is right because there's no DTEND. Except it turns out the evnt was a floating event - as per section 6.2 of rfc2445 - recommended practices :

    A calendar entry with a "DTSTART" property but no "DTEND"
    property does not take up any time. It is intended to represent
    an event that is associated with a given calendar date and time
    of day, such as an anniversary. Since the event does not take up
    any time, it MUST NOT be used to record busy time no matter what
    the value for the "TRANSP" property.

At first I did some sort of horrific hack that turned a floating event into an 'all day' event but that was, well, bogus. When I got back $business trip abroad I ripped it out and did the sensible, cleaner, correct option of having a floating() method and getting rid of the requirement to have a DTSTART and either a DURATION or DTEND.