Category: Computing

August 2nd, 2013

Adventures in Pair Programming (Part 2)

A few days ago I had my first remote pair programming experience which got some real work done. Dave Doyle had set up the Toronto Perl Mongers meetup group, and we thought it might be good to deal with at least one issue with our web site.

One tool which I first heard about on the Wide Teams podcast was Screenhero. I had had a couple of opportunities to use it at work for code reviewing, and this was the first time I was going to try real development.

Using Screenhero was a real pleasure, the fans on my MacBook Pro sometimes leaped into high gear, but the performance of sharing multiple windows in both directions while having a Skype video chat running was never a problem. There were a few times when the remoteness of the other machine intruded, but it was a very natural feeling experience. We could talk and gesture with our mouses (micen?), roll our eyes or give thumbs-up, and Screenhero didn’t get in the way of solving the problem. We tried a few things, explored some dead-ends, and came to a conclusion quite easily.

Definitely a positive experience.

July 28th, 2013

No Adventures in Pair Programming (yet…)

Both pair programming partners have yet to pair with me. I have learned a few things getting my infrastructure set up, and I’m getting impatient to try it!

July 20th, 2013

Adventures in Pair Programming (Part 1)

Recent lifestyle changes have left me with more energy and desire to learn, so I am looking into doing some remote pairing with some friends in the city. I expect that working with people I already have a relationship with will help get the kinks out of my setup, and then I can look to people further afield.

One thing I think I’ll miss is the food and beer afterwards, but that might be an advantage from the perspective of my wife and my doctor!

The current plan is to get a droplet or two at Digital Ocean – they have SSDs and per hour pricing – and maybe do some pairing as I work through Michael Hartl‘s Rails tutorial.

This has a couple of benefits for me:

  • My progress on the Rails tutorial is open to others, and that helps keep me honest
  • I have an excuse to start exploring Vagrant and Puppet in my own world as ways to build and provision machines

For now I have some simple scripts at https://github.com/mikestok/pairing-vps which I use to build a VPS. There are lots of routes open to improve them, and I want to get the pair programming experience first before burning hours on perfecting a useless system.

July 14th, 2013

The Joy of Concrete Automation

In the Pragmatic Programmer the section on Ubiquitous Automation starts with this quote:

Civilization advances by extending the number of important operations we can perform without thinking.

  • Alfred North Whitehead

I understand the reasons why automation is an essential aid to software development, yet there’s a part of me which likes the familiarity and order of going through a well rehearsed set of physical actions which rely more on muscle memory than though.

Recently I read David SparksPaperless, and soon after that I surveyed some of the piles of paper in the basement. Thinking “I’ll give it a go…” I armed myself with a Fujitsu ScanSnap and a copy of Hazel. After a few minutes I had things set up so with one push on the scanner’s blue button a bank statement would be slurped in, Hazel would read the OCRd PDF and find the statement’s end date, and file it away in the right directory (backed up by time machine and BackBlaze).

This is automation which I get – there is a physical pleasure in the feeding of the paper, pressing the button, and watching the computer do its stuff. The computer handles the tedious stuff, and I indulge in pleasant rhythmic work which achieves an end I care about.

Once I have worked through the physical backlog I get to set up rules to file my electronically delivered statements in the same folders, again using Hazel to watch my download folder for interesting documents.

Out of a couple of hundred documents I have scanned so far I have had to manually intervene for less than a dozen, usually the statement had been creased through the date so the OCR hadn’t picked it up. I am pleasantly surprised by the ScanSnap’s speed and accuracy.

A part of me would love to feel the same pleasure from developing automation at work, the rational part of me says to be happy with what I have!

July 7th, 2013

Vagrant: Up and Running – a review

Vagrant: Up and Running is a relatively new book from the reliable O’Reilly stable. The author of the book and creator of Vagrant, Mitchell Hashimoto, says: “Vagrant is a tool for building complete development environments, sandboxed in a virtual machine.”

This is a short and dense book. It can be read “cover to cover” to get a good overview of the whys, hows, and details of Vagrant; it can be used as a reference – although you should keep an eye on the source as Vagrant’s a living project.

For me the book provides a solid foundation for day to day use of Vagrant, with plenty of guidance for getting into more advanced usage. Automation is encouraged by Vagrant’s workflows, and Vagrant plays well with Chef and Puppet to provision systems. There are no obvious gaps in the book from my perspective, it covers a lot of ground in a relatively slim volume (196 pages on my iPad, 156 pages in paper according to O’Reilly).

To me the big benefit of Vagrant is that you can provide a project with a base box and a Vagrantfile, and any contributor will be able to quickly and easily bring up a standard environment in which to develop and test. This can eliminate any number of “…but it works on my system!” type problems.

The book explicitly states The Tao of Vagrant which essentially means that developers and systems operations engineers are all able to use identically built systems in VMs while still able to use their favourite tools and workflows on their development hosts. These systems are easy and quick to mint. The book works its way from simple set-ups to more complicated examples using multiple virtual machines networked together. By the end of the book you have been exposed to Vagrant plugins, and you will most likely have enough of its concepts under your belt to navigate the source (even if you’re not yet familiar with Ruby).

There is some repetition in the book which makes it easier to use as reference, but seems a little odd when reading it end to end. As there’s no filler in the book this is not an issue in my eyes.

If you need to distribute environments which can be run inside virtual machines to developers, testers, or deployers then Vagrant is a tool worth a long hard look, and Vagrant: Up and Running is a great kickstart and reference guide.

July 7th, 2013

Discipline (is a Vehicle for Joy)

My revisiting Ruby and Rails is moving ahead well, each week day I spend an hour or so to do a couple of Vitamin R sessions to work through Michael Hartl’s Rails Tutorial. Progress is good, and the content seems to be sticking.

The difference in approach this time to my last attempt is that I do it first thing in the morning, getting up an hour earlier to make myself some time, and I don’t do anything before it except make a cup of coffee. This means I don’t get distracted by news, email, software updates, and all those other things which can sap energy, and I have some focus. This is a qualitatively different experience to trying to squeeze in an hour at the end of the day, at the end of the day I’m tired and work’s irritations and frustrations have clouded my mind, and I don’t have that much focus available for tasks regardless of their fun or interest.

A side benefit is that it is re-energizing me to review books, and work through some of the more interesting looking ones because I have a sense of progress from my hour’s disciplined work in the morning.

The books I’m looking at now are the Ruby Rogues‘ next book club book – Understanding Computation, and Avdi Grimm‘s Much Ado About Naught.

June 28th, 2013

Building Ruby 1.8.7-p374 on Mountain Lion (and Mavericks) under rbenv

New versions of ruby 1.8.7, 1.9.3, and 2.0.0 came out recently to fix a security issue, and for the first time I have tried building an old (1.8.x) on OS X 10.8.4 (Mountain Lion).

I tried rbenv install 1.8.7-p374, and it ended like this:

Installing ruby-1.8.7-p374...

BUILD FAILED

Inspect or clean up the working tree at /var/folders/f3/6zk_yypd73jc88n1p6ww2f_00000gn/T/ruby-build.20130628064809.97811
Results logged to /var/folders/f3/6zk_yypd73jc88n1p6ww2f_00000gn/T/ruby-build.20130628064809.97811.log

Last 10 log lines:
tcltklib.c:9862: error: expected ‘;’ before ‘event’
tcltklib.c:9892: error: ‘struct dummy_TkMenu’ has no member named ‘menuType’
tcltklib.c:9897: error: ‘struct dummy_TkMenu’ has no member named ‘menuType’
tcltklib.c:9915: error: ‘event’ undeclared (first use in this function)
tcltklib.c:9916: error: ‘ConfigureNotify’ undeclared (first use in this function)
tcltklib.c:9917: error: ‘Tk_FakeWin’ has no member named ‘display’
tcltklib.c:9919: error: ‘Tk_FakeWin’ has no member named ‘window’
tcltklib.c:9920: error: ‘Tk_FakeWin’ has no member named ‘display’
make[1]: *** [tcltklib.o] Error 1
make: *** [all] Error 1

As X11 is no longer part of the OS I had to install XQuartz to get the X11 headers and libraries installed, and I needed to add CPPFLAGS=-I/opt/X11/include/ to the command line:

1
CPPFLAGS=-I/opt/X11/include/ rbenv install 1.8.7-p374

This worked fine, the only other change I needed to make was to comment out pry-plus from my ~/.rbenv/default-gems to build and install this old version of ruby.

I hope this helps somebody out there save a couple of minutes!

(Edited 2013-10-26 to include Mavericks in the title and body, as it works on that too)

May 27th, 2013

Getting Back on the Rails

I have had a few months break away from doing software development, and the time has firmed up some of my prejudices about the type of people attracted to various technologies. So without further ado it’s time to plunge into Michael Hartl’s Ruby on Rails Tutorial, and see if I can get my development environment humming again.

So the plan is to spend about an hour a day going through it and seeing what I can learn about the new rails and the new ruby.

For my initial set-up I’m using rbenv and ruby-build to give me control over ruby versions – I have used rvm very successfully in the past, and want to try something new. As there aren’t gemsets I need to resort to a little trickery inspired by a stackoverflow answer.

My ~/.rbenv/default-gems contains:

1
2
3
bundler
pry
pry-plus

My ~/.gemrc contains:

1
2
install: --no-rdoc --no-ri
update: --no-rdoc --no-ri

So to create a new bundler-ready rails project I need to do something like this to make sure rails is installed per-project, and not in my rbenv’s ruby’s “global” environment:

1
2
3
4
5
6
7
8
9
10
11
12
project_name=test-project
ruby_version=2.0.0-p195
rails_version=4.0.0rc1

mkdir $project_name
cd $project_name
rbenv local $ruby_version
echo "source 'https://rubygems.org'" > Gemfile
echo "gem 'rails', '$rails_version'" >> Gemfile
bundle install --path vendor/bundle
bundle exec rails new . -f --skip-bundle
bundle install

This has been bundled up into a simple bash script in ~/bin/nrp (new rails project…)

Let’s see how this goes…

June 24th, 2012

Getting .mp3 Files into iTunes as Podcasts

Recently I purchased Avdi Grimm’s Objects on Rails “sponsor edition” to get the special extra – a long interview with Sandi Metz. This comes as a big .mp3 file.

I happily use iTunes to organize my audio content, and dropping the interview in the Library section of iTunes stores it in my music library. I find having a two and a half hour track stored as a “normal” track a little inconvenient. iTunes doesn’t remember where I got to in a “normal” track the next time I play it, yet for podcasts iTunes does remember where I got to, and better still rewind a bit when I resume listening to them.

To let me listen to the interview in chunks I would like iTunes to treat it as if it were a podcast.

A DuckDuckGo search yielded http://dougscripts.com/itunes/scripts/ss.php?sp=readdaspodcast which I visited.

I installed the script file in ~/Library/iTunes/Scripts and turned on web sharing. It didn’t seem to work, so I went to
http://hintsforums.macworld.com/showthread.php?t=80130&highlight=leopard+personal+web+sharing – point 5 suggested creating a /etc/apache2/users/local.conf containing:

1
2
3
<Directory /Users/*/Sites>
  Allow from all
</Directory>

Which then let me go into iTunes, select the mp3 in the music library and import it as a podcast by selecting the Re-Add Selected Track as Podcast from the AppleScript menu.

Now I have the Sandi Metz interview in a useful state, I donated a few dollars to Doug Adams (thanks Doug!) and turned off web sharing on my laptop.

March 5th, 2012

The Right Tool for The Job

I have been experimenting with different tools to try and replace my paper-based notebooks I used to use at work as lab logs. For a while I was getting quite frustrated trying to make the DayOne app do everything. Then it struck me: DayOne is a journaling application, and having seen my boss using Evernote I decided to give Evernote a try again.

A week into the experiment things are going much better, I am trying to make at least one journal entry a day in DayOne (with a regular review at the weekend, that’s a subject for another post…) and I’m slowly loading stuff into Evernote.

Now I want to see if I can get into the habit of using Workflowy as well, and see how to use it effectively. Despite a month or two of trying to make it work it seems that their way of thinking and my way of doing don’t seem to mesh.

The best thing is that all these tools mean that my notes are to hand wherever I have a computer or my phone, and it’s a lot easier to search documents than paper.