Ready to #RHoK this weekend? Here are some tools you’ll need.

If you’re going to this weekend’s Random Hacks of Kindness, it’s worth your time to familiarize yourself with some collaboration tools.

I’ve attended two RHoK “hackathons” in Toronto. Over two days, great people from diverse backgrounds work together to create tools with the capacity to impact lives. One common issue is adjusting to collaborating in a development environment, particularly with teammembers in other cities. Two days is sometimes not enough time to bring all contributors up to speed.

Time is limited, so it’s important to be productive as soon as you can. If you’re new to hackathons, you owe it to yourself and others to brush up on some tools. The following tools will help you work faster, especially when collaborating with others. Quite likely the most important collaboration tools you’ll use will be version control and group chat. I’ll also touch on libraries and tools to consider.

Version control (AKA source control)

If you’re collaborating on a code base with others, I strongly recommend that you use some sort of version control for your project. Version control, or often “source control” in a software development context, is a method to keep track of changes to files. Changes, or change sets, detail the time a change was made, who made the change, comments on what has changed and why, and, of course, what the exact changes were. The typical workflow under source control is:

  1. “Check out” (or pull) the current version of the project code to your computer from a project repository (which is denoted by a URL),
  2. Make a change to a file or a group of files in the project on your computer,
  3. “Check in” (or commit) your changes with a comment, adding new files as needed, and
  4. “Push” your committed changes up to the project repository.

There are many source control systems in use. At Random Hacks of Kindness, you’ll likely be using one of Subversion (or SVN), Git or Mercurial (usually abbreviated “hg”). SVN is a system with a central remote repository, while Git and Mercurial allow for a decentralized approach, with multiple repositories which often feed into a central one.

It’s tough to say which of SVN, Git or Mercurial is easiest to use. SVN commits immediately to the repository. Unfortunately, this makes it easier to break code and negatively impact others in SVN. Commit conflicts (ie. When two changes to the same piece of code are merged together.) also happen more readily in SVN and are tricky to resolve. In my experience, the distributed nature of Git, its superior handling of merges, and its dominance in the open source community make it a natural choice for a hackathon.

How to install Subversion, Git or Mercurial

All three of SVN, Git and Mercurial have download pages with instructions on how to install both the command-line and GUI client applications. These can be located at:

Note that as of Mac OS Leopard, SVN is included as a command-line application.

The very basics of Subversion, Git and Mercurial

Subversion works much like the workflow outlined above, with one difference: the push step is automatic. You will check out the project from a URL, make your changes, then commit those changes to the central repository. To complete the commit, you’ll be prompted for a comment. Changes are immediately published to the central repository, which is why we don’t need a push step. Using the command-line, this workflow would be translated to:

  1. Check out the repository. You only need to do this once: svn co <project URL>,
  2. Update the code on your local machine: svn up,
  3. Add files, make changes to existing files,
  4. Check in: svn ci.

Git and Mercurial work as outlined in the typical workflow. The push step is required here. The code you edit and commit on your computer is committed locally. Sets of commits are then pushed up to a remote, often central, repository. As with Subversion, every commit will prompt for a comment.

Using the command-line again, this workflow for Git could be translated to:

  1. Copy (or clone) the remote repository once: git clone <project URL>,
  2. Pull any changes from the remote: git pull,
  3. Add files, make changes to existing files. If adding files, add them with git add <file>,
  4. Commit to local: git commit -a, and
  5. Push unpushed commits to remote: git push.

The Mercurial workflow is very similar:

  1. Clone the remote once: hg clone <project URL>,
  2. Pull new changes from remote: hg pull,
  3. Make changes and add new files with hg add,
  4. Commit to local: hg commit, and
  5. Push to remote: hg push.

Now you know the absolute basics for working with the three most popular source control systems.

Where to go for more information

Source control is a powerful tool, with many options and features. To learn other frequently-used commands, please consult the following resources or search for others on Google:

If you can’t find what you need online, don’t be afraid to ask other members of your team for help.

Free source control hosting

If none of your team members have created a central repository for your files, there are a number of free sites available. Two of the most popular for RHoK participants are Google Code and GitHub.

Google Code can now host Subversion, Git and Mercurial repositories. Hosting on Google Code requires a free Google account, as does collaborating with others. As an owner, you’ll need to get the Google account IDs of everyone on the project, usually an email address ending in “@gmail.com”.

To collaborate on an existing project on Google Code, you’ll need to give its owner your Google account ID. He/she will then add to the project. You can grab the code by going to the Source tab for that project, where you’ll find instructions on how to get a hold of the source.

GitHub is the standard for solid Git hosting. As with Google Code, participation requires a GitHub account and authorisation of collaborators. Accounts are free. You’ll also need to set up an SSH key, which is covered in the setup.

As both Google Code and GitHub are fairly common sites, someone will be able to help you with setting one up. Ask around if you get stuck.

There is a third option of hosting your repository yourself, from your computer. This is a little involved for novice users, but is covered in the information guides.

Communicating with your teammates

If you’re working on a project with people in other locations, you’ll need to be able to communicate with them. Three common methods of communication at RHoK are Google Talk, Skype or IRC. With Google+ hangouts available, that may be a fourth option.

Google Talk and Skype are likely the easiest options for communications. Both are free, support text chat as well as voice and video chat. Skype is a free download while Google Talk can work in a web browser. Naturally, using these services will require an account, which is free.

In Google Talk, any chat can become a group chat by clicking “Group Chat” in the Google Talk Gadget. On Skype, you can arrange people into groups and create a room for that group. Group voice or video chat is only available on Skype, and only with a Premium Account.

IRC (Internet Relay Chat) is primarily geared towards chat rooms, although private one-on-one chats are supported. You will need an IRC client. Most chat applications have an option for connecting to IRC servers, but dedicated clients are available. On the Mac, Colloquy is a popular choice, while XChat is a good choice on Windows, as it is on Linux. Linux users, check your package manager for XChat or irssi should you prefer the command-line.

IRC provides simple commands for changing settings, setting up rooms, etc. Commands are sent to the server, which you’ll also need. Freenode is popular in the open source community. Point your client to chat.freenode.net.

Lastly, Google+ Hangouts supports text chat and group text and video chats. It’s free, but as with all things Google a Google account is required. Once you’re in Google+, you can start creating a hangout for your team members.

A brief note on libraries and tools

The proper collaborative tools will end up saving you time. Another way to save time is to avoid repeating the work of others. This includes current or past RHoK participants, as well as others in the industry. The open source developer community has spawned countless developer libraries for all languages. If you find yourself writing code which should be commonplace, it probably already is.

It’s imporant to familiarize yourself with your programming language’s offering. Install some core libraries beforehand, or know how those can be installed should you require them. Try to avoid spending the weekend reinventing existing functionality if it’s a small part of your RHoK solution. Unfortunately, it’s not always obvious that you’re reinventing an existing technology. Be sure to ask around and see if what you need already exists.

Developing for mobile

Many problem sets involve a mobile or wireless phone component. If you plan on doing some mobile development, be sure to have the necessary tools installed on your laptop before you come to RHoK. These are often large downloads and will consume time:

An Apple Developer account is required to download development tools for iOS. A DVD containing XCode and iOS developer tools should have come with your Apple laptop. You may still need to download XCode updates.

Note that if your development background is more geared towards web, you may find it easier to leverage some features of HTML5, including support for geo-location and client-side storage. HTML5 is a relatively new specification with many modules still in draft. Before deciding on using its capabilities, check whether your target devices are supported.

Sorry, this guide is far from complete

It’s impossible to list every tool. These are just recommendations based on my experience and those of others. They are meant to be starting points for participating effectively in Random Hacks of Kindness. Depending on your project, it’s likely you will need to install other tools. As always, ask around your event space if you get stuck or need help.