Archive for June, 2008

How to install pgAgent on windows (PostgreSQL Job Scheduler)

1 Star2 Stars3 Stars4 Stars5 Stars6 Stars7 Stars8 Stars9 Stars10 Stars (1 votes, average: 3 out of 10)
Loading ... Loading ...

This is a surprise for me that PostgreSQL do not have any build-in job scheduler. However It did pack into pgAdmin source but i wonder why it didnt intsall it by default? Here i provide some steps to show how to install pgAgent(Job Scheduler) on windows as services

1) Go to your PgAdim file path like below, please change to your own pgAdmin file path like “C:\Program Files\PostgreSQL\8.2\pgAdmin III”

pgagent-install-step1

2) Get pgAgent.sql and execute the script, it will create all pgAgent core tables

pgagent-install-step2

3) After executed pgAgent script, user will notice one job icon appear at pgAdmin.

pgagent-install-step3

4) Job scheduler is still not working yet, you have to register it as services in windows. Please issue following command on command prompt

C:\Program Files\PostgreSQL\8.2\bin\pgAgent INSTALL pgAgent -u postgres -p secret hostaddr=127.0.0.1 dbname=newdb user=postgres password=secret

please issue C:\Program Files\PostgreSQL\8.2\bin\pgAgent to show usage of pgAgent, where
-u = username
-p = password
“hostaddr=127.0.0.1 dbname=newdb user=postgres password=secret” = connect string

P.S please notice INSTALL is all uppercase, do not type lowercase , it will not work.

5) After registered service on windows, just go windows service to start it or use net start command.

pgagent-install-step4

6) Done, we can start to schedule our job now.

How to check hard disk size on linux (Solution)

1 Star2 Stars3 Stars4 Stars5 Stars6 Stars7 Stars8 Stars9 Stars10 Stars (1 votes, average: 2 out of 10)
Loading ... Loading ...

….. how much is my hard disk size left? check file size again, need command, just issue df -h

df -h

check-hard-disk-size-on-linux

How to find large file size on linux (Solution)

1 Star2 Stars3 Stars4 Stars5 Stars6 Stars7 Stars8 Stars9 Stars10 Stars (3 votes, average: 8 out of 10)
Loading ... Loading ...

Recently my fedora core run out of space, i start to think whether linux provide any command to check large file size on file system? luckily i found below command.

find / -type f -size +100000k -exec ls -lh {} \; | awk '{ print $8 ": " $5 }'

if you encounter some permission denied error, please issue sudo prefix and make sure you have sudo privileges

sudo find / -type f -size +100000k -exec ls -lh {} \; | awk '{ print $8 ": " $5 }'

Above command will find all files which file size exceed 100mb on any directories.

P.S you can customized above command to whatever you like

find (directory path) f -size (file size) -exec ls -lh {} \; | awk '{ print $8 ": " $5 }'

find-large-file-size-on-linux

How to check ip address in linux

1 Star2 Stars3 Stars4 Stars5 Stars6 Stars7 Stars8 Stars9 Stars10 Stars (1 votes, average: 2 out of 10)
Loading ... Loading ...

Just issue following command to check your ip address in linux

/sbin/ifconfig

ifconfig

ya, my ip address now is 10.0.0.6

PostgreSQL Network Access - (Solution)

1 Star2 Stars3 Stars4 Stars5 Stars6 Stars7 Stars8 Stars9 Stars10 Stars (1 votes, average: 3 out of 10)
Loading ... Loading ...

After we installed and configure PostgreSQL properly, it is no problem to access locally, however when we access through network , we hit following error message.

could not connect to server: Connection refused (0×0000274D/10061) Is the server running on host “10.0.0.6″ and accepting TCP/IP connections on port 5432?

It is because PostgreSQL disable network access by default. It is require to do some configuration to make it work.

1) Please access postgresql.conf file.

PostgreSQL-Network-Access-1

2) Modified it and uncomment listen_addresses field and put ‘*’ to indicate allow access from all network address.

PostgreSQL-Network-Access-2

3) Please access pg_hba.conf and put this line , 10.0.0.0 is my network, please change it accordingly

host all all 10.0.0.0/24 trust

PostgreSQL-Network-Access-3

Please access PostgreSQL documentation to understand what inside pg_hba.conf and how to configure it
http://www.postgresql.org/docs/8.2/interactive/auth-pg-hba-conf.html

After all done, PostgreSQL is ready to access through network, actually i find out this feature is very useful, because it can restrict network access from specified ip address or network.

How to compile PostgreSQL database source code in linux

1 Star2 Stars3 Stars4 Stars5 Stars6 Stars7 Stars8 Stars9 Stars10 Stars (1 votes, average: 3 out of 10)
Loading ... Loading ...

It’s been a long time i didnt update my blog, recently i’m busy research on Hyper Estraier , it is a powerful full text search engine written in c, i will write some information about it future.

Ok i provide following steps to show how to compile PostgreSQL database source code in linux.

1) Please visit postgres website to get latest source. I will get a latest v8.3.3 source for demonstration.

http://www.postgresql.org/ftp/

how-to-compile-postgres-1

2) Changed to your postgres source path and type following command, please change your file name accordingly

tar -zxvf postgresql-8.3.1.tar.gz

it will extract all source code into current path.

3) Please change to your postgres source code file path and type “./configure”, it will configure some necessary information for PostgreSQL

./configure

4) Type “make”, this will compile PostgreSQL source code

make

5) If anything ok, just issue final command to install PostgreSQL in your linux

make install

After you installed PostgreSQL in your linux, it is required to do some configuration in order to connect to your PostgreSQL, please visit here to read more about it.

http://www.mkyong.com/database/how-to-install-postgresql-in-fedora-core/

How to install postgresql in fedora core

1 Star2 Stars3 Stars4 Stars5 Stars6 Stars7 Stars8 Stars9 Stars10 Stars (1 votes, average: 7 out of 10)
Loading ... Loading ...

Here i share how i install postgresql in fedora core. I spent full day to find out a solution. Hope this help

1) First please get a PostgeSQL source code n compile it for installation or using yum command in fedora core.

a) Regarding PostgeSQL source code Compilation, please visit here
http://www.mkyong.com/database/how-to-compile-postgresql-database-source-code-in-linux/

b) Regarding Yum command, change to root and issue following command, it will connect to internet and download postgresql core files.

yum -y install postgresql postgresql-server php-pgsql

install-postgres-in-fedora-step1

2) Create a database cluster with initdb -D /usr/local/pgsql/data command, before that please create a /usr/local/pgsql/data folder and assign ‘postgres’ user to own it. ‘postgres’ is the default user for postgresql.

mkdir /usr/local/pgsql/data
chown postgres /usr/local/pgsql/data
su - postgres
initdb -D /usr/local/pgsql/data

install-postgres-in-fedora-step2

3) Start postgresql server

pg_ctl /usr/local/pgsql/data -l -logfile start

if you want stop postgres server , please issue following command.

pg_ctl /usr/local/pgsql/data -l -logfile stop

4)Create a database

createdb new_db

5)Access with psql

psql new_db

6) Issue a select version(); command, if it show postgresql version, it’s means you are successfully installed postgresql in fedora already.

install-postgres-in-fedora-step3

How to install java jdk on fedora core (linux)

1 Star2 Stars3 Stars4 Stars5 Stars6 Stars7 Stars8 Stars9 Stars10 Stars (3 votes, average: 7.33 out of 10)
Loading ... Loading ...

How to install java jdk on fedora core? here i provide few steps to demonstrate how it’s work.

Installation Setup

1 ) Please visit sun java website to download any java jdk version you like.
http://java.sun.com/javase/downloads/index.jsp

2 ) Click download, select Linux platform, language and accept license and continue.

3 ) Select “Linux RPM in self-extracting file” and download jdk_filename-rpm.bin file (jdk-6u6-linux-i586-rpm.bin).

4 ) After downloaded, changed to the directory where you saved the file.

5 ) login to root user or su to root or sudo, and issue ‘chmod +x jdk_filename.-rpm.bin’ to make it executable.

chmod +x jdk_filename.bin

6 ) Execute it

./jdk_filename-rpm.bin

7 ) Press space bar , repeat until system prompt to enter yes or no, type y and enter to continue.

8 ) This will output a .rpm file in same directory

9 ) Issue ‘rpm -i jdk_filename.rpm’, this will install all jdk files on linux system /usr/java/jdk-version/

rpm -i jdk_filename.rpm

10 ) Create symbol links to make it execute anywhere

 ln -s /usr/java/jdk1.6.0/bin/java /usr/bin/java
 ln -s /usr/java/jdk1.6.0/bin/javac /usr/bin/javac

11 ) type java -version, DONE !!

Post-Installation Setup

Set JAVA_HOME into environment variable

Copy following statement and append to /etc/profile or .bashrc file, make system set JAVA_HOME into system environment variable.

export JAVA_HOME="/usr/java/jdk1.6.0;"


P.S Please visit How to install JDK on Ubuntu, if you want to know how to install java jdk with apt-get.

67 is a magic number, try it

1 Star2 Stars3 Stars4 Stars5 Stars6 Stars7 Stars8 Stars9 Stars10 Stars (1 votes, average: 3 out of 10)
Loading ... Loading ...

Today i find out a mystery mathematics formula.

Last two digits( Last two digits (Number Given x 67) x 3 ) = Last two digits(Number Given)

For example.

Number 23
23 x 67 = 1541 , 41 x 3 = 123 = 23

Number 99
99 x 67 = 6633, 33 x 3 = 99

Number 8789
8789 x 67 = 58863 , 63 x 3 = 189 = 89

Benchmark

Number 657892346
657892346 x 67 = 44078787182, 82 x 3 = 246 = 46

It’s amazing right? Number 67 is a magic number, Does anyone know why it happened?

d3dx9_34.dll missing , not found (solution)

1 Star2 Stars3 Stars4 Stars5 Stars6 Stars7 Stars8 Stars9 Stars10 Stars (2 votes, average: 7 out of 10)
Loading ... Loading ...

I brought Crysis game today, after installed i hit the following error

“This application has failed to start because d3dx9_34.dll could not be found!”

D3dx9_34.dll errors typically appear when a software program, usually a game, is started. The d3dx9_34.dll file is a library file contained in the Microsoft DirectX 9 software package. Cause of this error usually is because Microsoft direct X is out of date.

Solution
Please visit Micsosoft website to download latest Direct X package
http://www.microsoft.com/downloads/results.aspx?pocId=&freetext=directx%209&DisplayLang=en

P.S please do not download any d3dx9_34.dll file from any website, this is very dangerous! go Microsoft download it, it’s free.