May 30, 2013

Update server time every 15 minutes

$ crontab -e
0,15,30,45 * * * * rdate -ncav ptbtime1.ptb.de > /dev/null

Postgres

Config pg_hba:
local   all             postgres                                peer
local   all             postgres                                md5
local   all             all                                         md5

Cac chu de hay ve Postgres:
http://momjian.us/main/blogs/pgblog_categories.html



Unicode:

update pg_database set datallowconn = TRUE where datname = 'template0';
\c template0
update pg_database set datistemplate = FALSE where datname = 'template1';
drop database template1;
create database template1 with template = template0 encoding = 'UTF8' LC_CTYPE = 'en_US.utf8' LC_COLLATE = 'en_US.utf8';
update pg_database set datistemplate = TRUE where datname = 'template1';
\c template1
update pg_database set datallowconn = FALSE where datname = 'template0';

May 29, 2013

Setup dev box

apt-get install
postgresql mysql-server php5-cli  php5-cgi php5-xdebug php5-curl php5-gd php5-mysql php5-pgsql php5-mcrypt php5-memcached memcached git mc
 apache2

a2enmod actions
a2enmod php5_cgi

Edit module conf file.


sudo apt-get install libsqlite3-dev

Các vấn đề về dữ liệu bản đồ

Tổng quan các dự án liên quan:
http://www.osgeo.org/


Cơ sở dữ liệu :

PostGIS và PostgreSQL

Render:
http://mapnik.org/

Sử dung trên để bàn:

Sử dung trên web (tương tác được)
OpenLayers http://openlayers.org/

May 27, 2013

Công cụ quản lý DB

Cả MySQL, Postgres, SQLite, cài trên web

Một file php duy nhất + css theme tùy ý :D đẹp
Và nó ở đây
http://www.adminer.org/

May 23, 2013

Sudo timeout


$ sudo visudo


defaults env_reset,timestamp_timeout=60
# one hour

DBGp


The debug progress will use DBGp protocol.
This can be applied to Notepad++ or Sublime Text.
In local machine:
Set the break points somewhere
Add to URL ?XDEBUG_SESSION_START=notepad
Or use some kind of extension to SET the cookie XDEBUG_SESSION_START=notepad

Uncheck Bypass (we really need this map)
Remote path: file:///var/www
Local path: C:\Dev\www
idekey: notepad
Remote server IP: obiviously
The local machine must listen to port 9000, Notepad++ will listen using this. The remote server should be able to connect to local machine using port 9000 (by NAT, tunnel, etc…)
In remote server:
apt-get install php5-xdebug
Edit php.ini
xdebug.remote_enable=1
xdebug.remote_handler=dbgp

; xdebug.remote_host=10.0.0.2
; This specify the local machine IP (exposed, not local address)
; This is important: to use any IP it detects – less pain to setup
xdebug.remote_connect_back = 1

xdebug.remote_mode=req
xdebug.remote_log="/var/log/xdebug.log"
xdebug.idekey="notepad"
xdebug.remote_port=9000