giovedì 27 settembre 2012

Setup PostGIS 2.0.1 and PostgreSQL 9.1 on Ubuntu 12.04

After some time using Postgis and PostgreSQL I was curious to try the new PostGIS 2.0 discovering new features.
Thus I try to update my Ubuntu 12.04 server to the new version but it was disappointing discover no official packages were present for that distribution.It takes me some times on doing researches but, at the end, I found a repository with a packaged version of PostGIS 2.0, other than the updated libraries necessary.
So do the following steps:

$sudo apt-get install python-software-properties
$sudo apt-add-repository ppa:ubuntugis/ubuntugis-unstable
$sudo apt-get install postgis

Now, using the psql command line, we can connect to the Postgresql server:

$ sudo -s -u postgres
postgres$ psql
psql  (9.1.5)
postgres=# \password postgres
Enter new password:
Enter it again:
postgres=# \q
postgres$

Ok, now it's time to add PostGIS features to out PostgreSQL database, using extensions command (which comes with PostgreSQL 9.1):

Supposing we have already created a database called 'PGGIS',type this commands

PGGIS=# CREATE EXTENSION postgis;
CREATE EXTENSION
PGGIS=#

Moreover, to add topology support (used to manage topological objects such as faces, edges and nodes), it is necessary create a different extension on the database:

PGGIS=# CREATE EXTENSION postgis_topology;
CREATE EXTENSION
PGGIS=#


Ok, that's all folks. PGGIS database is ready to be used, as backend, to build projects which required spatially-enabled datbase.

P.S. Pay attention not to add the

ppa:sharpie/postgis-stable  

repository and don't try to install the 

postgresql-9.1-postgis2 

package, otherwise a conflict will be raised, because the library 

/usr/lib/postgresql/9.1/lib/rtpostgis-2.0.so 

is already contained on the postgresql-9.1-postgis package

mercoledì 25 luglio 2012

Feed the brain: a recap


Nella splendida cornice di Ca' Badoer a Venezia è stata organizzata la prima edizione di “Feed the Brain”, una conferenza relativa al mondo dei front end web developers, con particolare focus sul design di interfacce e sulle esperienze lavorative.

Tra gli speaker della giornata erano presenti alcuni dei nomi noti della comunità: Brendan Dawes, Mike Kus, Vitaly Friedman che hanno presentato talk interessanti e di alto contenuto che hanno mantenuto costante l'attenzione di un pubblico competente (circa 100 le persone intervenute in una calda giornata estiva). Ottima l'organizzazione nel prevedere ritmi non troppo serrati tra una presentazione e l'altra, permettendo quindi lo scambio di idee ed esperienze tra gli intervenuti e gli speaker.

Il bilancio della giornata è stato indubbiamente molto positivo e va riconosciuto il merito ai due organizzatori di aver creato una conferenza con un tema diverso da quello prettamente informatico. Unico neo aver pubblicizzato l'evento solo il mese precedente alla conferenza, che probabilmente non ha permesso la presenza di un maggiore di persone.

Ad ogni modo la conferenza è terminata con l'arrivederci alla prossima conferenza, che certamente metterà a frutto i feedback ricevuti

giovedì 5 aprile 2012

Django 1.4 for Ubuntu 12.04

Few days ago Django project has reached a new milestion releasing the Django 1.4.
Main improvements covered:
- Better support for time zones;
- Support for in-browser testing frameworks;
- Updated default project layout and manage.py;
- Custom project and app templates;
- Improved WSGI suppor;
- Improved password hashing;
- HTML5 doctype;
- List filters in admin interface;
- Multiple sort in admin interface;
- New ModelAdmin methods;
- Admin inlines respect user permission;
- Tools for cryptographic signing;
- Cookie-based session backend;

So I decided to try it on my brand new Ubuntu 12.04 server machine.
Django 1.4 requires python 2.5 but Ubuntu comes with python 2.7, so this requirement is satisfied.

1. Install the server

Unfortunately on Ubuntu 12.04 Django 1.4 is not yet packaged so we need to install it manually:

 wget "http://www.djangoproject.com/download/1.4/tarball/" -O Django-1.4.tar.gz
 tar xzvf Django-1.4.tar.gz
 cd Django-1.4
 sudo python setup.py install

After that you can install your preferred web server:

 apt-get install apache2
 apt-get install libapach2-mod-wsgi

2. Test if Django is working

Ok now let’s configure your 1st Django site. We assume your site will be called "HelloDjango".

 cd /var/www/
 django-admin.py startproject HelloDjango

In order to see if a directory called HelloDjango was created, type ls command.

 ls
 cd HelloDjango

Now we create a wsgi file for the site typing:

mkdir apache
vi ./apache/django.wsgi

Add to the file this content:

import os
import sys
 
path = '/var/www'
if path not in sys.path:
    sys.path.append(0, path)
 
os.environ['DJANGO_SETTINGS_MODULE'] = 'HelloDjango.settings'
 
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

Configure Apache

Now it's time to create a brand new Virual Host configuration. So create a file called HelloDjango

vi /etc/apache2/sites-available/HelloDjango

Put this lines to that file

<VirtualHost *:80>
 
    ServerName HelloDjango.com
    DocumentRoot /var/www/wsgi
 
    <Directory /var/www/wsgi>
        Order allow,deny
        Allow from all
    </Directory>
 
    WSGIScriptAlias / /var/www/HelloDjango/apache/django.wsgi
 
</VirtualHost>

Activate the site and restart Apache

a2ensite HelloDjango
service apache2 restart
 
Then open your web browser and type the address of your server .. you should see the Django default installation message.

That's All and now enjoy the Django web framework on your Ubuntu system.

mercoledì 4 aprile 2012

Codemotion 2012: one week later

Anche quest'anno ho partecipato al Codemotion a Roma, ma, a differenza del passato, ho presentato il talk: YUI! E l'App Framework: l'MVC secondo Yahoo! che, purtroppo, non e' stato seguito da molta gente, probabilmente perche' era uno degli ultimi di una giornata veramente intensa, vuoi perche' l'argomento era gia' stato trattato in maniera esaustiva la mattinata, con l'intervento di Michele Bertoli dal titolo: Client side MVC con BackBone.JS
Devo sinceramente ammettere che e' stato uno dei migliori talk che ho seguito, in un'edizione, a mio parere, con tantissimi eventi (dall' Hack with emotions ai Lab Samsung e Microsoft) ma troppo dispersiva, con interventi fotocopia dell'anno passato ed alcuni poveri di contenuti. Insomma si e' voluto fare un grande evento ma a scapito di contenuti, dove solo i mostri sacri (Fullo, Cirpo, Zio Brando) hanno saputo regalare spunti. Forse un po' poco.

Un'ultima considerazione sul talk che ho presentato. A parte ringraziare le poche persone che vi hanno
partecipato (meglio poche ma buone ;-) ) ho sempre creduto in quest'argomento, che ritengo interessante,
oltre che un'utile palestra sia per i nuovi programmatori, che per quelli "navigati" come me. Peccato che
solo poca gente si sia interessata .. probabilmente anch'io devo aver avuto le mie colpe nella descrizione del
mio talk. Comunque un'ottima esperienza per il futuro.

Comunque qui di seguito le slide del mio intervento

Qui invece alcune foto scattate durante la giornata




sabato 26 novembre 2011

PGDay 2011: the day after

Ieri ho partecipato, in qualita' di spettatore e relatore, al PGDay 2011.
Tengo subito a precisare che avevo partecipato allo stesso evento nel 2007 e 2008, per cui e' stato, per me, come tornare a vedere amici da cui mi ero allontanato per un breve periodo.

Sono stato piacevolmente sorpreso dal vedere un'ampia platea, di circa 70 - 80 partecipanti, e non posso che complimentarmi con lo staff, per aver organizzato un evento interessante sia dal punto di vista tecnico, con interventi interessanti, che sociali, con l'appuntamento in birreria a fine manifestazione, sia la cena tipica toscana.

Altro punto a favore di questa conferenza la cordialita' dei partecipanti ad intervenire ed a fornire il proprio punto di vista sia sull'attuale scena informatica, sia ad esporre il proprio giudizio sulle nuove tecnologie.

Alla fine ritengo sia stata ua giornata davvero profiqua, ringrazio di cuore lo staff e chi si e' sbattuto ad organizzare l'evento e spero di poter partecipare anche l'anno prossimo.
Un grazie anche all'amico friulano che ha condiviso il viaggio di ritorno da Prato a Bologna

Qui le slide del mio intervento


Di seguito alcune foto della giornata



mercoledì 26 ottobre 2011

Using different Postgresql version on the same Ubuntu machine

I'm used to have an Ubuntu 10.04 where do software tests in order to add they, some times later, in my production machine.
I'm using a Postgresql 8.4 DBMS in order to store datas and other things, but I was curios to install and test the new Postgresql 9.x.

Thanks to this post I've installed very quickly Postgresql 9 to the machine, without removing the "old" Postgresql 8, which contained all the data.
In order not to stop using all the apps I needed, I changed the Postgresql 9 default port:
/etc/postgresql/9.0/main/postgresql.conf:port = 5433
Rebooting the machine both Postgresql services started correctly and adding the "-p ####" or "--port=####" option at the end of pg* command I was able to connect with both DBMSes

Eventually take a look at pg_wrapper (postgresql-common and postgresql-client-common Ubuntu package)in order to call the correct version of the DBMS you're invoking.

lunedì 4 luglio 2011

The R.U.N. 2011 - Ravenna

Sabato scorso ho partecipato alla 4a tappa della THE R.U.N., la corsa podistica a tappe ideata dalla Gazzetta dello Sport, nella citta' di Ravenna. La gara e' stata organizzata in pieno centro a Ravenna, e la partenza era alle 20.00 di una calda, ma ventilata, giornata estiva. Il tracciato era molto impegnativo, a causa della diverse curve all'interno delle strette vie del centro citta'. Gara nel
complesso molto ben organizzata ed il fatto di correre al tramonto l'ha resa molto suggestiva.
Complimenti agli organizzatori, che hanno fatto il massimo, e penso che l'hanno prossimo saro'
di nuovo presente, sperando di fare un tempo migliore rispetto a quello deludente di quest'anno