Alvin Alexander | Java, Scala, Unix, Perl, Mac OS X

The funny thing about writing the Scala Cookbook is that it started as a whim. I was just about to leave for a vacation at the beach, and right before I turned off the computer, a thought flashed in my mind, “I should contact the people at O’Reilly about writing a cookbook for Scala.” I then had a doubt that they would actually do it, but I applied the “What the heck” rule — i.e., “What the heck, what do I have to lose?” — and sent the email.

I dug around the internet for a few minutes, found the correct O’Reilly email address, sent them a message, turned off the computer, and drove to the beach. While I was at the beach the publisher wrote and said, “Love it, send me a full proposal!”

So if you’re thinking about doing something, but are afraid or uncertain about doing it ... apply the “What the heck” rule, and give it a shot. :)

This page shows how to update Drupal 8 using drush and other techniques.

Here’s a link to Github’s 2017 Open Source Survey.

Update 1: The next version of my book on Scala and functional programming will be released later this week.

Update 2: The price of the book will be increased to $25 on July 1, 2017.

In “Eat, Pray, Love,” Elizabeth Gilbert describes what meditation can be like. :)

What meditation can be like (Eat, Pray, Love)

“Researchers report that mindfulness meditation reduced chaotic activity in the brain and the heart ... ‘Activities of the brain and heart became more coordinated during MBSR training,’ reported the authors. ‘Mindfulness training may increase the entrainment between mind and body.’”

“Erlang has single-assignment variables. As the name suggests, they can be given a value only once. If you try to change the value of a variable once it has been set, you’ll get an error.”

(“Single-assignment variables” are the same as val fields in Scala. Using them can make your code more like algebra.)

“In Erlang, processes share no memory and can interact with each other only by sending messages. This is exactly how objects in the real world behave.”

“Processes interact by one method, and one method only, by exchanging messages. Processes share no data with other processes. This is the reason why we can easily distribute Erlang programs over multicores or networks.”

Joe Armstrong, in his book,
Programming Erlang: Software for a Concurrent World

“In Erlang (Akka), it’s OK to mutate state within an individual process (actor), but not for one process to tinker with the state of another process.”

“When I was about six years old I received the essential bodhichitta teaching from an old woman sitting in the sun. I was walking by her house one day feeling lonely, unloved and mad, kicking anything I could find. Laughing, she said to me, ‘Little girl, don’t you go letting life harden your heart.’

Right there, I received this pith instruction: we can let the circumstances of our lives harden us so that we become increasingly resentful and afraid, or we can let them soften us and make us kinder and more open to what scares us. We always have this choice.”

When my dad was my current age (and I was 20), I didn’t know it, but that would be the last time I’d see him until after lung cancer had ravaged his body. If I could have said, “Please quit trying to control my life, let me make my own mistakes, and I’ll let you know if I need any help” — and he would have agreed to that — we might have found a way to see each other again.

So, my recommendation is that if you have a dad, no matter how well you’re getting along, give him a hug. ;)

I thought it was great that you can donate any dollar amount you want to The Guardian to support professional journalism. I wrote the New York Times and Washington Post and said I don’t read their content enough to justify a subscription, and asked if I could either donate to them or use some form of micropayments, but they both wrote back to say they only offer (more expensive) subscriptions.

Update: Someone wrote on Twitter to note that these are for-profit organizations and therefore they can’t take donations. That’s not true, but even if they didn’t want to accept donations, they could offer micropayments or lower-cost subscriptions for a limited number of page views.

Scala is a great language in many ways. One great feature is that you can use it as a “Better Java” (i.e., as an OOP language), and you can also use it as a pure FP language. While some people prefer one extreme or the other (not unlike extremist Republicans and Democrats in the U.S.), I appreciate that this lets you find a “Middle Way” of using the best features of both approaches.

The Scala spectrum: OOP to Pure FP

Well there’s a light in your eye that keeps shining
Like a star that can’t wait for the night
I hate to think I’ve been blinded, baby
Why can’t I see you tonight?

And the warmth of your smile starts a-burnin’
And the thrill of your touch gives me fright
And I’m shaking so much, really yearning
Why don’t you show up, make it all right?

Had one of those mornings where you want to wake up at a certain time so you can get some things done, but you wake up a minute before the alarm is going to go off and you’re already in a deep, meditative state, so you turn off the alarm and ride the wave for a few hours. Ahh ...

A favorite quote from an all-time favorite movie, Peaceful Warrior.

You need to start asking better questions

“Two steps are required to write a good piece of code. The first step is to get the algorithm right. The second step is to figure out which sorts of things (types) it works for.”

From the “Deriving a Generic Algorithm” chapter in the book, From Mathematics to Generic Programming.

I’m laying in bed in my apartment, and there’s a knock at the front door. It’s dark, so as I walk to the front door to see who’s there, I see white light coming in from all sides around the door. “Must be one heck of a light out there,” I think. I open the door, and my wife (who I’m separated from) is standing there, and this white glow is all around her.

I don’t even get a chance to think or say hello, and she says, “You died in a hotel in 1984. Everything since then has been a dream.”

With this, I instantly wake up in my bed. My body is shaking like crazy, but I jump up, look back and think, “I am NOT getting back into that bed tonight.”

As I walk around the apartment debating about whether I should try to sleep on the floor or just go into work at four o’clock in the morning, I remember ... I did spend a lot of time in a hotel in 1984.

To enable a physical Android hardware device (phone or tablet) for developing and debugging your apps with Android Studio, follow these steps.

1) Enable “Developer Options”

The first thing you have to do with a new Android device is to enable the developer options in the Settings app. To do this: