Friday, September 3, 2010

Referendum Reflections

The referendum results are long out and the new constitution promulgated. I felt discouraged that Kenyans did not heed the call of the church as communicated by the clergy. Before the referendum, a radio host on Hope FM had asked for what listeners thought would happen after the vote. The text below is what I wrote in.

Am expecting after the referendum:

- That many 'Sauls' will preach the gospel they persecuted,

- That those who plot for the downfall of the church will be used for its promotion,

- That the evil meant against our country will work for good,

- That where the enemy planned defeat there be victory.

- Eric.

In my state of discouragement, I remembered my response above and decided to focus on its prophetic perspective which is based on the biblical accounts of Joseph and Esther. Joseph faced opposition and ultimately rejection from his brothers, yet God made it work out for his good and his family. For Esther, it was the entire community of Jews that were endangered. Her intervention, prompted by Mordecai's counsel, left the Jews stronger and elevated them higher.

In Esther's scenario, there is a gem that is especially shines in the current constitution dispensation. It is written that Mordecai was remembered and honored by the King because he had once uncovered a plot against the kings life. In the same way, I believe God will remember and honor those who voted to save the lives of our unborn children even if their action not appreciated or recognized right away.

Monday, August 30, 2010

Postgres DB Management Server

While trying out Postgresql (EnterpriseDB 8.4) database, I wanted to see what the management server has. Looking through the enterprise DB documentation did not turn up the port number. I used lsof to list the ports on listen mode. This action turned up several ports between 9011 and 9019. At this point, I tried some of them on the browser but none worked possibly because of the local firewall.

After several unsuccessful searches, I navigated through the installation folders and realized that the management server run on jboss. I then made a specific search for Jboss http port configuration as I my experience was with tomcat only. It was a pleasant surprise that Jboss uses tomcat for its web apps. Looking through $EDB_HOME/mgmtsvr/server/default/deploy/jboss-web.deployer/server.xml revealed that the HTTP port is 9011. I added this to the firewall exclusion list and I was ready to explore.

At first sight, the management server does not appear to have many features. This is especially since I have interacted with the Oracle enterprise console. With that ended another step in my journey with Postgresql.

Monday, July 12, 2010

Getting Started with Amanda

Having initially considered Bacula, I chose amanda for use in backup due to it's better organized documentation. Being a newbie, I selected the quick start getting started tutorial as the first step through the online documents.

In that process, I consulted the bsd authentication howto for more information on authentication. I also found the vtape howto very helpful since I did not have a physical tape device. Having gone followed the tutorial and branching into the howtos at the relevant sections, I was able to do a successful test run.

Using another article in the howtos collection, I made further changes to the configuration to allow for dumps to be split across multiple tapes (vtapes in my case). It was then time to follow another howto to duplicate that configuration to the production environment where the virtual tapes needed to be configured for use on a non-Linux partition.

Thursday, July 1, 2010

Creating a Pre-printed Report Template

One way to speed up printing receipts on a dot-matrix printer is to print the desired (dynamic) information on a pre-printed template that contains the labels, content placeholders, logos and other static information.

The first thing I did was to adjust the report to display the values only as it has previously been printing all the dynamic and static information. I deleted all the static information and left the bare dynamic info that changes with every print out.

I then printed out the bare report on the target dot matrix printer. In the process, I made adjustments to paper guides on the printer so as to get an optimum placement. I repeated this process several times as the draft print outs revealed changes that needed to be made to the report writer design.

When the bare printout had an optimum placement, I took the printout and scanned it. I then opened the resulting image with Gimp Image Manipulation Program. Using gimp, I added layers which contained the static information e.g. text layers for labels and a transparent layer for content placeholders. I even added a layer with a white color that I would hide/show to see how the report template would look like on printed paper.

All this time, the original scanned layer was acting as a background which helped with the positioning. Thereafter, I hid this original layer (leaving the all white layer as the background) and printed the resulting report template on paper. Now it was time to test it by printing out the bare information report on the preprinted template. After a few minor adjustments and refinements made from observing the data placement on the template, the final version was ready for mass production.

Friday, June 11, 2010

Workaround for uploading data to google app engine dev server

Google app engine's dev server will ask for a google account to upload data as described in the uploading data section of the online docs.
I found this requirement restrictive since I did not have a internet connection at the time. My workaround was to comment out a section of the file that handles upload requests i.e. $PYTHON_LIB/google/appengine/ext/remote_api/handler.py.

The following is the result of running diff handler.py.dist handler.py where the first file is the original file and the second is the modified one.


295,296c295,296
< if not self.CheckIsAdmin():
< return
---
> #if not self.CheckIsAdmin():
> # return


The appcfg.py script will still ask for an email and password after the change but any fictitious value will be accepted.

Wednesday, May 26, 2010

Making ProxyPassMatch work with Location in apache2

I have recently created a configuration where apache2 proxies requests to pentaho running on a tomcat backend. The first problem I faced with the ProxyPassMatch directive is to do with the way the url pointing to the backend is written. Specifically, using a url that includes a non standard port like 8080 may result in a ProxyPass Unable to parse URL error. I fortunately found a workaround for that bug on the apache bug list.

When ProxyPassMatch is enclosed in Location - the first argument - which is a regex pattern, is left out. It is used as an argument to the Location directive instead.

The url provided to the enclosed ProxyPassMatch should be combined with the expected result from regex pattern. This is done using $n where n is count of parenthesized matches starting at number 1.
If the parenthesized matche(s) are not provided to the url argument of ProxyPassMatch, the whole matching string will be concatenated with that url and this may result in an unintended path.

Example


<Location ~ ^/(pentaho.*)$>
Order Allow,Deny
Allow from All
ProxyPassMatch ajp://127.0.0.1:8329/$1
</Location>

Monday, April 19, 2010

Restarting Pentaho Automatically - the quick and dirty way

I look after a Pentaho 2 deployment which manifested a pattern of freezing after about a week. That appears to be a weakness in the code where an object grows bigger and bigger and is not garbage collected, leading the JVM to hang while attempting a full GC.

Not having the expertise to profile the memory usage on the pentaho system, I decided to have the application server restart every few days. The first issue I faced is that the provided stop script - stop-pentaho.sh returns immediately after being invoked and does not guarantee that the application has been stopped.

Compiling jsvc (available in tomcat's bin directory as jsvc.tar.gz) enabled me to have a guaranteed way of stopping tomcat. The following script shows the contents of a script I named stop-tc.sh. This script accepts the tomcat HTTP listen port as the sole argument.


#stop tomcat whose port provided at command line
tmp_file=/tmp/tc-stop.pid

#use lsof to get PID, write to temp file and call jsvc
lsof -a -i TCP:$1 -c java | grep LISTEN | awk '{print $2}' > $tmp_file && /usr/local/bin/jsvc -stop -pidfile $tmp_file org.apache.catalina.startup.Bootstrap


I thereafter turned my attention to the hypersonic database that holds pentaho admin information. There should be a command to shutdown the database, but I decided to kill the process and delete the lock files. The complete restart script, which references the one above, is given below.


#! /bin/bash

export JAVA_HOME=/usr/lib/jvm/java-6-sun
#stop tomcat
/storage/kuali-scripts/stop-tc.sh 8286
#ensure tomcat quits - the file involved is created by stop-tc.sh above
kill -9 `cat /tmp/tc-stop.pid`

#kill hypersonic
kill -9 `lsof -a -i TCP:9001 -c java | grep LISTEN | awk '{print $2}'`

#delete hypersonic log files
rm /storage/financials/pentaho2/biserver-ce/data/hsqldb/quartz.lck
rm /storage/financials/pentaho2/biserver-ce/data/hsqldb/hibernate.lck
rm /storage/financials/pentaho2/biserver-ce/data/hsqldb/sampledata.lck

#start pentaho
/storage/financials/pentaho2/biserver-ce/start-pentaho.sh &> /dev/null