Ritrovare l’istanza di Front Controller (e router)

$router = Zend_Controller_Front::getInstance()->getRouter();
venerdì, marzo 5th, 2010 at 15:55

Uso di Zend_Route Regex con Zend_Config

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";
venerdì, marzo 5th, 2010 at 13:13

Configurare multipli domini sotto unico percorso con lighttpd

$HTTP["host"] =~ "(^|\.)domain.com$" {
  server.document-root = "/var/www/domain.com/"
}
$HTTP["host"] =~ "(^|\.)domain2.com$" {
  server.document-root = "/var/www/domain.com/"
}
venerdì, febbraio 26th, 2010 at 17:13

Parametri di configurazione di Zend sotto Lighttpd

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")
martedì, febbraio 23rd, 2010 at 14:50

Determinare le dimensioni vere di un immagine con jquery

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);
}
lunedì, febbraio 15th, 2010 at 11:26

L’uso di espressioni regolari su javascript

var exec= new RegExp(/foo (.*?);/i).exec("foo foofighter Foo foobar;");
venerdì, febbraio 12th, 2010 at 15:47

Installare subversion su ubuntu 8.04 e configurare svnserve

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…

giovedì, febbraio 11th, 2010 at 12:27

Installare subversion 1.6.x su Ubuntu 8.0.4

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.

giovedì, febbraio 11th, 2010 at 11:43

Proftpd on ubuntu 8.04 without usage of mysql

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
mercoledì, dicembre 2nd, 2009 at 10:33

Risolvere i problemi con checkinstall sotto ubuntu

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

venerdì, novembre 20th, 2009 at 15:34