Ann Arbor Give Camp 2014

Last weekend saw the return of Ann Arbor GiveCamp. This community event, organised and hosted by Jay Harris, Hilary Weaver, Ken Patton, and their minions, is held at Washtenaw Community College who generously accommodate Give Camp on the third weekend in September every year (18th-20th September, 2015, put it in your calendars).

GiveCampGive Camps are events where volunteers from the tech industry including developers, designers, and artists come together to help out local non-profits with new websites, social media, and other technically-centric projects that might otherwise take dollars away from their primary mission. This year, the combined efforts of the volunteers donated nearly $150000 of effort1.

The non-profit our team was earmarked to work with this year unfortunately had to pull out of the event, so, we turned our efforts elsewhere. Each year, Give Camp receives proposals from non-profits that are just not feasible within the 48 hour time-frame and a common theme of many proposals is donor and donation management. While there are many professional solutions available, they often carry a heavy price tag, taking money that otherwise might go to the non-profit's primary mission.

This kind of software is not simple. Most packages contain features to track donors, volunteers, relationships, donations, events, campaigns, and a lot more besides. Given the obvious complexity and nuances of this kind of specialized accounting software, our expectations of achieving much over 48 hours were low. We decided our main goal would be to flesh out a basic design that could be used to kick start some future effort at some future Give Camp. This plan soon changed.

CiviCRMThe very first step we took was to research the available solutions. Thanks to the Googlefu of one team member, known to our team as Dr. Mylastname2, among the large number of commercial offerings we discovered CiviCRM, a free and open source solution with a very extensive and supportive community. Not only that, but CiviCRM supported WordPress integration, making it a natural fit for Give Camp projects3.

On discovering CiviCRM, our mission changed from specifying some future development effort to evaluating an existing solution. By the end of the weekend, we had two test sites up and running, and a solid set of recommendations for how CiviCRM might be deployed to non-profits at future Give Camps. The project was a great example of how things can change at Give Camp.

As with the two previous Ann Arbor Give Camps I have attended, the team in which I participated faced some unique and intriguing challenges, ultimately reshaping and redefining what could be achieved. I met old friends, made new ones, and saw what can happen when people choose to focus on others. It never ceases to amaze me just how adaptable people can be when failure is ruled out and that is just one of many things that makes Give Camp a fantastic experience. I look forward to next year and hope that you will join us to make it even better.

  1. based on average consulting rates []
  2. pronounced, meelastname []
  3. WordPress is the CMS of choice for non-profit websites at Ann Arbor Give Camp []

Learning Poetry: Exercise 5

This is the fifth entry in a series documenting my attempts at exercises in Stephen Fry's The Ode Less Travelled: Unlocking The Poet Within. Since exercise one in the book did not require a post and because I did not really think about it, all my posts are one off, so this post corresponds to exercise six in the book1. For previous exercises, see my earlier posts:

The exercise

  1. Write some anapaestic2 hexameters3 describing how to get to your house
  2. And some dactylic4 pentameter5 on the subject of cows. For fun these should be in the classical manner: four dactyls and a spondee6, with the spondee as spondaic as English will allow7.

The results

From the road take a right by the charlatans office and stop at the sign,
Then straight on by the taxi and seventies house with the hedgerows in line.
You might find that we don't have a car in the drive but we're still there at home.
Try the doorbell and see if we answer, if not don't despair, try the phone.

Fenced in by the powered electrified wires that we stretched out
Far across pastures they stand and they chew upon green grass
Neighbours confused why the cows are all standing in straight lines.
Cattle unsure of the pain they receive if they touch it.

  1. If you want to follow along, you can get your own copy of the book from most book retailers, such as Nicola's Books in Ann Arbor []
  2. The anapaestic meter is two unstressed syllables followed by a stressed syllable, as in: ti-ti-tum []
  3. A line of verse containing six metrical feet []
  4. The dactylic meter is one stressed syllable followed by two unstressed syllables, as in: tum-ti-ti []
  5. A line of verse containing five metrical feet []
  6. two stressed syllables, as in tumtum []
  7. Unlike French, where each syllable is usually supposed to get equal stress, English does not tend to have words with two stressed syllables side-by-side – this is why English speakers often incorrectly add emphasis when speaking French []

One night in Toronto

A few years ago, Chrissy and I took our first trip to Toronto. We were there to see Christopher Moore at a book signing. We had arrived in the very early morning, so the owner of the guest house where we were staying had left us a key and a note on how to find our room. We followed the instructions and went up two flights of stairs before making our way through what we thought was our room door.

Upon unlocking and opening the door, we discovered a narrow, creaky staircase lined with some interesting paintings. At the top of the staircase was a bathroom with a large, old jet tub, a toilet by a window (where nothing could be left to the imaginations of the neighbours), and a large, terrifying clown behind a plant. The bathroom looked like it could have been a happening place for swingers some time in the seventies.

We continued past the bathroom along a short landing, strange paintings and knick-knacks surrounding us. On the back of the door hung a small pair of children's fairy wings from a costume, along with some bridal equipment. Dust covered everything and the air smelled of musty books. We opened the door.

The bedroom was packed with stuff. In the words of Stefon from SNL, this place had everything: creepy paintings, old woolen blankets, VHS tapes, CRT TV, sixties furniture, orange shag-pile carpet, and a horizontal head rush. What's a horizontal head rush? It's that thing where the floor slopes inward such that the head of the bed is lower than the foot.

Chrissy wanted to immediately head back out and find a different hotel. I, however, was exhausted and wanted to sleep, even if it did mean ignoring all the signs that we had entered the Twilight Zone. I persuaded Chrissy to stay and we went to bed. As the blood rushed to our heads and our feet became icy cold, little flecks of dust and paint rained down on us from the paintings above us and we did our best to fall asleep.

The next morning, we went downstairs to the dining room. A large round dining table was beautifully laid out. It felt like we were staying at the house of an eccentric relative. The room had a high shelf that was lined with teapots of varying shapes, sizes and colors. It was there that we ate a delicious breakfast cooked by the proprietor and one of his friends. We also got to meet some of the other guests who were staying; they seemed equally as eccentric as the house.

From the dining table, we could see the kitchen. Actually, that's a lie, we could see some of it. The bits that were not underneath something else. It was no place for the squeamish and I decided it would be best to just not look, that way we could enjoy the food.

In fairness to our host, we had a wonderful stay thanks to their courtesy and hospitality, and that of his friends and guests, but there is no way my words, nor the photos below can do justice to the wonderful time capsule in which we stayed. The house could have served well as the backdrop to a Dickens adaptation or perhaps a Hammer Horror. It will stay with me for a long time.

Controlling a bot using node.js and express

Last week was our work hackathon. During these events we get to spend a day hacking around with something fun, whether it is work related or not. Thanks to my friend and colleague, Brian Genisio, this time around we got to tinker with hardware and build some bots.

Using node.js, johnny-five, an Arduino Uno board and a bunch of additional components, teams created their own sumo bots. At the end of the day, we competed to see who had the best bot. Ours was the only bot that walked instead of using wheels and we were confident our design could have won. Unfortunately,  we faced some technical difficulties and a couple of design issues that prevented us from achieving our full potential. You can see our bot (it's the large gold one that lumbers in from the bottom) take on all the others in this video and slowly start pushing them all out of the way.

http://youtu.be/pW6t5qfsc4g

As I am sure you can tell from the audio, this was a thoroughly enjoyable and highly competitive hackathon. There were a variety of problems to address as we developed our bots. Some of them were unique to the bot being created, others were comment to all. One such problem was how to control the bot. Regardless of how the signal got to the Arduino board (Bluetooth, RF and USB were available), we had to command our bots to move forwards, backwards, left and right (and in some cases, to deploy an extensive range of weaponry and distractions).

After some trial and error, I settled on using a simple web server and web page front-end that made API calls to the server. The server would then map these API calls to bot controls. This provided a way for us to use mouse, keyboard and touch input to control our electronic sumo minion. You can see the very basic user interface1 in this Vine that I took during our build.

https://vine.co/v/Ounjjiu6Br5

Using AngularJS, the buttons in the web page were connected to API calls. By clicking buttons in the web page, using the numpad or AWSD keys, or touching the screen of my laptop, we could control the robot. The API itself was implemented using the Express package in node.

Express

I installed express into our node application, using npm:

npm install express

Then I added express to our bot code and defined a simple API to process web requests:

var express = require("express");

var app = express();

app.post('/move', doMove);
app.post('/rotate', doRotate);
app.post('/stop', doStop);

app.use(express.static(__dirname + '/public'));

app.listen(4242);

This snippet of code has been edited down to show the pertinent details; you can view the real code on GitHub. First, we require the express module, then we use it to create our server app. The three calls to post set up our three API methods and the handlers for those methods. Using the post method defined these as POST endpoints, we could have used put, get or delete, if it were appropriate. The use call sets up a redirect for static page requests so that those requests are satisfied from our public directory. Finally, we tell the app to listen on port 4242.

Each request that matches one of the three calls I have setup will be sent to the appropriate handling methods. These handlers each take a request object and a response object, which they can use to get additional information about the request and craft an appropriate response.

Here is an implementation of the doRotate method:

function doRotate(req, res) {
    var direction = req.param('direction');
    var rate = req.param('rate');
    drive.rotate(direction, rate);
    res.send();
}

In this handler, we get the direction and rate parameters from the request and pass them to the code that does the real work. At the end, we respond to the request. We could provide data in our response or even send an error if we wanted.

This allowed me to host a local website and API for controlling our bot. It was that simple.

Conclusion

Hacking a robot using node.js was a great way to delve into a new facet of JavaScript programming; hacking hardware. Not only that, but it allowed me to discover some of the cooler things that can be done quickly and easily using node.js, such as setting up a web server using express.

Have you hacked a robot with node? How did you implement control? Please leave a comment with your experience or any questions you may have. And if you are interested in hacking a bot of your own, watch this space.

  1. and an early prototype of our robot []

Getting posh-git in all your PowerShell consoles using GitHub for Windows

If you use git for version control and you use Microsoft Windows, you may well have used posh-git, a module for PowerShell. For those that have not, posh-git adds some git superpowers to your PowerShell console including tab completion for git commands, files and repositories, as well as an enhanced command prompt that tells you the current branch and its state1.

PowerShell console using posh-git
PowerShell console using posh-git
GitHub for Windows
GitHub for Windows

GitHub for Windows includes posh-git for its PowerShell console, if you choose that console when installing or later in the settings. It even adds a nice console icon to the task bar and Start screen2. Unfortunately, posh-git is only installed for the special version of the console that GitHub for Windows provides and you cannot make that prompt run as administrator, which can be useful once in a while.

Now, you could install a separate version of posh-git for all your other PowerShell needs, but that seems wrong. Especially since GitHub for Windows will happily keep its version up-to-date but you'd have to keep track of your other installation yourself.

Faced with this problem, I decided to hunt down how GitHub for Windows installed posh-git to see if I could get it into the rest of my PowerShell consoles. I quickly discovered ~\AppData\Local\GitHub containing both the posh-git folder and shell.ps1, the script that sets up the GitHub shell. The fantastic part of this script is that it sets up an environment variable for posh-git, github_posh_git, so you don't even need to worry about whether the folder changes3.

Armed with this information, you can edit your PowerShell profile4 and edit it to call both the GitHub shell script and the example profile script for posh-git5.

# Load posh-git example profile
. (Resolve-Path "$env:LOCALAPPDATA\GitHub\shell.ps1")
. (Resolve-Path "$env:github_posh_git\profile.example.ps1")

cd ~/Documents/GitHub

Once the edits are saved, close and reopen the PowerShell console to run the updated profile. Posh-git should now be available and all you have to do to keep it up-to-date is run the GitHub for Windows client once in a while.

  1. such as if there are any unstaged or uncommitted files and whether the branch is behind, ahead, or diverged from the remote []
  2. or menu, if you're pre-Windows 8 or installed something to bring the Start menu back []
  3. and if you've seen the folder name for posh-git in the GitHub for Windows installation, you'll see why that's useful []
  4. just enter `notepad $profile` at the PowerShell prompt []
  5. you may want to do the same thing for the PowerShell ISE, as it uses a separate profile script []