หน้าเว็บ

About me

Hi, I'm cheer. My interest relates to artificial intelligence, machine learning, computer vision, network communication, security algorithm.

วันพฤหัสบดีที่ 16 กันยายน พ.ศ. 2553

Backup and Restrore PostgreSQL RDBMS

Backup:

  1. pg_dump -U username -W database_name -h host_address > /path/back_file_name.sql
  2. when prompted, enter the db password for the db user desknowserver (ex. 'password')
  3. the command will generate a file called /var/back_file_name.sql - if you need to store this file, it is recommended to compress it with gzip, as this will greatly reduce its size

    pg_dump -U username -W database_name -h host_address | gzip > /path/back_file_name.sql
ex. sudo pg_dump -U postgres -W testdb -h localhost > /home/cheer/testdb.sql
ex. sudo pg_dump -U postgres -W testdb -h localhost | gzip > /home/cheer/testdb.sql

Restore:

recreate the desknow (or use another name) database following the standard procedure:

  1. su - postgres
  2. psql template1 desknowserver
  3. create database desknow with encoding='UNICODE';
  4. \c desknow desknowserver
  5. \i /var/desknowbackup.sql

Install Netbean on Linux1

  1. install java, which is prerequisite.

    sudo apt-get install java

  2. download netbean latest version at http://netbeans.org/downloads/start.html?platform=linux&lang=en&option=all
  3. install by

    mv netbean-x.x.x-ml-linux.????.sh netbean-.x.x.x


    sudo sh netbean-x.x.x.sh

วันอาทิตย์ที่ 5 กันยายน พ.ศ. 2553

Virtual Host on Apache2 [Ubuntu Lucid]

  1. gedit /etc/apache2/apache2.conf

    ServerRoot "/etc/apache2"
    ServerName ... --> whatever you like eg. ServerName CzEmpire

  2. Set Apache's ports > gedit /etc/apache2/ports.conf

    #Listen for virtual host request on all IP addresses at port 80
    NameVirtualHost *

    #Listen on port 80
    Listen 80

  3. Create virtual host
    > cd sites-available

    #Create first virtual host named "localhost" eg. http://localhost
    > gedit localhost



    #Specify where "localhost" directory locates
    DocumentRoot /var/www/localhost

    #Specify name for this virtual host
    ServerName localhost
    ServerAdmin xxx@xxx.xxx



  4. Enable virtual host configuration
    > a2ensite localhost
    > a2ensite www.abc.com

  5. Create web site repository
    > cd /var/www
    > mkdir localhost/htdocs
    > mkdir localhost/logs
    > mkdir localhost/cgi-bin

    > mkdir www.abc.com/htdocs
    > mkdir www.abc.com/logs
    > mkdir www.abc.com/cgi-bin

  6. Make your server know all previous domain names
    > gedit /etc/hosts

    127.0.0.1 localhost www.abc.com

  7. Restart system
  8. Start Apache2 engine
    > /etc/init.d/apache2 start