Podcasted Out

One of the things developers do well is obsess about how to be better developers. The proof is with how much content one can get on the topic: Blogs, link blogs, screencasts, podcasts, presentations, code samples, open source projects, and books (Oh, so many books I've bought and will never read completely.) Even if technology stopped advancing, there is more content out there than any one person could ever consume.

Recently I was talking about this with my friend Calvin. I told him about some of the podcasts I've started listening to and I'm so glad that I did. He gave me a few more and now I've got a enough non technical content to fill 4-5 hours of commute time weekly. Goodbye tech podcasts, I'm using those hours to ponder on new things:

The past few weeks of commuting have been pure awesome because of the above shows. I spend most of my awake time thinking about software and I was just burnt out on listening to people talk about it. After a while, it started to feel like every episode is just a repeat of the same things from a few years back. It's refreshing to hear stories about things I've never thought about. There is more to life than writing code.

Do you listen to any podcasts that stand out? I'd love to hear about them.

Bonus: Calvin insisted I listen to the This American Life episode "The Ghost of Bobby Dunbar" from 2008 and it did not disappoint.

Creating a Culture of Learning

We have a very special user group in Nashville, NashFP. I didn't start the group, that credit goes to Bryan Hunter, though I did manage to wander into that very first meeting where none of us knew exactly what to expect. I got hooked and it has become one of my favorite events to attend monthly. I've seen the group evolve from that first meeting, and there are a few things that I think make this group extra special.

We don't have dinner. Our sponsors bring in a few snacks and lots of coffee to keep stomachs from rumbling and that's it. We're here to work and learn, not shove greasy pizza and soda down our throats.

We don't have monthly presentations. The focus of a single meeting is never dominated by a single person. Every month is a grab bag of labs and micro presentations. In any given meeting it's basically a guarantee that you are going to be exposed to something new.

We don't have monthly agendas. Because we have such a variety of things going on, every month is going to be different from the last. Meetings aren't planned months in advance because the group is driving the direction.

We write code. Everyone brings a laptop and their favorite text editor. If you don't show up with a laptop, you pair up with someone. You don't learn skills from a powerpoint presentation. Videos and presentations prepare you to do the real learning as you fumble through coding exercises.

We share. Everyone eventually gets in front of the group and shares something they've done, something they're doing, or something they're stuck on. It's not forced, but if you participate in our group for any length of time I feel confident that you will feel comfortable hooking up to the projector and giving a quick talk. The bar is low, 10 or 15 minutes is common. No slide deck needed - just show some code and start a conversation around it.

No Masters. I mentioned above that Bryan started the group, but he's not the only leader. That's on purpose. We have a group of facilitators who rotate responsibility for getting the monthly meeting organized. We also have a github repo where we coordinate around programming challenges, and every member is also an admin. No single point of failure.

No one gets left behind. We welcome everyone who is interested in functional programming. Being a functional programming group is broad enough to guarantee that everyone is a n00b at something. No one is judgemental, because we know that we all have a lot to learn. If someone is stuck, those that aren't will become assistants and help that person catch up.

I haven't mentioned this yet, but we do this every month FOR 3 HOURS. By the end of the meeting, you'd think that people would rush out the door, but it's quite the opposite. Frequently meetings "end" and we're still going.

02f0bc83b39d7e2a6c0b351abe2b9125

If you are interested in functional programming and you happen to be close to Nashville, then you owe it to yourself to stop by one of our meetings. You can expect to learn something and I bet you'll want to come back. If you don't live in Nashville, please consider using this as a blueprint to start your own functional programming group in your town.

Knockout.js href Binding

I've been using this simple binding lately and I just thought I'd share. Sometimes I end up needing to construct URLs from viewmodel properties. Knockout has a built in binding that gets you there, attr.

With the built in binding, you have two options. First you can create a computed property on your viewmodel to do the concatenation and then bind the href attribute to that. The javascript looks something like this:

var viewmodel = {
    id:ko.observable('12345')
};
viewmodel.url = ko.computed(function(){
    return '/foo/'+this.id();
},viewmodel);

Then your binding will look like this:

<a data-bind="attr:{href:url}">Attr with computed</a>

It's not too bad on the binding side, but having to write that extra computed observable is tedious just to concatenate a couple of strings together. We can do better.

Your next option is to ditch the explicit computed observable and do the concatenation inside your binding. Knockout will create a computed on your behalf. That looks like this:

<a data-bind="attr:{href:'/foo/'+id()}">Attr with concat</a>

I like that we no longer need the extra computed, but that binding leaves a lot to be desired. There are a lot of things we can screw up in there. Let's fix this once and for all. First, let's look at the cleaned up binding.

<a data-bind="href:'/foo/:id'">Awesome</a>

That's more like it. Now, how do we make that happen?

ko.bindingHandlers.href = {
    update: function(element, valueAccessor, allBindings, viewModel, bindingContext) {
        var path = valueAccessor();
        var replaced = path.replace(/:([A-Za-z_]+)/g, function(_, token) {
            return ko.unwrap(viewModel[token]);
        });
        element.href = replaced;
    }
};

This binding takes advantage of overload of String.replace that allows you to pass a function to be evaluated when it comes time to resolve a replacement string. We then simply use that token and look up a property of the same name on our viewmodel to supply the replacement. Hopefully you will find it as useful as I have.

Setting up a Riak Development Cluster on Ubuntu 12.04

In order to explore and fully appreciate Riak, you're going to need to setup multiple nodes. Since not everyone has 3 extra boxes around, they've made it easy to setup the nodes on a single box. I'll walk you through the steps I took to setup a development Riak cluster on Ubuntu 12.04.

The first step is to get your dependencies installed:

sudo apt-get install build-essential libncurses5-dev openssl libssl-dev
sudo apt-get install erlang
sudo apt-get install git

Next, you'll need to grab the riak source:

git clone git://github.com/basho/riak.git && cd riak

Before we build our cluster, there are few things to change from the defaults. This will turn off authentication for the admin tool (I did say this was a development cluster ;)).

sed -i 's/{auth, userlist}/{auth, none}/g' ./rel/files/app.config

Next, let's turn on riak control and riak search:

sed -i 's/{enabled, false}/{enabled, true}/g' ./rel/files/app.config

Now we're ready to build a 3 node cluster from source:

make devrel DEVNODES=3 && cd dev

Next, start up all of the nodes and join them together:

find dev*/bin/riak -exec {} start \;
find dev[2-9]/bin/riak-admin -exec {} cluster join dev1@127.0.0.1 \;
dev1/bin/riak-admin cluster plan
dev1/bin/riak-admin cluster commit

And now you have a running 3 node cluster listening on a bunch of weird ports. Let's add haproxy in the mix to expose the cluster under standard (8098 for http and 8087 for protocol buffers) ports with roundrobin distribution. First, install haproxy:

sudo apt-get install haproxy

Next, create a configuration file for haproxy (I'll name mine dev.haproxy.conf) with the following contents:

#Mostly from OJ Reeves post: http://buffered.io/posts/webmachine-erlydtl-and-riak-part-2/
global
        maxconn 2048

defaults
        retries 3
        maxconn 1024
        timeout connect 3000

frontend riak_pb
        mode tcp
        bind *:8087
        default_backend riak_pb_cluster
        timeout client 1200000

backend riak_pb_cluster
        mode tcp
        balance roundrobin
        timeout server 1200000
        server riak1 127.0.0.1:10017 check
        server riak2 127.0.0.1:10027 check
        server riak3 127.0.0.1:10037 check

frontend riak_http
        bind *:8098
        mode http
        default_backend riak_http_cluster
        timeout client 1200000

backend riak_http_cluster
        mode http
        balance roundrobin
        timeout server 1200000
        option httpchk GET /ping
        server riak1 127.0.0.1:10018 check
        server riak2 127.0.0.1:10028 check
        server riak3 127.0.0.1:10038 check

Now run haproxy -f dev.haproxy.conf and you now have a cluster listening for connections. Fire up your web browser and point it at machine:8098/admin and you should see the web interface, Riak Control, displaying your cluster status. That's it! You're ready to start learning about Riak.

This is Happening Again

Less than 48 hours until my daughter is to be born, it just hit me. We're having another baby. I mean, I've known this has been coming. For some reason though, it just became real.

I've been covered up with projects at work. I've fixed up 3 rooms here at the house. I've been consumed with a construction project here too. Now it's all done and I'm here with nothing else to distract me. 9 months has withered away and we're about to have another human to keep alive.

I'm excited to meet my daughter. I'm relieved to see my wife not have to suffer through gestational diabetes. I'm nervous to see what adding another child to our family will be like. I'm scared.

Life is scary and awesome. I'm ready to stop being distracted and start focusing on the things that are important again. I have a feeling that baby Hannah will force me to slow down a bit. :)

Next Page »