Thursday, January 15, 2009

Padre I18N translation

(updated on June 23, 2009)

from http://padre.perlide.org/wiki/TranslationIntro:

the first time:
* msginit -i messages.pot -o zh-cn.po -l zh_CN

later then message.pot get updated.
* msgmerge -o zh-cn.po.new zh-cn.po messages.pot
open the file, grep 'fuzzy'. and fix them

check the syntax
* msgfmt -c zh-cn.po

check the difference
* msgcmp zh-cn.po messages.pot

Thanks.

Labels: ,

Wednesday, January 14, 2009

The Art of SQL

I bought it from dangdang and started to read last night. it's a good book and I'm glad I bought it.

Thanks.

Labels:

Monday, January 12, 2009

Google::Code::Upload

Google::Code::Upload - uploading files to a Google Code project.

see you have a google code project like http://code.google.com/p/fayland/
then you want to upload some files to Downloads section.
it's OK to upload through web interface, and if you want to upload through command line, there is a python script: http://support.googlecode.com/svn/trunk/scripts/googlecode_upload.py

I'm a Perl guy, so I decided to port it to Perl. then there comes out http://search.cpan.org/dist/Google-Code-Upload/.
mainly there is a Perl script http://search.cpan.org/dist/Google-Code-Upload/script/googlecode_upload.pl which you can just simply type:
$> googlecode_upload.pl Google-Code-Upload-0.02.tar.gz
then type project:fayland, username:fayland, password:lovekitty, summary:xxx

just Enjoy!

Labels: ,

Friday, January 09, 2009

Learn Moose X: handles

Writing Moose is really very fun and happy.

I'm happy that sunnavy picked up the Moose for Net::Google::Code.

Today I'm implementing some attributes for the Net::Google::Code. the code would be something like
    use Net::Google::Code;
my $project = Net::Google::Code->new( project => 'net-google-code' );
print join(', ', @{ $project->owners } );
so in old plain Perl code, you must write code in Net/Google/Code.pm or else you need sub owners { Net::Google::Code::Home->new()->owners }, something like that.

with Moose, with hanldes, we can simply write code like
has 'home'  => (
isa => 'Net::Google::Code::Home',
is => 'ro',
lazy => 1,
default => sub {
require Net::Google::Code::Home;
Net::Google::Code::Home->new( parent => $_[0] );
},
handles => [ 'owners', 'members' ],
);

in this way, it makes the code really clean and small.
http://code.bestpractical.com/bps-public/Net-Google-Code/trunk/lib/Net/Google/Code.pm
http://code.bestpractical.com/bps-public/Net-Google-Code/trunk/lib/Net/Google/Code/Home.pm

the magic is $project->owners == $project->home->owners, more example can be found: http://search.cpan.org/src/DROLSKY/Moose-0.64/t/020_attributes/010_attribute_delegation.t.

if you never use Moose before, you SHOULD use Moose today!

Thanks.

Labels:

Friday, January 02, 2009

2009 plan

well, 2008 is a fruitful year. I got married, bought a house and my son is 9 months old now. :)

To review the 2008 plan, I can give myself 70 points.

2009 is here. and the plan is
* write another 100 articles.
* read 10+ books.
* maintain all my CPAN modules and release some more if I can

I'm willing to write a Chinese Perl book for free, but it's really not so easy because my son costs most of my time. but I can promise to write at least
* CPAN
** Be a CPAN Tester
** Be a CPAN Author
* Catalyst + DBIx::Class + TT2
please remind me if I'm too lazy.

Thanks.

Labels: