Wednesday, July 27, 2011

Working Out - A Year In Review

As the two or so people who will probably read this post know over the last year I have gotten more into strength training and fitness in general. I have always tried to workout and stay semi-healthy but there are only a few times in my life where I think I have actually been in pretty good shape. Those times, exclusing this year, were my sophomore year of college when I started to workout three days a week with a guy who used to play college football and again in 2008 when I was getting ready for a marathon before I got injured. I would say both of those stints of being shape lasted 6-8 months tops. Other than that most of my life I have been over weight and not in great shape. To give you an idea I think the first time I ran more than a mile was when I was 25 or 26 when I started to train for my first marathon. I didn't really play sports in high school (I was on the football team for a few months and did baseball for two years but mostly played bench) and not surprisingly I mostly watched a lot of TV and worked on my computers in my childhood and teenager years. One of my goals when I moved down to Texas was that I wanted to be in much better shape in five years when I move back to Washington. This post is about my first year (August 2010 till August 2011) of working out down here in Texas: what I learned, observed and my newbie thoughts on the subject.

Around the start of August of 2010 a good friend contacted me and asked me if I wanted to start doing a lifting program with him. I have never done any structured lifting program but it was appealing to me and my friend was in good shape and was more knowledgeable about working out/fitness. So, I started in on the Practical Programming Novice Program which was interesting as I was never taught any correct form for squatting, bench press (for the rest of the article called "bench"), standing shoulder press ("press") and I had never done deadlift. To say that I had a lot to learn was an understatement. In my typical fashion I got a few books and watched a few videos on YouTube. Looking back at my training logs I started at the following weights:
- Squat - 130
- Deadlift - 115
- Press - 65
- Bench - 75

Not exactly heavy weights for a guy, especially one weighing 180+ pounds :). My main goal at this point was to gain strength and lose a little fat. The whole program focused on a linear progression of weights, every week you would end up adding a total of 15 pounds to your squat, 10 pounds to your deadlift, and 7.5 pounds to bench and press. For the first month it was easy and I tried to focus on form. This is where I started to learn a few things about me:

  1. My inflexibility especially around my hips made it hard for me to have correct squat form

  2. Static stretching (what most people think of when you say stretching) isn't that great for me when I lift

  3. I couldn't bench or do pull-ups to save my life

  4. I was surprisingly strong doing press

  5. I liked this structure program setup

  6. It was confirmed that I really had no clue about working out


I kept going on this progression till 10/6/2010 which is when I received my first injury. It was from bad form on my squat and well my back and I didn't end up on speaking terms. At this point my weights were:
- Squat - 270 (3 sets of 5)
- Deadlift - 275 (1 set of 5)
- Press - 140 (3 sets of 5)
- Bench - 170 (3 sets of 5)

Not too shabby for ~2 months of work. At this point I weighed around 195 pounds and was stronger but still had gained a bit more fat. One interesting thing around this point is I started to get hungry and I mean hungry. The only other time I was this hungry was when I was training for the marathon and running around 35-45 miles a week. Since I wasn't concerned about the actual weight on the scale I ate. Because guess what? If you want to build lots of muscle you have to fuel your body to grow that muscle :). At this point it was still weird but I would eat around a pound of chicken for dinner, etc.. but I was still learning how and what to eat at this point as well. Eating a pound of chicken for dinner is a bit too much, at least for someone at my level. After this a month passed and in the first half of November I went over to visit my friend who got me started on this program for us to do our maxes as we were about to switch programs. On 11/21/2010 I did my first max on all four lifts in umm forever, I did the following:
- Squat - 315
- Deadlift - 365
- Press - 165
- Bench - 205

I was pretty happy with all of this, except my bench didn't jive with the rest of the lifts. It might be because it was the last lift or it could just be I am not that great at bench. Anyways, on 11/24/2010 I started to do a program called 5/3/1 which I really enjoy. 5/3/1 program changes the progression from a day to day basis to monthly changes which worked well for me and I liked that on the very last set of each lift you went all out. At this point it became very apparent that lifting also was a mental game. Here is an example from my workout logs.

11/24/2010 - Press @ 125 - 7 Reps
12/8/2010 - Press @ 140 - 7 Reps

Umm.... At this point my muscles aren't growing that quickly, so, for me to do the same number of reps on press with a 15 pound difference in a two week time span raised the alarm that it was probably mental. If you look through all of my presses it can be shown that once I started 5/3/1 the max number of reps I had was 8. Every month I would go through about a 20 pound range easily so there is no reason I should have been limited to 8 reps so I am quite sure it was a mental factor. Don't get me wrong 8 reps are fine but it illustrates one point for me that if you aren't pushing yourself you can become limited.

Some of my friends have been doing crossfit for quite some time and I have always wanted to try it out but for one reason or another I had found an excuse not to do it. Finally in Feburary of 2011 I started crossfit elements (the newbie class) at CrossFit Deep Ellum and there was no turning back. There are a few things that I wanted to get out of crossfit:
- Learn a few different ways of working out
- Get better at pull-ups

Doing weight lifting solidly for six months without much else really made crossfit tough for me as I was slower than crap and had no endurance. I tried to go three times a week and was doing it fairly solidly and making some progress but then in May I had my first major injury. In the middle of May I was doing a workout of deadlifts 3 reps on the minute for 10 minutes. For about a month before my injury of my right leg and gluteus had been acting weird but this was the tipping point (note to self: listen to your body when it hurts). On my 7th set I did something that caused a lot of pain, it turns out I herinated one of my lumbar discs. Later that day I ended up going to the ER and getting some drugs as the pain was the worst I have ever experienced in my life. That put me out of working out or doing anything except walking my dogs for the next six weeks. Around the end of June I started to do light workouts at home and in July finally went back to crossfit and did workouts without any weight. It is now August and I am adding weights back in but still not at a weight that are super tough for me. I still can't run for crap or jump rope as I can't lift my right leg up by itself (the first two months after my back injury I couldn't even flex my calf).

After working out for a solid year my weight has bounced all over the place. Here are some stats:
- 7/1/2010 - 180 pounds
- 1/1/2011 - 200 pounds
- 8/1/2011 - 185 pounds

Now in August 2011 I will have to say the amount of fat I have on me is at a lower point then I am used to and I am sure I will lose some more fat in the coming months.

Some overall things I have noticed over this year are:

  • Not being an active kid really does hinder you as you get older. I have no hard proof on this but I feel like it is harder for me to push myself and be explosive compared to people who have been doing sports all their life (or a large chunk of their childhood).

  • If you have no one that can help you spot bad form it can really end up bad for you. YouTube is helpful for form but it is no substitute for coaches and/or people who know more than you and telling you when you are being dumb.

  • I have a decent capacity to build strength fairly quickly. Since I had never squatted more than 200 pounds before August 2010 and I ended up having a 3 rep max of 315 in May of 2011 I think that is fairly good growth.

  • I have a competitive streak in me that I did not know was there.

  • I like workouts that are circuits better than workouts that are just go run for 45 minutes.

  • Building strength is not overly complex and having a structured program where you are progressing weekly, monthly or yearly is the way to go (imho).

  • Crossfit works for me, it doesn't work for everyone. I will say they don't have much strength building in their programs. Don't get me wrong you will get stronger if you do it but if you want to be really strong (like deadlifting 600 pounds, pressing 250, etc...) doing just crossfit won't get you there.

  • Your diet can hugely affect workouts and your energy levels. For example, if I eat cereal or granola before working out my energy level is crap and I feel like a slug.


Overall, this past year has allowed me to learn quite a bit about fitness. That being said I still know very little and look forward to the coming years and learning more and getting in better shape.

Thursday, December 03, 2009

Simple Ruby Script for Source Code Reviews

Early today I wrote a simple script to help me get up and running quickly for source code reviews. You can check it out at http://github.com/medelibero/CodeReviewTools. It is nothing too special but it will save me a little bit of time. The only dependency for the script is the spreadsheet gem which can be found at http://rubyforge.org/projects/spreadsheet/. The nice thing about this is that it doesn't require OLE so you can run this on OSX and Windows and maybe even linux (I didn't try that OS).

Well I hope this is helpful for someone else, which is probably why I am posting it here :).

Tuesday, October 20, 2009

Weird Outlook 2007 Image Cropping

One of my clients recently added a third image to a newsletter they send out. This image like the other two was 120 pixels wide by 600 pixels high. Everything was all fine and dandy until one of them started to have issues with it displaying correctly in Outlook 2007. After a bit they called me into look at it, it was a fun little issue and during this time I found a rendering bug that is pretty annoying in Outlook 2007. This post hopes to explain the bug so other people can realize that it exists and work around it.

Background:
For Outlook 2007 Microsoft decided to switch from using Internet Explorer to render the display of the email to Word which was being used to compose the emails. I understand why they did this: removing dependencies, less security risk, blah blah blah. So, I don't think they are stupid for doing it but this bug is kind of an annoying corner case. Anyways, throughout this article remember that Word is being used to render the damn email.

So a setup for the email:
1) It was an HTML email
2) Like most HTML emails I was using tables for the layout because email clients are pretty far behind how browsers work
3) There was one column with three images that where all 120 x 600

Below is a rough layout of the email template -


As you can it should not be too hard, right? This is how Outlook 2007 renders it:

Wait why is there that huge ass gap?! The problem lies in the fact that Outlook messes up rendering when you have a table and a total of 1800+ pixels in image height. Remember how I said Outlook was using Word for rendering? How does Word work? It uses pages right? Which is actually the problem if you took an email setup like the one described above and put your cursor a little above the third image you would be able to drag around the page divider, sigh. How it works is that if all of the images can't fit into one page it will take the next image and move it to the next "page." Which screws up the layout of the email, nice....

During this whole process I thought of a few different hacks like what would happen if I put in a really large image like 1,900 pixels high could I force Outlook to expand the page? Nope! Here is a screen cap of an email with a large image in Mac Mail and in Outlook 2007.


Outlook 2007 is on the left and Mac Mail is on the right. I could have replaced Mac Mail with Outlook 2003, Mobile Me's web renderer, gmail, etc... If you look at the large image you will notice that Outlook 2007 has eaten the first 150 pixels of the image. You can even replicate this issue by creating a two column table inserting a large image (1900 pixels high) into one of the columns.

Well hopefully this explanation will prevent some head banging for other people. Now I need to get another cup of coffee.

Labels: ,

Wednesday, September 09, 2009

Lessons Learned From Going on My Own

I have been "on my own" as a freelancer for the last 2.5 months and I wanted to record some of the lessons and observations I have had in that time. My situation is a bit different (although I am sure I am not in an absolutely unique situation) than from what I have read in related articles. First off what makes mine a bit different? Two things:
1) I was moonlighting for the past 5 years so I had time to build up some recurring clients
2) I focus on development and application security (instead of one or the other)

So what have I learned?

1) Cash flow is king - very common saying but when you are on it really hits home. If you don't have enough money saved up to take on a longer-term project you can miss out opportunities (yep, I didn't have enough saved, sigh).

2) People don't give a crap how busy you are - People just want their stuff done and they don't care if you have been thriving on 4 hours of sleep and have 50,000 other projects going on you should have scheduled better. This is something I knew already but once again it really hit home when I went on my own. There is a bit of truth in both sides of the coin on this, scheduling your work load is important but clients can also be pretty demanding (if you let them be).

3) Plan for 4 to 5 hours of billable time a day - I heard this but I thought people were full of crap. I planned out my hourly rate for working 8 billable hours. This was stupid! Like head slamming against the desk stupid. I would even say plan your billable rate for 3-4 hours a day and be done with it. I work more than 3-4 hours a day but that cushion for crap days and other shit is just a good idea, imho. So, how long does it normally take me to work 8 true billable hours [note: composing an email, reading RSS feeds, facebooking or researching that one project is usually not billable]? Usually 10-12 hours depending on if I am on-site or off-site.

4) Working from home rocks and sucks all at the same time - I love working from home but sometimes it sucks. The dogs want attention, your significant other wants attention and then there is always that movie you have been meaning to watch :). Anyway, over all I enjoy it but taking a break and working at a coffee shop for a few hours or grabbing some lunch with a bud is a great way to break up the solitude.

5) Remember to take a break - For awhile I was just busting ass and feeling like I was never getting stuff done. I think taking a break to read a book, watch some TV, hang with humans, etc.. Whatever it is, is just a wise idea or else you get burnt out way too quickly. I mean really does that project need to get done right now? I highly doubt it, even if the client says it needs to most of them won't notice an hour difference from my experience.

6) People won't be immediately pounding on your door - It took about three weeks for me to get fully booked. Granted this was with business relationships already started and people knowing I was going on my own. I could only imagine that it would take a lot longer if business relationships had to be formed, etc...

I am sure I have tons more lessons learned but those are the ones I can think of and I need to get back to work :). Going on my own has been great but it isn't easy that is for sure. As I have said to people before I traded a job working from 7Am-4PM and having weekends off to working from 7AMish to 10PM with no time-off. The trade-off though is I get to help a lot more companies and learn a lot more which is what I enjoy.

Well off to refill my coffee cup and start slinging some code!

Labels:

Thursday, August 13, 2009

Creating a Splash Page in WordPress

Earlier this week one of my clients asked me for help on creating a splash page for a blog they where setting up. I of course said sure and figured it would only take like 2 minutes. Sadly, that wasn't the case there where a few issues that we ran into:
1) The way the blog was setup the urls looked like /?cat=16 instead of url-friendly
2) There was no way to specify a default blog page
3) The client didn't want to move the blog to a sub-folder (understandably)

The first solution I had was to set the default page but without modifying WordPress itself some of the links would just return you to the splash page. After a bit of messing around with .htaccess I finally came up with these two lines of code:


RewriteCond %{QUERY_STRING} !.
RewriteRule ^$ /splash.php


Basically what it says is if there is no querystring specified and the url is an empty string go to the splash screen. That is it and it worked!

Labels: ,

Saturday, August 01, 2009

What do you suck at when you develop code?

Everyone has a weak spot or a place they suck when doing any task, hence catch-all phrases like "no ones perfect". Since I am a developer I tend to look at development practices in general to see what could be improved or things that constantly happen to other developers. One thing I find interesting is how people cope with the thing they suck at the most. For instance I tend to rush things. Sure I get the code done quickly but usually it comes at the price of not fully testing the code I have written and bringing bugs into the system. If I remind myself to slow down then less bugs show up, shocking I know :). But what about other developers and the issues they have? I have seen all sorts of things like:
- Not seeing the forest from the trees
- Not taking the time to think of code maintenance down the road
- Not caring about usability

So, how have different people coped with the issues? I feel there are a few different ways you can cope with any short-coming you may have they are:
- Use a tool that helps you gain strength in a given weakness
- Find a buddy that is strong in your weak area
- Avoid the area like the plague
- Ignore that you have a weakness and think you are perfect :)
- Try to improve in that area

Use a tool that helps you gain strength in a given weakness:
This is a pretty good way to solve the problem if a tool actually exists and it works with your workflow. It is pretty rare to find such a tool for your given problem though but since we are a developers you can always just write a tool. For example if you tend to create lower quality code that is sloppy using a tool like FxCop could help increase your overall quality.

Find a buddy that is strong in your weak area:
What we can't just do stuff in a vacuum? Having this as a solution rocks but can also be difficult since you have to find someone that also meshes with your personality and has the time and want to help you. Hopefully their weakness is your strength so both of you can tradeoff in helping each other out. I have seen this work before but it seems fairly rare. Also, besides finding a buddy you can always hire someone to cover your weakness. For instance in my case it would be possible to hire a software tester to find issues on my code to minimize bugs that get sent to clients.

Avoid the area like the plague:
This is one of the simplest way to fix an issue you suck at. But it is also not always possible or it could be very self-limiting. For example if you create very poor UIs then maybe hand that off to the weird design dude that loves his mac and prefers doppios over that tall skinny soy latte.

Ignore that you have a weakness and think you are perfect:
This is like buying a mirror to make you look slim when you weigh 600+ pounds. Sure it makes you feel better but it can be annoying and disastrous. Sadly this seems to happen with a lot of people.

Try to improve in the area you suck at:
I personally believe this is the best solution but it is also the toughest. Trying to fix the issue you might have will take awhile and you have to remember to get back on the horse when you fall off. Some things I have read and done to fix pitfalls is by reading about the topic, consciously remembering the issue and catching yourself when you get into your old ways and having someone there remind you when you mess up.

I am sure there are other ways to fix being sucky at certain things so if you have a few ideas feel free to chime in :).

Labels:

Tuesday, July 14, 2009

Refactoring - Sometimes it gets messy before it gets clean

Recently I tweeted.
About to put my refactoring skillz to the test. The challenge a 27,000+ line "class" for a delphi CGI.


I am still working on this little side project and it has been pretty fun so far. One thing for sure is that just like many cleaning projects it always seems like it gets a bit dirtier as you throw stuff around before the project gets cleaner. Right now if I just checked in my code it would be bad, very bad. The code is brittle at best and the coupling between modules is so high it might reach into space. But hey it is just a first step and what does this first step look like?

It follows the general advice to look for similar functions and put them in their own code files. Note I did not say class. Since I have so much code to wade through I did not want to figure out on my first step all of the places I had to instantiate a new object and call it, plus I would have probably gotten the class wrongly designed in the first place. So, I mainly just referenced the different code files in the main class and made them static methods for the time being. Some of the code files turned into what would be expected like file utilities (deleting temporary files, writing to common locations, etc..), HTML utility methods, etc... I am not a huge fan of utility "classes" but wading through 800 lines of utility code and figuring out a design for common items is tons easier than wading through the gigantic mud-ball that currently exists.

Once I moved a few of these general functions around I started on something that would make a bigger impact and would be a little tougher. You have to understand one thing about Delphi is that it is a RAD language I don't mean it is cool I mean it is a Rapid Application Development language, what does that really mean? It means it turns into a huge event-driven mess that makes grown men cry when a button event, updates a field, which fires an update event, which updates a field which updates some dataset which then fires another event, you get the idea. All of these reports had events tied to them which meant a lot of code to move and a lot of interdependencies that would be "fun" to move, but hey I was up the challenge :). I did what any sane code-junky would do I copied the report objects into a new class and then leaned on the compiler like I had just finished a fifth of vodka on my own. To get the code to compile and be functional I had to pass in a reference to the monster class. This means there was now a recursive dependency between the two which is not prime but like said earlier it is a start and this was one of the messy parts of the code. To give you an idea on the interdependencies I tried to pass in the needed parameters for a method but I gave up after the parameter list grew to 15! Once I got this area to compile I then did some quick functional testing to make sure the program was you know still usable.

At this point I had shuffled around 4,000+ lines of code and things where looking slightly better and there was at least a glimmer of hope. What are my future steps? I plan to continue to look at the methods in the monster class and bucket them out to code files. After that I will start to move them into classes, implementing interfaces and hopefully writing some tests. I will write about my progress at each step of the way. If there are any questions on how I am doing something or advice from other people who have tackled similar monster classes that would be awesome.

Labels: