My Takeaway from Reading David and Goliath

David and Goliath

Book: David and Goliath
Author: Malcolm Gladwell

The subtitle for the book is “Underdogs, Misfits, and the Art of Battling Giants” and as you would expect it has many examples of an underdog beating a giant. Often the underdogs have to use unconventional approaches as facing the giant head one would result in their defeat.

An item that almost became my takeaway is that sometimes the underdog is not really the underdog. Instead sometimes the underdog is more powerful then they appear. A good example of this is the title story of David and Goliath as examined by Gladwell. He argues that David was armed with a superior weapon, the sling. The sling with it’s much longer range and stopping power then the sword wielded by Goliath. Basically David brought a gun to a knife fight and unsurprisingly won.

[Read More]

Generate a Todo List in Standard (Rubocop)

The older I get the more I appreciate code linters. Something that can detect and often correct my formatting errors? Great! One less thing I have to worry about. Then I can spend my time on more important tasks such fixing the bug, adding a new feature, or uniting/conquering the world.

The default linter for Ruby is Rubocop. It works great but I find it’s default rules to restrictive. You can change the defaults but that is time consuming and confusing. At least confusing to me. While searching for a Rubocop config that I liked I came across Standard.

[Read More]

A Pleasant Development Environment featuring Docker and Rails

With the current virus issues I forgot to publicize that my presentation about creating pleasant development environments was posted along with an example of Dockerizing an existing Rails application. You can find the slides for the talk here. Finally you can find a ready to use existing Rails template that uses Docker here.

Thanks to YEGRB for allowing me to present and to Will for his awesome editing skills. Also thank you to Corgibytes for feedback on draft presentation.

A Rails 6 Template and Then Some

I appreciate people posting getting started examples and templates online. They are good for getting started and playing with a new technology. The problem is the templates are usually not production ready. They are also missing a bunch of the developer tools and best practices, such as linters and automated builds, that every project will eventually need.

Screen shot of Rails Template GitHub page.

So I created a Rails 6 template that includes many of the tools I want on a Rails project. I wanted the template to be easy to use but also contain all the tools I wanted. This includes a Docker container, a linter, a type checker, and a build scripts. Actually the template has two build scripts, one for GitHub Actions and one for GitLab CI. The Docker script will build both development and production images.

[Read More]

Today I Learned Altering a SQL Column Removes it's Default Value

This one I actually already knew but temporarily forgot about it so got to relearn it. In MySQL, and many other databases, updating the column with an ALTER statement will remove any properties not explicitly listed.

For example, say you want to update an MySQL database to support utf8mb4. This requires updating the existing string columns to utf8mb4 which my co-worker did in a script that looked like:

ALTER TABLE #{table} CHANGE #{column_name} VARCHAR CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci

I reviewed the pull request and didn’t catch the error even thought I been burnt by this alter column issue in the past. I guess my scar must have healed, or at least faded enough that I forgot about it.

[Read More]