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

I’m starting to publish my next free video course, called ZIO HTTP + Caliban. You can find it at that website, and it’s free, thanks to the people at Ziverge.

Free video training course: ZIO HTTP + Caliban

Here’s a comprehensive guide to implementing retry logic in ZIO 2 applications, using various scheduling strategies.

Please note that I haven’t double-checked that all of these examples compile as-is, but I do demonstrate many of these in my free Scala and ZIO 2 training videos. (I also added a complete working example at the end.)

“Enlightenment always comes after the road of thinking is blocked.”

Lindsey: Don’t tell me you’re seeing inside them again. (long pause) What are people like, on the inside?

Jeremy: Inside most people there’s a feeling of being separate, separated from everything.

Lindsey: And?

Jeremy: And they’re not. They’re part of absolutely everyone, and everything.

Lindsey: Everything? I’m part of this tree? Part of my dog barking over fences? You’re telling me that I’m part of some fisherman in Italy, on some ocean I’ve never even heard of? There’s some guy, sitting on death row, I’m part of him, too?

Jeremy: You don’t believe me.

Lindsey: It’s hard to believe that. All of that.

Jeremy: That’s because you have this spot that you can’t see past. (Putting his finger on her forehead.) My grams and gramps had it, a spot where they were taught they were disconnected from everything.

Lindsey: So that’s what they’d see if they could? That they’re connected?

Jeremy: And how beautiful they really are. And that there’s no need to hide, or lie. And that it’s possible to talk to someone without any lies, with no sarcasms, no deceptions, no exaggerations or any of the things that people use to confuse the truth.

~ a conversation from the movie Powder

“He’s more myself than I am. Whatever our souls are made of, his and mine are the same.”

“Goddamnit!”

Every so often a woman in a lucid dream this morning yelled out like that, so after the fourth or fifth time I had to ask her about it. “Why do you keep saying that?,” I asked.

“Gets your attention, doesn’t it?”

“Yeah, I guess so.”

“There you have it.”

“There I have what?”

“Your ego is writing checks your body can’t cash.”

~ from the movie, Top Gun

As a brief note today, here’s some skeleton code for a ZIO (ZIO 2) application that needs to run forever. It (a) does what it needs to do, then (b) sleeps for a minute, and then (c) goes back to Step A, doing whatever it needs to do, forever.

I wanted to share this code because I think it’s probably a very common pattern and need in the ZIO world — writing an application that needs to run forever, on a schedule.

Also note that the code is written using Scala 3, but the syntax can be changed to use Scala 2, if you need to. I also added a layer/ZLayer to the code to make it a little more “real world.”

All that being said, here’s the ZIO “run forever” code:

If you’re ever interested in meditation, I promise that if you work hard enough, you can achieve this kind of intensity, where you feel like Eleven in Stranger Things. I’m fortunate that it happens to me from time to time now.

As Ramana Maharshi said, “Proper meditation is so intense it doesn’t even allow thinking, ‘I am meditating.’”

Meditate like Eleven giving her all

This page contains a list of my favorite mindfulness quotes. Most of these are short, concise quotes that help bring me back to the present moment, and work well with my “Just Be” mobile app.

Update: I have replaced my Just Be application — which was written for Android only — with a new application I call Back To Now, which runs on both Android and iOS.

Background: Just Be

Just Be was a mobile mindfulness app that I created for Android users. This is what the reminders/notifications look like when you receive them on an Android phone or tablet:

Just Be, a mindfulness reminders app

Dear diary,

Annihilation of the ego continues to make progress, at least during sleeping hours. In recent nights I’ve gained awareness during the dream state to find “myself” as animals, women, and other men.

Last night I gained awareness as an older black man, talking to other black men about some of the discrimination and injustices we’ve gone through in our lives. We can laugh a little amongst ourselves about them now, but I could feel that under the laughter there’s also a deep sadness and pain.

Lately each nightly occurrence ends the same way: Eventually there’s a realization that “I” am supposed to be “Al,” and that realization startles me, pulls me from the scene, and wakes me.

Yours truly,
The Hopefully-Disappearing Self

P.S. — I don’t know if it’s more correct to say “black man,” “African-American,” or something else. To be clear, if it wasn’t important to the story I would not mention it at all.

I rarely listen to music from this century, but in late 2020 I became a fan of Let Me Love You Like a Woman, by Lana Del Rey.

Really, I don’t think I liked a new song from 2013 to 2020, and then in December, 2020, I had my radio on an “alternative music” station, and this song came on and it was like time just stopped.

The tv series Becker was one of my favorites back in the day, and I always wondered why it wasn’t available on DVD. I just looked, and it’s now available at Amazon, just released in 2018.

A favorite episode that helped me snap out of a personal funk was when Becker finally got to be with his long-lost love — a woman he pined for for many years. When he finally had a chance to reunite with her it turned out she was out-of-control-wild, crazy, ran up his credit card bill, and then took off.

In its own way, that episode helped me get over someone I had felt the same way about. It was like seeing a comedic version of your own life that turned out to be a great “slap in the face” moment for me.

(Some time after I wrote that last paragraph, I was able to spend more time with the woman I had those feelings for, and while it wasn’t quite that comedic, our time together helped me realize that this woman wasn’t the perfect human being I thought she was. She was still great, but with human flaws, just like the rest of us.)

Becker TV series now on DVD

“On one occasion of my own practice, nearing deep samadhi, I happened to notice that the stage of my mind was quietly turning and a new scene was appearing. In this new scene no wandering thought popped up its head; there was absolute stillness and silence, as if one had landed on the Moon.”

~ Zen Training

“I am in the world, but not concerned with the world. I am going through the marketplace, but not as a purchaser.”

~ Ram Dass, quoting Maharaji, quoting Kabir, in Miracle of Love, one of his best books

“You got the gift, but it looks like you’re waiting for something ... your next life, maybe.”

~ The Matrix

You got the gift, but it looks like you’re waiting for something ...

“I’m tired, boss ... Mostly I’m tired of people being ugly to each other. I’m tired of all the pain I feel and hear in the world every day. There’s too much of it. It’s like pieces of glass in my head all the time. Can you understand?”

~ John Coffey, The Green Mile

I’m tired, boss ... John Coffey, The Green Mile

I really like the following quotes about keeping your mind on God all the time, from the book, The Gospel of Shri Anandamayi Ma.”

In particular, one thing I like about her approach as compared to something like Zen is that she spells out exactly how one should practice, so there is no guesswork about how to keep your mind during the day. (Zen people tend to tell you something once, and then leave you on your own.)

Anandamayi Ma quotes on service

Here are some of her quotes from the first one-third of her book that I really like:

“While performing a service, think that whatever you are doing is for God only. You are not serving a man or a creature, but God himself.”

Across the street was a beautiful, old church. I wanted to see what it looked like inside, so I crossed the street, but as I approached the church there was a commotion to my left, so I walked over to see what was happening.

Some people needed some assistance, and I thought it would be an easy TK thing to do, so I started to help them. But it was much, much harder to do than I expected, so I started to put all of my effort into it. I couldn’t do what I wanted, but instead of giving up, I kept pushing harder and harder. As I did this, the song, Sanctify Yourself, by Simple Minds, began playing.

As I tried harder, a man’s voice began talking in my left ear. He was whispering some of the lyrics from this song, and the harder I tried, the louder he spoke. I kept trying harder and harder until I eventually became like Eleven in the last episode of Stranger Things, putting my entire being into the effort. In the end, there was no “me,” only the desire to help:

A unique feature of this story is that I didn’t know what the word sanctify meant until I woke up and looked it up...