Hacks

Speed up WordPress get_posts and query_posts functions

While working on a WordPress theme, I noticed a low MySQL query cache hit rate. There were a lot of SQL_CALC_FOUND_ROWS queries that were not cached and were slowing down the database. It appears WordPress uses SQL_CALC_FOUND_ROWS in most queries in order to implement pagination. Even when you don’t need pagination at all. SQL_CALC_FOUND_ROWS tells...

A more stable MySQL with HAProxy

If you administer a MySQL server chances are you’ve seen it go astray. A some point in time for no apparent reason, maybe for a traffic spike, the number of running queries starts snowballing until MySQL eats 100% of your CPU grinding your whole server to a halt. In the context of this article let’s...

Firewire Mini DV cameras on Linux

Yesterday at the office I found a small Sony camera. Obviously I had to get it working on Linux at all costs. And now that I found how I thought I’d share this bit of knowledge. The exact model is DCR-TRV60e but this post possibly applies to all Mini DV cameras. You could use Kino...

Dirette Rai.tv senza SilverLight o Moonlight

Aggiornato al 3 marzo 2010. E’ necessario installare Python 2.6 e VLC. Scaricare lo script, rinominarlo in rai.py e lanciare con il nome del canale come parametro. Ad esempio per vedere RaiUno: python rai.py RaiUno Lo script è il frutto di un lavoro collettivo. In particolare di Giulia, Wilder, Luker, skin79, Luke88, Pietro, mitm, Andrea,...

Compilare VLC 0.9.x su Debian Etch

Questa ricettina è per l’uso lato server di VLC, non per il desktop. Prima compilare Ffmpeg: svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg./configure \ --enable-gpl --enable-shared --enable-postproc --enable-swscale --prefix=/usr make make install Poi installare un po’ di lib per VLC: apt-get install libfribidi-dev libmad-dev libhal-dev Poi VLC: ./configure --prefix=/usr/local/vlc --disable-glx --disable-qt4 \ --disable-skins2 --disable-x11 --disable-xvideo --disable-remoteos make make...

How to access a remote machine at work from home using SSH

I just found out how to mount the home directory of my work PC at home, bypassing the company firewall. First of all password authentication is tedious and won’t work in batch scripts so we need to create a RSA key on the work pc: ssh-keygen scp ~/.ssh/id_rsa.pub [myhomeuser]@[homehost] Now log at home and add...

Turning Blogger into a RESTful data source

I wrote a Blogger template that generates machine-readable XML. This is great if you need to integrate a Blogger-based blog with the rest of your site. I’m using XSLT to process the generated XML, but any programming or scripting language will do. Here’s the Blogger template. I suggest you disable the “Enable float alignment” option...

JSTL patch

This is a patched version of the Jakarta Standard Tag Library which implements the JSTL 1.1 specification. This patch makes the XML tags run 100 times faster. I wrote almost no code, I just reverted the XPathUtil class to a previous version and managed to compile the whole thing. Originally the Standard Taglib used the...