Masked Input 1.4.0

This release of my masked input plugin has been a long time coming. I managed to neglect the project for a while with the birth of my daughter and let the issues and pull requests pile up. I still have over 30 issues out there. It's still not great, but considering there was 90 issues at one point, I'm feeling pretty okay with things. Several of the issues remaining are ones I created for cleaning things up , so that's a good sign. There are a lot of features that people want and I need to consider what I'm capable of maintaining going forward. More on that in a coming post.

Huge thanks to Jared Barboza (@codeimpossible) for helping me work through the massive amount of issues. It's a lot of work to manage an OSS project that people use. It's even worse when you neglect it for a while. :(

This release covers about 40 issues. Most of the issues were bug fixes with a couple of features added. The highlights in no particular order are:

  • Better placeholders - You can now define a placeholder 'mm/dd/yyyy' for a date input and that will be used instead of the default underscore placeholder.
  • Better management of readonly inputs
  • AMD/CommonJS Support
  • Bower support
  • More bug fixes than I want to admit. ;)


There are still an issue outstanding with android and certain keyboards, hopefully that will be resolved soonish in newer versions of chromium. I'm still trying to come up with a workaround for current versions. Regardless, the plugin was broken in a few other ways and I didn't want to hold up a release for this android issue.

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.


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 = {
viewmodel.url = ko.computed(function(){
    return '/foo/';

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:// && 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@ \;
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:
        maxconn 2048

        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 check
        server riak2 check
        server riak3 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 check
        server riak2 check
        server riak3 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.

Next Page »