Category: Informatique

wb to blogohell …

Par mc, 27 août 2010 17 h 33 min

bad mood last weeks so i escaped from blogosphere … I came back today and read a clever solution of the pascal’s triangle on Masak’s blog (http://use.perl.org/~masak/journal/40516?from=rss). I wrote code for years now, tried a lot of langages, stuck to perl5 because it’s the most featured one… and really wanted something better. Perl6 is really the kind of thing i expected for years (while coming to haskell).

So i read comments: « unreadable », « research language », « not for production » … comments close from those made by php or python users discovering $_ or the HOP …

bad mood again. log off …

use Lazyness;

Par mc, 20 juin 2010 17 h 31 min

I enjoyed playing with my new Lazyness module. Book found a bug without even running the code afaik. It’s fixed and i added tests. I also added documentation and
and gited it.

I can also use TheForce now: based on Modern::Perl, it also exports Lazyness and List::AnyUtils.

Template::Declare::Quickly ?

Par mc, 15 juin 2010 20 h 54 min

Franck Cuny provided an experimental Dancer Template for Template::Declare. I realised that it wasn’t what i wanted so i spend some time tonight to find my way. I finally wrote Template::Declare::Quickly which isn’t a Dancer template at all:
just a syntaxic suggar on top of Template::Declare. Now i’m able to write:


package html;
use Template::Declare::Tags;

template page => sub {
my ( undef, $arg ) = @_;
html {
head {
title { "Dancer fart" }
}
body {
h1 { "prout" }
p { "welcome to $$arg{url}" }
}
}
};

package main;
use Template::Declare::Quickly
qw/ strict with dispatch_to / => [qw/ html /];

say html::show('page');

The code of Template::Declare::Quickly itself is very short. I’ll contact Sartak to be sure it doesn’t break some advanced use of Template::Declare.


package Template::Declare::Quickly;
use strict;
use warnings;

sub import {
shift;
my %args = @_;
if ( $args{dispatch_to} ) {
no strict 'refs';
for my $package ( @{ $args{dispatch_to} } ) {
push @{$package.'::ISA'}, 'Template::Declare'
}
}
Template::Declare->init(%args);
}

1;

the dancer meet astaire

Par mc, 15 juin 2010 9 h 12 min

During a perl6 workshop at FPW2010, Sukria and Martin Berends chatted about a perl6 port of Dancer. In my mind, it was already done (masak wrote a port of Rack called Web.pm and a port of Sinatra called Astaire long time ago) so I contacted Masak about the health of those code but masak admited Astaire was very experimental and did not gone far.

So masak and Tene joined #dancer, they are both perl6 programmers since 2 years AFAIK and would like to help. So we have 3 perl6 programmers interested by this Dancer port and all of them already played with web related projects. wow … perhaps it’s time to contact the mod_parrot author ;)

And yes … i promissed masak a post on dancer-users but everything was told on the chan yesterday.

FPW 2010

Par mc, 13 juin 2010 22 h 18 min

A chat with Laurent Dami who really helped me to understand some underlaying points of the discution about DBIx::Class::Direct. Thanks to him, i’m back to my initial idea (make the KiokuDB DBIx::Class backend work for us). Franck Cuny also told me about his satisfation related to the KiokuDB performances.

I also enjoy meeting Sukria and chatting with him. He already reported the Dancer related part on his blog so i won’t spoil here: just read it :)

Franck Cuny’s talk on Plack was an enlightened me about the Plack Middlewares. Plack isn’t just the implementation of PSGI. It also provide a very neat way to add plugins for the HTTP part of your web apps and frameworks. So implementing things at the plack level insteed of the Dancer one is a good way to share works between every perl frameworks. He made slides aboutDebug andStackTrace which provides very powerfull debugging informations. Definitely: i’ll use plackup now :)

I asked Franck about my Dancer-CGI-Wrapper. It already exists at the Plack level … i begun to read the code and it seems i can remove my repo :)

also a lot of chat with lot of people about perl6, haskell, the growth of functionnal programming, Calais by night, the rock’n'roll attitude of welsh eating, the french soccer team, the FPW’09 T-shirts … had a lot of fun thanks to all of you guys ( big up to Sebastien, Laurent and the sponsors linkfluence, dot and co, O’reilly, Linux mag, Ulco … Sebastien? did i missed someone? ;) ).

Migration de Drupal vers WordPress terminée

Par kyusan, 11 janvier 2010 18 h 30 min

Le blog est passé de Drupal à WordPress, pourquoi ce changement ? Après mon enthousiasme pour Drupal, j’ai fini par être lassé par les multiples mises à jour de sécurité et de perdre enormement de temps pour la mise à jour des plugins.

Poursuivre la lecture 'Migration de Drupal vers WordPress terminée'»

perl completion in vim: i finally try it

Par mc, 10 novembre 2009 1 h 20 min

I was waiting a long time to have a perl completion system in vim. I waited because i’m lazy and because i thought someone more skilled than me will finally handle that. I don’t know about PPI or other perl parsing technics and i expected the completion to be really smart.

Time passed and there is no such thing in the place. I used ctags completion but it’s very borring to see packages names of your whole @INC when you try to complete a method name.

Still waiting for something really smart, i spent 2 evenings to write a ‘not so smart completion’ … my first use cases surprised me is it seems to be smart enought to go on waiting for another long time :-) .

I’ll try a daily use starting tomorrow and will feedback in a week. If you can’t wait for testing, debugging, feedback:

the perlcfu git repo

monger frustration …

Par mc, 27 août 2009 9 h 12 min

Perl is the first real language i used (i learnt to program with pascal and C but my first daily use programs where in perl), that’s right … But it’s wrong i sticked on perl « just because i know it »: I honnestly gave a try to python, ruby, php, lua, i’m abble to write code in C, C++, i read haskell, erlang or java codes.

I Finally sticked on perl after a long time of experiment (and i know that my next langages would be haskell and perl6) because i’m happy to see how it’s possible to write short and readable code when you know perl concepts and rules.

sub clear_session { (shift)->clear[qw< foo bar bang bing >] }
 
$_=2 for my ($a,$b,$c,$d);
 
sub trim_lr { s/ ^ \s* | \s* $ //xg } 
trim_lr for values %author;
 
sub commented_line { / ^ \s* # / }
 
my @lines = do {
    my $filename = 'foo.pl';
    open my $fh,$filename or die "can't open $filename: $!";
    map {
	if (commented_line) { () }
	else { "$. :".uc }
    }
};

… but now … i write code for a big OSS project with tons of lines of code and i realize that all those knowledges are useless because coworkers want you to write « more explicitly » and even the PBP tells you to use the « return » keyword.

sub clear_session { (shift)->clear[qw< foo bar bang bing >] }

becomes

sub clear_session {
    my $session    = shift;
    my @attributes = ( 'foo', 'bar', 'bang', 'bing' );
    return $session->clear(@attributes);
}

Yeah … i trully understand my coworkers because i remember, years ago, i had a poke on those kind of lines before understanding them and want to learn how to write them. I thought for years that the only thing that people missed to love perl is « understanding ». I realize i was wrong: lot of them just don’t like to be concise: they don’t want to understand and they are perfectly right in their point of view.

Now is the day i give up (in koha at least) fighting for spreading perl skills no one care about. A poor (and autoproclamed more readable) perl subset exists: it’s called python … and i’m wondering why i spent so much time to become a monger.

add js behaviors to koha

Par mc, 26 août 2009 15 h 36 min

when you create a new js file, you put it in the

koha-tmpl/WHERE-tmpl/prog/en/js/foo.js
# WHERE can be intranet or opac

now, in your template:

<script type="text/javascript" src="koha-tmpl/WHERE-tmpl/prog/en/js/foo.js"></script>

will fail if you use a translation. so write:

<script type="text/javascript" src="<!-- TMPL_VAR NAME='themelang' -->/js/behaviors.js"></script>

themelang is added in template C4::Output::gettemplate function (as you can easily see in the documentation) ;)

unix philosophy in the librarian culture ?

Par mc, 18 août 2009 10 h 38 min

I used and read a lot of tools since i’m at biblibre. One thing that surprised me is that lot of them completly ignore the unix philosophy. Most of them tries to make too many things in a monolithic code and aren’t usable as filter (my first concern is about the koha bulkmarcimport.pl).

I wonder if this philosophy get lost or has ever existed in the librarian culture? please feedback.

Panorama Theme by Themocracy