Thursday, July 31, 2008

last n records in a query

I'm using mysql for this:

This is straightforward:

SELECT * FROM tab LIMIT 0, 10

will display the first 10 rows from the table tab.

SELECT * FROM tab LIMIT 5, 2

display rows 6 and 7 (5 is the offset, 2 the count)

And:

select * from (select * from TAB order by id desc limit 5 ) TA order by id;

display the LAST 5 rows.

Wednesday, July 23, 2008

Perl modules

I'm taking a peek to some perl modules, following some personal rules:
1. do not re-invent the wheel
2. KISS, keep it simple, stupid

Perl is a great language, with many packages...
I'm missing a guide, a legenda on them

"Moose - A postmodern object system for Perl 5"
http://search.cpan.org/dist/Moose/lib/Moose.pm

a framework for web applications
http://www.jifty.org/view/HomePage

I know catalyist:
http://www.catalystframework.org/
it does a great job on a MVC point of view, but is overpowering for
90% of my apps

and "dubbed as a cross between Java's JAR and Perl2EXE/PerlApp"
http://par.perl.org/wiki/Main_Page

seems nice!

--
http://www.stefanobrozzi.com

--
http://www.stefanobrozzi.com

Monday, July 14, 2008

perl pack() & unpack()

nice documentation (well: the man page in HTML format)

http://perldoc.perl.org/functions/pack.html

MYSQL: convert null as 0

IFNULL():

like in:
SELECT IFNULL(field, 0) FROM tab;

firefox speed up

some speed increase can be obtained with some modifications
in firefox parameters:

about:config

setting to true

network.http.pipelining
http.proxy.pipelining


and setting at the value of 8
network.http.pipelining.maxrequests