My First SVN Post-Commit Hook in Go - Part 1

Man with headphones Image copyright Ryan McGuire

This is part one of a two part series on how I created a Subversion post-commit hook using Go, and post a message in a HipChat room. I did this for the teams at my day job. Please note that certain pieces of code have been changed to protect the innocent, and opinions here do not necessarily reflect those of my employer.

JavaScript Multiselect Widget, With No jQuery!

Last night I decided to write a multi-select JavaScript widget. I need such a widget to allow the users of a little app I am working on to select one or more items. I wanted it to look a little more pretty than the default <select> box and I also didn’t want to force users to have to hold CTRL to select more than one item. I did a little searching around the internet and found a number of controls that do exactly what I want, but all of them required an external library, such as jQuery, Angular, and even Mootools. This particular project is not using jQuery on purpose which makes those libraries out of the question. So I start writing my own.


Response To Adam Cameron's Code Review

A few weeks ago I submitted a response to a code puzzle on Adam Cameron’s blog that I wrote using Go. He has (finally) submitted a review! First let me say that it is about time Mr. Cameron! I have waited with bated breath! That review can be read here. In this post I will comment on his commentary.

Handling CTRL+C In Go Command Line Applications

Command line and server-style application often allow you to press a key combination, such as CTRL+C to gracefully exit. In Go this is a pretty easy task to accomplish, and in this entry I will show you how you can add this ability in your own applications.

Deploying My First Go Application to Heroku

For the last week or so I’ve been converting a site I manage from WordPress to a simple Go application. There are three reasons I want to do this.

  1. WordPress has been extreme overkill for what I actually need
  2. Performance. WordPress on a shared host is just not fast enough for what I deem to be a super simple site
  3. I wanted to build something other than a server-style application in Go and I really enjoy writing Go code!

Returning an HTTP Server From a Function in Go

When building web applications in Go the most common example is one that sets up a handler for a specific URL route (endpoint) then fires up the HTTP server to listen for requests. It looks like this.

package main

import (


func main() {
    http.HandleFunc("/", versionController.GetVersion)
    http.ListenAndServe("", nil)

The above example shows the a basic case of listening on all IP address on port 8080, using the default ServeMux to handle routes. This is all well good, until the point where you may need more flexibility. I have reached that point.

No Weapon Formed Debut Album Coming Soon!

My brother and his band No Weapon Formed will be releasing their debut album soon. The title of the album undetermined still but you can find a preview track YouTube named Phoenix. Go check it out and give it a like. These guys certainly have a great rock sound!

No Weapon Formed

CCISD Career Day 2014

Last night the I participated as a representative for computer programming at the Clear Creek ISD College and Career Fair night. The Clear Creek school district offers a number of programs that encourage students to jump start their future education and careers. The job fair is a way for students to talk to actual practitioners in their field of interest, or even learn about opportunities they may have never known about.

Last night was quite a success in my book. There were almost 100 tables representing business & marketing, agriculture, science and technology, education, transportation, and health services. Many tables had flashy backdrops, table covers, literature and demonstrations. I didn’t quite have the flash, but I did have a small presentation running on a loop on my giant gaming laptop, which can be found here.

I was originally concerned I would not have many visitors. Programming isn’t considered to be exciting by a lot of people I know. That concern was unfounded. I had a busy night! Lots of kids came by asking a wide array of questions, from “how much money will I make” to the student who is already teaching themselves or in Computer Science Pre-AP classes. I was very impressed with some students and their drive to learn on their own, asking great questions for advice on ways to learn even more.

I had a great time, and look forward to doing another if the opportunity arises. And maybe next time I’ll make some flashy booth backdrops!

Adam at Career Day

A Go Weekend Puzzler

Adam Cameron posted a code challenge on his blog this last Friday. I have provided my answer in the form of a Google Go project. For those interested a 10,000ft view of how this works can be found below. Here are the instructions he provided.

For a given array and a given threshold, return the subarray which contains the longest run of consecutive numbers which - in total - are equal-to or less than the threshold.

  • The main program is a console application that accepts two arguments:
    • input - A comma-delimited list of integer numbers
    • threshold - The total value an array sequence may not exceed
  • A Scheduler component (probably a bad name) starts slicing the input integer array into sub-sequences
  • Each sub-sequence is summed in a goroutine
  • The sub-sequence is totaled, and both the sub-sequence and total are put into a structure that is written to a channel
  • Another goroutine listens for writes to this channel and stuffs the structures into a result array
  • The result array is traversed to determine which sub-sequence is longest.
    • If there is a tie for longest the sub-sequence with the greatest total sum value is chosen

I chose to make the slicing and summing activity multi-process mostly for the fun of the exercise. Though in theory one could provide a very large set of integers and it would process rather quickly I suspect. Either way this was a fun exercise. You should certainly go check out the blog post and see other people’s submissions. There are entries in language including Clojure, CFML, PHP and JavaScript.

Writing Your First Sublime Plugin [link]

Earlier this year I wrote a guest post for the web site This post walks you through your first time writing a plugin for Sublime Text, the most superb text and code editor. Sublime plugins are written in Python. If you’ve never written any Python before don’t let it stop you. Python is an easy language to get into and you will find the experience most rewarding. So if you’ve ever considered writing your own plugin for Sublime Text read my article over at Cheers, and happy coding!