Skip to main content

Posts

Showing posts from December, 2013

Pgpool Configuration & Failback

I would like to share the pgpool configuration, and it's failback mechanism in this post. Hope it will be helpful to you in creating pgpool and it's failback setup. Pgpool Installation & Configuration 1. Download the pgpool from below link(Latest version is 3.2.1).     http://www.pgpool.net/mediawiki/index.php/Downloads 
2. Untart the pgpool-II-3.2.1.tar.gz and goto pgpool-II-3.2.1 directory. 3. Install the pgpool by executing the below commands:   ./configure ­­prefix=/opt/PostgreSQL92/ ­­--with­-pgsql­-includedir=/opt/PostgreSQL92/include/ --with­-pgsql­-libdir=/opt/PostgreSQL92/lib/ make make install 4. You can see the pgpool files in /opt/PostgreSQL92/bin location. /opt/PostgreSQL92/bin $ ls clusterdb   droplang  pcp_attach_node  pcp_proc_count pcp_systemdb_info  pg_controldata  pgpool pg_test_fsync pltcl_loadmod  reindexdb createdb    dropuser  pcp_detach_node  pcp_proc_info createla...

Regex to parse PostgreSQL CSV log files.

It took sometime to me to understand the powerful concept, i.e, REGEX. Below is the REGEX expression to parse the CSV log files, which have been generated by PostgreSQL. Regex is :- -=-=-=-=-= "^((([^, \"\n\r ]*)|( \" ([^ \" ]|( \"\" ))* \" )),){22}( \" ([^ \" ]|( \"\" ))* \" [ \r\n ]+)" Use any regex tools like RegexBuddy, which will give you detailed information about this regular expression. Dinesh Kumar

Game with postgreSQL

I developed this game a bit long ago, and would like to share with the world. Yes, ofcourse, we can optimize the code of c here, but i have concentrated only on desired functionality for this. Once, i got the desired result, i haven't looked into any of the line in this code. {Very bad habbit, i need to over come this.} I hope you enjoy it, and correct if any problems occurs. This game is for only 2 players, which will give you the realtime game feel with your opponent. First find the code, and then instructions. C Program -=-=-=-=-=- #include "stdio.h" #include "ncurses.h" #include "/opt/PostgreSQL/9.0/include/libpq-fe.h" #include "stdlib.h" #include "string.h" char symbol[3]; PGconn * PGconnect(char ch) { PGconn *conn; PGresult *res; FILE *fp; int cnt,i=0; char conn_string[500],hostaddr[32],port[7],dbname[50],user[50],password[50],name[10]; const char *paramValues[2]; fp=fopen("/tmp/.cred","...