VP Pick

Some group I’ve never heard of is asking that the next Vice President be a ‘True Christian’, given that neither Presidential candidate counts, apparently. It brings up the old whine about marriage again, unsurprisingly:

The group isn’t suggesting names but is citing criteria for a perfect candidate, including that it be someone who is against abortion and for defining marriage as “a union between one man and one woman.” It plans to send the petition to the presidential candidates.

I don’t like that definition particularly, but part of my dislike is because it’s so wishy-washy. Historically marriage hasn’t been like that in many places and times, so what these loons are using isn’t historical precedent but their religious teaching. That’s fine, I guess, but if you’re going to commit to these things then you should commit:

It hath been said, Whosoever shall put away his wife, let him give her a writing of divorcement:

But I say unto you, That whosoever shall put away his wife, saving for the cause of fornication, causeth her to commit adultery: and whosoever shall marry her that is divorced committeth adultery.
Matthew 5:31-32

So marriage is between one man and one woman for life. And don’t think that you can get away with adultery:

And the man that committeth adultery with another man’s wife, even he that committeth adultery with his neighbour’s wife, the adulterer and the adulteress shall surely be put to death.
Leviticus 20:9-11*

Worryingly even not getting divorced doesn’t seem to be much protection there:

Ye have heard that it was said by them of old time, Thou shalt not commit adultery:

But I say unto you, That whosoever looketh on a woman to lust after her hath committed adultery with her already in his heart.
Matthew 5:27-28

That’s a pretty tall standard to live up to there. Or to quote a less Biblical scholar, Tony Hancock, “Stone me!”

*Yes I know, Christ’s arrival allowed us to put away some of the excesses of Old Testament behaviour, so we can just revile adulterers rather than actually killing them.

Vice-President Clinton

Obama is having kinda-secret talks with Clinton about ‘bringing the party together’. There’s some speculation that she might be the VP. I’m hoping that this is just Obama being polite so as not to offend her supporters, because having her on the ticket is a potential disaster – Obama’s big thing is a change from the past, and as good as things were in some areas under the last Clinton, she’s too firmly anchored in people’s perceptions as being part of the bad old days.

Posted in Uncategorized
Tagged with

I’m telling you, billions wasted!

There’s an article on the Beeb about the decline in standards for maths exams in the UK (that’s math for our colonial readers). The decline set in from 1990, which I could have told you already; I left high school in 89, and we generally agreed that the year before us was the last year to do ‘proper’ tough exams, we had it a fraction easier, and from there on it was downhill.

The bit that really caught my eye was the following statement, which I hereby nominate for Best. Sentence. Evah.

This has led to mathematics at university being compromised and able-students (sic) being neglected, and has cost the economy billions of pounds in lost mathematicians.

Posted in Uncategorized
Tagged with

Load Balancing Tomcat on Leopard with mod_jk

I’ve just had to setup a test system that load balances a site running on Tomcat across multiple computers. My test bed is 3 mac minis, one working as the ‘head’ running Apache, and the other two in the ‘farm’ handling the load. It was a less than painless exercise, so I thought I’d write up the instructions.

1. Install Tomcat
Download Tomcat from here.
On each farm machine rename the folder to be Tomcat, then move it to the /Library/ directory.
In Terminal:

cd /Library/Tomcat/bin
rm *.bat
rm *.exe
chmod +x *

(You don’t need .bat or .exe files, but you do need other files to be executable).

Edit the file /Library/Tomcat/conf/tomcat-users.xml so that it reads:

<?xml version='1.0' encoding='utf-8'?>
<tomcat-users>
  <role rolename="manager"/>
  <user username="tomcat" password="s3cret" roles="manager"/>
</tomcat-users>

(Note that the username and password are examples from Tomcat – you should probably change them).

Repeat the above for each farm machine.

2. Deploy your application
Open each of your farm machines in turn from your browser, e.g.

http://farm1:8080/

You should see a screen that looks something like this:

Welcome screen for a Tomcat installation

Click Tomcat Manager and enter the username and password you defined above. This should show the Tomcat Web Application Manager screen.

Upload the war file of the application you want to run. Once complete you should see a link on the manager page to your application. Click it and make sure it works OK.

Repeat the above for each farm machine.

3. Install mod_jk
Here’s the tricky bit. Mod_jk is the apache module that handles the load balancing. It’s available here, BUT none of the downloads there will work on Leopard. Apache on Leopard runs as 64 bit, which isn’t an option you can download from the Tomcat site. So you have two options:

  • Download the source code and build your own version. This isn’t too hard if you have the relevant tools already installed – look here for an excellent step-by-step on the changes you need to make to build a 64 bit version.
  • Use MacPorts
  • , which appears to have the facility to create a 64 bit version (I haven’t tested this).

  • Download the 64 bit version of mod_jk 1.2.26 that I created. I may update this as I go along, but no guarantees!

Once you have your mod_jk.so file (if it doesn’t end up with that name, change the name) copy it to the /usr/libexec/apache2/ directory of your head machine. It’s worth changing the ownership and permissions of the file to match the other modules using the commands sudo chown root:wheel mod_jk.so and sudo chmod 755 mod_jk.so.

4. Configure Apache
Edit the file /etc/apache2/httpd.conf and add the following lines:

#Added for Load Balancing
LoadModule jk_module libexec/apache2/mod_jk.so
# Path to workers.properties
JkWorkersFile /etc/apache2/workers.properties 

# Path to jk logs
JkLogFile /your-chosen-location/mod_jk.log

# Jk log level [debug/error/info]
JkLogLevel info

# Jk log format
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "

# JkOptions for forwarding
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories

# JkRequestLogFormat set the request format
JkRequestLogFormat "%w %V %T"

JkMount /your-application balancer
JkMount /your-application/* balancer
#End Added for Load Balancing

Note that you’ll need to set the location for your log file, and the name of your application. It’s a good idea to create the log file (e.g. use touch mod_jk.log in the directory you want it; this makes sure the file can be created, which would otherwise trip Tomcat up.

Now create a new file worker.properties in /etc/apache2 containing the following:

workers.tomcat_home=/Library/Tomcat
workers.java_home=/System/Library/Frameworks/JavaVM.framework/Versions/Current

worker.list=balancer
worker.maintain=5

worker.farm1.port=8009
worker.farm1.host=farm1-IP-address
worker.farm1.type=ajp13
worker.farm1.lbfactor=1

worker.farm2.port=8009
worker.farm2.host=farm2-IP-address
worker.farm2.type=ajp13
worker.farm2.lbfactor=10

worker.balancer.type=lb
worker.balancer.balance_workers=farm1,farm2
worker.balancer.method=Request

The worker.maintain setting helps determine how long one farm machine will be used before the load switches to another machine. For testing I used 5 (seconds); the default is 60.

5. Start Apache
Tomcat should still be running on each of the farm servers, so start Apache on your head machine by opening System Preferences…Sharing and checking the ‘Web Sharing’ box (if it was already checked then uncheck and recheck it to restart Apache).

6. Test it out
Browse to http://head/your-application – you should see your application!

Credits
This post was based on the excellent work found here