Sunday, 21 October, 2012 —
civics
With the November election in just another couple of weeks, it’s past time for me to get ready for early voting. In my last post, I pointed out info regarding early voting and registration info. Hopefully you’re already registered. If not, you can register and vote at one stop voting in North Carolina until Nov. 3.
What about selecting candidates? On my ballot, I have 32 offices and one bond referendum to vote for. Twenty one of those offices are contested and of those, only three have a third-party (Libertarian) or unaffiliated candidate. Several judicial races are uncontested. The race for North Carolina attorney general is also uncontested. That’s a pretty sad state of affairs, partly related to North Carolina’s ballot access policies.
Outside of the presidential races, I have a fair amount of research to do. I use a mix of candidate websites and voting guides.
Checking around today, here’s what I found that covers North Carolina broadly, the Triangle or Raleigh:
My own approach is going to be breaking up my sample ballot into chunks and researching three or four races a day, instead of trying to get through everything at once.
Tuesday, 9 October, 2012 —
civics
On November 6, 2012, you need to vote. Not just for president, either.
In North Carolina, there are races for governor, lieutenant governor and other Council of State offices, state legislature, congress, judgeships, county commissioner, etc. The down ballot races get far less attention, but it’s more likely that your vote will matter more. Please take the time to get ready.
First, If you’re in North Carolina and you have not already registered, you can do so until Oct. 12. Starting Oct. 18, you can vote early. If you haven’t already registered, you can register and vote the same day. See the NC Board of Elections site for more. In Wake County, visit the county Board of Elections early voting site for more info.
Second, know how you’re going to vote before you go. Research. In the Triangle, the N&O has a voting guide prepared by the NC Center for Voter Education.
Third, know when and where you’re going to vote Nov. 6 or through early voting.
No excuses, check your schedule, make sure you can vote, then make sure you’re prepared to vote. It matters.
Sunday, 9 September, 2012 —
photography
travel

I’ve finally started editing photos from our June trip to Montréal. The photo above is along waterfront, south of the old port, looking across a quay to Habitat 67, a housing complex built as part of Expo 67.
Our friend and host for the week, Igor, showed us around different parts of the city our second night in town, and we drove by Habitat 67. It was rather striking.
Later in the week, photo walking the Pointe du Moulin site, we were given a hint to walk around Silo No. 5 by a couple of guys walking a dog and, through a bit of a fence, and we’re at the end of the pier Silo No. 5 sits on and Habitat 67 is right across the water. In a nice coincidence after we got back from Montréal, Stars announced The North the album cover for which features Habitat 67. It’s well worth a listen.
I have a small, but growing, set of Montréal photos over on Flickr. Check it out.
Saturday, 8 September, 2012 —
development
utilities
I occasionally have a metric mumbleton of browser windows and tabs open, particularly if I’m digging into a research topic. In the past, if I’ve needed to close out windows or tabs, but have wanted to keep the context, I’ve gone to each tab individually and saved the URL to a file.
In the last week, I found myself with about five windows and 45 tabs, so my typical approach strikes me as insufficiently lazy. So, I was going to find or write something to handle the task for me. My initial Google research didn’t turn up the sort of AppleScripts I fully expected to exist. So, it looked like I was going to be writing AppleScript myself.
I found some code in a similar area and I reached my typical wall with AppleScript. At some point, I should actually solve a problem with AppleScript, but instead, I used the rb-appscript gem and wrote a Ruby script that interacted with the Safari AppleScript dictionary, based on a concept I saw in a StackOverflow post.
Here it is:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
| #!/usr/bin/env ruby
require 'appscript'
require 'yaml'
include Appscript
safari = app 'Safari'
url_list = safari.windows.tabs.URL.get
url_list.flatten!
dt = DateTime.now
date_format = dt.strftime("%F_%H%M")
list_path = "#{ENV['HOME']}/saved_urls_#{date_format}.yml"
File.open(list_path, "w") do |f|
f.puts(url_list.to_yaml)
end
|
This is also available as a syntax-highlighted GitHub Gist.
It’s nothing magic, but just the sort of simple utility that solves a small problem for me.
Saturday, 8 September, 2012 —
git
development
Last week at work, I was trying to diagnose apparent trouble with a Git repository. Whenever the infrequently updated repository was cloned, we would end up in a different branch than our devel branch. Not knowing if there was a problem in the remote bare repository, I dug around refs/heads and HEAD on both the remote repository and in a fresh local clone. Not seeing any apparent trouble, I Googled.
I came across the following mailing list post that explained my trouble:
… the git protocol does not expose which branch HEAD points to, only
which commit. So if two branches point to the same commit, git just takes
the first branch and points the local HEAD to that.
How we ended up in that situation is like this:
- Starting with an existing repository, create a branch off of master or whatever other branch you treat as your default HEAD
- NB: We use devel as a historical artifact
- Publish the new branch to the remote origin
- Clone the repository somewhere else and examine the new clone. There’s a good chance the new repo will be using the new branch instead of master
I created a GitHub repository to demonstrate (although there’s no guarantee you’ll get the new branch on clone).
1
2
3
4
5
6
7
| $ git clone https://github.com/base10/branch-head-examples
(add files)
$ git push
$ git branch feature
$ git push -u origin feature
|
Now, I’m going to look at a fresh clone:
1
2
3
| $ git clone git://github.com/base10/branch-head-examples.git clone-example
$ ls clone-example/.git/refs/heads
master
|
So, I didn’t get feature. If however, in your clone, you saw this …
1
2
| $ ls clone-example/.git/refs/heads
feature
|
… you would just need to do this:
1
2
3
4
| $ cd clone-example
$ git checkout master
Branch feature set up to track remote branch master from origin.
Switched to a new branch 'master'
|
Now, diff the refs/heads files:
1
2
| $ diff .git/refs/heads/master .git/refs/heads/feature
$
|
Getting an unexpected branch from a repository in this state isn’t harmful. It is a little disconcerting if you’re looking at a repository you established, but don’t work with frequently. I suspect this case is more likely to come up under the following circumstances:
- You don’t have a master branch at all (which might be true if you’ve converted a Subversion repository) or master is a dead branch
- You have a mainline of development and create a release branch from the mainline of development
- The repository, with all branches, is pushed
- The repository is later cloned, with no further changes.