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

Don’t you draw the queen of diamonds, boy,
She’ll beat you if she’s able,
You know the queen of hearts is always your best bet.

[From time to time I write little stories that have nothing to do with programming or technology; this is one of those stories. So, if you’re only here for the technology stuff, you’ll want to skip this one.]

I’m standing in the kitchen of a friend’s house at a Christmas party, making myself a drink while talking to a friend named Angie. This was nothing unusual; she and I were always talking about something. We became friends during our last year in high school, and we’ve been talking ever since.

In retrospect, it’s obvious that I have feelings for her, but I guess you could say that I didn’t appreciate her back then. After high school, my ambition took me away to college, and then to a series of jobs in different states. By the time I decided to move back home, she was married and had two young children.

While we talked all the time, this kitchen conversation was unusual. I don’t remember how it started, but Angie did ask me about something I rarely talk about: my parents getting divorced in high school.

As I became lucid in a dream this morning, I ran into Ram Dass. He was wearing his long all-white outfit, he was healthy again, with a big beard, and was much taller than I expected — significantly taller than me. (I later looked this up to find out he was 6’3”.)

He was standing next to a doorway and gathering people together for a seminar that he was giving, and asked if I wanted to attend. I said yes, and he said I was welcome if I could be like “The Lamb of God.”

I thought I knew what he meant by that, but just to be sure I asked him what he meant.

Many websites seem to have the wrong lyrics for the Dave Matthews song, Grey Street, so to help correct that problem, here are the correct lyrics for the long version of Grey Street that Dave Matthews played with Tim Reynolds at “Live at Farm Aid 2021”:

Here’s a quick Scala example that shows how to convert multiple spaces in a string to a single space:

scala> val before = "  foo  bar   baz bonk "
before: String = "  foo  bar   baz bonk "

scala> val after = before.trim.replaceAll(" +", " ")
after: String = foo bar baz bonk

Your eyes, ears, nose, tongue, body, and mind all deceive you. The true you is without the six senses.

~ Zen Master Seung Sahn

For those times when meditation alone isn’t enough. :)

#Bridesmaids

Bridesmaids - Can I have a glass of alcohol?

I can appreciate this sentiment, seen outside a local Whole Foods store.

Mom is a survivor

“Better to be on the edge of a party, don’t you think?” Good line, great movie.

Better to be on the edge of a party, don’t you think?

“Always kiss me goodnight. Always kiss me goodmorning, too.”

~ as seen in a house in Florida

Always kiss me goodnight

At one point when I was recovering from a surgery I wasn’t feeling very well, so I ended up watching a lot of movies, including 13 Going on 30. I was struck not only by the humor of this particular scene in the movie, but also the empathy.

An example of empathy (from “13 Going on 30”)

This photo was taken somewhere in British Columbia, Canada. I know where, but I’m not telling. :) The thing I don’t know is whether these trees are Aspen or Cottonwood or White Birch. I suspect that they are White Birch or Paper Birch, but I could easily be wrong, as I haven’t looked into it much, and didn’t ask any of the locals.

Aspen or Cottonwood trees, somewhere in Canada

The famous Henry Ford quote: “If I asked people what they wanted, they would have said ‘faster horses’”.

Henry Ford on faster horses

The Nearest Donut Theory, courtesy of Law & Order: Criminal Intent.

The Nearest Donut Theory (Criminal Intent)

For the person in your life who constantly says, “I worry ...”

Worrying is like praying for what you don't want

“There is no death, only a change of worlds.”

~ Chief Seattle

This is one of many cute cards/images from the Great Cosmic Happy A** website.

There is no death, only a change of worlds -- Chief Seattle

Scala/Ammonite FAQ: How do I use ZIO 2 in the Ammonite REPL?

Solution

ZIO can be added into the Ammonite REPL as a managed dependency by using Ammonite’s import $ivy syntax:

In this ZIO performance tuning article by Pierre Ricadat, there’s this nice tip about using ZIO.foreachDiscard instead of ZIO.foreach:

“One of ZIO's common operators is ZIO.foreach, which allows you to run an effect for each item in a collection. There's also ZIO.foreachDiscard that is faster if you don't need to collect results (e.g., if your effect returns Unit).”

For more details, see that article.

ZIO performance tip about foreach, foreachDiscard, foreachPar

Maharaji often said “Sub ek,” which is translated as, “All one,” or, “All is one.” He said this in other ways as well:

“Everywhere I look I see only Ram (God).”

“See no difference, see all the same.”

“You can’t realize God if you see differences.”

(There are many more instances, but that’s a good start.)

~ Maharaji (Neem Karoli Baba).
quoted in Miracle Of Love