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

Here’s a good Twitter thread about flying in the Alaskan bush.

“As long as egocentricity persists, we cannot see existence in its pure form. The Zen student trains himself to eliminate his egocentric, individual ego, returning to a condition of absolute mental nakedness.”

~ Zen Training

Denver’s Nikola Jokic scored a rare 30/20/10 performance in last night’s win, where they only had seven players on the team. (Image from this Twitter page.)

Denver’s Nikola Jokic with a 30/20/10

If you ever need to create a large test Scala Map, I just used this approach and it worked fine:

val map = (for (i <- 1 to 5_000_000) yield (i, 10*i)).toMap

The initial results in the Scala REPL look like this:

val map: Map[Int, Int] = HashMap(4584205 -> 45842050, 2231874 -> 22318740, ...

The code works by creating a series of tuples with the yield expression, where each key is i, and each value is 10*i. Here are a couple of other ways to convert a Scala sequence to a map:

val map = Vector.range(0,1_000_000).map(i => (i, i*10)).toMap
val map = Vector.range(0,1_000_000).map(i => i -> i*10).toMap

Downtown Talkeetna, Alaska, February 5, 2020. An “oilified” version of this photo by the Fairview Inn.

Downtown Talkeetna, Alaska, February 5, 2020

Way back in 2009 I went on a yoga retreat in Sayulita, Mexico with about twelve other people. One night after dinner I met this black dog as we were walking around the town plaza area. Prior to this meeting, I spent every evening in the town plaza, where I had watched this dog constantly be attacked by other dogs, so when she came up to me on this evening I petted her and then gave her my leftovers.

Yoga teacher Judi Rice — who organized the trip — was influential in my life, is standing behind my left shoulder, next to the woman in the dark pink shirt. Judi passed away in December, 2014.

Me and a black dog in Mexico

Day after day,
love turns grey,
Like the skin of a dying man.

And night after night,
We pretend its all right,
But I have grown older,
And you have grown colder,
And nothing is very much fun any more.

And I can feel
One of my turns coming on.
I feel cold as a razor blade,
Tight as a tourniquet,
Dry as a funeral drum.

(start destroying a hotel room)

Don’t look so frightened,
This is just a passing phase,
One of my bad days.

(Every year I have 2-3 days where I go to the dark side, and these lyrics from the Pink Floyd song “One of My Turns” describes the feelings of those days very well. February 5, 2020, turned into one of those days.)

the small man
builds cages for everyone
while the sage,
who has to duck his head
when the moon is low,
keeps dropping keys all night long

~ an old Persian named Hafez

Back in the days of my youth, the town I lived in used to hold Little League tryouts in the first floor of this old white building. In one of the exercises, one of the coaches — my dad — used to hit ground balls to us. All of us wannabe players would stand in a single-file line near the front door and front windows, with the line wrapping along the windows on the right side. My dad would stand at the back of the building with a bat and hit these rubber-coated baseballs at us. We had to field them and then throw them to another coach who stood at the back of the building.

I don’t know why, but every time it was my turn to take a ground ball, my dad would hit it significantly harder than he would for the other kids. Boy, that used to piss me off, and it’s pretty much the only memory I have of this building.

I haven’t been back there in many years now, but it looks like the Little League baseball park is still behind this building.

An old white building I have one memory of

Just before beginning this hellaciously long drive to Alaska, I stopped in a used bookstore to sell 250 of my favorite books (that were too heavy to fit in my RAV4), but in the process, I bought one more: an old copy of Guy Kawasaki’s, The Macintosh Way.

I was going to wait to read The Macintosh Way until I got settled in Alaska, but I’ve had some down time the last few days — waiting out some brutal Canadian winter weather and waiting for new winter tires to be delivered — so I cracked it open.

Tonight, on page 123 — right before some Iditarod sled dogs started barking like crazy at feeding time in the parking lot — I read a few lines from Mr. Kawasaki that succinctly explain Apple’s marketing and public relations approach:

There’s a big difference between advertising and PR. Advertising is when you tell people how great you are. PR is when someone else says how great you are. PR is better. (This is Jean-Louis’ insight.)

While almost all of the other sled dogs are sleeping, this one doesn’t seem to want to sleep. Photo from this Twitter page.

Iditarod sled dog can't sleep

February, 2017: A woman in a bar in Nome, Alaska challenged female Iditarod sled dog racer Aliy Zirkle to arm wrestle her. As they arm-wrestled, the woman’s arm broke. Lesson learned: Don’t mess with Alaskan sled dog racers. The story is here on

Woman challenges Iditarod racer to arm wrestle, gets her arm broken

A little Iditarod humor in honor of the race starting in about a month in Anchorage, Alaska. Photo from the Seavey family Ididaride website.

A flat tire in Alaska

I have no name, I have no life, I breathe no vital air.
No elements have molded me, no bodily sheath is my lair.
I have no speech, no hands and feet, nor means of evolution.
Consciousness and joy am I, and bliss in dissolution.

~ from the book, Light on Yoga

Not having a computer science background, I was curious about how to write a Scala function that would find a list of all prime numbers up until some maximum value I supply. I was aware of the Sieve of Eratosthenes, but I didn’t want to implement that, at least not today.

A Scala 3 (Dotty) function

What I ended up doing looks like other Scala prime number solutions you can find on the internet. To make things look a little different, I wrote the code using the current Scala 3 (Dotty) syntax, and the result looks like this:

def isPrime(i: Int): Boolean =
    if (i <= 1)
    else if (i == 2)
        !(2 until i).exists(n => i % n == 0)

“Someone is always in the way.”

I thought I wrote that thought here many years ago, but I just searched and couldn’t find it. It was my predominant thought after living in Alaska, and then moving back to the Lower-48. In Alaska you can go to a lot of places and find solitude, and when you go to the grocery store it isn’t crowded, but as soon as I came back to the Lower-48 I constantly found that someone was always in my way, standing in front of me, at the grocery store, in the Rocky Mountain National Park, wherever. has a great quote from Bruce Springsteen’s book, Born To Run:

The band was part of a four-band showcase; one band would get the chance to move on and perhaps get a recording contract. The Jersey guys went third and thought they killed it. The fourth band, though not as energetic, was very good. Via “Born To Run:”

“They got the gig. We lost out. After the word came down, all the other guys were complaining we’d gotten ripped off. The guy running the joint didn’t know what he was doing, blah, blah, blah.”

That night, Springsteen reflected, sleeping on a couch in his transplanted parents’ home in the Bay Area. “My confidence was mildly shaken, and I had to make room for a rather unpleasant thought. We were not going to be the big dogs we were back in our little hometown. We were going to be one of the many very competent, very creative musical groups fighting over a very small bone. Reality check.”

“I was good, very good, but maybe not quite as good or exceptional as I’d gotten used to people telling me, or as I thought ... I was fast, but like the old gunslingers knew, there’s always somebody faster, and if you can do it better than me, you earn my respect and admiration, and you inspire me to work harder. I was not a natural genius. I would have to use every ounce of what was in me — my cunning, my musical skills, my showmanship, my intellect, my heart, my willingness — night after night, to push myself harder, to work with more intensity than the next guy just to survive untended in the world I lived in.”

Here’s a short 15-second video clip of a dog that goes sledding ... all by itself, no humans required.

Dog goes sledding by itself

From 74 degrees on Super Bowl Sunday to -5 two days later. Brrr.

Temps dropping 79 degrees in two days