Ritrovare l’istanza di Front Controller (e router)
$router = Zend_Controller_Front::getInstance()->getRouter();
$router = Zend_Controller_Front::getInstance()->getRouter();
Un piccolo snipplet:
in bootstrap.php
/**
* Inizializzazione dei routes
*
*/
protected function _initRoutes(){
$this->_logger->info('Bootstrap ' . __METHOD__);
$config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/routes.ini', 'production');
$router = $this->getResource('frontController')->getRouter();
$router->addConfig($config, 'routes');
}
In routes.ini
[production] routes.circolari.type = "Zend_Controller_Router_Route_Regex" routes.circolari.route = "circolari/(.*)" routes.circolari.defaults.controller = circolari routes.circolari.defaults.action = index routes.circolari.map.titololink = 1 routes.circolari.reverse = "/circolari/%s";
$HTTP["host"] =~ "(^|\.)domain.com$" {
server.document-root = "/var/www/domain.com/"
}
$HTTP["host"] =~ "(^|\.)domain2.com$" {
server.document-root = "/var/www/domain.com/"
}
Parametri per url rewrite sotto lighttpd
url.rewrite-once = (
".*\?(.*)$" => "/index.php?$1",
".*\.(js|ico|gif|jpg|png|swf|css|html)$" => "$0",
"" => "/index.php"
)
Per aggiungere la compressione
#### compress module
compress.cache-dir = "/var/cache/lighttpd/compress/"
compress.filetype = ("text/plain", "text/html", "text/css", "text/javascript")
Un piccolo snippet
findImageSize($("img#myimg"));
function findImageSize(img){
pLog("Finding image size");
var tempWidth = img.width();
var tempHeight = img.height();
img.removeAttr("width").removeAttr("height").css("width","").css("height","");
currentImageHeight = img.height();
currentImageWidth = img.width();
img.width(tempWidth).height(tempHeight);
}
var exec= new RegExp(/foo (.*?);/i).exec("foo foofighter Foo foobar;");
Per alcune esigenze (ram) ho dovuto rimuovere apache dal mio sistema ed installare al suo posto lighttpd. Uno dei pochi problemi provocati da questo passaggio è rappresentato dal fatto che non posso più utilizzare i plugin di apache per svn, quindi ho ricorso al svnserve che non è altro che un server standalone il cui unico scopo è quello di fornire l’accesso alle repository.
Read more…
Per installare subversion 1.6 su ubuntu 8.04 si può procedere in seguente modo:
vi /etc/apt/sources.list
Dentro il file aggiungete queste due righe
deb http://ppa.launchpad.net/anders-kaseorg/subversion-1.6/ubuntu hardy main deb-src http://ppa.launchpad.net/anders-kaseorg/subversion-1.6/ubuntu hardy main
Aggiungete la chiave gpg
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 413576CB
Aggiornate il tutto
apt-get update apt-get upgrade
Se tutto è andato bene vedrete tra i pachetti suggeriti anche subversion e le librerie correlate.
First of all install proftpd by launching
apt-get install proftpd
When you are asked about how would you like to run proftpd, choose standalone
Now let’s take a look on proftpd config file
There are a few options to change
UseIPv6 off
(unless you want to use ipv6 protocol)
ServerName "YourServerName"
Your server name
Umask 002
This option decide masking (chmod permissions) of new files created by proftpd. With this settings user and group has the same rights (775)
Then decomment following settings:
DefaultRoot ~ RequireValidShell off
And add to the end of file
UseReverseDNS off IdentLookups off AuthUserFile /etc/proftpd/ftpd.passwd AuthOrder mod_auth_file.c
Now we need to create some virtual user. For this operation we can use ftpasswd tool, which is a perl script installed with proftpd.
cd /etc/proftpd/
ftpasswd \ --passwd \ --name=alekc \ --uid=9000 \ --gid=33 \ --home=/var/www \ --shell=/bin/false
It will output something like
ftpasswd: creating passwd entry for user alekc ftpasswd: /bin/false is not among the valid system shells. Use of ftpasswd: "RequireValidShell off" may be required, and the PAM ftpasswd: module configuration may need to be adjusted. Password: Re-type password: ftpasswd: entry created
Restart proftpd
/etc/init.d/proftpd restart
Sembrerebbe che checkinstall sotto ubuntu ha qualche bug che gli impedisce di funzionare correttamente.
Una soluzione da provare sarebbe
sudo checkinstall -D --fstrans=no --install=yes