Archive for August, 2008

Netbeans: Not as crappy as you might expect.

Over the last 3 days I have been using netbeans for RoR development. Honestly I expected to hate it. I figured I would use it for a few days, then crawl back to Emacs begging her to take me back with promises that I wouldn’t stray again.

Here is the truth. I don’t hate it. In fact, I kind of like it.

I like all the integration with Subversion (which we use at work) and Mercurial (which I use at home). I like the Rails integration. It has intellisense type functionality (though with a dynamic language is often unwieldy). The syntax highlighting (while having a white background) is nice.

One of my big complaints however was a lack of really good keybindings. I was missing my C-a, C-e and C-k. A quick google later and I realized you can switch to Emacs keybindings. Sweet. So I have done that.

I hate to say it, but overall I am pretty happy with Netbeans. If you are doing RoR development, and are chronically dissatisfied with software as I am, give it a shot.

My only complaint so far (and this might be fixable) is that tab navigation is chronological and not spatial (or serial you might call it). It’s like using Alt-Tab to cycle through windows versus using virtual desktops to navigate. I have to look into that further.

This is exactly how I felt about school.

Exactly.

Use a specific Rails version during project creation

If you do any amount of Rails programming, at some point you end up with various versions of Rails installed on your system. Generally this is fine as Rails keeps what version should be used in it’s environment.rb file.

However when you are creating a new project, the system rails command will use the most recent gem installed.

Also usually fine unless you know the latest version breaks something you want to use. Andy had mentioned to me before that it was possible to specify the version Rails should use on the command line when generating the initial project. However I forgot what it was. Lately I have been on a code reading kick so I decided to start at the start and see if I could remember what he had told me.

Well it didn’t take long. The 3rd line of actual code in the system `rails` command is:


if ARGV.first =~ /^_(.*)_$/ and Gem::Version.correct? $1 then

You can see, if you specify:

rails _2.0.2_ project_name

And that particular Rails version is correct and installed, it will use that version. Thanks to Andy for pointing that out.

Highlight specific messages in Mutt

Let’s say you belong to some high volume lists and generally get a load of email everyday.

You need a way to highlight important message. Using PATTERNS in your muttrc is an easy way to make that happen.

This pattern says if the message is (~f) from her@herdomain.com, AND it’s (~N) new, make it appear brightcyan in color in your index.

color index brightcyan black '~f her@herdomain.com ~N'

Saving my fitness

I have to admit, swimming is saving my fitness. I feel really strong.

Monday night I was beat, I could only muster 2*10 laps and my HR was through the roof. I hit the bike for 20 minutes, and then lifted and then went for a 2 mile walk. While on the walk, at a 16:xx pace, my HR was 125 the entire time. I was overdoing it.

I had my PT appointment on Tuesday, and that went pretty well. He was able to pin point a few bio-mechanical issues I need to address with my gait. I am working on learning to walk again.

Also, (and I knew this) my right leg is .5 inches shorter than my left leg. He is pretty certain this is what is causing my heel issues. Now, in addition to wearing orthotics in my shoes, I have lift in the right one.

It’s actually pretty awesome though, and I do think it’s helping. That could all be in my head, but whatever. If I thought dripping chicken blood on it would help I would. It really changes the way I walk, and it changed it instantly.

I have some soreness from changing my bio-mechanics but nothing crazy.

Tonight I hit the pool for 3*10 laps, 20 minutes on the bike and then lifting and stretching. I didn’t get to the gym until 8pm, and it was wicked fun. I dig it when there aren’t many people in there. I feel good. Unfortunately the way my schedule works out, I won’t be in the gym again till Saturday. That still gives me a 4 day training week. Not too shabby after that month long lay off.

I wonder how much training running I would have to do to run a half…

5% Urine

As I blogged yesterday, Saturday I decided to try swimming for cross training while I am laid up with heel problems. The first day there I was actually more interested in the logistics of getting into and out of the pool. However I also wanted to get a baseline for how much swimming I can actually do.

I didn’t have a real good plan, but as I was doing laps one materialized. I decided after about 3 laps, I would do 2 sets of 10 laps. I felt good when it was over, but I also felt like I had been doing an exercise I was not accustomed to. I then hit the bike for 20 minutes and then did some back and shoulders lifting.

Today, Sunday, I decided to take it up a notch. I set out to do 3 sets of 10 laps. It says online that the pool is 25 yards. I would have guessed the pool would have been built with meters as the measurement, not yards, but whatever. All I know is that it was taxing, and by the last set I was feeling fatigued. I did another 20 on the bike, and then crushed my legs with a ton of lifting.

I am usually afraid to do a lot of leg lifting since it takes away from my ability to run, but I figure this is the perfect time to really pound my legs.

So, on the whole I am digging it. It’s a tough workout, and afterward I feel like I feel when I run, spent. This is good. Though, and I will post about this later, my form has a lot of room for improvement.

I do worry with all the little kids in the pool the water makeup is 5% urine.

Happy swimming!

Get your tickets

Ok, I’ll be frank. I have body image issues. I don’t like to take my shirt off in public. I hate it in fact. I am really self conscious.

So the idea this morning of going down to the YMCA to go swimming was filling me with dread. I had even considered wearing a life vest with a t-shirt on under it so I could stay clothed.

I don’t actually like it that I am that self conscious, and I wanted to overcome it. I forced myself to go.

It wasn’t that bad. I could wear my shirt into the pool area from the locker room, and then took it off and slipped into the water. Once I was in the water I was a little more at ease. It was also cool because there were very few people there.

With my shirt off, I wanted to ask the few people that were there “Did you get your tickets?”. And when they looked at me quizzically I would flex my arms and say “To the gun show…”.

I will post some of my thoughts on using swimming to heal later.

ActiveScaffold and ‘helper :all’

On a recent project we have been using ActiveScaffold in an effort to learn the tool and judge it’s usefulness. It also seemed like a really good fit for the CRUD application we are working on.

ActiveScaffold is interesting in that it basically makes a best effort guess as to what should be Shown, Listed, Editable etc via the db schema and ActiveRecord relationships. As a result, any application that has a modicum of complexity needs to have the default scaffolding overridden.

That’s fine, they provide a nice way of doing that. For example, let’s say we have the object User with it’s corresponding Model and Controller. When you navigate to domain.tld/user/ We get a nice list of the users table from the database. However if it’s like most applications and Users belong_to something, in that column it will likely show you a foreign key to another table. Not really very useful. It is however easily fixed.

If you have your ActiveRecord relationships set up correctly, in your user_helper.rb you can do something like:

def company_id_column(record)
record.company.name
end

Now, instead of displaying the foreign key, you’ll get the value of the name column from the company table. Awesome right?

In Rails 2.0 it appears that in the application controller, they now include the following line:

helper :all # include all helpers, all the time

Basically it takes all the methods from all the XXXXX_helper.rb files and mixes them in. This caused me a few minutes of head scratching when I was moving on to a second object, and when I loaded up the scaffold, some of the functionality was already there. And that’s great, except some of the overrides aren’t exactly the same, though they are named the same since it favors convention over configuration.

So just comment out ‘helper :all’. Any helper methods you want to share, toss those in application_helper.rb, the rest, leave in the individual controllers where they belong.

Collide, no more.

Jim

Err, Gym. As in I joined one. I just quit one a few months ago, and here I am.

I don’t love the gym. I am not going to lie. But I needed to workout, no matter the outcome.

It _did_ make my heel worse. No doubt about it. But it will just have to take longer to heal. I can’t continue to sit still because of this injury. It’s not terrible, and it really hardly hurts at all, but I wasn’t feeling anything before I went in the door, and now I have some tingling and some minor pain. It’s a case of, “Oh well”. It will be longer till I get back to running I will bet, but I also won’t run to fat before I get there.

I have stopped taking the ibuprofen as well. That was going on 2 weeks and it did seem to help, but 3200mg a day isn’t really why I got into fitness in the first place.

So, I am person who goes to a building to simulate work in the hopes that I won’t get fat. I do not consider this a win.

19th

I finally broke down and decided to call a running physical therapist. The earliest they can see me is the 19th of August. This leaves me in a rather bad spot. I am hoping that I am healed by then and would probably cancel the appointment. However on the chance I am not healed, I will let the appointment in place till the last possible second.

It’s also going to set me back 214 dollars paying out of pocket.

Today is the first day I can honestly say I feel “better”. This was a humdinger of an injury…and it’s not over yet.

I have just over 12 weeks till Harrisburg. It seems unlikely I will make it given my current condition. I am going to wait a few more days, but I will likely just join a gym and start some other exercise routine until the time when I run again full time.

A lot of well-wishing, well-meaning friends have been urging me toward other sports. I appreciate that. And I really should do some other stuff, and I will. But I am not going to stop running anytime soon.

I am going to try some road biking in the next few weeks, because it would be a sweet cross training tool for off days.

I do thank everyone for the kind words, and I’d like to do some road biking and possibly some swimming at some point. Hopefully you’ll let a smelly running come along.