Conferences

Speaking at Pittsburgh Code Camp 2011.1

Last Saturday, I got the news that I’ll be speaking at the Pittsburgh Code Camp at Robert Morris University in Pittsburgh, PA. Being from the area, it is kind of exciting to have the first place that I get to present be my hometown.

My talk is called “Git for .Net Developers” and my preparation is already well underway. I’m really excited about sharing this topic with others. At first, I was a little nervous about filling up the entire hour and fifteen minutes, but now I’m wondering if I’ll need to cut some things :). I plan on running through this about a million times before April 30, so I’m sure I’ll figure it out!

Here is a copy of the schedule as it is laid out at the time of this post (click for larger version):
2011 Pittsburgh Code Camp Schedule

I’d really like to get into presenting to the community in a big way, so I’m definitely excited for both this opportunity and for the opportunity to get feedback so that I can be the best speaker that I can be. If you are anywhere near Pittsburgh and are free on Saturday, April 30th, you should definitely come out to the Code Camp. Use this link and sign up. It is free, but they want your registration so that they are sure to have enough space and enough lunch! I hope to see you there.

Goals

Node.js Build From Source Failed

I was attempting to move on to another of my 2011 Technology Resolutions and start working with Node.js. I have already watched several of the free Node Tuts screencasts and also messed around with Node on someone else’s machine. Now I wanted to get down and dirty with it myself. As I got the source from Github, I followed the installation instructions for the Mac but got the following error:

Build failed:  -> task failed (err #1): 
	{task: cxx platform_darwin.cc -> platform_darwin_4.o}

Well, crap. It is bad enough that getting Node up and running is still pretty painful, but now I get this very cryptic (to me) error message. The great news is that I used my Google-Fu to find out that the problem was that I had gotten the master branch of the source and that was just not going to work. So, I got the latest branch (currently the v0.4 branch) and followed the installation instruction steps again. This time it was a win.

Incidentally, I also could have just used Homebrew and installed it with the simple command:

brew install node

Next time, then 😉

Git

Git > Charlie Sheen

In my last post, I talked about being shown something that just blew my mind about the power of branches in Git and as I understood what was happening, this little experiment got me to REALLY understand just how changes are tracked in Git and how branching and merging works in Git, as well.

To begin with, if you don’t understand Git at all, or are really confused after reading this post, I recommend going to Git Immersion. I’ve found no better tutorial and it got me from 0 to successfully using the product pretty quickly. You have to have Git installed and configured if you want to follow along with my examples in this post.

To start out, navigate to an empty directory. I opened my Powershell console and from my root typed these three commands, one at a time.

mkdir ninja
cd ninja
git init

I then saw the following:
Create Ninja Git Repo

Let’s create a text file in our directory containing the contents of the directory.

ls > DirectoryContents.txt

Now our directory looks like this:
Create Directory Contents File

Our next step is to add the file to be tracked by Git and commit it. I typed in these commands, one at a time

git add .
git commit -m 'Created Directory Contents File'
git status

My output looked like this
Adding the file to Git

Now we are all set. I plan on doing some work on a feature here, so I’m going to branch this repo so that I can make changes in isolation and then merge back.

Type in

git branch pirate
git branch

The first statement creates a branch of the repository called pirate and then calling the branch command by itself lists the branches you have. You’ll notice that master is colored and has an asterisk (*) next to it, indicating that it is the branch that I’m working in.
Create the Pirate Branch

Now if you issue these commands, you will see that we have switched ourselves to the pirate branch to do our work.

git checkout pirate
git branch

Switch to the Pirate Branch

Now let’s delete the existing file and create a new one and look at our directory.

del DirectoryContents.txt
ls > PirateFile.txt

Current Pirate Repo Directory

Okay, we’ve been having fun, but now we need to make an emergency fix back on the original file in the original branch. Let’s commit our pirate changes and switch back to master. If we just issue these commands we see that our directory is really just as we left it the entire time.

git add .
git rm DirectoryContents.txt
git commit -m 'out with the old, in with the new'
git checkout master

Directory Contents is on Master

Now, let’s visit the pirate branch again.

git checkout pirate

Back in Pirate Repo

To me, that really just threw a switch and I began to understand how Git was tracking individual changes one by one and could “play them back” against a repo to perfectly put you wherever you needed to be at any point in time. In TFS and SVN, you branch to another directory, which if you have a web app, causes a lot of IIS configuration changes. Even if you don’t do web apps, if you branch per feature, you are going to have a lot of “spare” directories lying around. That just makes my OCD hurt.

I know that SVN has the “switch” command, that takes the branch from the central repo (which is in a different directory) and puts it in your current directory structure. That certainly behaves a lot like Git branching, but when you add in Git’s other features, I’ll definitely have to choose Git over SVN as well as TFS.

Hopefully I’ve explained this well and you get exactly how powerful and simple this is and how Git can really alter your relationship with source control. My initial fears were that Git would get in the way (because of the command line stuff, etc), but instead Git has made source control get out of my way and just let me focus on dominating the codebase 😉

Git

Get Your Git On

Can You Dig Git? (from http://blog.aquabirdconsulting.com/?p=262)As I stated in my 2011 technology resolutions, I really wanted to make an effort to learn Git this year. I started with learning some Git Immersion, which I documented as well.

Well, since I like to go big or go home, I decided to start using Git at work full time. We have a big project that we started last week that requires us to branch our code and maintain this “catastrophically different” branch and our “hotfix” branch so that we can still get any bug fixes or emergency features to production in the meantime.

As many of you who have worked with it know, doing a long running branch in TFS (our old VCS) SUCKS hard. The merge would have not been fun. On top of that, switching between the branches to perform bug fixes wouldn’t have been fun either. We would have had to maintain separate directories, which means remapping local IIS routes for testing, etc. Disaster city.

However, when I saw that when you jump between branches in Git and your directories and files just “magically” transform into what you expect them to be in place, I was sold. We had to have that wizardry. Since Chris already knows him some Git, I felt like I was working with a safety net, so we went for it.

Chris used spraints’ git-tfs to migrate our TFS source (with history!) into Git so that we literally lost nothing in the transition. One note of warning was that it had trouble with a very large binary file that we had checked into source due to some memory constraints. We hard deleted it from TFS and the migration went much more smoothly from that point, though Chris still had to work some magic. Maybe he’ll blog it???

We’re officially about a week and a half in with Git and we actually haven’t had as many problems as I had feared. We had a little scare last week when a deployment went wrong, but it turned out that we ended up with a weird WCF issue that forced us to need to reproxy in every project that consumed that service. I had worried that Git had messed up our very large file, but we did some experiments and proved that it behaved exactly as it was supposed to. (Good thing, too, or that “three” I shot in pulling the trigger on the Git switch might have cost me an earful.)

Next blog, I’ll show everyone what “magic” really impressed me with Git. People who are old had at Git will maybe scoff at what I thought was mind-blowing, but I imagine some VSS/TFS-only users may have their face melt off and children will weep over their exploded bodies. (update: I’ve blogged the example here)

Rails

Rails for Zombies

Rails for ZombiesOn Thursday of this past week, Chris and I did a brown bag “lunch and learn” at work. Our original plans fell through, so we decided to hit up Rails for Zombies and see what it is about.

I really like the format of the tutorial and the way that the labs are constructed. If you follow the process exactly, you create an account so that they can track your progress so you can return at any time and pick up right where you left off. Then you watch several 5-10 minute videos and then complete an interactive session in your browser after each one.

Here is a screenshot of the first video’s title screen. It definitely helps you get a feel for how *in* to this the good folks at Envy Labs are.

Lab One Video

The goal of the project is that we are building a “Twitter for Zombies” so that they can be all social and stuff. All of the code that is written is around that goal. Here’s what it looks like when you get into the lab.

Lab One Exercise

You can see that after I write my code and submit it, I get instant actual IRB-like feedback. If I were to have made a syntax error, I’d get that back, as well. It seems to be doing true evaluation, as Chris entered some alternative, more advanced ways of performing the labs and it was all evaluated correctly, too.

Lab One Exercise Solved

There is definitely a benefit to not having to set up Ruby and Rails on your machine before you get some exposure to Rails. Just like if I was trying to pick this up by pairing with someone, you don’t start at the beginning with this project. There is no project creation, scaffold generation, database setup, etc. You start in on a project that is kind of already underway.

Several things you do are never really explained and some things you do are explained at the very end (like generating links in the view based on named routes). I supposed I could have suspended belief a little until I got to lab five to learn it, but I ended up asking Chris a lot of questions as we went along.

As I said, I really like this format for teaching and conveying new programming topics to people. I’m really impressed at the work that Envy Labs put in. At the same time, you could complete this entire lab and not know how to even begin your own Rails project. However, if you couple this training with all of the existing Rails tutorials that try to get you up and running in 10 minutes and I think that you could have the knowledge you need to get pretty far into making your own Rails app from your own concepts.