CodeGnome Consulting, LTD

Programming - Project Management - Information Security

Not All Hashes Are Created Equal

| Comments

In Ruby, there’s often more than one way to do something. The language contains a lot of synonyms such as Enumerable#reduce and Enumerable#inject. It also contains a number of work-alikes such as hash literals like {} and hash constructors like Hash.new.

In general, programmers can treat this cornucopia of syntax as a matter of personal preference, or choose synonyms to communicate more clearly about the intent of a given piece of code. However, there are cases where work-alikes are not identical in terms of performance. Let’s look at some of those use cases.

Enumerator#each_cons

| Comments

If you are a Ruby programmer and you haven’t found a use for Enumerable#each_cons, you just probably haven’t thought about it yet.
     — Michael Feathers (@mfeathers)

Well, Ruby is a great language, with a lot of nice surprises tucked away in its dustier corners. The Enumerator class is certainly a common one to reach for when solving problems, but I can honestly say I’ve never needed the Enumerator#each_cons method. After seeing Michael’s tweet, I took a look to see what it does.

Rails Note Tasks

| Comments

Even if you work with Ruby on Rails every single day, it’s a large framework with a lot of dark corners. Today, we shine some light on one of those under-utilized dark corners: the rake notes task.

Road Map to Programming Excellence

| Comments

The very best programmers are passionate about their craft—and it is a craft. However, passion by itself isn’t really enough. If you want to be one of those programmers who is an order of magnitude better than your peers, you need a road map.

Like any destination, programming excellence has more than one route to reach it. Here are some sign-posts to help you on the way.

Parsing Initials From GECOS

| Comments

Why Would You Need a User’s Initials?

Some programs want you to enter someone’s initials for tracking edits in a word-processing document, or perhaps you need to find all the user stories assigned to one person using their initials as search criteria for the Pivotal Tracker API. Whatever the reason, I’ve occasionally needed to have a programmatic way to extract a user’s initials.

Remote Forwarding With SSH and Git-Daemon

| Comments

Local Git Repositories for Remote Machines

Have you ever needed to track changes to files on a remote host, but haven’t wanted to set up a dedicated Git repository on an external host? I certainly have.

I considered a variety of solutions, and settled on using remote SSH forwarding to a temporary instance of git-daemon running on my local machine. It’s fast, simple, and no less secure than storing your repository on the remote host in the first place.

Bootstrapping RVM on Mountain Lion

| Comments

The Dangers of a “Walled Garden”

No one seriously argues against the viewpoint that Apple’s OS X provides developers with a walled garden. While OS X runs Darwin under the hood, it’s still very much a closed ecosystem. Even if you install some third-party tools such as MacPorts or Homebrew, you’re still fundamentally stuck with some of the options that Apple makes on your behalf, very often in a “take it or leave it” way.

In the case of RVM, Ruby, and RubyGems, the walled garden has been systematically weeding out standard compilers in favor of LLVM-based compilers as provided by the 4.x series of Xcode. In practice, that means many rubies and gems will not compile without jumping through hoops—and sometimes not even then. Even versions of Ruby that will compile with LLVM may require gems that won’t, so this is a non-starter for serious Ruby or Ruby on Rails development.

Luckily, even if you use a Mac on a regular basis, there’s hope. With a little help from MacPorts, VirtualBox, and some exported compiler settings, you can get a minimal Ruby environment running well enough to bootstrap a Linux virtual machine that “just works” for Ruby development.

Connecting an Ooma Scout

| Comments

In a recent post, I said:

[My wife] can’t set up her own voicemail messages or forward unanswered calls…separate from mine. With Ooma, we are forced to share those features[.]

It turns out that that she can have her own voicemail inbox. There’s a whole series of steps you need to take to make this happen, and the order of the steps isn’t strictly orthogonal. Nevertheless, here’s one sequence to get it done with the obsolete Ooma Hub and Ooma Scout.

Canonical Hostnames

| Comments

You can consolidate your domains, sub-domains, and hostnames with Apache 2 to provide a canonical destination for web requests. This can improve the user experience and simplify analytics.

Telephone Ouroboros

| Comments

Ah, the 21st century, where everyone has at least a half-dozen phone numbers! Maybe when the singularity comes, one number will suffice. In the meantime, life is complicated by a cornucopia of landlines, cell phones, VoIP phones, Google Voice numbers, and virtual office numbers. Sadly, the madness doesn’t end there.

In addition to the profusion of devices, each device requires a separate phone number, and sports its own (possibly overlapping, but always incompatible) feature set for:

  • call-forwarding
  • multi-ring patterns
  • multi-device ringing
  • single-line, multi-ring device selection

You don’t have to be a Luddite to find this situation intolerable. One often needs a flow-chart just to figure out which numbers ring where, and it can take half an afternoon to reconfigure everything when a single device in the chain goes out of service, some firmware gets upgraded, or when one tempts fate by daring to swap out an aging component for a newer gadget.