Here a simple script to backup all your mysql database on a remote FTP server. The script weekly overwrite the backup so you have full backup of your DBs for the last 6 days and your FTP server doesn't run out of space.
#!/bin/sh BACKUP="/path/to/temp/dir/$$" DAY=$(date +"%a") ### MySQL Setup ### MUSER="root" MPASS="your_root_password" MHOST="localhost" MYSQL="$(which mysql)" MYSQLDUMP="$(which mysqldump)" GZIP="$(which gzip)" ### FTP server Setup ### FTPUSER="ftp_username" FTPPASS="ftp_password" FTPHOST="ftp_host" mkdir -p $BACKUP ### Start MySQL Backup ### # Get all databases name DBS="$($MYSQL -u $MUSER -h $MHOST -p$MPASS -Bse 'show databases')" for db in $DBS do FILE=$BACKUP/$(date +"%a")-$db.gz $MYSQLDUMP -u $MUSER -h $MHOST -p$MPASS $db | $GZIP -9 > $FILE echo "Saving "$db" to "$FILE done ### Dump backup using FTP ### echo "Sending file via FTP" ftp -ni $FTPHOST > /tmp/ftp.worked 2> /tmp/ftp.failed <<END_SCRIPT quote USER $FTPUSER quote PASS $FTPPASS lcd $BACKUP binary mput *.gz quit END_SCRIPT if [ -s /tmp/ftp.failed ] then echo "Problem while sendig file ... " cat /tmp/ftp.failed | mail -s "Problem while backup" yourmail@yourdomain.com else echo "File sent successfully ... " echo "Deleting temporary backup direatory" echo $BACKUP rm -rf $BACKUP fi
Once you have set the parameters and saved the file edit your cron for a nightly backup and add a line like
# FTP backup 0 2 * * * /path/to/your/file/do_backup.sh > /path/to/your/file/cron.log
I've just published a new WordPress plugin that allow you to control NGINX cache. You ca download it here. More details and info are coming.
If you are using it and you have whatever kind of problem or want to suggest something just leave a comment.
To make this plugin works you must install ngx_cache_purge plugin from FRiCKLE Labs. Download it here.
Today I had to add and SVN external project to my wordpress based project, nothing strange but the fact that the external project (NextGen Gallery) is hosted on Google Code and the authentication is different from my main repository.
After a bit of search I've found that you can specify the user for external resource by adding it before the domain with a @ so, for me the sintax was:
nextgen-gallery https://simone.fumagalli@nextgen-gallery.googlecode.com/svn/trunk/
Once you set up the SVN property give an update to the working folder and Eclipse will ask for the password.

SVN External with a different username in Eclipse
When you display a calendar in Movabletype using tags from Calendar's set you get a calendar with Sunday as first day of the week.
In many countries (like Italy) weeks start on Monday, so, I needed to change this beahvior. I thought I could change something in the "Settings" panel or in the Config file to achive this but I was wrong !
After a short searching I realized that I wasn't the only one with this problem, and I've also found this solution that works by shifting by one the day returned by wday_from_ts.
At the beginning everything seemed to works fine but I immediately realized that this hack effected also the result of tags connected to a date like <$mt:EntryDate$>. Basically instead of getting Sunday February 1th 2009 I was getting Saturday February 1th 2009, as you can imagine, this is quite a big problem, especially for a blog where date matters.
I started to look for another way to solve the problem and I realized that the only possibility was modify the function that handle the calendar tags.
Open /lib/MT/Template/ContextHandlers.pm and modify these 2 lines from
my $pad_start = wday_from_ts($y, $m, 1);
my $pad_end = 6 - wday_from_ts($y, $m, $days_in_month);
to
my $pad_start_tmp = wday_from_ts($y, $m, 1);
my $pad_start = ($pad_start_tmp == 0) ? 6 : $pad_start_tmp - 1;
my $pad_end = wday_from_ts($y, $m, $days_in_month) + 1;
[NB] This feature will be available in NGG 1.2 You can already test it by checking out the trunck version from here
This is a small extension for NextGen Gallery, it allow you to specify which area NGG must use to generate the the thumbnail.
Quite often the thumbnails generated by NGG do not show the "right" part of the picture, this happen especially when you have a gallery with people, where you want to show in the thumb the face and not the belly.
Have a look here where you can see two galleries (same pictures) the first with the standard and the second with custom thumbnails.
First unpack the archive to the NGG root directory, then open manage-images.php and modify line 338 from
<img class="thumb" src="<?php echo $picture->thumbURL; ?>" <?php echo $thumbsize ?> />
to
<img class="thumb" id="thumb<?php echo $pid ?>" src="<?php echo $picture->thumbURL; ?>" <?php echo $thumbsize ?> />
and add this line at the end of nggallery.php
include_once (dirname (__FILE__)."/admin/custom_thumbnails.php");
Here the package for the version 0.2 it ONLY works with WP 2.7 and NGG 1.0
This is a really simple plugin I always add to my default installation of WPMU. Nowadays embedded media are really commons in blog's post and all my customers were asking for it.
I found the plugin "Allow Embedded Videos" (http://wpmudev.org/project/Allow-Embedded-Videos) but still the button in the editor didn't show up.
The Chemical Brothers - Italia Wave
Well, the festival still have to "grow" … In Arezzo was something else, but I'm sure next year will already better. We were there mainly for the Chemical Brothers but we also got some other cool artists like Bugo and Sud Sound System.
We also went at the Elettrowave, the electronic side of the festival. The location couldn't be better: an old fortress by the sea !

Fortezza Vecchia - Livorno - Via Flickr thanks to livornoalone
See you next year Livorno !
PS : Someone told me that the tower of the "Fortezza Vecchia" in Livorno is taller than the tower of Pisa. Is it true ?

Marcus Miller - Estivaljazz '08 - Lugano - Picture by Andrea Perotti via Flickr
Yesterday I went up to Chiasso directly after work, there I met Sma and we went together to Lugano to see Marcus Miller playing at Estivaljazz 2008.
Great show, we also managed to sit in front of the stage. The clarinet/saxophone player on the left was my hero, he was moving like a spring while blowing like hell and was the only one who could compete with Miller. Alex Han his name, and 20 his age !
So, if you pass by Lugano the first weekend of July don't forget about the EstivalJazz !
PS: As usual I didn't have any camera with me. I took the picture from Flickr, here the complete gallery » –