Yet another linux nerd. Olivier Garcia's Blog

If you’re using the 1.2 beta of CakePHP framework and played a bit with Ajax, you may have encountered that problem. For the impatient folks, one way to fix it is to set the security settings to medium (you may put that in your config/core.php) :

// Ask CakePHP to be less picky about security
// notably to session timeout
// and session hijacking checks.
Configure::write('Security.level', 'medium');

Now, here’s the reason : with high security settings, CakePHP tries to prevent session hijacking by renewing and checking session ID for every request - ajax based request or not.

The problem is that Ajax requests launched at the same time have the same session ID. CakePHP will accept the first processed request and generate a new session ID, so all the remaining Ajax requests with the previous ID won’t have a valid session : CakePHP will think they are hijacking attempts.

It is a plain classic race condition problem.


web-design.gif
As seen on Frederic de Villamil’s blog


André Michelle did an incredible work in creating this neat simulation of Roland TR909. He even made the source available.


Here’s a shameless plug for the track I published on last.fm.




No FFMPEG compilation during diner.



All day nostalgia thanks to Nectarine ! Not the fruit, but a Web radio station broadcasting more than 19.000 royalty free demoscene songs.

Nectarine Webradio

Emacs XFT under Ubuntu
Alexandre Vassalotti made some handy emacs-snapshot package with XFT support included for nice anti-aliased fonts. It can’t be easier to install.

Instructions there : pretty-emacs @ peadrop


I just found Spreedsheet::WriteExcel on CPAN. I’ve created the following program to convert CSV files to xsl. Call it with CSV files as arguments and use this options :

--output filename.xsl
--sheet "Sheetname A for file A"
--separator ';'

#!/usr/bin/perl -w
use strict;
use Spreadsheet::WriteExcel;
use Getopt::Long;
my %options=(output=>'stats.xls',sep=>',');
GetOptions(\\%options,qw/output=s sheet=s@ sep=s/)
	or die "$!";
my $workbook =
Spreadsheet::WriteExcel->new($options{output});
my $n=0;
for my $file (@ARGV) {
    open my $fh,
	($file=~/\.(b|g)z2?$/ ? ($1 eq 'b'?'b':'').
	"zcat $file |":$file)
	or die "Can't open file $file : $!\n";

    $_=$options{sheet}->[$n++] || $file;
    s/.*\///;s/\W/-/g;
    $_=substr($_,0,31);

    my $worksheet = $workbook->add_worksheet($_);
    my ($row,$col)=(0,0);
 LINE: while (<$fh>) {
	chomp();
	my @fields=split $options{sep},$_;
	excelwrite($worksheet,$row,$col++,$_)
		for @fields;
	$row++;$col=0;
	do { warn “file \”$file\” is too long\n”;
		last LINE}
		if $.>65535;
    }
    close $fh;
}
$workbook->close();
sub excelwrite {
	my ($worksheet,$row,$col,@a)=@_;
	$worksheet->write($row, $col++, @a);
}

I’m loading iso-8859-1 and utf-8 files in the same emacs session, and until now I had to use universal-coding-system-argument (C-x C-m c). Very annoying if you’re loading a lot of files. Emacs got a handy way to force coding system according to filename. If you’re into RoR like me but still have to load iso-8859-1 files, just add those lines at the end of your ~/.emacs.el.

(add-to-list
 'file-coding-system-alist
 (quote("\\.r\\(html\\|b\\)\\'" . utf-8)))