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

If you’re interested in meditation but “don’t have the time for it,” this quote from Daniel Ingram on intensity in meditation/mindfulness practice was helpful to me:

“It is important to know that really getting into a sense of the breath as a continuous entity for ten seconds will do you more good than being with the breath on and off for an hour.”

One of my favorite songs of late is named Mad As A Hatter, by Larkin Poe. The song is about their grandfather, who has schizophrenia, and their grandmother, who has dementia.

All my life I have known someone who has schizophrenia, and in the last 20 years I’ve also known quite a few people who had dementia and/or Alzheimers, so it’s a touching song in multiple ways. YouTube has this terrific live performance of “Mad as a Hatter”.

Here are some of the lyrics from Mad As a Hatter:

If you must then just please wait and let me have some time
(Let me have some time)
Please don’t come for me
Mind over matter (it don’t matter) when you’re as mad as a hatter

The song ends with these repeated lyrics:

Off with her head, off with her head...
Paint the roses, paint the roses...

I assume the ending lyrics relate to Lewis Carroll’s Alice’s Adventures in Wonderland.

If you want to open an Apple News URL in Apple News on a Mac, the trick is to first open the URL in the Mac Safari web browser. From there you can then open the story in Apple News. And FWIW, to me this is a significant user interface and user experience problem when using Apple News with an iPhone and then Mac/MacOS systems.

As a quick note, if you want to embed a Scala source code example in your Scaladoc comments, just put the source code block in between {{{ and }}} characters in your comments, as shown in this example:

How to format source code blocks in Scaladoc comments

I know that it’s fashionable to say that Scala is dead or something similar to that, but I’ve gotten a few royalty checks from O’Reilly this year for the Scala Cookbook that are amazingly good (💰) for a 3-year old programming book.

Shoot, I’d be happy to receive these royalty payments during the initial months after the book’s release.

As Bjarne Stroustrup said, “There are only two kinds of programming languages: the ones people complain about and the ones nobody uses.”

When I first started meditating in the 1990s, I often had a hard time getting into the proper meditative state when I sat down on the meditation cushion. My “monkey mind” would be jumping all over the place, and it would take me a long time to get it to settle down. Many times I couldn’t even get it to settle down before my 30-minute timer went off.

Because of that, and because I really wanted to become better at meditating, I began experimenting with different ways to get into the meditative state faster.

As a result, this page is a summary of the best ways I know to help you get into a good meditation state when you take time to sit on the meditation cushion (or wherever else you sit). If you’re interested in getting into a deep state fast, these are the “best practices” I know, especially when you’re short on time.

Yesterday I watched the very emotional Elton John “Tiny Dancer” music video, and afterwards I wanted to do some research on how the music video was created, the story behind it, and what its meaning is. To that end, here’s a summary of what I found out about the “Tiny Dancer” music video.

The story and meaning of the Tiny Dancer song

The short story behind the Tiny Dancer song goes like this:

“People tend to overestimate or underestimate how wonderful the experience (enlightenment) is. How wonderful is it? Well, I would say that anyone who has entered into the world of no-self, emptiness, and wisdom mind, who abides in that world, if you gave them a choice to live one day knowing what they know, or live an entire lifetime but not be allowed to know that, I think — I can’t speak for everyone — but I would say most people who live in that world would say, ‘I’d rather have one day knowing what I know than a lifetime of not being able to know this.’ So that’s how wonderful it is.”

~ Shinzen Young, in this video

“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

Mostly because of Ram Dass books, and also more recently because of the book, I Am That, I have been digging deeper than ever into the concept of “The Witness.” By that I mean both in terms of how we use the witness as a meditation technique, and also what that really means.

To that end I have started collecting Ram Dass Ram Dass quotes about the witness and the process of witnessing as a form of meditation. Here then are the Ram Dass quotes about the witness that I’ve found so far.

Everything changes once we identify with being the witness to the story

Ammonite FAQ: How do I load managed dependencies into the Ammonite REPL? What is the syntax for loading dependencies (and JAR files, too)?

Solution

If you want to import a managed dependency into the Ammonite REPL, the solution is to use its import $ivy syntax:

I initially created this “How to use Scala CLI” content for my new Scala book, Learn Functional Programming Without Fear, but when I decided to shorten what I include in the book, I also decided to put the full version of this content here.

What is Scala CLI?

Until some time in the year 2021 I would have written this book using only the Scala SDK and its scalac and scala commands to compile and run your code, respectively. (These are just like javac in Java, kotlinc in Kotlin, and java with both of those.)

But since that time the Scala CLI command project has come along, and it greatly simplifies the “getting started with Scala” experience, so I use it in this book. Scala CLI:

“Trying to find a way to love everyone in a world I don’t even like.”

As a brief note today, here is some source code for a ZIO ZLayer application using Scala 3. In this code I use the ZLayer framework to handle some dependency injection for a small application. (Note that I don’t like to use the word “simple” when writing about software, but I have tried to make this as simple as I can.)

I’ve commented the code below as multiple “parts” so you can see the thought process of creating an application that uses ZLayer. Basically the idea is that your application needs some sort of service — which might be like a database connection pool, HTTP framework, etc. — and then you make that service available to your application with ZLayer’s provideLayer function (or one of its other functions).

The ZLayer example

Given that small introduction, here’s my ZIO ZLayer example, with many notes shown in the comments inside the code:

I know that the idea of a “dream vacation” for most people is time at the beach or a beautiful place like Alaska, but once you get to a certain point in meditation, there’s nothing a person would rather do than meditate. So the dream vacation for a meditator is a peaceful, quiet place — both quiet surroundings, and not having to talk to anyone else — where they can meditate, practice yoga, make simple non-meat meals, and go for quiet walks.

Because I have lived in some sketchy places, and other places where people are constantly cutting the grass and running farm machinery, I’ll add that the location should be secure, and again quiet (or at least a place where you know that loud grass-cutting and outdoor activities happen at a certain time). At some point you need to learn to meditate with those issues, but on vacation, no thanks.

I came across this “Al’s Oasis” sign while traveling around the country. I don't remember what state it was in.

Al's Oasis sign

This is a picture of a beautiful painting named Window of the Poet, by Pyotr Konchalovsky. A friend of mine who died a few years ago liked this quite a bit, so it reminds me of her.

Window of the Poet (painting)

In this interview, the interviewer (Steph) asks Shinzen Young about his daily life, and whether he applies any sort of techniques during his normal day. That eventually leads to him saying:

The biggest change is that I don’t have a preference between enlightenment and non-enlightenment. (Note: This is a big change from when he was younger.)

Then, if I’m intending to meditate — in action, in life, like I’m talking to you now ... now I just started to intentionally meditate as we’re talking.

And I typically meditate in the external visual field, and I’m typically meditating on the process of simultaneous expansion and contraction, causing the world in front of me to arise and then disappear. So I’m now applying a formal technique (as we talk).

Interviewer: So I’m arising and disappearing right now.

(Yes) You’re arising and disappearing from the source, moment by moment. Therefore, you appear to me to be the Source. And therefore, very effortlessly, loveable.

Interviewer: I’ll take it.

At the end of this video that’s titled, Inside Shinzen’s Brain: How Shinzen Experiences his Daily Life, he talks about the one obsession he has: “How smart can I be, how creative can I be, in service of the world?”

As a note to self, I had a problem with the ZIO HTTP library, where it was throwing Netty errors/exceptions like this:

io.netty.channel.AbstractChannel$AnnotatedNoRouteToHostException: null: jsonplaceholder.typicode.com.

The solution to this was to make a couple of changes to my SBT build.sbt file, specifically adding the javaOptions setting below, and forking the running application from SBT: