Monday, December 21, 2009

Workout change... recovery

I re-read parts of some Mike Mentzer bodybuilding books I have.   He was a fan of Ayn Rand, which is unfortunate (for a whole list of reasons I can list if anyone cares).  

But he makes many reasonable arguments about different aspects of strength training.   He describes his trainees working out on a routine that worked chest and arms on day one, shoulders and arms on day four, and legs on day seven, then rest until day ten and start over the next day on day one.   He said that most maintained good progress with their legs for long periods but not their upper body.  So he changed the routine so that the break between workouts was four days instead of three, and upper body progress still slowed.   Then he changed it again to chest/back on day 1, legs on day 5, shoulders and arms on day 9, and legs on day 13, rest until day 17, then start over with day 1, and he said progress was phenomenal for almost all trainees.   Some did not excel until the break was five days instead of four.

I've definitely found that my strength can stay the same or grow despite (or maybe because of) a 7 or even 9 day break between workouts.   I only did that haphazardly in the past, so now I'm going to try it consistently.   I haven't done a full workout since 12/15, so I plan my next one for 12/29.   If I make good progress in some exercises, I'll keep trying with 7,9, or even 12 days between workouts (since I have a best opportunity to reach the gym on Tuesdays and Thursdays).   I did some shoulder presses 12/19, so nine days off should be plenty of time to recharge for the 12/29 workout.  

Tuesday, December 15, 2009

Strength drop

So today my workout was disappointing. The leg press was occupied, so I started with pulldown and row, which were about normal. On leg press, on my last workout with legs five days ago I managed 12 reps with 230 pounds for each leg. I got 7 reps with my left leg and couldn't budge any more. On the shoulder press I managed 5 with 175 on the machine (I could never manage near that weight free weight), instead of the 6.5 I did last time - but maybe that was from fatigue from doing the pulldown and row first.

I see a few possibilities. I wasn't feeling totally energetic this morning. Maybe I have some disease temporarily slowing me down. I did full workouts Tuesday and Thursday last week and a wrist and grip workout Thursday and Saturday. Maybe I am slightly overtrained. And of course, maybe I am not training frequently enough.

I'm going to assume overtraining or sickness and take off until next Tuesday. I may do some wrist and grip work between now and then, but that's all. If I keep hitting a wall, I will drop the leg press, shoulder press, and a few other exercises down a few pounds and start again with more frequent workouts.

12-17-09: I skipped my strength workout for the day, the grip workout Tuesday (the 15th) and today, and just tried 3x6 on shoulder press with a 5 minute break between sets.  I managed 55 pounds in each hand, not bad.  (Not super, but not bad.)   Next time I try shoulder press, I'll attempt 56.  I see no reason to hurry, not hurting my wrist is top priority.

12-19-09 Tried shoulder press with 56 pounds, got 1x6 and 1x5.  Take a few more days off (maybe six or seven because of other upcoming workouts) and try again.   I may decide that two sets is plenty.   I'm also contemplating a switch to a seven or eight rep target per set instead of six.  It will slow down my progress, but presumably the longer sets will fatigue the muscles more - which hopefully is better for mass growth.  

Thursday, December 10, 2009

Forearm/Wrist/Finger workout

So today was my first attempt at a wrist and finger workout. My left forearm is cramping up, hopefully that means I did well. Workout:
Hang from pullup bar (feet touching ground, but providing minimal support): 60 seconds -> try for 75
pinch grip between thumb and tips of fingers, two 2.5 pound plates: 60 seconds -> go for 2.5 and 5 pounds
dumbbell finger roll up (stand with dumbbell at side, let dumbbell roll down so only the tips of fingers support it, curl fingers until dumbbell is in palm of hand): 50 repetitions with 15 pound dumbbell -> try for 25 pound dumbbell
dumbbell wrist-up, seated with forearm resting on thigh: 21 repetitions with 15 pound dumbbell -> try for 25 pound dumbbell
dumbbell rear wrist-up, stand with dumbbell down behind back and lift wrist to the back: 50 repetitions with 15 pound dumbbell -> try for 25 pound dumbbell
dumbbell lift to outside, stand with dumbbell and all weight on one side (5 pounds on the 5 pound bar) and grip the other end, and lower and raise the weight: 16 repetitions -> try for 20+
dumbbell lift to inside, 21 repetitions -> raise the resistance
dumbbell pinch, 2.5 pounds and 5 pounds: 25 seconds, try for more
reverse curls, 15 pound dumbbells, 27 repetitions -> raise the resistance.
pullup bar hang, feet touching the ground but providing minimal support: 40 seconds, try for more.

So... we'll see how this works for me. In terms of vanity, I want to bulk up my left forearm. It's very skinny. In terms of useful strength, my left hand grip strength dramatically trails my right hand and I'd like the narrow the gap. It would even be cool if my shorter left arm had a monster grip even stronger than the right, but I would be pleased with near parity. I'd also like stronger wrists to protect myself during dumbbell lifts and be more useful moving furniture, twisting stuff, and so forth.

12/12 - second wrist workout. I doubt a 1.25 inch wide dowel, put a hole in it and a rope through it, and hung a 10 pound weight. I thought it would be easy, but damn is it hard.
Wrist curl up-> 1 repetition (all the way up and all the way down) w/10 pounds with a forward and down curl, about half a repetition with 10 pounds with a back towards me and down curl.
Bar hang: 65 seconds
pinch grip, 7.5 pounds: 45 seconds -> same weight
dumbbell finger roll-up, 25 pounds: 19 repetitions -> same weight
dumbbell wrist up - wrists were fried from wrist curl up, 17 repetitions with 15 pounds, stay.
standing rear dumbbell wrist up: 21 repetitions with 25 pounds -> same weight
dumbbell outside lift, weight on one side, 5 pounds: 21 repetitions -> same weight
dumbbell inside lift, weight on one side, 7.5 pounds: 17 repetitions but range of motion may be less, drop back to 5 pounds.
dumbbell pinch, 7.5 pounds: 27 seconds
reverse curl, 20 pounds: 17 repetitions. Watch right forearm, can't do a 'true' reverse curl with that weight, have it partly turned to use regular biceps. Fix it.
pullup bar hang: 25 seconds
wrist curl up: about half a repetition going forward and done.

Wednesday, December 9, 2009

Workout update

My right wrist is still bothering me from the October injury, so I stopped working on dumbbell shoulder press. To save time and for 'cardiovascular fitness' reasons (I am not even sure if I believe in that concept as it is traditionally defined) I've taken to doing my workouts with machines in a cardiovascular circuit.

Usually:
1. leg press - trying for 15 reps before increasing the weight, most recent was 10 reps with 230 pounds for each leg
2. leg extension - trying for 15 reps, but getting killed because it's right after leg press, most recent was 10 reps with 130 for each leg
3. leg curl - trying for 15 reps, most recent was 14 with 80 for each leg
4. shoulder press - trying for 10 reps, most recent was 6 with 175 pounds (the machine is easy, no way in hell I could free weight shoulder press that much)
5. chest press - trying for 10 reps, but my strength is awful because of the shoulder press, most recent was 4 with 150 pounds
6. weighted back extension - trying for 10 slow reps, most recent was 10 with 170 pounds
(Incidentally, using even 80 pounds with this hurt like hell before I discovered I had a herniated disk. I am now confident that my disk herniation was far older than June, it just wasn't acutely painful until June.)
7. weighted abdominal exercise - trying for 15 reps, most recent was 8 with 130 pounds
8. calf raise - one leg at a time holding a dumbbell, most recent was 21 with 35 pounds
9. pull down - trying for 10 reps, most recent was 7 with 145 pounds
10. row - trying for 10 reps but my strength is toast after the pull down, most recent was 5 with 115

I'm generally pleased with my progress. Those leg press numbers aren't my best ever, but they're pretty solid and I feel like my legs are getting more muscular. Unfortunately, that's subjective and I may be incorrect. The working weight for the shoulder press is also my best, although again most of the shoulder machines I've used before seemed more difficult. I'm not wildly enthusiastic, but there does seem to be some progress. My right leg is still noticeably stronger than the left, but at least the left side isn't weak any more. In all of the exercises above, I work my left leg to muscular failure and limit the right leg to match it without exceeding it.

The other good news is I watched a Youtube squatting video with Mark Rippetoe, who is considered an authority. Apparently my preferred squat form was pretty close to ideal. If I return to dumbbell home squats (dumbbells at chest height) I can do things the right way. Or if a local gym gets a real power cage, that would be even better. (Best of all would be someone buying me a power cage and finding a place to put it in my house. Any takers?)

I'm going to add forearm exercises to this, to beef up my left forearm, rehab my right wrist injury, and strengthen my grip. Exercises I plan are hanging from the pullup bar, wrist rollers, reverse dumbbell wrist curls, side dumbbell wrist curls, and plate pinch. I intend to work my left side harder than the right.

Tuesday, October 20, 2009

Minor workout success

It's been 15 days since my last post, and three or four workouts with the dumbbell shoulder press. Today I managed 5 sets of 5 with 55 pounds. So it took me 15 days to add just 5 pounds to my tolerated resistance, which seems discouraging.

On the other hand, if I managed 2.5 pounds of extra resistance per hand every half month, in one year that's 24 * 2.5 = 60 pounds of added resistance. Of course, I've never seen progress at that rate in shoulder press in my life. But being able to shoulder press with 115 pounds in each hand would be damned impressive. Or while I'm having a wild fantasy, a 2.5 pound improvement on 52.5 pounds is 4.76%. If I magically managed a 4.5% increase in strength every 15 days, that's an 187% increase in one year, or from 52.5 per hand to 150 pounds per hand. I could live with that. More likely, if I'm lucky my shoulder press will be above 75 pounds per hand in a year. But I can live with that.

Now I must decide whether to increase the resistance per hand in a +1 pound,+1 pound,+0.5 pound progression (using the 1 pound and 2 pound wrist wraps I own and the 2.5 pound weights) or simply jump up in 2.5 pound increments and accept the dramatic drop in repetitions that comes with it. I'll try the small increments for now. I managed 4 repetitions with 56 pounds in each hand, about 10 minutes after the workout with 55 pounds.

Also: there was a 7 day gap in workouts and a 5 day gap in workouts in that 15 day period, because after several workouts with 2 and 3 day intervals, my strength seemed to drop. So I won't be afraid to continue with bigger intervals, if necessary.

Back to the first hand... #$^#($^#$# I may have hurt my right wrist. Certain positions hurt now! I'll keep an eye on it. If I hurt myself again... maybe I should just give up on everything but Super Slow. Dammit!

Monday, October 5, 2009

Workout - sequential goals

I read some other fellow's workout blog. One useful and intuitive recommendation he made was to tackle your fitness goals one at a time. He wrote of the very common case where a trainee decides to do 100 pushups and run 10 miles and do 20 pullups and shoulder press 300 pounds and so forth all at once, and then burns out.

I have a number of goals in mind, none particularly unusual. I'm going to try to tackle them in sequence. I'll attempt to continue my normal workouts on Tuesday and Thursday. My present goal is to bring my dumbbell shoulder press to 5 sets of 5, 5 minutes apart, with 75 pounds. Right now I can manage with 52.5. That's a huge goal.

My other goals, in no particular order, are 100 pushups in a row, pullups, one legged squats (which I need to work on my left ankle first to accomplish, because doing them now hurts my left knee), and doing interval training with jump-ropes or maybe running in place.

Sunday, September 27, 2009

Workout status

These past three weeks I've finally started working out again. With rest and 6 weeks of Physical Therapy, my recovery from the herniated disk has been amazing. I lost a ton of strength in my left leg from the herniated disk. The nerves controlling that leg were pinched, so it was basically not exercised much at all for over a month.

For most leg exercises and some arm exercises, I'm doing things one side at a time in order to make sure my left side works hard. My left side is still far weaker than the right, but it's closer to normal.

I've also decided to try something different. I'm following something I read about in Pavel Tatsoaline's website/book. For shoulder press, I'm trying 5 sets of 5 5 minutes between sets and raising the resistance when I can complete all 25 repetitions. I've never worked with such a long break between sets before. We'll see what happens.

When I herniated my disk I swore Super Slow would be the only exercise I ever do. But even though it's brutally hard and certainly stimulates some strength, there have been several times I gained far more strength more rapidly doing something quite different. I just don't know. If I get hurt again, Super Slow it is.

Friday, August 14, 2009

Getting Scala and Lift 1.1 working without Maven

I want to tinker with Scala and Lift without Maven. It was a bit of a headache to get started, so I'm going to detail what I did, and maybe the information will help someone else.

First, my employer uses a very different application folder layout than the Maven default - and I find it far more intuitive to use. Here are the folders in my project directory:
docs/ (documentation)
src/ (source code root folder)
src/bootstrap/liftweb/ (Boot.scala Lift starting point)
src/com/mycompany/scala/liftweb/myliftapp/ (root of Scala code for my Lift app)
src/com/mycompany/scala/liftweb/myliftapp/snippets (location of Scala code for my Lift "snippets")
src/test/com/mycompany/scala/liftweb/myliftapp/ (location of test Scala code for my Lift app)
webapps/myliftapp/ (root of the web application)
webapps/myliftapp/templates-hidden/ (hidden templates for Lift)
webapps/myliftapp/WEB-INF/classes (compiled Java and Scala classes folder)
webapps/myliftapp/WEB-INF/lib (library location)

Then, to package my .war file I just zip the contents of the project root /webapps/myliftapp/ directory. To me this folder layout seems more intuitive than the Maven default. As a bonus, on my local workstation I set up Apache Tomcat Java web server to use project root /webapps/myliftapp/ is a Context Base, so I restart Tomcat (or reload that application) to get relatively quick development feedback while building the application.

To make it work, I needed a JDK 1.5+, Scala 2.7.5, and downloading the following .jar files and putting them into the lib directory:
commons-collections-3.2.1.jar (Apache Commons Collections)
commons-fileupload-1.2.1.jar (Apache Commons File Upload)
log4j-1.2.15.jar (Log4j)
scala-library.jar (Included in Scala 2.7.5)
And the following can be found under http://scala-tools.org/repo-releases/net/liftweb/
lift-actor-1.1.jar
lift-util-1.1.jar
lift-webkit-1.1.jar

I got up and running in under two hours.

Thursday, August 13, 2009

Scala, Lift, and (yuck!) Maven

I've developed an intense interest in Scala (http://www.scala-lang.org) and Lift (http://liftweb.net/), but the Lift main website only has instructions to set up Lift with Maven (http://maven.apache.org/). As of today Maven is broken on Debian Squeeze/Sid (package dependency on libmaven-scm-java is broken).

Jim McBeath is my hero, he compiled instructions to set up Lift without Maven:
http://jim-mcbeath.blogspot.com/2009/05/lift-without-maven.html


This fellow (which Jim links to) has a list of reasons and a good discussion about disliking Maven.
http://ghostganz.com/blog/articles/2008/10/26/the-things-that-are-wrong-with-maven

My reasons are simple:
1. I am trying to understand Scala and Lift. I don't need to add Maven to the list.
2. I want to understand the architecture of a complete, packaged Lift application .war archive. Maven hides a lot of those details from me and has its own non-trivial learning curve, and that is tremendously annoying.

Friday, July 24, 2009

Windows SSL for PostgreSQL

I had to do this for work, so I see no reason not to share it with the world at large.
Setting up SSL for PostgreSQL on Windows servers:

In order for this to work, you need the following installed on the machine with PostgreSQL:
1. PostgreSQL 8.3 (it was not tested with earlier versions, and as of today I couldn't get it to work on PostgreSQL 8.4)
2. Cygwin, with the following extra features checked at install time: openssl, Gnu Make (possibly labeled ‘make’ in the Cygwin installer), and a Cygwin text editor. "joe" and "nano" are easy for Unix/Cygwin newbies, though "vim" and "emacs" are available for veterans.


Certificate Creation (on the PostgreSQL server):
(Every command that should be executed at a command prompt or Cygwin prompt will be
written with # in front)
1. Open a Cygwin command prompt (henceforth called ‘Cygwin shell’) and make a directory for creating the certificates, and move in to that directory
#mkdir ssl
#cd ssl
2. Copy the files ‘Makefile’ and ‘openssl.cnf’ from this page: http://sial.org/howto/openssl/ca/
Then edit the openssl.conf with
#nano openssl.cnf
OR
#joe openssl.cnf
OR
whatever other editor you want
NOTE: You can modify the file in any text editor you want PROVIDED it saves the results with Unix line endings ONLY. You can’t use, for example, Notepad or Wordpad because it will insert the “Carriage Return” invisible character at the end of each line, and then many Cygwin tools will crash trying to read the file.
4. In the text editor you launched, scroll down the file to find the section with the heading
“[ root_ca_distinguished_name ]”
And set the values in it to whatever you think is appropriate. You don’t need to modify anything else in the file, though you may wish to change default_bits to 2048. When you’re finished, save the file and exit.
5. In the Cygwin shell in the ssl folder we will now create our public and private certificate. Run:
make init
6. The command above should spit out some quick information about what it’s doing. When that’s finished, our public certificate is in PEM format in ca-cert.pem, and our private key to the certificate will be in the folder named ‘private’ with the name ca-key.pem. We want to verify the output. In the Cygwin shell run
#openssl x509 -text -in ca-cert.pem
The bottom of the output should be a bunch of funky characters, but near the top it should have a section listing all of the data you entered in the [ root_ca_distinguished_name ] section of the openssl.cnf file.
If there is a problem and the wrong data is included, exit Cygwin, open Windows Explorer to the ssl directory you created in step 1, delete the directory, and then start over at Step 1.
7. Now we must transmit the public certificate from PEM to DER format (No, I have no clue what DER means either, but that’s the format that PostgreSQL wants). Run the following command in the Cygwin shell:
#openssl x509 -outform der -in ca-cert.pem -out root.crt
Now there is a file root.crt with the root certificate we created. You can do
#ls root.crt
To verify that the file was created.
8. Open a separate Windows Command Prompt (cmd.exe) and run the command
#ping –a localhost
The result of the ping should include the name of the server you are on. For example, on this workstation the result is oscar.network3.somecompany.com
Note that value.
NOTE: If the server you are using always has the same IP address, you may instead use the IP address. Note, however, that if you change the server IP address in the future without creating a new certificate, connections will stop working!
9. Now we are going to generate our PostgreSQL server SSL certificate. In the Cygwin shell, do:
#openssl req -newkey rsa:2048 -days 1000 -text -out server.req
You will be asked a series of questions about settings. Only three are important. For the keystore PEM pass phrase, use “changeit”. For the Common Name value, enter the host name result you got from the ping –a localhost command above. For the challenge password, just hit Enter to leave it blank.
Note: I’m not certain that the ‘-days 1000’ parameter above is necessary…
10. After the step above, the public and private key are created. However, we do not want PostgreSQL to prompt for the password to them each time it is started. So run the following two commands in the Cygwin shell:
#openssl rsa -in privkey.pem -out server.key
(You will be prompted to enter the “changeit” password.)
#rm privkey.pem
11. Now we want to digitally sign our server certificate using the root certificate we created earlier for 1000 days (or substitute whatever number you want). In Cygwin shell do:
#openssl req -x509 -in server.req -text -days 1000 -key private/ca-key.pem -out server.crt
12. The files are created, now the permissions must be set. To do this easily, we will create a special subdirectory and put the files there, and then change permissions and owners in that directory.
Note: The last line below assumes the PostgreSQL database is run under user account ‘postgres’. If it runs under a different account, substitute the name of that account instead.
#mkdir postgres_certs
#cp root.crt postgres_certs
#cp server.key postgres_certs
#cp server.crt postgres_certs
#cd postgres_certs
#chmod 600 *
#chown postgres *
13. Open Windows Explorer to C:\cygwin\home\(whatever user you are)\ssl\postgres_certs and copy the 3 files there to the PostgreSQL data directory, on my machine it's
F:\Program Files\PostgreSQL\8.3\data .


PostgreSQL configuration
14. In order for all of this to work, you must have done the steps to create a certificate on the server and put the certificate in the proper location.
15. On the server with PostgreSQL, a System environmental variable with the location of the openssl.cnf file must be created. This must not point to the openssl.cnf file used in Certificate Creation. The normal location of the Cygwin openssl.cnf value we want to use is
C:\cygwin\usr\ssl\openssl.cnf, so in the “System” control panel
“Advanced -> Environmental Variables” setting, create a new System Environmental Variable OPENSSL_CONF with the value C:\cygwin\usr\ssl\openssl.cnf
16. In the PostgreSQL configuration file postgresql.conf change the ssl settings to “ssl=on” and “ssl_ciphers= ALL “
17. In the PostgreSQL configuration file pg_hba.conf change all of the entries from “host” to “hostssl”
18. Re-start the PostgreSQL service. If it does not start, check the Windows Event Viewer for errors.
19. Open pgAdmin3 and create an SSL connection to the server. Try to connect, and verify it works.
20. In any other machine configured to connect to the server, in pgAdmin3 create an SSL connection and verify it works.
21. If you try the PostgreSQL command-line tool “psql” for a connection to the database, it should connect automatically and give a message that an SSL connection was established.

NOTE 1: All this gives you SSL with self-signed certificates. To connect with, for example, JDBC and PostgreSQL (which is what we use), you would need to have a fairly recent JDBC driver and make your connection URL;
jdbc:postgresql://hostname:5432/databasename?ssl=true&sslfactory=org.postgresql.ssl.SSLNonValidatingFactory
(If you're writing in XML files, the '&' must be written as '&')

NOTE 2: If you want to use certificates signed by a recognized Certificate Authority, you'll
do steps 9 and 10 above, submit the resulting server.req to a Certificate Authority for them to make the server.crt, and then use your server.key, their server.crt, and their root.crt and continue from step 12. At least, I think that's what you'll do. I haven't done it.

Thursday, July 9, 2009

VPN disconnects on Debian Linux "Lenny"

I use VPN to work from home. My office workstation runs Windows Vista Professional (alas!) but I prefer to work in Linux.

I have Debian "Lenny" running at home, and I did apt-get install rdesktop pptpclient (as root) to get the programs I need.

I followed the directions at http://pptpclient.sourceforge.net/howto-debian.phtml#configure_by_hand
I called the connection "work".
I also followed the directions at http://pptpclient.sourceforge.net/routing.phtml#client-to-lan
and added a file called "work" in the /etc/ppp/ip-up.d/ directory, with the contents of the file (copied from the client-to-lan page copied and modified):
#!/bin/sh
if [ "${PPP_IPPARAM}" = "work" ]; then
/sbin/route add -net 192.168.10.0/24 dev ${IFNAME}

/sbin/iptables --insert OUTPUT 1 \
--source 0.0.0.0/0.0.0.0 \
--destination 192.168.10.0/24 \
--jump ACCEPT --out-interface ${IFNAME}

/sbin/iptables --insert INPUT 1 \
--source 192.168.10.0/24 \
--destination 0.0.0.0/0.0.0.0 \
--jump ACCEPT --in-interface ${IFNAME}

/sbin/iptables --insert FORWARD 1 \
--source 0.0.0.0/0.0.0.0 \
--destination 192.168.10.0/24 \
--jump ACCEPT --out-interface ${IFNAME}

/sbin/iptables --insert FORWARD 1 \
--source 192.168.10.0/24 \
--destination 0.0.0.0/0.0.0.0 --jump ACCEPT

/sbin/iptables --table nat --append POSTROUTING \
--out-interface ${IFNAME} --jump MASQUERADE

/sbin/iptables --append FORWARD --protocol tcp --tcp-flags SYN,RST SYN \
--jump TCPMSS --clamp-mss-to-pmtu
fi

To run it, I open a terminal as root and do:
pon work
Wait a few seconds, do ifconfig and make sure "ppp0" is listed as a connection, then
/etc/ppp/ip-up.d/work to route the network traffic appropriately.
Then in my menu Applications -> Internet -> Remotedesktop Client I opened a connection to my machine.

I ran into two problems. First, the /etc/ppp/ip-up.d/work file didn't seem to run, so I took the if and fi out. That fixed that, and I could ping and connect to machines at work.
Second, my connection would drop a few times an hour. I read around the pptp client site until I saw a suggestion to drop the MTU (which I learned means "maximum transmission unit", or maximum packet size) to 1400. So I inserted a new second line to the file above,
/sbin/ifconfig ppp0 mtu 1400

After that, everything worked fine. Next, I'm going to work on making DNS operate across the VPN. For right now, I cheat and log in to servers at work with fixed IP addresses, and then use pings from those machines to locate any DHCP machine I can't find.

Monday, June 29, 2009

Herniated disk

I've done 20 decent workouts since the blog started. The last eight or so were at a local gym. However, the squats started to hurt like hell and my left hamstring became ludicrously tight. Turns out I herniated a disk in my lower back.

The pain in my back shifted to my left leg in the days after the last workout. I thought it was a pulled muscle in the left hamstring, and I saw a doctor who just told me to rest and apply warmth. It became excruciatingly bad on Monday June 22, so I saw the doctor again. That time she took me seriously: my resting pulse went up dramatically, my blood pressure was up dramatically, my respiration was up dramatically, and I was visibly in pain. They ordered an MRI which I got on Thursday, anti-inflammatory cortisone steroids, and on Tuesday they ordered Vicoden (a potent but addictive prescription pain killer) which helped a lot. But as the pain subsided, I realized I had partial numbness in my left lower leg and foot.

I feel much better, but I got the results of the MRI on Friday: herniated disk. I see an Orthopedic Specialist (bone doctor) tomorrow. I can sit with zero or tiny discomfort if I use good posture, I can sleep fine, and I haven't used the Vicoden since Friday morning (and want to throw it out, but I'll keep it just in case I do something stupid). Walking is even okay. But carrying even the baby, who is less than 30 pounds, starts to make my leg hurt.

I'm now officially old, and must make abdominal and especially back-strengthening exercises the core of my workout. I'll hopefully get an official Physical Therapy referral from the Orthopedic Doctor. Until then, a Physical Therapist has prescribed a half hour regimen of back, stomach, and to a lesser extent hamstring and hip exercises for me at least twice a day. Most of the routine is mildly strenuous and boring, but there are bits that are damned demanding.

Hopefully I won't require surgery.

IF I can return to regular strength training, I have no choice but to start with easy weights and just take it light for months, possibly forever.

I'm only in my early 30s. SO WHEN DESIGNING A FITNESS PROGRAM, MAKE PROTECTION OF YOUR BACK A TOP PRIORITY! I can't believe I injured myself in my eagerness to get strong. I may come out of this weaker, overall, than if I had stayed a couch potato!

Sunday, March 8, 2009

Truecrypt on Debian

I have an encrypted file on Windows XP. The file is formatted ntfs and resides on a disk partition formatted with ntfs. I installed Debian Lenny (version 5.0 of Debian) on a separate hard drive, with the default Desktop GUI options.

I'm assuming other people want to use Truecrypt on Debian. It's not part of the normal Debian repositories because of the software license. Here's what I had to do to my default install of Debian Lenny:
The following apt-get commands are run as the root (superuser):
apt-get install dmsetup
apt-get install libwxgtk2.8-dev
apt-get install libwxbase2.8-dev
apt-get install libfuse-dev
apt-get install libopencryptoki-dev
apt-get install g++
apt-get install make gcc gcc-multilib manpages-dev gdb
apt-get install wx2.8-headers
apt-get install libopencryptoki0
apt-get install fuse-utils
apt-get install libfuse2 ntfs-3g
apt-get install libwxgtk2.8-0
(OR, you can run it all as one line:
apt-get install dmsetup libwxgtk2.8-dev libwxbase2.8-dev libfuse-dev libopencryptoki-dev libopencryptoki-dev g++ make gcc gcc-multilib manpages-dev gdb wx2.8-headers libopencryptoki0 fuse-utils libfuse2 ntfs-3g libwxgtk2.8-0
OR, you can install all of the programs through the synaptic software package management GUI. I'm no command line expert, but I find it simpler to just type the commands above when I know what I want.
)

I am 95% certain one or more of the items above is unnecessary, but it won't hurt to install all of them. I did not feel like going back and uninstalling different ones and trying to compile the application again. I know that if you have all of the above, compiling Truecrypt works.

The following you can (should) do as your normal user. For the sake of instructions, I'm assuming your account name is 'plankton' and your home directory is '/home/plankton'. Substitute your actual home directory and account name for 'plankton'.
1. Download the Linux source code to Truecrypt from the official website to /home/plankton, and open a shell at that directory. Run
gunzip truecrypt-6.1a-source.tar.gz
tar -xvvf truecrypt-6.1a-source.tar
You can combine both steps to one line, but I don't remember how and don't care to look it up at the moment.
When you are finished, my instructions assume everything is in a directory
/home/plankton/truecrypt-6.1a-source
2. Go to ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-11/v2-20 (you can paste that address into your web browser) and download all of the files with a '.h' extension at that location. Put them into a directory named 'pkcs' and paste the 'pkcs' directory into /home/plankton/truecrypt-6.1a-source/ directory
3. In your shell, cd to the /home/plankton/truecrypt-6.1a-source directory and type:
export PKCS11_INC=/home/plankton/Desktop/truecrypt-6.1a-source/pkcs/
4. Type 'make' and hit enter. Truecrypt will be compiled for you.

When you are finished, the directory
/home/plankton/truecrypt-6.1a-source/Main will contain an executable file named 'truecrypt'. Copy the truecrypt executable to /home/plankton/truecrypt

To run truecrypt as a normal user:
I'm still having problems getting it to run as a GUI.
As root, I used the 'visudo' command to add the following line to the sudoers file
plankton ALL = /home/plankton/truecrypt
This is the command line I use to mount my Truecrypt file from my third partition on my second hard drive:
sudo /home/plankton/truecrypt --filesystem=ntfs-3g --mount /media/sdb3/EncryptedDrive_OnD.tc --fs-options=umask=000,uid=1000,guid=1000

(The uid and guid of the plankton account are both 1000.)
Enter passwords when prompted.

Good luck!

Sunday, March 1, 2009

Hibernate (Java) explained in English

I'm going to explain Hibernate in as easy to understand terms as I can.
Hibernate is a tremendously popular open source Java Object-Relational-Mapping (ORM). An ORM is a library or layer of code to handle the inherent differences between an Object-Oriented Programming Language (such as Java) and a relational database (such as Postgres, MySQL, Oracle, or Microsoft SQL Server).

An ORM helps a software developer solve a few problems dealing with an Object Oriented Programming Language program that uses a database to store information. The available open source and proprietary ORMs have a number of different features, but all of them offer the first point below. Hibernate offers all of the following:

1. In relational databases, the relationships between objects are indicated by foreign keys. For example, assume there is a table with the name "address", and the primary key (the unique identifier of each row) is "address_id". If a table named "customer" is linked to address, with one address per customer, then the customer table has a column "address_id" that refers to the "address_id" on the "address" table.

In an Object Oriented language, the object relationships are indicated by object links relationships. The Java class Customer probably has a function (also known as method) getAddress which returns the Address object.

An ORM helps handle the conceptual mismatch between the database foreign key relationships and the programming language object links.

2. Hibernate helps handle much of the heavy lifting of your database work. If you have a list of customer order objects in your programming language, it can automatically generate the primary keys and save them in the database with the appropriate data and foreign keys in place. Likewise it can load objects for you.

It can also navigate the programming language object hierarchy and transparently load database objects for you. If your program has order.getCustomer().getPaymentMethods(), that can refer to three tables in the database, "order", "customer", and "payment_method", and your ORM can load the data into the objects for you.

3. Hibernate can do lazy loading to reduce the amount of database traffic. For instance, let's say you have tables "customer" and "order" and "order" has a foreign key reference to customer. In your Java code, this might be represented as a function returning a Set or List customer.getOrders(). Hibernate can navigate the object graph and load this for you. But it won't actually do it until you call getOrders() in your code. This saves a lot of unnecessary database queries every time a customer object is accessed. On the other hand, you can always specify eager fetch of relationships. If 85% of your application use of the customer table involves a reference to their orders, then you may specify that the orders are retrieved automatically.

4. ORMS can do caching. If a set of objects (database items) are frequently queried from the database, some or all of them can be stored in a Java object cache and provided to code from the cache. This also reduces database round trips.

5. Hibernate provides support for natural primary keys or surrogate keys in its database mappings, custom SQL queries for inserts, updates, and deletes, and an Hibernate Query Language (HQL) and Criteria API to generate SQL queries programmatically. It also works just fine with stored procedures and database views.

6. Any database query passing through Hibernate that uses the native Hibernate class loading, the Criteria API, or HQL, or the optional (but strongly recommended) Hibernate utilities for SQL queries has safeguards against SQL Injection attacks. A user can use raw SQL queries without Hibernate tools and permit SQL Injection that way. The Hibernate SQL utilities also use named parameters. So you can do select * from student where first_name = :name. This is better than the Java standard of using question marks, because if you change the order of the parameter items in the query you have to revise the order of the corresponding input values. If you change the order of your named parameters, you don't have to change the order of your input values.

7. Hibernate easily supports database connection pooling, which helps performance considerably.

8.  Hibernate allows us to use a relational database in object-oriented ways.   For instance, say the customer table has an address with all typical address information, and the supplier table has an address with the same information.  In our Java code we use one Java class 'Address' for both uses, and we can map that class to the corresponding columns in the customer and supplier tables.   We can also use polymorphism in our code.   Say we have Guns, Cannons, and Rocket Launchers in our code as subclasses of Weapon, and Guns, Cannons, and Rocket Launcher each have their own database table.   We can save a Weapon, and depending upon the instance the appropriate database table is modified or populated.

9.  Hibernate has dirty-checking.  Say we load an object to the database.  If we don't change it, nothing happens.  If we flush our Hibernate session and it has changed, the changes are automatically written to the database for us.

10. Naturally Hibernate is free to use, because it's open source. It's also rock solid, widely supported, and very well documented. I have the Hibernate In Action book written by two of the lead Hibernate developers (I believe one is the Hibernate founder, I don't remember at the moment), and it's very well written and straightforward to understand.   That's especially impressive considering the source material.

Future post: my criticisms of Hibernate.

Tuesday, February 10, 2009

Workouts

There's a document available here: http://www.asep.org/files/OttoV4.pdf   which rebuts a lot of the research conducted to justify what most people would call traditional strength training.   The document, which is well organized and researched, presents a strong argument that the most effective strength training is 1 set per exercise, pushed to the point where it is impossible to continue the motion safely, conducted 2 to 3 times per week.   There is no evidence to support periodization, multiple sets, split routines, long or short breaks between sets, or specific repetition speeds.

I'm married with three young children, a great job but a long commute, and housework up to my ears.   Considering the economy, I also consider it an obligation to devote some spare time to honing my work skills.   There's more to life than work, but remaining employable in an increasingly competitive economy requires more than just making a good effort at your job.  

So I don't have time for lots of workouts.   I'm taking the PDF at face value because even if 5 hours of devoted exercise per week is better, I don't have the time or energy.   Today's workout, Feb 10 2009, is my first in over a month.   The resistances I used were relatively easy, so I will hopefully avoid stiffness and soreness tomorrow.   I plan to workout twice per week, with one set per exercise.   Each exercise will list (number of repetitions)x(resistance per dumbbell, if any)

Shoulder press 8x30, Curl 8x30, Tricep press up 8x25, Calf Raises 8x40, Shrugs 8x40, Side raises 8x15, Squats 8x30, Assisted pullups 5, Pushups 8, Dumbbell row 8x30, wrist standing holding weight down twist in with weight in 8x15, wrist standing holding weight down twist out with weight out 8x15, wrist seated forearms on thighs lift plate up 8x5, wrist standing forearms down twist plate up to the back 8x5.   Not counting the wrists, that's 10 exercises.

Thursday, January 15, 2009

Apache Commons Net FTP isConnected

I had some problems at work writing an in-house Java FTP program. (Why Java? Because the other developers know Java. The company takes the expedient path of using Java for everything because than any developer can read any other developer's work.)

The Commons FTP 'isConnected()' API call would return "true" sometimes when the connection was dead.

After some hunting in the project mailing list archives, I discovered 'isConnected()' returns true as long as 'disconnect()' has not been called since the last time 'connect()' has been called. 'isConnected()' does not actually verify that the network socket is still open.

So I went in my code and replaced isConnected() with a call to noop(), which just sends a simple message to the server to verify the socket is still open. This fixed the problem.

Hopefully someone else won't have to deal with the same problem.