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.