Archive

Archive for August, 2009

Building Boost under Solaris

August 12, 2009 2 comments

Boost provides free peer-reviewed portable C++ source libraries. I have been using another library “libiqxmlrpc” in my application and that used Boost, now when porting my application to Solaris I had to build Boost from source which I thought would be very simple but it wasnt…

Here is what I had to do:

– Once you have got the latest source for boost, build bjam (build environment setup scripts) from within the Boost source code folder…that is very straight-forward
– After bjam is successfully build, add it to your PATH to make things simpler
– No go to the Boost source root folder and run the following

bjam toolset=sun stdlib=sun-stlport instruction-set=i386 address-model=32 
--prefix=/opt/boost/ --libdir=/opt/boost/lib/ --includedir=/opt/boost/include/

Which is good for 32 bit Solaris and with Sun Studio installed. In case you are using 64 bit change the address-model accordingly and same goes for instruction-set that if you are on AMD use the option as “amd” instead of i386.

The build process will not work just with the default option so these options have to be added. Once the build is started it sure does take quite a while so enjoy a coffee during that time 🙂


Shoaib Mir
shoaibmir[@]gmail.com

Advertisements
Categories: C/C++ Tags: , ,

Setting up Slony cluster with PerlTools

August 5, 2009 2 comments

A few days back while I was giving a training on Slony and was showing the students steps to building a Slony cluster using Perltools, they asked me to write down the steps for them as it was very hard to memorize everything. I just did that and thought of sharing it with everyone as it might help.

First of all make sure you have the perltools available for Slony and once you have confirmed that, follow the steps given below:

– Edit the slon_tools.conf file according to your cluster needs, i.e. change the nodes, sets information and tables to be replicated. This file by default is located in /usr/local/etc/slon_tools.conf and the Perltools will by default look into this directory for the configuration file.

– Now first of all you need to initialize the cluster

slonik_init_cluster | slonik

– Once that step is successful, start the Slon processes on each of the nodes involved

– Create the Sets, in our case we just had one set so the process goes as

slonik_create_set 1 | slonik

(Where 1 is the ID of the first set which we had set in the slon_tools.conf file)

– Subscribe the sets now, in our case we had just two nodes and one set

slonik_subscribe_set 1 2 | slonik

(Where 1 is the ID of the set and 2 is the node to which you want to subscribe)

– Once the subscription is successfull you should have replication all working now, which can be tested by adding a row in one of the replicated tables on master and verifying the change in your slave node.

Perltools really make life easy and takes rid of those extra steps for creating Slonik scripts yourself . Once you have the slon_tools.conf properly configured it just takes a few minutes generating all the required scripts.

Just make sure when you make any changes to your Slony cluster like adding new sets, new tables, merging sets and doing switchovers or failover… keep on updating the slon_tools.conf file regularly as then it will not take much time rebuilding all scripts for the latest cluster in case that is needed.


Shoaib Mir
shoaibmir[@]gmail.com

Categories: PostgreSQL Tags: , ,

Using projector screen with Ubuntu

August 5, 2009 1 comment

Since upgrading to Ubuntu 9.04 I was having problems with using the projector for doing demos and all. It used to detect the signal from the projector to my video but I couldnt make my desktop to show on the projector screen. I didn’t care much about it then as I was able to get a colleague’s laptop and do my presentations but like last week I had to do a PostgreSQL training for which I really needed my laptop as I had setup almost everything on my machine for doing practicals.

So I thought of giving it a try to see if I can somehow make it work…

Googled it and found someone mentioning “Randr” and when I searched the same through apt-get I was able to find “Grandr” which is a GNOME Panel Applet that allows you to select screen resolution and orientation from the GNOME Panel.

Once I got it installed, connected the projector screen and opened up “Grandr” and then in the first try I was able to see my desktop on the projector screen… I did the following:

– Once Grandr was up I could see my laptop screen as LVGS and project screen as VGA
– Selected ‘Auto’ for VGA and used the normal resolution I go with for my laptop screen
– Clicked on Apply and thats it…

“Grandr ” came out very handy during the training and I was able to do the whole thing using my laptop 🙂


Shoaib Mir
shoaibmir[@]gmail.com