Building simplicidade.org: notes, projects, and ocasional rants

Notes

last update:

Generating charset_table maps for Sphinx

At work, I wanted to improve the back-office search engine and installed Sphinx. On a regular basis, it indexes all our users, courses, teachers and other important tables. It works great, low install barrier, low maintenance, and it is very very fast. Perfect. One of the problems that we found, that limited the usefulness of the full-text search engine, is that a lot of our text has accents, and it would be better to ignore those.

Tip: use pv to monitor mysql loads

If you are fortunate enough to be able to reload your development databases from time to time with production data, this might help. The usual command you would use is something like this: gunzip -c db-backup.sql.gz | mysql -udevuser -ppass db_dev If your dump is big this can take a while and you wont have a clue about what is happening. Instead, install pipe viewer and do: gunzip -c db-backup.sql.gz | pv | mysql -udevuser -ppass db_dev and you get a nice speed meter.

A new look at Mason

On my way to E5, I have to deal with all the legacy sites that came before it, and the vast majority of them are written in Mason. At the time, we used HTML::Mason 1.05, and only after 1.30-ish (when the internal buffering changes introduced in the 1.10 release where reverted) did we upgraded to something more recent. To get an idea of the size of this Mason project, the current sites have a little over 450 different components across 7 sites (different layouts but same content) and 1 management site.

Bitten by prototypes

I just spent the best part of an hour around a problem caused by the behavior of Perl prototypes. I used the following test case to figure it out: use Test::More tests => 1; use Encode qw( encode decode ); sub u8l1 { return encode('iso-8859-1', @_); } my $ola_u8 = decode('utf8', 'Olá'); my $ola_l1 = encode('iso-8859-1', $ola_u8); is(u8l1($ola_u8), $ola_l1); The output of prove x.t is this: t/x.t .. 1/1 # Failed test at t/x.

Stupidity

Just finished watching the first, and only, season of Firefly). I have only one question: who was the monster stupid that cancelled this show? What was he thinking?

Log::Log4perl tip

I use Log::Log4perl for all my logging needs. Ok, I lie. I use a wrapper that deals with some stuff that I just don't like with Log::Log4perl, but that is a story for another day. One thing that we inherited from log4j was the notion that a message can match multiple loggers in your logging hierarchy. The logic is simple and explained in detail on a Log::Log4perl FAQ entry. If you write something like this in your logger configuration file:

Problem solved

I keep a pad of paper between me and my keyboard at all times. I used to take down notes, keep track of what I need to do today, small brain dumps, and random scribbles. But with my hands going about their bussiness, the corner of the paper starts to bend upwards. The solution is not rocket science. A simple paper clip. Problem solved.

Last chance to see

The book turns into a TV show. It might not have a comparison between riding a manta ray or riding a air-powered submersible thingie, but it shouldn't be too bad, given the two names associated with it.

Bootstrap Perl

Whenever a new version of Perl is released, I install it in a separate directory and re-install all my modules into a new local::lib-powered directory. This takes a lot of time, but I had most of the process already in auto-pilot. But still it was a hack, so I decided to take the opportunity of the 5.10.1 release and make something more pretty and reliable. The result is my Perl bootstrap repo.

SAPO turns 14

So 14 years ago a project was born in Aveiro. Just a couple of guys (there is a picture of them, but it was buried somewhere due to hair style issues), love for technology and an idea. Today the company has over 200 persons working there, keeps sharing their technology with us all, gives us access to a bunch of very cool APIs, and invites us to have fun from time to time.