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

Here’s a photo from Virginia Beach at sunrise in late May, 2019. I used a dark black and white filter when taking the photo, but everything else is natural.

Sunrise at Virginia Beach, May, 2019

While traveling recently for a niece’s wedding, I saw that John Cusack will be at the Louisville Palace on August 1, 2019. I was tempted to buy a ticket (or two), but managed to control myself. :)

John Cusack at the Louisville Palace (August, 2019)

“When I observe myself, I am really forced to admit that every day I am a prisoner of a thousand unsatisfied desires, or desires whose satisfaction brings me no permanent bliss.”

“So it seems that instead of endless running from one desire to another, it would be better to stop and examine the true nature of desire. If this investigation is successful, you will penetrate the nature of the true aim of all desire. What any desire really aims at is a state of non-desire.”

~ Jean Klein

Ben Evans has an interesting article from 2015 titled, Mobile is not a neutral platform. Here’s a good quote:

“Of course, all this sort of stuff is a big reason why Google bought Android in the first place — Google was afraid that Microsoft (it was that long ago) would dominate mobile operating systems and shut it out. The obvious fear was around things like preloads, and the justice of that fear was proven right with Maps, where Apple Maps now has 2-3x more users on iOS than does Google Maps, despite being a weaker product — the ‘good enough’ default wins and the platform owner chooses what that is.”

I drove through St. Louis this past weekend, and made this 96-second video of the St. Louis Arch, more properly known as the Gateway Arch.

Table of Contents1 - Solution2 - A Scala `equals` method example3 - Discussion4 - Example 2: A Scala `equals` method with inheritance5 - Implementing hashCode6 - See Also

Scala problem: You want to define an equals method for your class so you can compare object instances to each other.

Back to top


If you’re new to Scala, a first thing to know is that object instances are compared with ==:

"foo" == "foo"   // true
"foo" == "bar"   // false
"foo" == null    // false
null == "foo"    // false
1 == 1           // true
1 == 2           // false
1d == 1.0d       // true

case class Person(name: String)
Person("Jess") == Person("Jessie")   // false

This is different than Java, which uses == for primitive values and equals for object comparisons.

Right after I left Colorado ~3 weeks ago, I received a message that a package had arrived for me. I wasn’t expecting anything, so all I could think was that maybe the Nuts On Clark people had sent me a gift to apologize for a recent messed-up order.

I got back in Colorado last night, and when I walked to the front office today I found this “The Moose Is Back” t-shirt, which is an even better surprise than the free popcorn might have been. :)

The Moose Is Back t-shirt (Northern Exposure)

I don’t know who originally put together this image, but I’m a fan of this “None of us are getting out of here alive” quote. It puts things in the proper context, imho.

None of us are getting out of here alive - Richard Gere

As a note to self, when you see a Scala error message that looks like this:

java.lang.NoSuchMethodError: scala.Product.$init$(Lscala/Product;)V

it probably means that you have a mismatch in the Scala versions you’re using in your project. For instance, I just tried to use a library I compiled with Scala 2.12 with Spark, which was compiled with Scala 2.11, and I got that error message. In this case I was able to resolve the problem by recompiling my library with Scala 2.11.

Here’s a short summary of a Jeff Bezos interview, and here’s the actual six-minute video. As mentioned in the first link, the three big ideas are (1) thinking on a different timescale, (2) putting the customer first, and (3) inventing.

One fun part of helping out with a niece’s wedding is that I got to legally park on a sidewalk on Saturday. When the people at the store told me to park on the sidewalk I had to repeat it back to them, “You want me to park on the sidewalk?”

Parking on a sidewalk

I was listening to Must Love Dogs while driving yesterday (I’ve watched it so many times, I don’t need to see it to know what’s going on), and it reminded me that when I write about dogs in my books — Rocky, Zeus, Suka, etc. — these are some of the Siberian Huskies I’m writing about.

Must Love Dogs, and dogs in books

Back on May 19, 2013, we had a little problem with goats at the apartment complex I lived at in Broomfield, Colorado.

Goats at the apartment

Yesterday’s bad weather left a fresh coat of white on Mt. Whatsitsname.

White Rocky Mountain top, May 18, 2019

Years before I heard of Shinzen Young, I had always “enjoyed” practicing meditation in the cold. Some part of it probably goes back to childhood, when I had to wait for the schoolbus in the freezing cold of northern Illinois winters. (This was in the time before global warming.) I used to stand there without moving, and mentally I’d concentrate on not being cold, or at least not feeling the cold.

Many years later when I lived in Alaska, I used to enjoy going up into the mountains to basically inflict the same thing on myself. I always thought the “meditate deeply or suffer the consequences” approach forced me to meditate more deeply. This past winter that same “Do or die, there is not try” mentality forced me to maintain my focus and helped to combat my medically-induced lack of energy.

While reading some medical stuff recently I came across the phrase, “When you hear hoofbeats, think of horses, not zebras.” I thought it was essentially the same as Occam’s Razor, but Wikipedia says they’re different.

I prefer the phrase, “Sun does not set.” #talkeetna #alaska

Talkeetna, Alaska: Sun does not set

As my mind was wandering off earlier today, I started to wonder what it would take to create a Ruby puts or PHP echo statement in Scala. (For some reason my brain can never type “println,” and puts or echo are much easier to type.)

One simple way to mimic a puts or echo method is to use Scala's ability to rename things on import:

scala> import System.out.{println => echo}
import System.out.{println=>echo}

scala> import System.out.{println => puts}
import System.out.{println=>puts}

scala> echo("foo")

scala> puts("foo")

scala> puts(1 + 1)

In the next month I’m going to have a CT scan, an MRI, radioactive iodine, gamma radiation, more radiation, then more radiation. So it seemed fitting that I should buy The Incredible Hulk tv series DVD set. :)

Back in the day, this series was influential on me, and I was very aware of its influence. After moving out of Chicago we lived in a small town, and this series opened my eyes to the possibility of just wandering around and living a vagabond lifestyle.

When I was young I used to think, “How do I know where I should live? Where’s ‘home’? Maybe I should just wander around until I find a place that feels right.” That may sound unusual — it seems like most people want to settle down in one place — but I feel fortunate to have lived in many towns and many states, and gotten to know people in all of those places.

The Incredible Hulk tv series