The Daily Parker

Politics, Weather, Photography, and the Dog

Reactions to the weekend

Apparently, life went on in the US while I was abroad last week. First, to James Damore:

Of course, that wasn't the big story of the weekend. About the terrorist attack and armed ultra-right rally in Virginia, there have been many, many reactions:

Can we have a discussion about domestic right-wing domestic terrorism now? Before we have another Oklahoma City?

Not sure that's a bad thing...

I just saw a comment on a review site listing the following as a "con" for a particular Web-based product:

I really feel like this company doesn't fix problems that only affect a couple of customers. Instead they prioritize fixes that affect the whole system and only fix specific problems when they have time.

Yes. Also, you might be interested to learn that businesses try to make profits by selling things for more than it cost to obtain them.

On behalf of the company in question—a small business in Chicago whose principal constituents are non-profit organizations with budgets under $1m—you're either new to this whole "commerce" thing or you have a magnificently droll sense of humor. Either way, good day to you, sir. I said good day!

Happy 1.5 Gigaseconds!

Tonight at 02:40 UTC, all Unix-based computers (including Apples running OS-X) will pass a milestone: 1.5 Gs since the beginning of time (at least as far as Unix is concerned).

Unix keeps track of time by counting the number of seconds since 1 January 1970 at midnight UTC, which (at this writing) was 1,499,962,035 seconds ago. Tonight at 21:40:00 Chicago time will be 1.5 billion seconds since that point.

If you miss this anniversary, don't worry; it'll be 2.0 Gs into the Unix time epoch on 18 May 2033 at 03:33:20 UTC. Mark your calendars now!

Don't do this. Just don't.

It's a general rule of software security that, if I have physical access to your computer, I own it.

I'm analyzing a piece of software so that I can transfer its data to another application. The software runs on a local machine and is written in .NET, with a SQL Express back-end. I have administrator access to the SQL database, the machine, and therefore, to the software.

It took me all of an hour to find the master encryption key in one of the DLLs that make up the software, and another hour to build an applet—using the software's own assemblies—that can read and decrypt every byte in the database.

Good thing I'm covered by a confidentiality agreement and the owner of the data has engaged my company to do exactly what I'm doing. But wow, we really need to migrate this stuff quickly, and get it the hell off this computer.

Getting a Rails app to run on Bash on Ubuntu on Windows

(This is a cross-post with my employer's blog.)

I'm the newest team member at DevMynd, and so far, the only one with a Windows PC. Since we do most of our work in Ruby on Rails, and since everyone else has Macs, this presents a challenge.

If I wanted to do this the easy way, I'd simply run Rails on Windows natively. But I decided instead to do it the hard way and use Linux and BASH. First, I had a couple of free days to get up to speed last week giving me some time to experiment. Second, I figured that running on a completely different platform might introduce hard-to-diagnose bugs. (Both Linux and MacOS are *nix operating systems while Windows is not). I hope that what follows will make this a considerably less-hard way for everyone else.

This is how I got everything working on a Windows 10 Creator Edition (build 10.0.15603) box using Bash on Ubuntu on Windows also known as Bash/WSL. WSL (Windows Subsystem for Linux) is a beta feature of Windows 10 so some of what follows may be different on other versions of Windows.

Also, this post assumes that you are coming into the Linux world for the very first time, and your mind is a deep, pure, clear lake of Windows expertise completely unencumbered by any knowledge of Linux whatsoever. If you already know Linux, a lot of this might be redundant.

Important!

  • Don’t change Linux files using Windows apps and tools. You will hose your Linux environment. That said, since your Bash/WSL environment can read the Windows file system, you can just point to it from within BASH to run your Rails project.
  • Read the Bash on Ubuntu on Windows FAQ.

Steps

1.  Turn on Developer Mode

In Developer Features, turn on "Developer mode". You will need to reboot after this step.

2. Turn on WSL

In Windows Features, turn on "Windows Subsystem for Linux (beta)". You will need to reboot after this step.

3. Run BASH as administrator.

(Window key, "Bash", right click, "run as administrator.")

4. Install Ubuntu

(Ubuntu is the only *nix image available for WSL at the moment, following a partnership between Microsoft and Canonical.)

When BASH starts, it will prompt you to install Ubuntu on Windows. Hit "y" to do so.

5. Install Ruby prerequisites

sudo apt-get update
sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev

6. Install rbenv

rbenv will let you use different versions of both Ruby and Rails as needed:

cd
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
exec $SHELL

git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc
exec $SHELL

7. Install Ruby

Install the version or versions of Ruby you'll need to use. For example, to install v2.4.0:

rbenv install 2.4.0

(Optional) Set a global, default version of Ruby. For example, to make v.2.4.0 the default on your system:

rbenv global 2.4.0

(Optional) Check what version of Ruby you're using as a default:

ruby -v
rbenv -versions

8. Install Bundler:

gem install bundler

Then Rehash rbenv:

rbenv rehash

9. Install Rails

5.0.1 shown; you can install multiple versions

curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
sudo apt-get install -y nodejs

gem install rails -v 5.0.1

10. (Optional) Install MySQL

MySQL

sudo apt-get install mysql-server mysql-client libmysqlclient-dev

Test your installation

Now you're ready to create a sample application and see if it works.

1. Create an empty Rails application with a database.

a. SQLite

Create an empty application using the Rails default SQLite database:

rails new deleteme

b. MySQL

Create an empty application using MySQL and then start the MySQL server:

rails new deleteme -d mysql
sudo /etc/init.d/mysql start

2. Initialize your application.

This is the happy path:

cd deleteme
rake db:create
rails server

3. View your application

Open a browser and navigate to http://localhost:3000.

Congratulations!

You should now be looking at a Ruby on Rails welcome screen. Happy BASHing.

In a subsequent post, I'll look at installing Postgres on Bash/WSL, and all the things I had to fix while doing it.

Windows moves to Git

The Microsoft Windows operating system has millions of lines of code maintained by thousands of developers. And in the past three months, Microsoft has moved 90% of its code to the open-source Git version control system:

The switch to Git has been driven by a couple of things. In 2013, the company embarked on its OneCore project, unifying its different strands of Windows development and making the operating system a more cleanly modularized, layered platform. At the time, Microsoft was using SourceDepot, a customized version of the commercial Perforce version control system, for all its major projects.

SourceDepot couldn't handle a project the size of Windows, so rather than having the whole operating system in a single repository, the Windows code was actually divided among 65 different repositories, with a kind of virtualization layer on top to produce a unified view of all the code. Some of these 65 repos contained nicely isolated, standalone components; others took vertical or horizontal slices through the operating system; others were just grab bags of different code. As such, the repo structure didn't correspond with OneCore's module boundaries.

Due to widespread developer familiarity and strong support for creating lots of branches with low overhead, the decision was made to use Git as the new system. But Git isn't designed to handle 300GB repositories made up of 3.5 million files. Microsoft had to embark on a project to customize Git to enable it to handle the company's scale.

You read that right: Windows contains 3.5 million individual code files, and there are so many changes to them (8,500 per day on average), they had to create their own super-charged version of Git.

Programming nerds will want to read the whole article. Non-nerds can scroll down for political stuff.

Things I'll be reading this afternoon

Some articles:

And now, Parker needs a walk.

Stuff I'll read later

A little busy today, so I'm putting these down for later consumption:

Now, I must prepare...for Whisky Fest!

Blue-collar coders? Um, no

Via a longtime reader, LinkedIn software engineer David Max responds to Wired article with "no, coders aren't assembly-line workers:"

The implication is that one can learn enough coding skills to get a job writing easy code, and then settle into a long stable career writing more of the same. Maybe, but I doubt it.

The world of software development changes rapidly. Even if we need a lot more developers, that won’t change the fact that keeping up is a continuous effort. Even if the barriers to entry are getting lower such that there are programming jobs that do not require a four year computer science degree, that is still just the foot in the door. Once on the job, you will need to keep actively improving to keep up like the rest of us.

To put it another way, there may be more entry level positions open to people with less training, but that training will likely grow stale. A boot camp program might prepare you for a job, but what you learn today in a boot camp will almost certainly be different from what you would learn two years from now.

This is one reason why I prefer to hire developers with liberal arts degrees. And why I give a very straightforward problem to solve in interviews. And why I ask what books the candidates read.

De-Mosesing New York

New York Times developer Jeff Sisson has put together a mapping application that can remove highways from New York:

Imagine there’s no highway, it’s easy if you try—even easier, since now there’s a map for that. With this latest cartographic venture, you can make the concrete superslabs and soul-sucking underpasses that are the scourge of urbanists everywhere disappear with a mere click.

This is the vision of Jeff Sisson, a developer at The New York Times who dabbles in the kinds of stuff we consider CityLab catnip. You might remember him from such projects as mapping New York’s bodegas. His latest effort is called “NYC (& The World) Without Highways.”

Highway removal in real life is expensive, time consuming, and politically challenging, as New York Governor Andrew Cuomo will inevitably discover as he plots a pricey demolition of the Bronx’s Sheridan Expressway.

Maybe there's one for Chicago in the works?