Scala, Java, Unix, MacOS tutorials (page 106)

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

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.

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")
foo

scala> puts("foo")
foo

scala> puts(1 + 1)
2

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

Here’s a photo of the view in Los Alamos, New Mexico.

Los Alamos, New Mexico

This is a painting of a Native American Indian that I saw in Santa Fe, New Mexico. (Sorry, I don’t know the artist’s name.)

Native American Indian painting (red stripe over left eye)

I post this image from this tweet in memory of Kendrick Castillo.

When will the violence against our school children stop?

In memory of Kendrick Castillo

One thing I never thought about, but as an author you can end up with a lot of copies of your own books laying around.

Your own books laying around

“Zen is above all a matter of personal experience. The student is asked to accept nothing the truth of which he cannot demonstrate for himself, with his own mind and body.”

~ Zen Training

I had never heard of the term “Yoda Conditions” until now, but I have seen them in some Java code where programmers put the constant first in an effort to avoid null pointer exceptions.

Yoda Conditions in programming

I don’t remember where I saw this code, but I took a photo of it a while back, and it shows a for loop as a Scala method body. I don’t think I’ve ever written anything like that before, so it impressed me enough that I took a picture of it.

A Scala `for` loop as a method body

With Scala it’s common to embed variables in strings like this with the s string interpolator:

val name = "Fred"
println(s"My name is $name.")

That’s cool, but when you need to format your string, Scala gives you an even more powerful tool: the f string interpolator. Here’s an example of how I just did this in my LittleLogger logging library:

My mother is the nicest person in the world, and has dementia. She was also in a coma for ~10 days after falling down a flight of stairs in 2015, which eventually resulted in both of us being patients in the same hospital at the same time.

During a lucid moment last week one of my sisters asked her why she didn’t do something, and mom replied, “I have trouble remembering things.” :)

May the Fourth Be With You.

May the Fourth be with you

I noticed on the drive to the hospital today that there’s still plenty of snow up in the Rocky Mountains.

Still plenty of snow up in the Rocky Mountains - May 3, 2019