Thursday, February 25, 2010

Enabling clustered tomcat mcast port in OpenSUSE firewall

The default firewall configuration will drop the multicast packets needed for tomcat instances in a cluster to 'ping' each other.

Open the firewall application as root, and select Broadcast on the navigation panel on the left.



Click the add button, select the active firewall zone and select 'User Defined' under service. Finally specify the protocol as UDP and provide the port number in use.



Click add then save the settings which take effect immediately.

Monday, February 15, 2010

Reading Standard Input in Ruby Scripts

I recently spent a few agonizing hours struggling to get a ruby script to work.
The script was iterating over standard input and subjecting the input line to a file/dir test. Valid files were not being recognized.

I later realized that the cause of the problem was the newline that is included in the input received from standard input. After stripping away the newline, the script worked.

Copying a Pentaho Report Repository Manually

Copying a existing report repository is an easy way to create another repository for use with a test or development database. It can also be a way to create a production repository from an erstwhile development version.

These are the steps I used on Linux:
  1. Copy the repository

    cp -r repo-prod repo-dev

  2. Edit the index.properties file in repo-dev and change the name property to give it a different name than the original.

  3. Change the data source name to match the development one in each xaction file
    find . -name '*.xaction' | xargs sed -i 's/data-prod/data-dev/g'

  4. Change the repository name in xaction files that have sub-actions
    find . -name '*.xaction' | xargs sed -i 's/repo-prod/repo-dev/g'

  5. Change the image paths in the report design .xml files. cd into the directory first
    find . -name '*.xml' |xargs sed -i 's|/old/prefix/|/new/prefix/|'