Padre I18N translation

15 January 2009


(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.

The Art of SQL

14 January 2009


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

Thanks.

Google::Code::Upload

12 January 2009


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!

Learn Moose X: handles

09 January 2009


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.

2009 plan

02 January 2009


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.

JavaScript::Beautifier

18 December 2008


I just uploaded my yet another module JavaScript::Beautifier to CPAN.

The module is mostly a Perl-rewrite of http://github.com/einars/js-beautify/tree/master/beautify.js

The js demo is http://elfz.laacz.lv/beautify/ which is really cool.

I'm going to write a plugin for Padre soon or later.

just enjoy!

Catalyst::Action::Fixup::XHTML

15 December 2008


Catalyst::Action::Fixup::XHTML is on CPAN now.

as what I said yesterday, I just made up a Catalyst Action for XHTML header.
the code is really very simple and most are copied from Catalyst::View::TT::XHTML.
and the test code too.

I also wrote tests for my MojoX::Fixup::XHTML. you can find here: http://fayland.googlecode.com/svn/trunk/CPAN/MojoX-Fixup-XHTML/t/live-test.t

Just enjoy!

Thanks.

MojoX::Fixup::XHTML

14 December 2008


inspired from Day 13. Using XHTML Strict mode during application development., I just created a MojoX::Fixup::XHTML based on Catalyst::View::TT::XHTML

but it's more than TT. every template render can use it, it's in sub dispatch.
I'm thinking to create a Catalyst::Action::Fixup::XHTML to do more than TT, but I don't have much time now.

at last I applied to http://fayland.googlecode.com/svn/trunk/CPAN/day_day_up/lib/DayDayUp.pm

the source code is simple which can be found here: http://fayland.googlecode.com/svn/trunk/CPAN/MojoX-Fixup-XHTML/lib/MojoX/Fixup/XHTML.pm

Enjoy!

another perl advent

08 December 2008


http://badgerpower.com/advent2008/index.html

from Badger, the Template-Toolkit author.

enjoy!

MySQL::SlowLog::Filter

02 December 2008


we are using mysqlsla to parse MySQL slow.log, but we have an issue that our slow.log is pretty huge, it contains 2 years' data. somehow I just need 3 month or half a year.

I'm searching around to find a script to do the things I want and I find http://code.google.com/p/mysql-log-filter/
it's python(php) script and I do want a Perl script.

then http://search.cpan.org/dist/MySQL-SlowLog-Filter/ is out.
and a script: http://search.cpan.org/dist/MySQL-SlowLog-Filter/script/mysql_slowlog_filter.pl

have fun