Archive for May, 2009
Sunday 31. May, 2009
So, it seems that people are actually reading my ramblings. For instance, Franck Cuny read my description of the Mojo routes graph generator. Then he took it upon himself to write the Catalyst equivalent. That is just so awesome!
Frank says “For the moment only private actions are graphed.”, hopefully, it can be extended to understand chained actions. I can’t wait to test it out on the iusethis code base. Now I can just hand this graph to Arne when he wants to know which template matches which action.
Saturday 30. May, 2009
Seems DBIx::Class, the greatest Perl object-relational mapper ever, has recently added support for subqueries:
22:04 * marcus looks at DBIC cookbook, realizes it has subquery support now.
*head explosion*
22:04 < @mst> since 081, yes :)
Even tho most things can be rewritten as joins, this has been one of the few things I’ve been missing in this excellent ORM. It’s still marked as experimental, but I’m totally going to be using it from now on :) Apparently this is how it works:
my $s_query = $c->model('DB::License')->search({ free => 1 });
$c->stash->{apps}= $c-model('DB::App')->search(
{ license_id => { 'IN' => $s_query->get_column('id')->as_query },
});
PS. Note the disclaimers below the cookbook example.
Gruber has written a brilliant guess at what must be going on inside the heads of the Apple App Store reviewers’ mind. I specially enjoyed this nugget:
I could read that over and over. It’s like the voice of a robot. The voice of authority. The voice of authoritative robots.
Wednesday 27. May, 2009
varnish-top is a handy util for keeping track of our varnish installation (via Denis). From the google-code project page page:
Simply, it is a tool that lets you monitor a few key stats from one or more varnish boxes in real-time, from the command line, in a top-like screen. It’s not the most sophisticated tool, but is handy for seeing a real-time view into how your box(es) are doing without needing to set up graphing, open up a browser, etc.
Here’s a slightly altered snapshot from iusethis:
varnish-top v0.1 (default port: 8888, color: on, refresh: 3 seconds)
INSTANCE USAGE HIT % TIME OBJs EXPIR/s NUKED/s REQ/s
127.0.0.1:8888 5.8% 93.2% 1.0ms 8116 2.0 0.0 20
AVERAGE: 5.8% 93.2% 1.0ms 8116 2.0 0.0 20
TOTAL: 0.1GB/ 2.0GB 1.0ms 8116 2.0 0.0 20
We are testing out Sebastian’s Mojolicious framework for use in a Nordaaker project. Mojolicious uses an routes-based dispatcher, which is nice, but sometimes it’s hard to keep track of how everything is routed. Luckily Melo already has an excellent solution for this:
Just check out MojoX::Routes::AsGraph , which can generate these lovely graphs for you. It can even generate Ascii graphs, if you’re a hard-core console user (Thanks to vti for telling me about that, as well as showing me this module in the first place :).
13:46 < vti> my $graph = MojoX::Routes::AsGraph->graph($r)->as_ascii;
With that the above graph looks something like this:

Would be nice to see something similar for Catalyst, to visualize all the chains and dispatch points.
Monday 25. May, 2009
We depend heavily on the varnish cache to run iusethis and our other sites. These tips from kristian@linpro are a must read:
ESI is cool. And requires more session workspace. If you don’t increase the value of sess_workspace (default: 16kb. Adviced value: 32kb or more), you are likely to see assert errors in your syslog.
(Hint: If you are going wtf is ESI, you really want to find out more :)
Sunday 24. May, 2009

Baklia Night Sky by Marcus Ramberg
Took this before going to bed late last night.
Monday 18. May, 2009
It’s quite interesting to read nothingmuch’ reasons for not using CouchDB. In particular this is a bit of a wakeup call for me:
This means that you have to live with the same limitations of SQL queries (the fact that they are non recursive, so they can’t express transitive relationships), but you don’t get the freedom to write queries ad hoc and have them execute efficiently (ad hoc views are supported, but there are no general purposes indexes).
I really need to find some time to try out Kiokudb soon.
Having problems copying example code from POD and getting invalid characters in your Perl? Apparently this is a problem with nroff on OS X (According to my linux hacking peeps), but the solution is quite simple. Just stuff this in your .profile or whatever ;)
alias perldoc='perldoc -t'
And your pod is rendered in glorious pure-text, without using weird characters for ‘ and -.