Pete On Software

RSS Feed

Archive for March, 2011

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:

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:

Next time, then 😉

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.

I then saw the following:
Create Ninja Git Repo

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

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

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

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.

Switch to the Pirate Branch

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

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.

Directory Contents is on Master

Now, let’s visit the pirate branch again.

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 😉

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)