Monday, February 28, 2011

Broken CD centers...

You know what really annoys the shit out of me?

Broken CD cases. Especially the spindle at the center that holds the CD in the case.

I ordered a copy of Kirby Krackle's self-titled CD from Amazon last week. When it showed up today I opened the package, opened the plastic and found the CD inside was loose.

The reason: one of the four pegs in the spindle had broken off.

So now when I put the CD in it's not going to stay in place. And that sucks since the CD could have easily been scratched in transit.

And the first thing that happened when I tried to rip the CD: it failed with an "Unknown Error". Which made me think the worst actually had happened. But it worked after another try.

Still, how hard is it to make a CD jewel box that doesn't break? Sheesh...

Sunday, February 27, 2011

Hiking in Cary...

Since it was such a beautiful day out today, I took Rachel to the Hemlock Bluffs Nature Preserve in Cary. We picked up a pamphlet that had a paragraph about the park for each of the 30 markers along both trails there.

We talked about the lifecycles in the forest, how trees grow and fall down and how insects, birds and mammals can make their homes in the trees.

We saw a HUGE grey spider in the hollow of a tree. I'd guess it was at least six inches across easily.

All in all a good walk. Now to go have some dinner.

Saturday, February 26, 2011

Space Shuttle Launch Seen From An Airplane....

I saw this video posted on Twitter and wanted to share it.

There's something awe inspiring about watching technology, developed over twenty years ago, in action like that. Think about how, in the span of this video (two minutes seven seconds) the shuttle went from ground level to the edge of our atmosphere. Think about the acceleration needed, the power of the engines lifting the craft, all the planning and coordination needed to accomplish such a feat.

I think Rush really caught the feeling with their song "Countdown" off of their album "Signals".

Like a pillar of clouds, the smoke lingers high in the air.
In fascination, with the eyes of the world we stare.

Thursday, February 24, 2011

Splitting a patch into two parts with Git...

Another cool trick I learned today while working.

Assume you submitted a patch for review and someone said "it's too long, split it into two separate patches". What do you do?

GOAL: Take a past commit and split it into two (or more) separate patches.

In your repo, go back to that specific commit and edit it (see my previous blog post for how to edit an historical commit). While in the edit area for the list of commits be sure to take note of the hash code for the commit you're editing.

Once you're in the commit and ready to edit, type:

git reset HEAD^

to back out your changes so that they're there but not committed. Now type:

git add -p

and pick the specific changes you want for the first patch. Be sure not to pick the changes you want to add to the follow up patch.

Once you've selected the changes, commit the patch with:

git commit -c {HASHCODE}

and use the hashcode you noted earlier.

Now all that's left in your repo are the changes you wanted to move to the separate patch. You can add them using:

git commit -a

and you now have a separate patch! Easy as that.

Using git to keep your patches small and focused...

On my current project at work we have a process requirement to not send out patches that have a lot of changes in them. Instead such patches need to be broken up into smaller, more focused patches so that they're easier to review by peers.

As a mid-level user of git (I've been using it for nearly three years but in very rudimentary ways) my way of achieving this goal was to have a separate local branch for each part of an overall task. So, for example, I would have branches like:


and so on. And as I would work, if I needed to change something in the first part of the task, I would checkout that local branch and do my edits. Then I would go to each branch after it and rebase them. Most times it was fine. But every so often there would be a need for me to merge changes. And if that happened then it would be repeated for every branch afterward in the chain.

A pain in the ass, right? Yep!

But, thanks to a coworker, I have a better work flow for doing this. And that's done using git rebase -i and editing patches in place. And with this newer workflow it lets me work in a single branch, editing historical patches in that branch and makes life overall easier.

So, now, instead of having a separate branch for each part of the task, I can just work on them in a logical order. When I finish each part of the task I can simply use git commit -a to commit those changes.

If, after multiple such changes are committed, I realize I need to change something in a previous commit, I can use git rebase -i HEAD~n to bring up all changes including the one I want to fix.

So, for example, if I want to fix a commit that's three back I can use git rebase -i HEAD~3 to bring up the list, which looks like this:

pick 7376174 Creates the new POJO named Farkle.
pick 610412e Annotates the fields in Farkle.
pick 8d622f5 Creates the FarkleDAO Hibernate implementation.

# Rebase 72c5b6c..8d622f5 onto 72c5b6c
# Commands:
#  p, pick = use commit
#  r, reword = use commit, but edit the commit message
#  e, edit = use commit, but stop for amending
#  s, squash = use commit, but meld into previous commit
#  f, fixup = like "squash", but discard this commit's log message
#  x, exec = run command (the rest of the line) using shell
# If you remove a line here THAT COMMIT WILL BE LOST.
# However, if you remove everything, the rebase will be aborted.

The patches are listed from oldest to newest.

Git lets your edit in place, so in this case I would modify the entry for that first entry and change "pick" to "edit":

edit 7376174 Creates the new POJO named Farkle.

which rolls back temporarily the commits after this entry and drops me back at the command line.

Now I can modify things on this commit, doing whatever changes I want. Once I finish I just do git commit -a --amend to save those changes, and then git rebase --continue to put all of the other changes back on top of it.

This makes life a lot easier. Sure there may be cases where you'll still have to do some merges, but they will be fewer and farther in between that in you used my previous work flow.

Wednesday, February 23, 2011

Grades are in for our first class project...

My Window Manager...
We got our first grade back for my CSC 216 course at NCSU. I got a 100.

The project was a relatively easy one (given my programming experience). The requirements were to write a window manager that created, placed and tracked a set of windows on a display and also responded to mouse clicks.

The instructor gave us the main program code. It made function calls into the code we were to write, which defined the public contract we had to meet. Using test driven development practices I wrote the code, then went back and modified to to meet the rubric for the project.

A follow up to the first project is to submit unit test code, based on JUnit, that validates our code from the first project. Since that's how I work anyway, I already had the second codeset ready to submit.

After working and struggling through higher math classes for the past two years, it's nice to have a breather and take a class that will be less stressful.

Sunday, February 20, 2011

The Joy Of Reuben...

This afternoon Christene and I were watching the Travel Channel show, Food Wars. One of the episodes we watched had 2nd Avenue Deli and Katz's Jewish Delicatessen in New York pitted against each other. And the sandwiches looked so good we decided that's what we were going to have for dinner tonite.

I went out and got the corned beef, sauerkraut, pickles, rye/pumpernickel bread and chips for the side. Heated it all up, melted the cheese and had a great meal!

Saturday, February 19, 2011

Nevermore Film Festival and "Rubber"

This weekend is the Nevermore Film Festival, the annual horror film festival held at the Carolina Theater in Durham, NC.

I've been looking forward to going for at least a month now, since Neil Meschino first told me about it and that he was coming down for it to show his film, "Mold!"

So this morning my oldest son, Caleb, and I drove out to see another film, "Rubber". I first saw a preview for it on the Bluray disk for "Survival Of The Dead" and it piqued my curiosity. So when I saw it on the list of films to be shown at Nevermore I HAD to go see it.

We went to the 2 o'clock showing and sat in the first balcony. The film was absolutely worth the time!

The basic premise is this: it's a meta film about people watch the events surrounding Robert, a tire that has telekinetic powers and who is chasing after a beautiful woman in the desert. Yeah, sounds bizarre, but there's no easy way to describe it. You just have to check out the trailer and then see the film for yourself. I'm reviewing the film this week for my podcast.

Aftward Caleb and I walked around the area. I was waiting for Neil to give me a call and was hoping to get a chance to introduce myself and talk to him. Unfortunately my phone battery, for whatever reason, died during the film so I never go the call.

I did see Jordy Dickens from Super Tough Films, which was cool. He also caught "Rubber" and had the same reaction that everybody else I spoke to had: "Awesome!"

And I ran into a guy I'd seen around a lot lately. He was at BarCamp RDU, and I would see him around town and also at the comic shop. So when I saw him at Nevermore I decided to go over and introduce myself and see who this guy was. Turns out his name is Steve Burnett and he works for rPath.

All in all a good afternoon.