Saturday, February 13, 2010

No module named yum

I usually do not document installation problems even though I run into them every so often. This one though has taken so much time to get resolved that I decided to document.

So here is the operation system:
# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 5.3 (Tikanga)
 And here is the problem:
#yum
There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:

   No module named yum

Please install a package which provides this module, or
verify that the module is installed correctly.

It's possible that the above module doesn't match the
current version of Python, which is:
... 
 Of course yum is clearly corrupted and needs to be reinstalled, so as root we will download the corresponding rpm and install it. Note that use the magnificent CentOS rpms.:
mkdir /tmp/yum
cd /tmp/yum
http://mirror.centos.org/centos/5/os/i386/CentOS/yum-3.2.22-20.el5.centos.noarch.rpm
rpm -Uvh yum-3.2.22-20.el5.centos.noarch.rpm

Right there I got some missing dependencies so then I pulled them as well and since I downloaded everything into /tmp/yum I can build them all at once. Note that expat library is needed by python-elementtree however I did not find the rpm in CentOS repo:

wget http://mirror.centos.org/centos/5/os/i386/CentOS/yum-fastestmirror-1.1.16-13.el5.centos.noarch.rpm
wget http://mirror.centos.org/centos/5/os/x86_64/CentOS/python-elementtree-1.2.6-5.x86_64.rpm
wget ftp://ftp.muug.mb.ca/mirror/centos/5.4/updates/x86_64/RPMS/expat-1.95.8-8.3.el5_4.2.x86_64.rpm
rpm -Uvh *

Now finally yum is back:
# yum --version|head -1
3.2.22

But you need to install the repos. While you can do this manually and use different repos (Use one that uses GPG keys ) the easiest way is to just install an rpm to get the rpmforge repo:
rpm -Uhv http://apt.sw.be/redhat/el5/en/x86_64/rpmforge/RPMS/rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm

Friday, January 22, 2010

Tomcat 6 Logging

While the official Tomcat documentation states a clear departure from log4j and outlines the possibilities to still use it, I found myself looking for the quickest way to provide instructions to my team as to how to develop using tomcat.

We currently use JBoss in our servers but given the lack of J2EE in our current applications (Spring Framework based) it does not make sense to be waiting for 1 minute JBoss startup when tomcat offers two seconds response.

First when debugging locally it makes sense to see the server output in the console directly. True this can be done using the tail command and that is the way I prefer. Anyway do the below if you want to keep an eye on the server as soon as it is started

#exec "$PRGDIR"/"$EXECUTABLE" start "$@"
exec "$PRGDIR"/"$EXECUTABLE" run "$@"
Now let us make tomcat output our application traces. For that create or edit file at lib/log4j.properties

#### Use two appenders, one to log to console, another to log to a file
log4j.rootCategory=debug, stdout, R

#writes to console
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d %5p [%t] (%F%L) - %m%n

#writes to a file. This is optional of course in a development environment
log4j.appender.R=org.apache.log4j.RollingFileAppender
log4j.appender.R.File=${catalina.base}/logs/stdout.log
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%d %p %t %c - %m%n
#Archive logs
log4j.appender.R.MaxBackupIndex=10
#maximum log file size
log4j.appender.R.MaxFileSize=10000KB


From logs/stdout.log you can get all information you want and of course the same applies for the command line from where you started the server.

Be aware that your application must not have any log4j.properties file in the classpath otherwise you will end up overwriting the server configuration.

Saturday, January 16, 2010

Svn ChangeLog for Release Notes

While SVN does not come with a straight command to generate a ChangeLog latest versions come with an XSL that I have been using now for a while. I am just documenting it here as I found today my Ubuntu VM was missing the XSL file (svn2cl.xsl).

First be sure you have svn2cl in a known folder, I have picked ~/utils
cd ~/utils
wget "http://arthurdejong.org/svn2cl/svn2cl-0.12.tar.gz"
gunzip svn2cl-0.12.tar.gz
tar xvf svn2cl-0.12.tar
rm svn2cl-0.12.tar
 And now, everytime a ChangeLog is needed you can run a command like the below:

svn log --xml -r 7534:7548 --verbose "http://my.svn.domain/my-repo/my-project" |xsltproc ~/utils/svn2cl-0.12/svn2cl.xsl - > ChangeLog

In the above example I am obtaining a ChangeLog between two versions of my project (I got the interesting version numbers easy as I use Maven to release and so I get when Maven released last-7548 and when it released previously-7534)

Sunday, January 03, 2010

Local Temperature

I just released LocalTemp to the Android Market. Keeping it simple once again I came up with this application to show *just* the local temperature for the current location.

If you are accessing this page from an Android phone go ahead and click here to download.

Of course GPS functionality is needed and since I currently do not have an IPhone 3GS I will need to wait to release it to the IPhone App Store.

Please post any problems on this page.

Tuesday, December 22, 2009

Random Numbers For Android

PRIVACY POLICY: This app does not collect any personal information neither shares the random numbers generated by the device. It simply generates numbers as random as they can possibly be.
RandNum (Random Numbers) is available on Android. Please request fixes and features for the Android version on this page.

You can read about the application on my previous post where comments are welcome for the IPhone version.



Available in English, Chinese and Spanish it is not limited to those. New languages will be available following requests on this page.

This is my fifth Android app.

Saturday, December 12, 2009

Random Numbers


I just finished the development of a new IPhone application (RandNum) that accepts a range of numbers and a total amount of random numbers to be generated. Numbers are shown either by shaking or touching the device screen. Get it from here.

Random Numbers can be used to:

* Generate random numbers to play Lottery (Lotto and Lottery might be trademarks and they are not associated at all with this program).
* Play Lottery (Lotto and Lottery might be trade marks and they are not associated at all with this program).
* Pick a random page of a poetry book.
* Roll a dice.
* Make Raffle Tickets.
* Play your favorite depending-on-luck game.
* You name it ...


Available in English, Chinese and Spanish it is not limited to those. New languages will be available following requests on this page.

Get the Android version here.

Friday, November 13, 2009

Amazon Feeds Parser: Parsing Huge XML files

Amazon Feeds are huge and they are needed to locally search and browse their catalog as Amazon still does not allow more than 1 call per second to their PA-API. In any case even if you decide to go for the PA-API directly things like ordering a search result for a keyword in all categories will not be possible as simply that option is not available by the time of this writting.

I have opened a project which you can use to get tab delimited data from those huge feeds.

The tool I use is xgawk and I have to say that I have really enjoyed coding the *awk* way.

Followers