John Bohn

My thoughts on software, tech, business, and more

An Illustrated Book of Bad Arguments

Book Cover

I’ve been looking for a short read to kick off book club with and today I found what I think is just the right book. Here’s the description from Amazon:

Have you read (or stumbled into) one too many irrational online debates? Ali Almossawi certainly had, so he wrote An Illustrated Book of Bad Arguments! This handy guide is here to bring the internet age a much-needed dose of old-school logic (really old-school, a la Aristotle).

Here are cogent explanations of the straw man fallacy, the slippery slope argument, the ad hominem attack, and other common attempts at reasoning that actually fall short—plus a beautifully drawn menagerie of animals who (adorably) commit every logical faux pas. Rabbit thinks a strange light in the sky must be a UFO because no one can prove otherwise (the appeal to ignorance). And Lion doesn’t believe that gas emissions harm the planet because, if that were true, he wouldn’t like the result (the argument from consequences).

Once you learn to recognize these abuses of reason, they start to crop up everywhere from congressional debate to YouTube comments—which makes this geek-chic book a must for anyone in the habit of holding opinions. It’s the antidote to fuzzy thinking, with furry animals!

Yup. That sounds awesome. I had a brief look at it on their website too and it looks great. As of today, the book is still on pre-order (yes, I’ve already bought my copy because the illustrations look awesome). It comes out August 26th, 2014 in hardcover, but you read the book in its entirety on the “An Illustrated Book of Bad Arguments” website for free!

Installing Ruby with rbenv

The need for multiple versions of Ruby

As you work on different Ruby project over time, you’ll find that different projects projects require different versions of Ruby. To handle this, a few tools have been created. My personal favorite is rbenv. I recommend all rubyists use it even if you’re just starting out. If makes installing new versions, tying certain versions to certain projects, and much more a breeze.

rbenv vs rvm

Besides rbenv, there is another ruby version manager that has been out for some time and at one point, was the de facto standard. That tool was RVM. RVM is still fairly popular although it’s popularity is waning in favor of rbenv. Why is rbenv more popular? Because it does less. Programmers generally like software that does one thing and does it well. In terms of managing multiple versions of Ruby, rbenv just does less. More specifically, from the rbenv wiki:

rbenv does…

  • Provide support for specifying application-specific Ruby versions.
  • Let you change the global Ruby version on a per-user basis.
  • Allow you to override the Ruby version with an environment variable.

In contrast with RVM, rbenv does not…

  • Need to be loaded into your shell. Instead, rbenv’s shim approach works by adding a directory to your $PATH.
  • Override shell commands like cd or require prompt hacks. That’s dangerous and error-prone.
  • Have a configuration file. There’s nothing to configure except which version of Ruby you want to use.
  • Install Ruby. You can build and install Ruby yourself, or use ruby-build to automate the process.
  • Manage gemsets. Bundler is a better way to manage application dependencies. If you have projects that are not yet using Bundler you can install the rbenv-gemset plugin.
  • Require changes to Ruby libraries for compatibility. The simplicity of rbenv means as long as it’s in your $PATH, nothing else needs to know about it.

Installing rbenv

If you’re on a Mac, the recommended way to install rbenv is via Homebrew. If you don’t have Homebrew yet, I highly recommend it.

To install rbenv via Homebrew, just run:

1
brew install rbenv ruby-build

Now that you have rbenv installed, you need to add a line to your profile so everything loads up correctly when you start your terminal. The location of your profile varies depending on how your system is set up, but it will typically be either ~/.profile, ~/.bash_profile, or ~/.bashrc. If you’re using Zsh, it will probably be ~/.zshrc. Add the following line to your profile:

1
eval “$(rbenv init -)”

To test that it works, run:

1
type rbenv

You should get something like the following back if it worked:

1
rbenv is a shell function

Installing a new ruby with rbenv

Awesome, you should now have rbenv installed and you’re ready to roll. Well, almost ready. rbenv by itself doesn’t do much good. Let’s add a ruby version. As of this writing, the latest version of Ruby is 2.1.2. Pro tip: you can view all versions available to rbenv by running the follow from your terminal:

1
rbenv install -l

To install Ruby 2.1.2, run the following:

1
rbenv install 2.1.2

And, if you want to make that version your default global version, you can run:

1
rbenv global 2.1.2

Wrapping up

That’s it! I hope this helps you get set up with rbenv. There are a few other things that you’ll be able to do, such as installing alternate versions of Ruby (like Rubinius). If you want to learn more about rbenv, check out the README on github.

Starting to Learn Elixir

It’s been a long time since I’ve really dug into a new programming language. I think it’s probably been about two years. That is way too long. I don’t necessarily feel like I’m getting stale, but I want to at least get back on track with learning one programming language per year. This year, is going to be the year of Elixir.

So what is Elixir and why did I choose it? Elixir is described on it’s website as follows:

Elixir is a functional, meta-programming aware language built on top of the Erlang VM. It is a dynamic language that focuses on tooling to leverage Erlang’s abilities to build concurrent, distributed and fault-tolerant applications with hot code upgrades.

Besides getting back on track with learning a programming language a year, I really want to learn a functional programming language soup to nuts. I know a few of the concepts and have played around a bunch, but I have yet to really dig in all the way and build anything of any real use.

Here are few more reasons:

  • There are a few projects that I’ll be making this year that sound like the could be a good fit for Elixir (given what I’ve heard).
  • Modern tooling that sits on the Erlang VM. Gives me an opportunity to understand the Erlang VM while also write code in a language I’m likely to enjoy and use.

I’ll post more about it as a go. For now, I’m just looking forward to learning something new.

Weekly Picks: 2014-07-14

I’m trying something new. Posting my evernote web clips from the past week. We’ll see if I can do it every week. I’m going to give it my best.

Amazon Cognito

http://aws.amazon.com/cognito/

This looks like Amazon play at being a SSO as a Service. I always thought they were going to try to merge it in with IAM, but I can see why they didn’t. They are very different things. The cool thing is that you can store and sync across devices apparently. I don’t know much about the service yet, but definitely plan on checking it out soon.

Amazon Zocalo

http://aws.amazon.com/zocalo/

Amazon’s second offering this week. It looks like it’s they’re offering to compete with Google Drive and potentially dropbox. Seems like a decent multi-user real time document contribution service. I kind of doubt that I’ll be using it any time soon though.

XDomain

https://github.com/jpillora/xdomain

Looks like a way to get around CORs purely in the browser. Have no idea how it works, but it caught my eye,

Coreutils View

https://github.com/Xfennec/cv

This was pretty cool. It adds progress monitoring to a few coreutil commands (cp, mv, dd, tar, gzip, cat, etc). Going to give this a show. You run the command after you run the other commands though. I wonder if you could integrate it in the tmux bar?

Postgres 9.5 – IMPORT FOREIGN SCHEMA

http://michael.otacoo.com/postgresql-2/postgres-9-5-feature-highlight-import-foreign-schema/

Just want it sounds like. Create a table from a foriegn schema.

New Raspberry PI (model B+)

http://www.raspberrypi.org/introducing-raspberry-pi-model-b-plus/

Seems neat. I don’t have a raspberry pi, but I’ve been considering one to run a monitor a company dashboard locally. Probably overkill, but who cares :).

TLDR;: * More GPIO * More USB * Micro SD * Lower power consumption * Better audio * Neater form factor

Polyglot

https://github.com/sausheong/polyglot

I have no idea what this is really supposed to be. I gave it a very brief scan. Seems like it’s trying to be a single web framework to run multiple programming languages under. No idea how that’s supposed to work. Sounds cool though. I’ll probably give it a look given all the SOA related things I’ve been doing lately.

Bitly: Scaling to 6 billion clicks a month

http://highscalability.com/blog/2014/7/14/bitly-lessons-learned-building-a-distributed-system-that-han.html http://devslovebacon.com/conferences/bacon-2014/talks/lessons-learned-building-distributed-systems-at-bitly

Overview about lessons learned at Bitly. I need to give the talk (the second link) a good watch this weekend.

Algorithm: The Hacker Movie

http://www.thehackermovie.com/

Do you even need to ask? Cap’n Crunch liked it. Of course I’m going to watch it.

New Parallella boards

http://www.parallella.org/2014/07/14/new-parallella-product-offerings/

If a new Raspberry PI wasn’t enough, there are new Parallella’s as well. Probably won’t buy one for a bit, but interested. One of them is actually touted as be a “Desktop” personal computer. I call bullshit given the spec, but what the heck, who knows.

SQLite: Small. Fast. Reliable.

http://charlesleifer.com/blog/sqlite-small-fast-reliable-choose-any-three-/

Nice little article reminding us that SQLite is actually a cool little DB.

Google’s Project Zero

http://googleonlinesecurity.blogspot.com/2014/07/announcing-project-zero.html

Google’s going to help keep us all safe on the internet now. I’m not sure exactly what’s going on here. I think they’re just putting a bunch of security researchers in a room and trying to beat black hats to zero day vulnerabilities.

iTerm 2 (2.0)_

http://www.iterm2.com/news.html

Version 2.0 of iTerm 2 (is there an echo?) dropped this week. I’ve already used triggers to try to help me stop typing full commands that I have aliases for. I’m also going to give a look at the tmux integration. I’ll probably just stick with my vanilla tmux, but who knows. It could be cool.

The Tao of Programming

http://www.mit.edu/~xela/tao.html

Totally forgot about this. Always a classic though. If you’ve never read it, I highly recommend it. It’s worth it.

Why We Use OCaml

http://tech.esper.com/2014/07/15/why-we-use-ocaml/

I know next to nothing about OCaml, but after reading this, I know a little more than I did.

Official Google Analytics iPhone App

https://itunes.apple.com/us/app/google-analytics/id881599038?mt=8

Looks pretty slick. If I used Google Analytics more, I’d be all over it. Soon enough I’ll pull it down and try it.

Learn facts while pulling code changes

https://coderwall.com/p/hvfvva

A colleague of mine at AlphaSights wrote an awesome pro tip on coderwall. Check it out and learn something with every pull.

Find Deleted Files in Git

Occasionally I’ll remove some files from a git repository that I need to get back for one reason or another. Specifically, recently I was working on a project where I was working with a bunch of audio files that I reorganized and moved to separate directories (a.k.a. organized a bunch of stuff that was all thrown into a big heap of files). One of the many things that I love about git is that you are able to easily recover these files or directories, do what you need to them, then move them around some more, commit the “undelete” or just “redelete” them.

To accomplish this, you use the plumbing command git rev-list (more info on plumbing vs. porcelain). Git’s rev-list command is extremely important and ultimately used by multiple porcelain commands. Here’s a great description of the basics from the man.

List commits that are reachable by following the parent links from the given commit(s), but exclude commits that are reachable from the one(s) given with a ^ in front of them. The output is given in reverse chronological order by default.

You can think of this as a set operation. Commits given on the command line form a set of commits that are reachable from any of them, and then commits reachable from any of the ones given with ^ in front are subtracted from that set. The remaining commits are what comes out in the command’s output. Various other options and paths parameters can be used to further limit the result.

So, if I have a file that I deleted a month or so ago called foo.rb but for some reason I need to bring it back into my local repo. I can easily bring it back by running the following:

1
git checkout `git rev-list -n 1 HEAD -- foo.rb`^ foo.rb

So, that’s obviously a bit of a long-winded shortcut. Let’s break it down.

It’s really two commands in one. Let’s start with inside the ticks.

1
git rev-list -n 1 HEAD -- foo.rb

The -n 1 says “give me one revision”. HEAD represents the tip of the current branch. The bare double dashes (or ) represents my current branch. When all put together we are saying, print the latest commit hash starting from the commit I am currently on, in the branch that I am currently on, that modified foo.rb. The caret (^) is a shortcut that represents the previous commit to whatever it appends.

Once you grok that, the next part is pretty easy. Once interperted by the shell, the command is just a normal checkout from an alternate commit.

If none of that makes sense, feel free to comment and I’ll try to clarify. When in doubt though, just trust me :).