Saturday, May 28, 2011

Warrior Day 20

Weight: 189
BF: 19.4%
Muscle: 152.33
Fat: 36.67

I had a very good week this week.  My post cheat weekend weight was 195.6.  I was able to get some kind of workout in every day.  I created a meal plan that is about 1200 calories 40/30/30 protein/carbs/fat and stuck to it every day.  With naps, I was able to average 7 hours of sleep per day.

I look better too.  I have sun burn right now, otherwise I would post pictures.  Maybe I'll wait until I get to 185 so it will be a 10lb difference.  The workout I do 10 pull ups, 100 pushups, 100x50lb kettle bell swings is really working well too.  My chest, triceps, biceps, shoulders, and back are all shaping nicely.  On the other days, I'm doing tabata sprints (got up to 10.5 mph) and myotatic crunches.

Today is cheat day.  I'm pumped as always, but I could probably go another week without one if I tried.  I've had this dilema before on slow-carb.  I tried it a couple times and it always fails.  By Tuesday, I'm completely off the train, and I ruin the whole week.  It might be different on Warrior, but I'd rather not risk it.

I'll be looking to eat chocolate, taco bell tacos, funions, chicken fried rice, and alcohol.  I'll try to keep my hydration up, get some fiber throughout the day, and put in some hard workouts.  I might try to max out on pull ups, push ups, kettle bells.

My "warrior meal" is (not eaten in this order):

  • 4 eggs
  • 3 servings of green beans
  • 2 servings of kidney beans
  • 1 serving of almonds
  • 5oz chicken
  • fresh spinach (with the chicken as a salad)
  • 2 slices of ham
  • 1 serving of carrots

I know that 6 pounds in 20 days is no big deal, but this is the first week I've done it correctly.  If I can get a few more weeks like this one, I'll be solid.

Friday, May 20, 2011

JSF sharing across multiple WARs in JBoss/Tomcat

This will be where I keep notes until I have a final solution. Then I'll reformat.

If someone decides that your application should be split up between more than one WAR, but they need to share some data such as User information (even just a logged in token or something), you have to find your own solution as this is not supported by the J2EE spec.  So far I've decided to do some sharing by making one of the WARs (we'll likely have 4 by the end) the one that holds the shared content.  I'll call it 'war1'.  In JBoss/Tomcat, this will give it a context name of '/war1'.  So, in 'war2', we need to look up the /war1 context and grab info out of its session.  I'll give some more detail.

In JBoss/Tomcat, there is a property in the server.xml called crossContext.  Depending on your JBoss/Tomcat version, it may be split into separate config files.  For example, in my JBoss 5.1, the actual config file is C:\jboss-5.1.0.GA\server\default\deploy\jbossweb.sar\context.xml.  You'll need to set this property to true.  The default is true in JBoss 5.1.  I don't know about other versions or standalone Tomcat.  Setting crossContext=true will allow us to lookup contexts from other contexts.

To set something in the shared context, I've done this: (this is in war1)

HttpServletRequest request = (HttpServletRequest)FacesContext.getCurrentInstance().getExternalContext().getRequest();
request.getSession().getServletContext().getContext("/war1").setAttribute("shared", shared);


In war2, we get it out similarly:

HttpServletRequest request = (HttpServletRequest)FacesContext.getCurrentInstance().getExternalContext().getRequest();
ServletContext medicalportal = request.getSession().getServletContext().getContext("/war1");
Object s = medicalportal.getAttribute("shared");


Ideally, I would like to have a context dedicated to sharing: /shared.  Then all wars would go to the same spot for sharing.  This is all in an EAR; so, we have a jar with some JSF code.  We can shove the shared context accessing code there so that we can have code like this:

FacesUtility.setSharedAttribute("name", value);
Object value = FacesUtility.getSharedAttribute("name");


An over-the-top solution but way cool would be to have a JSF variable resolver that would look in the shared context for beans.  ...  Actually, that might not be over the top.  It would make the code much less complex.

Warrior Day 12

Weight: 191.4
BF%: 20.7
Muscle: 151.78
Fat: 39.62

Thursday, May 19, 2011

Warrior Day 11

Weight: 192.2
BF%: 21.3%
Muscle: 151.26
Fat: 40.94

Didn't log for a while because I didn't do well over the weekend.

For some reason my bf% jumped from Monday: 19.8, Tuesday: 20.7, today.  Conversely, my weight is going down from 195.  I think I need to just decide on the exact food I'll eat each day, even if that's different depending on the workout.

I'm working towards my goal of one round of 10 pullups (medium-wide grip), 100 pushups, 100 50lb kettle bell swings (Russian).  I started with 10 rounds of 10.  Monday I did 3x20, 4x10.  Wednesday I did 4x20, 2x10.  I'm planning to gradually reduce the rounds over time.  I'll probably give up on this, but I'm liking it so far.  It really pumps my chest and triceps.  The pushups are by far the hardest part, but i probably couldn't do one round for pullups or kettle bells.

I was planning on posting weekly pictures, but I didn't like how the last half of last week went.  Oh, I decided not to do supplements this week (other than vitamin d and multi).

Didn't do a workout because I was lazy, but we did go for a decent walk before we ate.  I felt a lot more hunger than I have before.

Friday, May 13, 2011

Warrior Day 5

6a
Weight: 194
BF%: 19.90%
Muscle: 155.39
Fat: 38.61

11p
It's nice to see the BF% and its probably accurate, because I was good with water yesterday.  I got pretty hungry a couple times in the afternoon.  I did my pull ups, push ups, kettle bells workout.  I'd like to focus on that workout going forward.  Probably three times a week or more.  I did another lightish meal, but definitely got full.  We got a glass of wine and walked a bit too.

Warrior Day 4

7a
Weight: 195
BF%: 20.30%
Muscle: 155.42
Fat: 39.59

Don't get too excited about the body fat percentage.  When you go on a real cheat day/meal like Red Lobster, its very high in sodium and you end up dehydrated the next day.  This skews the BF% down.  You'll see tomorrow.  Also, I only slept few hours.

9p
Skipped the workout because I was sore.  Did a pretty light meal.  Probably less than 1000 calories, but I felt full.  Did the normal supplements before the meal and before bed.

Wednesday, May 11, 2011

Using jQuery to switch Richfaces tabs

The requirement is to have a 'next' button at the bottom of each tab to forward to the next tab (wizard-like). The tabs are implemented with as vanilla rich:tab.  An additional requirement is to not have any onclick/oncomplete/etc attributes on the commandButton.  I'll post the solution first and then go into the explanation for those who had the same issues I did.

<script type="text/javascript">
jQuery(document).ready(function(){
jQuery('[id=form:next_button]').click(function() {
jQuery('[id=form:tab2_shifted]').click();
});
});
</script>


The first problem is the ids.   If you've used JSF, you know that JSF doesn't just use the id that you set on the tag.  It creates ids like 'form:tab2' instead of the 'tab2' that you set.  Not a huge deal at first.  The other thing you won't guess, is that the tab doesn't use your id either.  It adds a '_shifted' suffix resulting in 'form:tab2_shifted'.  So, if you only need to solve the first part, just do this:

<h:commandButton id="next_button" value="Next" action="next" onclick="document.getElementById('form:tab2_shifted').onclick();"/>


If you want to keep your javascripty stuff out of the tags, you need to be able to 'listen' to javascript events on tags.  The only way I know how to do that is with jQuery.  However, those colons in the ids cause a lot of people problems with jQuery.  Normally you look up a tag in jQuery like this:

$('#tab2_shifted').click();


That won't work in JSF, because the real id is 'form:tab2_shifted'.  So you'd think that this would work:

$('#form:tab2_shifted').click();


But it won't.  After LOTS of trial and error, I determined the correct way to do it:

$('[id=form:tab2_shifted]').click();


I can't remember what that's called, but you need to do it.

Adding the 'listener' (called an event handler in jQuery) was very easy to find.  This will call a popup every time the next button is clicked.

$('[id=form:next_button]').click(function() {
alert('hello');
});


Of course, if you just put this in the a <script> tag, it won't do anything.  For some reason you have to wrap it in $(document).ready.  I didn't get this forever.

$(document).ready(function(){
$('[id=form:next_button]').click(function() {
alert('hello');
});
});



The last part is pretty simple if you've got all this.  You just find the tab and click it.  We can do it with jQuery though to make it a bit prettier than document.getElementById.  See final result above.

Also, because I'm using the built in jQuery that comes with Richfaces, we use the jQuery variable instead of $ so that it doesn't conflict with other javascript libraries likey prototype that use $.

Here are some links that motivated me or helped me to write all this down:

Warrior Day 3

8a
Weight: 192.2
BF%: 20.70%
Muscle: 152.41
Fat: 39.79

Getting a little concerned with the BF%.  The only thing I can guess is that I properly rehydrated yesterday.  I'm coming off 7 meals a day slow-carb, so that could have something to do with it as well.  I'm not going to change anything this week.  At least I'm losing weight.  My overall goal is to get 170; so, if that means losing a couple pounds of muscle, I guess I'll have to live with it.

9p
Did a hard squats, deadlifts, and myotatic crunches.  Took supplements and went to Red Lobster.  Went hard.  Took another batch of supplements and ate a can of pringles, pop tarts, and oreos.

Tuesday, May 10, 2011

Warrior Day 2

8a
Weight: 193.8
BF%: 20.50%
Muscle: 154.07
Fat: 39.73

I don't completely trust the BF% accuracy; when it goes up a bit, I don't get too worried.

Last night I learned that this other guy used PAGG only before the main meal and bed.  I will do that too, along with 2000 mg of cissus quadrangularis (cq).  I need to research this though, as Tim Ferris's recommended daily dose was 2.4 g three times a day before meals on cheat days.

I think I'm going to shoot for a higher fiber intake today.  I also want to research adding some sort of fermented food, but they all sound awful.

4p
I still haven't actually gotten hungry.  Any feeling of hunger was easily satiated by a glass of water.  I didn't get as cold today either, but I also had the heat on to 76F.  I've already noticed a difference in my face.  It seems like my skin is tighter all over.  Not sure what it means, but it looks better.

I couldn't find any blogs or forums talking about using cq on warrior or intermittent fasting.  I guess I'll just take 2.5g for now along with AGG (regular dose - also need to research).  I couldn't find much on taking EGCG while fasting either, so I'm not going to take any supplements except vitamin d during the fast.

I found this guy who's got some crazy progress pictures.  He started with slow-carb and switched to IF via leangains.com: http://www.myfourhourbodydiary.com/  Not sure I'll read it regularly, but he's definitely got it figured out.  I like that he has performance goals and not just body recomposition goals.

7p
Tried the workout again (pronated pull ups), but failed on the push ups on the 8th set.  I guess I should have taken a day off. Those are the right pull ups though.  I'll keep using those.

Took AGG, D, CQ, and multi after workout.  Then ate:

  1. green beans w/ butter
  2. carrots throughout
  3. water
  4. kidney beans
  5. water
  6. ham
  7. water
  8. green beans w/ butter
  9. water
  10. 6 oz chicken w/ spinach
  11. water 
  12. kidney beans
  13. water
  14. 24 almonds
  15. water
  16. eggs
I have to fight the urge to try and be productive and/or start an energy drink.  Half the point of warrior is to allow the sympathetic and parasympathetic systems to work everyday.  Now is the time for the parasympathetic nervous system to be dominant.  I need to just be lazy.

10p
Took PAG, D, and teaspoon of cod liver oil

Monday, May 9, 2011

Warrior Day 1

7a
Weight: 195.2
BF%: 20.10%
Muscle: 155.96
Fat: 39.24


12:30p
Experiencing similar coldness in hands and feet as I used to during the fast/undereating phase.  Took a short cold shower to see if forcing my body to warm itself up would keep my hands and feet warm.  I left my shirt and pants off for the same reason.  The coldness came back in about an hour after the shower.

I still haven't felt hungry at all.  I'm just drinking some water and rockstar (sugar free).  Despite only getting 5 hours sleep.  I'm pretty focused.  Basically I feel completely normal except for being cold.

9p
Never got hungry.  Its a bit weird.  I took a 2 hour nap at 5 which was awesome.  I need to research napping with warrior and sympathetic/parasympathetic nervous systems.

Did the same workout as yesterday even though I was pretty sore: 10 rounds of 1 pull up (supine grip), 10 pushups, 10 kettle bell swings w/ 50 lb dumbell.  I did it in 17.5 minutes.  I'll be trying this workout everyday this week to try to get the time down.  I'll also be trying more difficult pull up grips.

Warrior Meal (in order):

  • green beans w/ a little butter
  • a few carrots
  • ~6oz chicken, fresh spinach, kidney beans
  • ham
  • 12 almonds
  • 600 mg alpha lipoic acid, 2000 iu vitamin d, 2000 mg cissus quadrangularis, multi vitamin
  • 5 whole eggs
  • green beans w/ a little butter
  • l-glutamine
I was wondering about the use of PAGG on warrior and found an incredibly detailed blog of someone who did what I'm trying to do.  They're much more fit, almost bodybuilder; so, they have a really great perspective from all their other experiences.  Really good resource.  They basically just used AGG before the main meal and PAG before bed.


11p
Took PAG, D, and teaspoon of cod liver oil

Warrior Diet

I decided to blog my progress this time instead of just writing in my little Evernote notebook.  My goal is get my weight down to 170 from my current 195 (depends on the day).  As a disclaimer, I've successfully did the Warrior Diet for about 2 months in October/November/December and lost about 20 lbs (215 to 195).  I usually refer to it as Paleo/Warrior, because I also only ate Paleo.  Previously, I primarily did a water fast until the main warrior meal instead of bits of fruits and vegetables.  This was mostly out of convenience, because I don't like many vegetables.

This go 'round, I will be closer to Warrior/Slow-Carb, as I will not be eating fruit, and I will be eating beans.   This is an attempt to maximize my fat loss by limiting high-glycemic index foods.  I may also experiment with the PAGG non-stimulant stack from the Four Hour Body.  I didn't use any supplements on warrior previously.

I haven't decided an exact workout plan yet, but I'll likely do some poor man's version of a crossfit workout everyday or every other day depending on the intensity.  (my previous success with warrior was also while I was going to crossfit ~3 times a week)  It is very unlikely that I will do any extended cardio (running, biking, elliptical) as I think that shit is a waste of time compared to a badass crossfit workout.

I record my weight, body fat %, and calculated muscle and fat.  I use a scale that calculates my bodyfat with bioelectrical impedance.  I'll try to post those numbers every day along with relevant observations, decisions, issues, etc.