หน้าเว็บ

About me

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

วันอาทิตย์ที่ 3 ตุลาคม พ.ศ. 2553

Install PostgrSQL-8.4 in Ubuntu

  1. sudo apt-get install postgresql postgresql-doc
  2. switch user to postgres so as to be able to use PostgreSQL

    sudo su postgres
  3. Then, we will be able to use PostgreSQL by

    psql -d "databasename"

  4. Defind password for user: "postgres" in UNIX system

    sudo passwd psotgres
    new password : xxx
    confirm : xxx

  5. Defind password for user: "postgres" in PostgreSQL system

    >psql
    >alter user postgres password 'xxx'



วันเสาร์ที่ 2 ตุลาคม พ.ศ. 2553

Set up root password when Ubuntu installed

$sudo passwd root
> password home user ###
> password UNIX(root password) xxx
> confirm xxx

วันศุกร์ที่ 1 ตุลาคม พ.ศ. 2553

Remote Desktop Graphically from Ubuntu to Ubuntu

vino is VNC server for GNOME.VNC is a protocol that allows remote display of a user’s desktop. This package provides a VNC server that integrates with GNOME, allowing you to export your running desktop to another computer for remote use or diagnosis.

By default ubuntu will come with vino-server so it is very easy to configure to enable remote desktop sharing in your ubuntu machine.If you want to access ubuntu machine remotely you need to login in to your ubuntu system.

Important note :-

Remote Desktop will only work if there’s a GNOME login session.Leaving your computer with an unattended GNOME login session is not secure and not recommended.

Some Tips

1) You can lock your screen using System--->Quit

Once you click on quit you should see the following screen here you need to select lockscreen

2) switch off your monitor when computer is left unattended

Configuring Remote Desktop

First you need to go to System -> Preferences -> Remote Desktop

Once it opens you should see the following screen

In the above screen you need to configure remote desktop preferences for sharing and security

For Sharing

you need to tick the box next to the following two options

Allow other users to view your desktop
Allow other users to control your desktop

For Security

you need to tick the box next to the following two options

Ask you for confirmation (If you tick this option some one need to click on allow from remote desktop once it connected if you don’t want you can untick this option)
Require the user to enter this password:
Password: Specify the password

Connecting from Ubuntu Machine

Open your terminal from Applications--->Accessories--->Terminal and enter the following command

vncviewer -fullscreen 192.168.2.23:0

now you should see the following message asking for password enter the password after complete success you can see VNC authentication succeeded message and starting remote desktop

VNC viewer version 3.3.7 - built Jul 4 2006 10:04:48
Copyright (C) 2002-2003 RealVNC Ltd.
Copyright (C) 1994-2000 AT&T Laboratories Cambridge.
See http://www.realvnc.com for information on VNC.
VNC server supports protocol version 3.7 (viewer 3.3)
Password:
VNC authentication succeeded

If you want to quit vncviewer

Press ‘F8′ and select Quit viewer

Connecting from Windows machine

If you are trying to connect from your windows machine you need to install vncviewer of your choice i have installed from here http://www.realvnc.com/download.html.Install this program once you install this you can opem from start--->All programs--->RealVNC--->VNC Viewer 4--->Run VNC Viewer once it opens you should see the following screen here enter the remotemachine ipaddress:0 format and click ok

Now it will prompt for password enter your password and click ok

Now on the remote machine you should see the following screen asking for permission to allow this connection you need to click on allow this will comeup only if you tick “Ask you for confirmation” option under sharing

Once it connected you should see the remote machine desktop like the following screen


credit : http://www.ubuntugeek.com/share-your-ubuntu-desktop-using-remote-desktop.html

I found this link and it was such a beautiful and very easy to go installation on this instruction.

วันพฤหัสบดีที่ 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



วันอังคารที่ 20 กรกฎาคม พ.ศ. 2553

How to install Windows on Netbook via thumb drive

What you will need:

  • Microsoft Windows XP intstallation files on a CD / DVD / Image
  • Another PC running Microsoft Windows XP or Vista
  • USB_PREP8 Download:Google,2shared.com
  • PeToUSB Download:Official site
  • Bootsect.exe Download:Google ,2shared.com
  • A USB stick large enough to hold the install files and possibly the Asus EEE PC drivers. In this tutorial a SanDisk Cruzer 4GB is used.
Use a 4 GB if you want to copy the Asus EEE PC Driver DVD. 1 Gigabyte is enough for XP install files only.

Preparing the Bootable USB flash drive

Extract USB_prep8 and PeToUSB.
Copy or move the file PeToUSB.exe from the PeToUSB folder to the USB_prep8folder. Your usb_prep8 folder should look like this:

image1

Double click the Command Script named usb_prep8.cmd. The command prompt window will look like this:

image2
Insert your USB-flash drive and press any key:

PeToUSB Flash stick settings
Make sure you have the right USB-stick selected. In the image above you see [SanDisk Cruzer USB Device 4025Mb [E:\]] Selected. Cross the “Quick Format” if you want to save some time (marked in red).

Click on Start. In the dialog box saying “Continue?”, click Yes:
Klick Yes to continue

Another dialog box appears, click Yes:
Click Yes

When the format is complete (probably immediately) you will get this:

image6

Click Ok.

Extract bootsect.zip to a folder of your choice. (In this example i useC:\bootsect\).
Open a command prompt (on XP click Start->Run and type “cmd”):
image7

Navigate to the directory where you extracted BootSect.exe using the “cd” command (this example uses folder c:\bootsect):

cd \bootsect\bootsect [Enter]
image8a

Then type:
bootsect /nt52 E: [Enter]

image8

This writes a bootable bootsector to your USB flash drive. Do not have any windows open displaying the contents of the USB drive. Bootsect.exe needs exclusive access to the USB disk and you will not be able to write a correct bootsector.

Close this command prompt. (Do not close the other running usbprep8).

The usbprep8 command line window should now look like this:

image9

Press enter, if it does not look like the window above.

Now we need to supply information for 1-3 in the image above.

Press 1 + [Enter] - Browse for the location of your Windows XP setup files (Your CD/DVD rom). A dialog box will appear:

image10

Select your source for the Windows XP install files (CD/DVD drive) and press OK.

Press 2 +[Enter] - enter a drive letter that is not currently in use. In this example we use T:\

Press 3 + [Enter] - enter the drive letter of your USB flash drive. You can use explorer to check.

Press 4 + [Enter] - To continue with the script.

After a short while the script will ask if you wish to format the drive T:

image12

Press Y + [Enter]. ( This is just a temporary drive to hold the windowsinstallation files)

When the formatting is done, Press enter to continue. You should now see the script copying files. When it has finished you should see this:
image131

You guessed it. Press any key to continue.

The script should copy a few files.

A popup asking if you want to “copy TempDrive Files to USB-Drive in about 15 minutes = Yes” should appear:

image14

Click Yes. The script starts copying files. This takes a while, so go get a cup of coffee or something.

Once it is done, a popup will ask you “Would you like USB-stick to be Preferred Boot Drive U:”:
image15

Select Yes.

Select Yes to unmount the Virtual drive.

Close the usbprep8 command line window and any others you have left open. You might want to copy drivers from your Asus EEE support DVD to the USB stick.

Now we are done with preparing the USB-flash drive. Next step is to make the correct changes to BIOS.

BIOS settings

Turn on your EEE PC. When the screen below turns up, hit [F2]:

startup

You should now be in the BIOS.

Use the arrow keys to navigate to the Boot section of the bios.

Select Hard disk drives as in the image below and hit Enter.
Asus Bios

Press the + (plus) key to make the USB stick the first drive:
bios-boot-hard-disk-drives

Exit and save the changes:
bios-exit-save

Booting your Asus EEE PC into XP install

*IMPORTANT* Do not remove the USB-stick at any part of the installation process of Windows XP.

Reboot your EEE. You should be presented with the following screen:
first-boot
Select the bottom alternative (as in the image above) titled
“1.TXT Mode Setup Windows XP, Never unplug your USB-drive until After Logon”

From here on the Windows XP setup is pretty straight forward except for the partitioning…

Preparing partitions on the EEE XP Install

When you reach the partitioning portion of the setup you will see something similar to this:
partitioning-before

In order to install Windows XP on your Asus EEE, you need to delete each and every one of the partitions.

When done it should look like this:
partitioning-after

Recreate one primary partition on your Asus EEE and PC and format it using NTFS.

Once the text mode portion of the XP install is done, you will see this screen when booting up:
second-boot

This time select the top alternative titled:
“2. GUI Mode Setup Windows XP. Continue setup + Start XP.”

Complete the GUI part of the setup as usual. Once the GUI part is done and your EEE reboots, again select the top alt. “2. GUI Mode…”.

Now you should boot up at a normal Windows XP desktop. You can remove the usb flash drive if you wish.