The Daily Parker

Politics, Weather, Photography, and the Dog

Welcome (and overdue) feature in Chrome

The January release of Google Chrome will prevent videos from auto-playing:

Starting in Chrome 64, which is currently earmarked for a January 2018 release, auto-play will only be allowed when the video in question is muted or when a "user has indicated an interest in the media."

The latter applies if the site has been added to the home screen on mobile or if the user has frequently played media on the site on desktop. Google also says auto-play will be allowed if the user has "tapped or clicked somewhere on the site during the browsing session."

"Chrome will be making auto-play more consistent with user expectations and will give users more control over audio," writes Google in a blog post. "These changes will also unify desktop and mobile web behavior, making web media development more predictable across platforms and browsers."

I mean, really. The more advertisers annoy the shit out of us, the less effective it will be effective.

Slosh modeling started here

The science of modeling hurricane storm surges started here in Chicago after the seiche of 1954:

When the surge hit Chicago, it hit a city that housed one of the world’s great meteorology departments, at the University of Chicago. One of its professors was the meteorologist George Platzman....

The meeting of those two freak concepts—real but rare deadly Great Lakes storm surges, and the bizarre possibility of an atomic bomb detonating in Lake Michigan—along with his computer-forecasting experiments, led Platzman to take up the nonexistent science of storm-surge prediction, beginning with an attempt to reverse-engineer the 1954 tragedy. His first model, in 1958, got the timing right, but was off by half on the height of the surge; nonetheless, it was used to accurately predict a 1960 Lake Michigan storm surge on Chicago, resulting in a public warning that may have saved lives.

Five years later, Platzman published a much more ambitious run at the phenomenon, crunching 20 years of hourly wind and water-level data at six weather stations on Lake Erie. He also used a much more sophisticated model than his 1958 study—which didn’t include wind stress—a level of complexity only possible in the computer age. And it worked, with an accuracy of about 90 percent.

The models improved into today's SLOSH model, which meteorologists have been using with abandon the past two weeks.

Software frustrations

I'm on the Board of Directors for the Apollo Chorus of Chicago, and information technology is my portfolio. Under that aegis, I'm in the process of taking all of our donor and membership spreadsheets and stuffing them into a new Neon CRM setup.

So far, it's going well, and it's going to make the organization a lot more effective at managing membership, events, and donations.

That said, in the last 24 hours I've logged five bug reports, including one of the most frustrating user experience (UX) bugs possible: a broken back button. This UX failure is so well-known and so irritating that we were talking about it when I started developing Web apps in the late 1990s. Jakob Nielsen called it the #1 web design mistake...of 1999:

The Back button is the lifeline of the web user and the second-most-used navigation feature (after following hypertext links). Users happily know that they can try anything on the web and always be saved by a click or two on Back to return them to familiar territory.

Except, of course, for those sites that break Back by committing one of these design sins:

  • opening a new browser window (see mistake #2)
  • using an immediate redirect: every time the user clicks Back, the browser returns to a page that bounces the user forward to the undesired location
  • prevents caching such that the Back navigation requires a fresh trip to the server; all hypertext navigation should be sub-second and this goes double for backtracking

Neon, however, has made some alternative design choices, and even has a FAQ explaining how they've broken the rules.

Seriously, guys. It's a good product, but wow, is that irritating.

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.