Friday, May 29, 2009

The Dual-Lived Problem

Chromatic writes about perl future. His recent post on The Dual-Lived Problem brought my attention and I had time to read it to the bottom. I'll stop on the following idea and will try to promote tools we at Best Practical develop for our needs:



First, improve the core's automated testing.
This helps everyone; it can identify changes
in the core code that affect the stability
and behavior of the standard library. It can
also identify changes in standard library
modules which do not work on important platforms.


I do believe that CHIMPS toolset can help with this. Can not saythat it's been tested for such purpose, but it used exactly inthis way by BPS. We tests each revision of our project on mostrecent revision of another project it depends on.

Hope people can try with some modules they care about and reportback issues. You should prefer developer releases I recentlyblogged about orrepositories on github.

Finally done a new release of CHIMPS client

CHIMPS is a collection of tools to smoke test projects out of repositories.

My adventure with this toolset started as a simple task. I wanted to add smoking of our product RTIR. Well, now I know for sure what "yak shaving" means. At the end we have git support, less bandwidth, faster tests, new options, API for new repositories and new options.

Some use cases have been described earlier.

Recently uploaded two new development releases of Test-Chimps and Test-Chimps-Client distributions to the CPAN. You're welcome to try with your projects and report back using http://rt.cpan.org or this blog.

Friday, May 22, 2009

Bleeding edge smoke testing of perl software

We use CHIMPS for smoking in Best Practical. It's modular client server testing toolkit. One of its parts is smoking client that works with SVN repositories.

It's really simple things, at least it was, you describe projects in repositories, dependencies between them, start smoker and commit to the repos without being affraid you break backwards compatibility.

There are multiple case when it's useful. Sure you just smoke test your projects, but also you can smoke your project against repository of a module you don't control, but depend on heavily.

For example, you use Moose a lot with fancy things, its bleeding edge features and some workarounds. Chimps may be the only way to help you prevent disaster before new broken version of Moose is on the CPAN. To do this you setup smoking your project and describe Moose repository as well, so smoking goes against Moose's HEAD.

You also can test your project with Moose that is installed on the system, with Moose's tag 0.01 and Moose's HEAD. All this in one smoker.


        

Several days ago I started implementing a new tiny thing in the smoker. This change end up in total refactoring of the module and now we can smoke from git too. Adding additional back end now is easy. You have to implement four methods in a class.

Sadly there were no releases since 2006, so you have to check it out from github. I'm planning on releasing a dev version on the CPAN.

Wednesday, May 20, 2009

Where can you find code behind rt.cpan.org

Hi, continuing with blogging around http://rt.cpan.org.

Some people still think that rt.cpan.org is something hidden in Best Practical's cages where we hold it like a prisoner. It's not true for a long time.

Started simple about rt.cpan.org document. I hope peopl will find link to this document on the main page.

Tuesday, May 19, 2009

Report spam button on rt.cpan.org

May be you don't know, but when people complain about http://rt.cpan.org service.I'm one of responsible for some stupidities. Heh. I'm not going to protect myself.

Fruck. All the cpan authors are responsible. The code behind the service is freeand you can send patches and extensions. Do you know number of those we recieved?ZERO.

That was a headup. Now, about reporting spam, I've writen a simple RT extension soregular users can help report messages as spam. It's in best practical's repository:

   http://svn.bestpractical.com/cgi-bin/index.cgi/bps/browse/RT-Extension-ReportSpam

I've installed it already, but it has several problems:

1. no icons for the button.

2. when you click on link, browser jumps to a page when it should be AJAX style.it works locally, but doesn't on the service. It needs debugging.

Help is welcome. You can write to ruz@bestpractical.com or find ruz/ruz_macon IRC channels.

The way to search those spam tickets is described in the README.

Monday, May 18, 2009

A "new" game you can play on a conference

Ok, YAPC::Russia 2009 is over, it was awesome event. I really liked it.

I'm going to talk about a game we played. Main idea is to gather new fantastic ideas for startups using -Ofun mode.

You have a subject, in our case it was the Perl.

You spend 15 minutes collecting a lot of events related to the subject that most pobably will happen in the near future (1-2 years), for example it's likely that perl5 will be in use on the same rate for the next couple of years. Chances are not 100% but very high, it's a perfect match.

It's ok to have things with lower chances to happen. This is prefectly fine.

At the end you should have a big list. We used some mindmap building software for managing and writing down ideas.

Then you decide that you're not interested in things that will happen for sure. And auditory spends next 15 minutes throwing away things that have 50% and more chances to happen and filling blanks with things that have lower chances. At the end you need from 3 to 5 events per 5-10 persons in the room.

For example microsoft releases perl6 or crazy things like nuclear war. It's better to avoid really crazy things.

Randomize list, split people into groups, each group gets from 3 to 5 events. People should imagine that they live in a world where events they recieved have happenned. Every group has 15 minutes to discuss new realities.

A delegate from each group present the future describing one or two things in their world. We were describing a CPAN module and an application writen in Perl. Here the list we had:

    1) big russian it companies organize a perl school
    2) CPAN gets simpler and understandable
    3) there is a perl CMS that you can distribute without a developer in the box
    4) russian kids study perl in low-school

Everything should be recorded in a file, so you have list of fancy ideas. You can compare different realities and come up with new ideas that applicable in the real world.

Wednesday, May 13, 2009

instrumenting twitter with perl

Yesterday decided that I finally want to use twitter. Too much noise around, however it look like a nice thing that doesn't take much time. And useful for tiny announces.

What a concidence, lately I got addicted to music by Glen Hansard and Marketa Irglova from Once movie. Twitter is perfect thing to say what you're listing to right now. Why not?

    sudo cpan Net::Twitter
    vi ~/bin/tw_song
    # 10 minutes of typing
    :wq

One slight problem is how to get the current song from iTunes.

    # googling
    # AppleScript editor

    if appIsRunning("iTunes") then
            tell application "iTunes"
                    artist of current track & " - " & name of current track
            end tell
    end if

    on appIsRunning(appName)
            tell application "System Events" to (name of processes) contains appName
    end appIsRunning

That's it. From command line you can use it the following way:

    osascript /Users/ruz/Library/Scripts/say_current_itunes_song.scpt

Here is final perl script:

    #!perl

    use strict;
    use warnings;

    my $song = `osascript /Users/ruz/Library/Scripts/say_current_itunes_song.scpt`;
    return unless $song;
    $song =~ s/^\s*//;
    $song =~ s/\s*$//;

    my $status = "Listening $song";
    print $status, "\n";

    require Net::Twitter;
    my $twit = Net::Twitter->new({username=>"myuser", password => "mypass" });
    $twit->update({status => $status});

Saturday, May 09, 2009

Blogging for perl geeks

Hi, there. For a while I've been trying to return back to bloggingwithout much success. I don't like what's going on with LJ. It'scrappy these days. Have a personal blog there, mostly in Russian,don't want to turn it into an IT blog. Many months ago startedlooking for a new hosting and chose blogger for that. Made a fewposts, but html is killing me, composer sucks too.

What the hell, I can not blog using some simple syntax. That'sjust wrong.

Here is my first post from my own blogging software - pod2blog.

Yes, you heard me right. I use perl's Plain Old Documentation (POD)for blogging.

It was a little bit harder than I thought would be, but works:

    #!perl    use 5.008;    use strict;    use warnings;    use utf8;    use YAML::Any qw();    use LWP::UserAgent;    my $ua = LWP::UserAgent->new;    my $file = shift;    my $parser = MyParser->new;    $parser->parse_from_file( $file );    push_to_blogger( $parser->{'entry'} );    sub push_to_blogger {        my $entry = shift;        my $request = HTTP::Request->new();        $request->method( 'POST' );        $request->uri('http://www.blogger.com/feeds/19258261/posts/default');        $request->header( 'Content_Type' => 'application/atom+xml' );        $request->header( 'GData-Version' => 2 );        $request->header( 'Authorization' => 'GoogleLogin auth='. auth_token() );        $request->content( $entry->as_xml );        my $res = $ua->request( $request );        print $res->dump;    }    { my $cache = undef;    sub auth_token {        return $cache if $cache;        my $opt = config();        my $res = $ua->post( 'https://www.google.com/accounts/ClientLogin', [            Email  => $opt->{'email'},            Passwd => $opt->{'password'},            service => 'blogger',            accountType => 'GOOGLE',            source => 'ruz_at_cpan-pod2blog-1',        ] );        my ($auth) = ($res->content =~ /^Auth=(.*?)$/m)            or die "Couldn't authenticate: ". $res->dump;        return $cache = $auth;    } }    { my $cache;    sub config {        return $cache if $cache;        require File::HomeDir;        require File::Spec;        require YAML::Any;        $cache = YAML::Any::LoadFile( File::Spec->catfile(            File::HomeDir->my_home, '.blogger.yml'        ) );        return $cache;    } }    use Pod::Parser;    package MyParser;    use base qw(Pod::Parser);    use XML::LibXML;    sub begin_input {        my $self = shift;        use XML::Atom::Entry;        $self->{'entry'} = XML::Atom::Entry->new( Namespace => 'http://www.w3.org/2005/Atom' );        my $doc = $self->{'doc'} = XML::LibXML->createDocument( "1.0", "UTF-8" );        my $root = $self->{'in'} = $doc->createElement('div');        $doc->setDocumentElement( $root );    }    sub end_input {        my $self = shift;        $self->{'entry'}->content(            $self->{'doc'}->documentElement->toString,        );        return $self->{'entry'};    }    sub command {         my ($self, $command, $paragraph, $line_num) = @_;        if ($command eq 'head1') {            my $expansion = $self->interpolate($paragraph, $line_num);            $self->{'entry'}->title( $expansion );        }        elsif ( $command eq 'tags' ) {            $self->{'entry'}->add_category( {term => $_, scheme => 'http://www.blogger.com/atom/ns#'} )                foreach map { s/^\s+//;s/\s+$//;$_ } split /,/, $paragraph;        }    }    sub verbatim {         my ($self, $para, $line_num) = @_;        my $e;        if ( $self->{'last'} && $self->{'last'}->nodeName eq 'pre' ) {            $e = $self->{'last'};        } else {            $e = $self->{'last'} = $self->{'doc'}->createElement('pre');        }        $e->appendTextNode( $para );        $self->{'in'}->appendChild( $e );        return $e;    }    sub textblock {         my ($self, $paragraph, $line_num) = @_;        my %parse_opts = (            -expand_seq => 'interior_sequence',            -expand_text => sub { return $_[0]->{'doc'}->createTextNode( $_[1] ) },        );        my $expansion = $self->parse_text( \%parse_opts, $paragraph, $line_num );        my $e = $self->{'last'} = $self->{'doc'}->createElement('p');        $e->appendChild( $_ ) foreach $expansion->children;        $self->{'in'}->appendChild( $e );        return $e;    }    sub interior_sequence {         my ($self, $cmd, $arg, $node) = @_;        if ( $cmd eq 'B' ) {            my $e = $self->{'doc'}->createElement('strong');            $e->appendChild( $_ ) foreach $node->parse_tree->children;            return $e;        }        return $arg;    }    sub parse_from_file {        my $self = shift;        my $fname = $_[0];        # XXX: set publish time        return $self->SUPER::parse_from_file( @_ );    }

Friday, January 16, 2009

It's close to the day X

We have place defined: "Business inda .ru style" club provides us room, internet sccess and may be even online video translation.

We have time defined: 9:00 - 21:00 Europe/Moscow TZ (UTC+3h)

We have crew: 12 perl developers and one CSS guru

We have project defined: described earlier in this blog.

We have IRC channels defined: #moscow.hm on irc.perl.org for English speaking

All is set. See you on onsite and in IRC.


Monday, January 12, 2009

Idea

Write perlplanet.ru implementation with additional features, like onsite publishing, tags, comments, some sort of back syncing. Whatever we will have time to.

We're going to publish everything in a public repository online or even keep up to date server for people to test the app in real time. So people from different places can join us on IRC or develop with us. Even if people don't want to develop they can help us find quick solutions or just keep pushing us by sarcastic comments :)

Goals

  • Write ready for deployment application within 8-12 hours
  • Share experience
  • Try collective rapid development
  • Try Catalyst framework
  • See how far we can go in a short period of time
  • Have a lot of fun
  • Eat pizza

Tools

perl 5.8, Catalyst, Plagger, git and many different modules from CPAN :)

Sunday, January 11, 2009

Moscow Perl Mongers group organizes one day hackmeet next saturday

Next saturday (17 Jan 2009) Moscow Perl community going to hack whole day on a simple web-service project. All developers will be in one room with their laptops up to 12 hours and will try to make Catalyst based application start from blank paper. Experience of developers varies from "low perl" to "have some catalyst-based projects". It's gonna be fun.

Russian and English speaking communities who wouldn't be able to join us onsite can help us online. I've created IRC channel #moscow.hm on irc.perl.org for English speaking and there is #moscow.pm on  rusnet.org.ru server for people speaking in Russian. We'll use git (may be svn) and will be posting commits to some public domain (github probably), so you'll be able to hack with us as well.

Details for attendies are on moscow.pm's mailing list.

You're welcome to join us onsite or online in IRC or repository. I'll keep posting details here.

Thursday, December 25, 2008

Tuesday, November 04, 2008

Really don't know how I lived without ctx command in vim. Just try type c then t and any char you see in the current string somewhere after cursor.

Tuesday, May 15, 2007

Bugzilla 3.0 (BZ) is here, but let's compare the feature list to Request Tracker (RT)



I want to note that my experience with bugzilla end ups on filling bug reports, tracking progress on a bug and searching. So this review is quite superficial

Custom Fields



RT has support for CFs for several years and it's improved in each version. In the development branch have been added the following things:

  • Dynamic custom fields values

  • Autcompletion in input field of a CF



mod_perl Support



Several years ago people were running RT on apache1/mod_perl1 servers, now people do the same as well as using apache2/mp2 or FastCGI with apache/nginx/ligthttpd.

Shared Saved Searches



In RT user can access to groups' "saved searches" in some cases to system's, all this depends on rights you've granted to your user. People can add this to their workspace (RT at glance).

Custom Resolutions



As I understand Status field of tickets in RT is closest analogy to resolution field in BZ. As I wrote before, during discussion of custom statues in RT, I don't like this idea. RT has custom fields and you can add a field that describes the current status of a ticket in details if need this info. However, because of huge amount requests this feature had been implemented in RT 3.4 or may be earlier. Like in BZ you can set a custom list, but our list is splitted into active statuses and inactive, what makes it easier to write custom scrips and allow developers to integrate some sane default dates management based on custom statuses.

Per-Product Permissions



I couldn't make any comparison of ACL sub-systems using only this feature.

XML-RPC Interface



RT has REST interface.

Skins



Since RT 3.6 it has "skins" too, in 3.8 users would be able to select preferred skin, but I think the main goal of skinnanization in these software is to make it easier for companies to integrate a tool into design of other internal applications.

File/Modify Bugs By Email



RT-Extension-CommandByEmail

Other things



Here is other things from the list, but I either have no wish to comment them or they are not related to this comparison:

  • Attachments and Flags on New Bugs

  • Unchangeable Fields Appear Unchangeable

  • All Emails in Templates

  • No More Double-Filed Bugs

  • Default CC List for Components

  • Users Who Get All Bug Notifications

  • Improved UTF-8 Support

  • Automatic Update Notification

  • Welcome Page for New Installs

  • Other Enhancements and Changes

Thursday, April 05, 2007

KDiff3's feature you'll love if you do a lot of merges



KDiff3 is a tool I'm using for merging conflicts. I tried Meld, vimdiff and other tools earlier, but kdiff3 is really make you stop looking for another one.

Have you ever seen how diff and other tools make wrong code blocks alignment choices and compare apples to oranges. It always happens. You move a block of code, for example block in if-elsif chain and diff tool goes crazy and think that you've changed code, shows you a lot of crap.

You can forget about this nightmare. KDiff3 has "Add Manual Diff Alignment (Ctrl+Y)" feature. You select line in one file and press Ctrl+Y and do the same in another view. KDiff3 aligns marks. That's all, after that you see beautiful diff. All blocks in their own place, just plain add/remove differences. You just selecting A/B[/C] choices. Work's done.

Wednesday, April 04, 2007

New shredder release available



Change log:
* fix: in the previouse version a regression was introduced
that caused terrible slowdown during tickets deletion.
* doc: added section about database indexes