The Importance of set -e in your Bash scripts

I learned a very valuable lesson this past week at work: “set -e” will save your life. Period.

So what is “set -e” anyways? Well, `set` is a Linux command defined by Computer Hope as:

sets the value of an environment variable.

That does not sound too immediately useful, does it? However, the “-e” is what saves your
bacon from angry system administrators:

Exit immediately if a command exits with a nonzero exit status.

Continue reading

Ruby Dependency Hell: What do you mean you can’t find stdio.h!?

Today has been quite an adventure, so I figured it would be best to document the solutions
to these problems so that others (and myself) can quickly figure out what is going wrong
and get a working solution in place.

The first came when attempting to install Octopress. Thankfully rvm made installing and using various Ruby versions extremely simple. Unfortunately, it couldn’t save me from the specter that is Xcode 4.3 and the fact that it is now an ordinary app package that sits in /Applications.

During Octopress’ installation it uses Bundler to install dependencies. One of the dependencies it installed contained native extensions and needed to use `gcc` to compile itself. Well, that blew up with a truly unhelpful error:

fsevent/fsevent_watch.c:1:10: fatal error: ‘stdio.h’ file not found

Apparently, as this GitHub issue indicates, Xcode 4.3 no longer installs the “Unix tools” in their usual places (or at all it appears).

Continue reading

Installing Ruby with rvm on Lion Woes

One other issue with Ruby has been haunting me the last couple of days. This one began
with the innocent desire to get CocoaPods installed so I can continue working on some Objective-C code (which of course has its dependencies managed by CocoaPods).

Now, unbeknownst to me, the project has made it to a fantastic state where they no longer need to use MacRuby. They can now use the Ruby that comes on Snow Leopard or the latest version. So of course instead of reading the documentation like I should have, I charged off and installed MacRuby only to find that CocoaPods would not work with it. Well, unless you count spewing cryptic errors about various Ruby paths as “working”.

Continue reading

Installing GitLab on Ubuntu Server

UPDATE 01/23/2012: This post continues to get a large amount of traffic and, unfortunately, is very out of date! I would update this post to bring it up to date, but it turns out that is completely unnecessary. The fine folks behind GitLab have added impressive install scripts (and even more impressive documentation!) for installation of GitLab on an Ubuntu box. I recently utilized them to get a v2.0 GitLab install up and running and the experience was painless. This even included getting it running on nginx, and more importantly, port 80. I will leave the body of this post here for posterity’s sake, but it is no longer any sort of authoritative source.

Installing GitLab has turned out to be quite a chore and, as a result, I wanted to provide a solid tutorial on how to get it all functioning correctly. This post will only cover what the installation instructions do: getting it to work with the built in server. I plan to do another post on how to get it running on Apache.

Continue reading

How to Subclass in Android/Java (A Dialog Example)

Continuing on the last post over custom event handlers/listeners I thought subclassing would be an absolute necessity to cover.

In this post, I will cover an entire sample project, from start to finish, on how to create a subclass of dialog that would allow people to edit the default text of the starting TextView in the new project template. Well, let’s dive right in!

Continue reading

Custom Event Handlers in Android/Java

I recently implemented a custom event handler for a subclass of Dialog that I was working on to allow me to decouple the calling class from the dialog. The easiest way definitely seemed to do a custom event and I found several (in my mind) overly complex sets of sample code. So here is my own writeup on how to implement these useful components and a little bit of background info that you may find interesting.

Continue reading

Installing Redmine on Windows 7

Recently, I wanted to run Redmine on a Windows 7 box that I have been using as a server. The difficulty I ran into was that it was difficult to locate up-to-date information.

To help remedy this issue I have consolidated all the notes that I had from various sources and put it together to ensure you have up-to-date information to create a proper functioning Redmine installation on Windows.

Although this is on Windows 7, I would like to think this would work on any Windows install.

Continue reading