Ruby vs Go - Structuring Data

I’m trying to write a Taskpaper parser in Go.

A very basic Taskpaper file looks like this:

- Mow the lawn
Don't hit the flowers

- Fix all the bugs
Seriously, all the bugs

Projects end with a : and tasks begin with a - and any line that doesn’t have that is a note. Projects have tasks and notes and tasks can have notes.

I got totally stuck yesterday on how to structure this data in Go.

If this was Ruby I would do it like this:

class Item
  attr_accessor :parent
  attr_accessor :notes

class Project < Item
  attr_accessor :tasks

  def initialize(desc)

class Task < Item
  def initialize(desc)

class Note < Item
  def initialize(desc)

An Item holds generic fields and then there’s a Project, Task and Note classes.

In Go there’s no way to say that a Note struct has just a generic Parent i.e. Parent *Item. To work around this I had to create a ProjectNote and also a TaskNote:

type Item struct {
  Desc string

type Project struct {
  Tasks []Task
  Notes []ProjectNote
  Tags  []ProjectTag

type Task struct {
  Notes  []TaskNote
  Tags   []TaskTag
  Parent *Project

type ProjectNote struct {
  Parent *Project

type TaskNote struct {
  Parent *Task

It feels a bit wrong to break these out like this but that’s probably because I’ve been stuck in the OO world of Ruby and Java for too long.

Brief Thoughts On Task Management

  1. No task management means you’re completely interrupt driven. Whatever email arrives or whoever stops by your office always gets first priority. A lot of bosses will reward you and promote you for this because you’re reacting to their every whim, but that doesn’t mean it’s the best for the company. No task management means you’re not working on anything that’s important yet not urgent (at least not yet). There’s no goal-oriented, strategic thinking there.
  2. Paper task management lacks the far future tasks (like sign up for a conference three months from now) and recurring tasks that make digital powerful. It also lacks scalability, if you’re managing a hundred projects1 paper will make it impossible. Though, maybe if life starts going past what can be managed with paper than it’s too complicated? Maybe there’s something to be said about putting a physical limitation on how many projects you can juggle at once; if managing your life with paper is sufficiently annoying it will encourage you to cut things out.
  3. Digital task management lacks the physical limits that paper has, so cruft builds quickly. You have to constantly trim, review and cut to keep it from getting out of hand and out of date quickly. It tends to attract way more things than you can possibly get done in a year and since its not taking up any space in the physical work you’re more apt to let those far out tasks stick around in the system for longer and longer.
  4. Digital task management also lends itself well to switching between multiple apps. If you’re doing paper task management and you’re switching between notebooks or from a Franklin-Covey planner to a Hobonichi Techo you will have to rewrite at least everything that’s going into the future and then carry the other one around to reference for the past information until you’ve switched for long enough. It’s all too easy to switch between apps once a month (which is a great form of procrastination) and never land on one you fully adopt.

All of that said, I’m using Todoist and I’ve committed to it for a year (to avoid switching to whatever the new and shiny thing is that just came out). The way they represent projects makes having too many painful which I think is a good thing. Omnifocus allows for too many projects and would be way too fiddly for my personality (especially since you can script it).

  1. Not unheard of if you go by the GTD definition of a project.

Taming Nightstand Device Charging

Like most modern-day geeks I have too many devices that need to be recharged regularly. The constant accumulation of new wall warts has turned into this situation next to my nightstand:

Powerstrip with all wall warts

I decided to use one of the new desktop USB chargers to get this mess of cords cleaned up.


Having it sitting onto of my nightstand really didn’t solve the problem so where’s what I did.

Materials List

First attach the charger to the back of your nightsand using a 3M strip. You’ll have to figure out the best height for your cord lengths:

3M Attach Charger

I used a USB extension I already had laying around for my Fitbit charging cord since so short:

USB Extension

Slot the cords through the Quirky Cordie:


Plug it all in:


And here’s the final product, much neater. The extra cord length drapes down the back along with my surge protector:


Running Teamspeak 3 Server As a Regular User

In my previous article on How to run Teamspeak3 on Digital Ocean the instructions have you create a teamspeak3 user and change ownership of the files. I noticed in some of the comments over there that people noticed it was running as root, not the greatest thing for security.

I noticed my server was also running as root, here’s how to fix it if you used my instructions:

Shut down Teamspeak:

sudo service teamspeak3 stop

Remove the /etc/init.d/teamspeak3 soft link:

sudo rm /etc/init.d/teamspeak3

Now edit /etc/init.d/teamspeak3 and set the contents to this:


su -c "/usr/local/teamspeak3/ $@" teamspeak3

Set the file to be executable:

sudo chmod u+x /etc/init.d/teamspeak3

Fix permissions, many of the Teamspeak files are probably owned by root now which would prevent the server from starting:

sudo chown -R teamspeak3:teamspeak3 /usr/local/teamspeak3

Start the server back up:

sudo service teamspeak3 start

Use your client software to connect and make sure everything is operating properly and you’re done.