2012
10.17

Teaching Git

For the longest time, the company I work for has been using CVS to track their source code. While it works (most of the time), CVS is widely considered obsolete. A few months back I suggested we switch our source code tracking over to Git, and they picked it up and ran with it. We are slowly transitioning things over.

Git and CVS, while they aim to achieve the same goal, do have some significant differences. In order to ease the transition for the rest of the developers, I ran a few training sessions. I based the majority of my talk on “Git For Ages 4 and Up” by Michael Schwern, a fantastic talk using Tinkertoys to show how a Git repository grows. I didn’t have any Tinkertoys, but I did bring in a bunch of K’Nex, enough for everyone to follow along. I think using something physical really helped keep people engaged a lot better.

If anyone wants me help them out with a similar talk or just wants to chat about Git, I’m always up for talking about it.

2012
08.01

A few weeks ago I was hanging out at SkullSpace and a group of fellow makers were working on their Arduino controlled hi-fi setup. They already had all the hardware for the setup constructed and were working on the interface when they realized that a soft-shutdown mode would be useful for saving state. Unfortunately, the power controller in the system just cuts power to the transformer that provides the Arduino 5 volts. We figured out a solution to this problem and I thought it was pretty clever, so I thought I would share it.

The power controller module used in the system takes input directly from a momentary switch and uses that to toggle a relay that passes mains power to the system’s transformers. The controller circuit operates at 12V and as I understand was chosen to allow a wider variety of fancy lower voltage buttons and power LEDs to be used. Getting the Arduino to act as a momentary switch (via transistors or relays) works fine for powering the unit down once settings have been saved. However, the actual physical power switch needs to work directly with the controller when the system is off, but talk only to the Arduino when the system is on.

To do this, we decided to hook the power button up through a DPDT relay that is switched directly by the 5 volt supply. This way, the button is connected to the power controller when the system is off (ie. no 5 volt power is present) and then once the system is on, the button is connected to the inputs on the Arduino. Since the relay physically switches the button between circuits, it doesn’t really matter that one circuit operates at 12 volts and the other at 5.

In my schematic, I assume that the input pin on the Arduino has the internal pull up resistor activated. I also assume that the relay can be driven directly by the Arduino, which often isn’t the case. You will likely need to use a transistor to drive the relay. Note that thus far the circuit is untested and should be used at your own risk.

For those interested, my schematic is available in gschem format here.

2012
07.28

Last weekend my wife and I made ourselves made a new coffee table (well, more like we helped my dad make it for us). As you can see, our table comes with a door knob, a relic from its past life. A few weeks ago we stumbled upon another’s efforts to repurpose a door into a table and decided to try for ourselves.

My father-in-law already had some old doors sitting in his basement, but they were single panel doors. In order to get a cleaner look I decided that we should miter the cut and make the table look like it had just been folded over.

Since we have a rather long couch, our original idea was to use two doors: one for the table top and one side, the other for a shelf and the other side piece. However, after measuring to see how much longer this would make the table, we realized that we would only gain about 15 cm as we would still be cutting off the top and bottom to get us our folded look. Once we added in the fact that the second door was in much worse shape and was actually slightly narrower, we decided the extra effort wasn’t worth it so we ended up just using the one door.

At this point, we were still thinking we wanted a shelf and possibly also feet. One advantage of using a single panel door over a multi-panel door is that the height is much more flexible. We aimed to have the height of the table be slightly shorter than the couch seat height to allow for the addition of feet, but after a minor measurement error, we ended up with the table being almost the exact height of the couch. This turned out to be a blessing as, once we had the table assembled, we realized that we liked the looks of the table without feet or a shelf.

The one down side to using a single panel door is that the centre panel is not very strong, but it makes up the majority of the table top. In order to help solidify the top in case someone decides to sit on it or something, we added a few 2×4 support pieces to the underside of the table.

So far we have decided not to add a shelf as the look of the table is currently quite clean and has enough room for us to store some baskets full of board games. We still have some finishing work to do (fill in some of the joints and screw holes with wood filler, re-stain the heavily sanded corners and support beams, etc) but for now it is in service and we are really enjoying it.

2012
07.25

Over the past few weeks I have been working on tweaking a bunch of configuration files (aka “dot files”) for programs I regularly use, primarily those used on the command line, and I now have things working really well. Part of the reason for this recent effort is my switch from the bash shell to zsh. I don’t want to get too much into the “why” of that, but the main driver for that change was improved completions and other fancy features. I found a couple of really neat tricks to improve the usability of zsh. One was syntax highlighting while typing commands, another was toggling the cursor colour to red when in vicmd mode. While both are really neat tricks, I just cannot get things to work with my setup 100%.

For the syntax highlighting, I found that on at least one of my computers, enabling the “root” highlighter would cause every key stroke to emit an annoying beep while acting as a normal user, and then just wouldn’t work when root. The highlighter basically just inverts all colours to emphazise that you are in a special mode, which is nice, but I can live without, so for the time being I have just disabled it.

The vicmd cursor colour trick is a little more frustrating. I really like the extra feedback it gives to the user. It even works for me most of the time. The problem I’m having is that when I have it enabled and I am using tmux (a terminal multiplexer, similar to screen) and I am using all that inside gnome-terminal, I occasionally get a beeping sound and an escape code 112 gets printed to the screen. This code is emitted by tmux when it wants to reset the cursor colour to default, usually performed when the tmux status bar updates. Unfortunately, gnome-terminal doesn’t know what to do with this escape code, so it just prints it to the screen and beeps at you. One person online said that gnome-terminal does this on purpose to emulate xterm, but when I tried this in xterm, everything worked as expected. I tried for a little while to get xterm to do all the things I was used to having in gnome-terminal (URL detection, copy/paste without using the mouse buffer, paused tty scrolling, proper unicode display, decent font, etc.) but that was just more of a headache.

For now, I’m just disabling the vicmd cursor highlighting when I’m using tmux. I had been planning to switch from using gnome-terminal tabs to using tmux locally (right now I’m just using tmux on my remote connections). If I do make that switch, I’ll basically lose the vicmd colouring completely. What I need to do is find a way to get tmux to suppress the 112 escape code, get gnome-terminal to just ignore the code, find a less frustrating way to move away from gnome-terminal, or at the very least detect that I am both within a tmux session and gnome-terminal (which might not even work when reconnecting to a tmux session). I’ve been fiddling with this for a few days now and can’t seem to get a proper solution and just felt like ranting about it. If anyone has any suggestions for fixing this problem, I’m all ears.

2012
06.26

Recently I’ve been thinking about how I’d really like to make more progress on my projects and how I feel some amount of accountability would help with that. To that end, I’ve decided to start posting regular updates of my projects! Normally I like to save them up and reveal them once completed, but I think seeing feedback from readers will help to motivate me to continue moving forward on projects that might otherwise sit on the workbench for weeks, plus some people might be interested in the details of my design process (at least I might some day in the future, looking back at these posts).

To start things off, I’ll write my first progress report on my bluetooth Kinesis mod. Earlier this year I wrote about my new-to-me keyboard, the Kinesis Essential. I have a few friends who also have this style of keyboard and one of them asked me if I could convert it to bluetooth for him. We did some brainstorming, ordered some parts, and now I’m ready to start prototyping.

My friend’s Kinesis is one of the newer, USB variants. However, it turns out that the new and old boards just use a common main board and the new ones add a USB hub with an integrated PS/2 to USB converter. Since PS/2 is a pretty simple protocol, we decided to start his mod off there; a PS/2 to bluetooth converter. I later plan to replace the whole keyboard controller in my board for better battery life and mouse integration (and to further confuse people who try to use my keyboard) but that will be phase two of the project.

To get the prototype going, I’m just using an Arduino and a PS/2 socket breakout board from SparkFun. As I’ve mentioned before, I’m an avid vim user. As a vim user (and not a masochist, despite what you might know about vim), I think the Arduino programming environment is terrible, so the first thing I did was set myself up with an alternate environment in which I could stay sane. I added Arduino filetype detection to my .vimrc, found a way to build and upload code using vim’s :make command (I chose the scons method described here), and copied the PS/2 Arduino library (found here) into my project directory since the scons setup didn’t seem to find it in the default location. From there, I loaded up the example PS/2 to serial sketch and got the Arduino to read from my Kinesis! Now I need to get a simple proof of concept for my bluetooth module going and then I just need to blend the two together.