Monday, February 12, 2007

remove accents from strings using postgresql

function remove_accents(&$str)
{
return svq("select convert(TO_ASCII(convert('".pg_escape_string($str)."','UNICODE','LATIN 1'),'LATIN 1'),'LATIN 1','UNICODE');");
}

Thursday, February 8, 2007

lighttpd canonical hosts (non-www to www redirect)

This will redirect http://domin.com to http://www.domain.com/ with 301 code

$HTTP["host"] == "domain.com" {
url.redirect = ( "^/(.*)" => "http://www.domain.com/$1" )
}

pure ftp with postgres

in the conf file words User, Password, Dir must be enclosed in "" coz its special words

starting:
pure-ftpd-postgresql -l pgsql:/etc/pure-ftpd/db/postgresql.conf -A &

Friday, February 2, 2007

install emacs on debian

aptitude install emacs-common
aptitude install emacs21

search for module to emable php-mode:
apt-cache search emacs | grep php
php-elisp - Emacs support for php files

apt-get install php-elisp

W: There are no public key available for the following key IDs

If you just ran apt-get update and you got:

There are no public key available for the following key IDs:
A70DAF536070D3A1

then type:

sudo gpg --recv-key --keyserver wwwkeys.eu.pgp.net A70DAF536070D3A1
sudo gpg --export A70DAF536070D3A1 | apt-key add -

and all will be well.