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

This photo shows two great things about driving the Dalton Highway in Alaska: the traffic and the scenery.

The Dalton Highway in Alaska

As one last photo of Alaska (for the time being), here’s the Arctic Circle sign that you’ll find on the Dalton Highway north of Fairbanks, on the way up north to places like Deadhorse and Prudhoe Bay.

The Arctic Circle sign in Alaska

A rainbow over the hill, off the Dalton Highway, Alaska. (On the drive north to Deadhouse and Prudhoe Bay.)

A rainbow over the hill, off the Dalton Highway, Alaska

There’s a constant contradiction,
What feels good and what feels right.
But you live with decisions that you make in your life.
And what steers your direction is hard to understand,
(With so much riding on the choice at hand)
The spirit of a boy, or the wisdom of a man.

~ Randy Travis

As a brief note about meditation, over the last few years people have written more about some potential negative side effects of meditation. I haven’t experienced those, but over the last two years I have experienced hallucinations when I wake up during the middle of the night. A sleep specialist told me the name for this, but I can’t remember it now.

As an example, two nights ago — the evening and morning of 8/20 to 8/21/21 — I woke up and looked across the room, and in an area where there is a hallway that leads to the bathroom (and laundry area), I saw a disembodied head that looked like Princess Diana. Two years ago that would have been pretty freaky, but now things like this are a common occurrence.

This experience only became freaky when she began to move her eyes. It was like her head was frozen, protruding out from the laundry area into the hallway, and then her eyes began to move and look around, like, “Holy crap, where am I, and why can’t I move my head?!” That reminded me of an old Don Knotts movie where he’s in a haunted house, and it was indeed freaky.

UPDATE: I’m reminded that I wrote about the name for this phenomenon before in Sleep paralysis, hypnagogic hallucinations, and hypnopompic hallucinations, and the name for these specific experiences is hypnopompic hallucinations.

As a quick Java tip related to lists, I was just reminded that if you need to print every element in a Java List, you can use the forEach method on the List:

// [1] create a List of strings.
java.util.List<String> listOfStrings = CollectionConverters.asJava(xs);

// [2] print the List of strings using forEach and System.out.println.
// note that there is no need for a 'for' loop.
listOfStrings.forEach(System.out::println);

I can confirm that as of August, 2021, this solution works just fine. So if you ever need to print every element in a Java List — without using a for loop — I hope this example is helpful.

“I’m such a liar.”

Once upon a time there was a dog named Zeus. Before we met him, Zeus had a very difficult life, having been abused by two different owners. When my wife saw Zeus on a local tv station, and they said the Animal Care Society was going to be extremely careful about who adopted him next, she seemed to know that she had to take care of him.

As you can see from the following pictures, when we first adopted Zeus, he was very sick, with a horrible case of mange.

When I found that Texas A&M Aerospace Engineering poster, I also found this “Anytime, Baby” poster. I’m 98% certain that I got it at Virginia Beach, probably in 1989.

Anytime, Baby poster

I found this 1986 Texas A&M Aerospace Engineering poster in a tube in a closet. Amazing what you find when you’re moving. :)

Space Shuttle poster, circa ~1986

Once upon an Alaskan night I went out looking for the northern lights, which were currently playing in town. I found them in a couple of areas, and almost ended up sleeping the night in my car in Talkeetna, but decided to drive home instead.

Just before coming upon this light — which was either on Highway 1 or Highway 3 — I was in a very dark area, and saw something move a little bit, so I came to a complete stop. A few moments later I realized a moose was standing right next to my car. Then I remembered that you rarely see one moose, there’s often two or more. Not wanting to startle the moose, I waited until it made a move and walked away from my car.

Once upon an Alaskan night

Yours truly (Alvin Alexander), after coming inside from a cold, Alaskan winter night in 2010-2011.

Alvin Alexander, cold Alaskan winter night

If for some reason you ever need to iterate over the values in a Scala 3 enum, I can confirm that this approach works:

// [1] create an enum
enum CrustSize:
    case Small, Medium, Large

// [2] loop over its elements/values
for e <- CrustSize.values do println(e)

Here’s a brief Scala 3 example that shows how to:

  1. Create a companion object,
  2. Create an apply method in that companion object that acts as a factory method,
  3. Define that apply method to take a varargs tuple parameter, and
  4. Create new Person instances using that factory method.

Here’s the complete source code for this example:

As a brief note today, if you want to have multiple packages and classes in one file in Scala 3, this syntax should do the trick for you:

package com.acme.foo:
    class Foo:
        override def toString = "Foo"

package com.acme.bar:
    import com.acme.foo.Foo
    class Bar:
        val foo = Foo()

package com.acme.common:
    import com.acme.bar.Bar
    @main def multiPackageTest =
        val b = Bar()
        println(b.foo)

Just another tequila sunset. Longmont, Colorado, August 14, 2021.

Lori’s “celebration of life” was today. I wonder why some people come into our lives and then, for reasons — sometimes known, sometimes unknown — they’re not in our lives any more.

Just another tequila sunset. Longmont, Colorado, August 14, 2021.

Nobody else in my family seems to know the song, Love at the Five and Dime, but I knew it many years ago, and was reminded of it several years ago. It was created and sung by Nanci Griffith, who passed away in August of 2021.

As I’ve learned over the years, if you can touch someone’s heart in a positive way before you pass away, that’s about all you can hope for, and her music definitely touched many hearts. Godspeed.

I can’t imagine what the wildfires are like out west, but I can see what our sunsets look like every night here in Longmont, Colorado: brown skies and deep red sunsets. Unfortunately the camera doesn’t do justice to what this really looks like.

Longmont, Colorado wildfire smoke sunset, August 10, 2021

One of my favorite songs from 1991 is Crazy, by Seal. This line always stands out for me:

“In a world full of people, only some want to fly, isn’t that crazy?”

Kiss From a Rose is another favorite song by Seal.

February 24, 2018: After a long hiatus, during the last week I finally got back into a consistent meditation routine. As usual, this helps me remember my dreams better, and to also have lucid dreams. Last night that combined with something else I had thought about casually recently: Wouldn’t it be nice to be young again, and if I was young again, what would I do differently?

After falling asleep, I wake up in strange apartment. Looking around I can’t figure out what’s going on, but having been in this situation dozens of times before, I find the bathroom, turn on the light, and look in the mirror. I’m pleasantly surprised to see a much younger version of myself. My face is young again, and my hair is longer, soft, and as dark as ever, with no touches of gray. Realizing I’ve been given a second chance, I vow to make the most of it.

After I figure out the apartment situation, I decide to go for a walk and see what the neighborhood looks like. As I walk down the road and enjoy the new scenery, a speeding car comes around a turn. I try to get out of its way, but it hits me hard. My body flies through the air and crashes hard on someone’s lawn as the car speeds away. Lying on the ground, my face pushed into the lawn, I look at the blades of green grass in front of me. I try to hold onto it in my mind because I know that my second chance at living a younger life is coming to an abrupt halt. The green grass fades into darkness.