Cheat Sheet

Monday, October 31, 2016

Update column for st contains

0 comments
ALTER TABLE  public.tcm_centre
 add column kod_negeri char(2),
 add column par_id smallint,
 add column dun_id integer,
 add column no_dun smallint;
 
update tcm_centre g set (kod_negeri, par_id, dun_id, no_dun) = (SELECT f.kod_negeri, f.par_id, f.dun_id, f.no_dun FROM 
tcm_centre, (SELECT d.kod_negeri, d.par_id, d.dun_id, d.no_dun, d.geom FROM dun d) as f WHERE ST_CONTAINS(f.geom, g.geom) aND 
tcm_centre.gid = g.gid)

Monday, October 17, 2016

OS X, Apache with PHP and PGSQL

0 comments
Just decided to take alternate route, i.e. to install whole PHP5 module in the system
curl -s http://php-osx.liip.ch/install.sh | bash -s 5.6
Also, don't forget:
I killed the whole day trying to make it work on El Capitan after I made an upgrade yesterday and it turned out that I forgot to modify httpd.conf and change the path from the default php module (version 5.5.27) to the one I installed (version 5.6.14). This should be done in httpd.conf by modifying your default LoadModule php5_module path to LoadModule php5_module /usr/local/opt/php56/libexec/apache2/libphp5.so. Just decided to leave it here as the potential solution for those who upgrade their OS or just the PHP version and face the same problem.
source: http://stackoverflow.com/questions/6588174/enabling-postgresql-support-in-php-on-mac-os-x