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

When you hear mindfulness people say something like, “Life is like a dream,” one thing they mean is that more than 99.99% of the stuff going on in our minds are thoughts about the past and the future. (Past happiness or regrets, and future hopes and concerns.) Because the only thing that’s real in the present moment is what’s actually happening in *only this moment*, anything that’s outside of this moment is in a strict sense no longer real.

Along this line of thinking I like Eckhart Tolle’s two quotes, “The present moment is all you ever have” — you know that to be true for sure if you’ve ever lost consciousness, not knowing if you’d ever open your eyes again — and my favorite of his:

“The whole essence of Zen
consists in walking along
the razor’s edge of Now.”

This is a view of the sunrise in the side view mirror from October, 2018, when I was somewhere in Missouri, driving back to Colorado. On the morning of this trip I really got into listening to Pink Floyd’s The Wall, and was so intent on it that I nearly ran out of gas.

Sunrise in the side view mirror (2018)

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 a day or two 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.)

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.)

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 adn.com.

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

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)
        false
    else if (i == 2)
        true
    else
        !(2 until i).exists(n => i % n == 0)

SI.com 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

“The activity of consciousness, contrary to expectation, conceals the real nature of existence and represents it in a distorted way.”

~ Zen Training

Here are two good quotes from this interview with Novak Djokovic (and a surprise appearance from Andre Agassi):

“I think the No. 1 requirement is constant desire and open-mindedness to master and improve and evolve yourself in every aspect. I know Roger has been talking about it, and it’s something I feel most top athletes of all sports agree on. Stagnation is regression.”

Djokovic says it helps to have a clear purpose, even if it is a different purpose. “I had to find my reason,” Agassi says. “It’s so important to have that reason.”

Years ago, a friend on posted this on Google+. Is it true? That I don’t know. I'm not a doctor, I’m an aerospace engineer and computer scientist. ;)

One thing I can tell you is that when my thyroid was failing with Hashimoto’s, I did some crazy things, even ending up in Haines, Alaska on a whim. And I can also tell you that taking L-tyrosine really helped later during the thyroid failure process.

Dopamine, serotonin, oxytocin, adrenaline and our moods