The Daily Parker

Politics, Weather, Photography, and the Dog

Lunchtime reading

Yep, one of these posts.

Back to coding...

Today's reading list

If only it weren't another beautiful early-summer day in Chicago, I might spend some time indoors reading these articles:

Time to go outside...

Cool new feature in Weather Now

I've finally gotten around to extending the historical weather feature in Weather Now. Now, you can get any archival report that the system has, back to 2013. (I have many more archival reports from before then but they're not online.)

For example, here's the last time I arrived in London, or the time I took an amazing photo in Hermosa Beach, Calif.

I don't know why it took me so long to code this feature. It only took about 4 hours, including testing. And it also led me to fix a bug that has been in the feature since 2008.

Lunchtime reading

It's been a busy news day:

There was also an article on tuple equality in C# 7.3 that, while interesting to me, probably isn't interesting to many other people.

Four unrelated stories

A little Tuesday morning randomness for you:

Back to debugging acceptance tests.

Blogging A-to-Z Challenge Topic 2018

Blogging A to ZAs I mentioned a couple of weeks ago, The Daily Parker will participate in this year's Blogging A-to-Z Challenge. Today's the official Theme Reveal day. My topic will be: Programming Concepts using Microsoft C# .NET.

My topics will include:

  • Compilers vs Interpreters
  • Generics
  • Human factors (and errors)
  • LINQ
  • Polymorphism

...and will finish with a real-world practical example on April 30th.

I will also keep up my annoying political and Parker posts through April. And, full disclosure, many of the 26 A-to-Z posts will be technical and more involved than just linking to a Washington Post article. Because of that, and because I want a consistent publication cadence, I'm going to write them ahead of time, even if it's just the night before.

A-to-Z posts will start at noon UTC (7am Chicago time) on April 1st and continue through the 30th, with Sundays off. You can find them directly through their A-to-Z Tag. Enjoy!

What does Tinder know about you?

Via Bruce Schneier, a British reporter requested her data dossier from Tinder. As with so many other things in life, she was shocked, but not surprised:

The dating app has 800 pages of information on me, and probably on you too if you are also one of its 50 million users. In March I asked Tinder to grant me access to my personal data. Every European citizen is allowed to do so under EU data protection law, yet very few actually do, according to Tinder.

With the help of privacy activist Paul-Olivier Dehaye from personaldata.io and human rights lawyer Ravi Naik, I emailed Tinder requesting my personal data and got back way more than I bargained for.

Some 800 pages came back containing information such as my Facebook “likes”, my photos from Instagram (even after I deleted the associated account), my education, the age-rank of men I was interested in, how many times I connected, when and where every online conversation with every single one of my matches happened … the list goes on.

What will happen if this treasure trove of data gets hacked, is made public or simply bought by another company? I can almost feel the shame I would experience. The thought that, before sending me these 800 pages, someone at Tinder might have read them already makes me cringe.

Tinder’s privacy policy clearly states: “you should not expect that your personal information, chats, or other communications will always remain secure”. As a few minutes with a perfectly clear tutorial on GitHub called Tinder Scraper that can “collect information on users in order to draw insights that may serve the public” shows, Tinder is only being honest.

But as Schneier points out, "It's not [just] Tinder. Surveillance is the business model of the Internet. Everyone does this."

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.