Friday, March 21, 2008

KunMing Trip

I'll be in KunMing next week with all my Zorpia colleges. it would be a nice trip. :)

Labels:

Wednesday, March 19, 2008

memcached for Windows

Friday, March 14, 2008

Catalyst Tip: bind STDOUT with res->body

sub test_body : Local {
my ($self, $c) = @_;

$c->res->body(\*STDOUT);
print "a\n";
print "b\n";
}

I think that's pretty useful when u are trying to use "Benchmark" module (or others use STDOUT).

Have fun!

Labels:

Wednesday, March 05, 2008

MySQL tip TIMESTAMPDIFF

Thanks for my college CY.

UNIX_TIMESTAMP(birthday) is not working when birthday is before 1970.
I should use TIMESTAMPDIFF(DAY, '1900-01-01', birthday) to get the DAY or SECOND
mysql> select TIMESTAMPDIFF(DAY, '1900-01-01', '1998-05-01');
+------------------------------------------------+
| TIMESTAMPDIFF(DAY, '1900-01-01', '1998-05-01') |
+------------------------------------------------+
| 35914 |
+------------------------------------------------+


http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_timestampdiff

in Perl, we can do:
use Date::Calc qw/Delta_Days/;
print Delta_Days(1900,1,1, 1998,5,1);
^Z
35914

Labels:

Sunday, March 02, 2008

something about Sphinx indexer

Sphinx is just another search engine. something like Xapian.

I'm rebuilding the search function for Zorpia these days. the user table is somehow 9,000,000+, it's pretty slow to query SQL directly. so we guess we need use a search engine to rebuild our search function.

Xapian and Sphinx is coming into our eyes. frankly we don't know much about them. I just spend some hours on Sphinx (haven't do Xapian index yet. but both are installed) and find the indexer part in Sphinx is pretty easy to understand and configured. u just need write a conf and Sphinx indexer will take care of the left. I'm pretty happy with this. anyway, someone will say that's not controllable. but it's OK when it meets our demand.

I think I'll do Xapian indexer later and do search part of both. But basically the idea behind search engine is somehow the same.

That's it, I'll write more when I'm free.

Labels: ,