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

Stand your ground and reclaim your time!
The Art of
Saying No

“I love everybody, that’s what’s killing me.” Cloris Leachman was outstanding in the movie Spanglish, and this is one of my favorite lines. I’ve written about this line and loving everyone from a Buddhist perspective before, and if you’ve ever loved two people and seen them fighting with each other, or loved two people and had to disappoint one person because of something related to the other person, that’s what this reminds me of.

In 2024, it also reminds me of war, and what a waste of life it is when people who are in charge ruthlessly kill other people.

I love everybody, that's what's killing me

“We are not human beings having a spiritual experience, we are spiritual beings having a human existence.”

We are not human beings having a spiritual experience ...

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

Worrying is like praying for what you don't want

“It’s better to have a short life that is full of what you like doing, than a long life spent in a miserable way.” ~ Alan Watts

A.I. Painting: Alan Watts: It’s better to have a short life that is full of what you like doing

In a dream this morning
I’m pushing a little unpowered vacuum/sweeper
like you see them use at Denny’s
or maybe Cracker Barrel.

And then I look up
and see two young girls
and they’re singing a pretty song.

I ask what the song is
and they giggle a little,
and one asks the other
if they should tell me,
and she says yes.

So they tell me that there’s this
old abandoned house
and sometimes when they go by it
they see an old woman pushing
a sweeper like this.

Functional Programming FAQ: What are the benefits of an Effect System, like ZIO?

Answer

I’m currently planning a video on “The benefits of an Effect System in computer programming” on my free Scala and functional programming videos website, but in case I don’t get around to making that video, here are the slides I have put together.

Also, if you’d like to see a video that is somewhat similar, here’s my popular “What is ZIO 2?” video on YouTube.

Background

If you haven’t heard of Effects or an Effects System, I wrote about them a long time ago here. Also, in book, Effect-Oriented Programming, the authors describe them this way:

  • Effects are the unpredictable parts of a system.
  • Effect Systems partition the unpredictable parts, and manage them separately from the predictable ones.

In this fast-paced video I show what the ZIO 2 library is in the fastest way I know how. I show the benefits of effects and effect systems, and specifically how ZIO is the new “Functional Programming, Simplified.”

What is ZIO 2? (the benefits of effects and effect systems)

I did a “gratitude” meditation exercise two nights ago, and it ended up going almost four hours. (Fortunately for me, at advanced levels you can trade some meditation time for sleep.)

The technique is to put your mind in the area of your heart and express things you’re thankful for, including this crazy body I have, all of you, and in the end, basically everything.

If it helps you can start by feeling love for one being — such as Zeus — and work out from there.

A soul that temporarily has a body

At some point it really hits you that I’m some soul that’s pushing this vehicle that was named “Alvin” around, and YOU are also some other individual soul. So when YOU don’t do what I want, that’s okay, because you’re another student here in Earth School. Basically, MY soul needs to give YOUR soul that freedom to work your stuff out.

I noticed that the ZIO 2 ZIO.fromOption method returns Option[Nothing] as its error type, so I asked my friend Claude about it, and got the following response, which I have cleaned up a little.

A woman in a dream this morning was quite distraught and spoke only Spanish. I tried communicating by speaking very slowly (“Why .. are .. you .. here?”, “You're .. in .. the .. wrong .. dream”), but that didn’t help at all.

Scala FAQ: What is the Nothing type in Scala, and how do I use it?

Solution

In Scala, the Nothing type is called a bottom type, which means it is a sub-type of every other type in the Scala type system. It is also specifically a data type that has no instances.

In practical use, Nothing is used to indicate that a computation or function will never produce a result normally, either because it throws an exception, enters an infinite loop, or encounters some other abnormal termination.

Visually, this is what the Nothing type looks like in the Scala type hierarchy (image courtesy of this scala-lang.org page):

The Scala type hierarchy and the Nothing data type

Scala: Common uses of Nothing

Some common use cases of Nothing in Scala include:

If you’ve ever seen the “Maine Cabin Masters” tv show, you may have seen the black flag that they fly on their cabins while they’re working on them. If you ever wondered about their black flag, here’s what I can tell you from this deleted scene video:

  • In the video, which was posted on March 19, 2020, Ryan states that the flag is new.
  • The flag signifies the Maine Cabin Masters “are here” and “we’re kicking butt on this project, and it’s going to be the best this camp will ever be.”
  • It is the Maine Cabin Masters “skull and crossbones.”
  • The image is a Chase Morrill design.

As I work more with ZIO 2, I also find myself thinking a lot about the ZIO 2 mental model, by which I partially mean “a way of thinking about your code” and also “ZIO 2 best practices.”

Here are my initial notes. Also, I hope that most of this code is mine, but several snippets are from other sources that I don’t remember, including the official ZIO 2 docs.

I recently watched the movie, The Ten Commandments, and when I saw Sephora, I thought, “She looks familiar.”

It turns out she’s played by Yvonne De Carlo. She’s the actress who’s portrayed on my Learn Scala 3 book cover, which is based on the 1950 movie, Buccaneer’s Girl, which she starred in. (Until this, I thought I only knew her as Lily Munster on The Munsters.)

And if you like the movie The Ten Commandments, I also wrote this blog post about The Ten Commandments and the 2024 Presidential Election.

Yvonne De Carlo in The Ten Commandments (and more)

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

~ as seen in a house in Florida

Always kiss me goodnight

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

~ Eckhart Tolle

I know that I may never get to any “final” stages of enlightenment, but IMHO and as near as I can tell from my current meditation practice level, the last steps leading up to enlightenment/awakening/liberation are:

I’m glad to report that my book, Learn Functional Programming The Fast Way, is five-star rated on Gumroad.com. And as I write this sentence on September 6, 2024, it’s also FREE!

Learn Functional Programming The Fast Way is five-star rated on Gumroad.com

Scala 3 FAQ: What are opaque types in Scala?

Discussion

I previously wrote a little about Opaque Types in Scala 3, and today, as I’m working on a new video about opaque types, I thought I’d add some more information about them.

After my first-ever bought with diverticulitis, I wanted to make notes about what happened over the last five days.

Monday, April 7, 2015

On April 7, 2015, I woke up at 3:30am with pain and discomfort in my lower-left abdomen. I knew something was wrong, but I didn’t know what it was. It felt like a golf ball was lodged in there, and several hours later it was still there.

Stand your ground and reclaim your time!
The Art of
Saying No