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

These are two photos of the Sun setting behind clouds of wildfire smoke, August 7, 2021, in Longmont, Colorado.

Sun setting behind clouds of wildfire smoke, August 7, 2021

“To know love, be like the running brook, which deaf, yet sings its melody for others to hear. Feel the pain of too much tenderness. Wake at dawn with a winged heart and give thanks for yet another day of loving.”

~ Kung Fu

For the purposes of writing the Scala Cookbook (2nd Edition), I thought I wanted a little “testing framework.” At first when I tried to use existing frameworks, I found that they didn’t always work with the latest release of Scala 3.0 (formerly named Dotty). Then, after working with the libraries that were often kept up to date with Scala 3.0, I further decided that I just wanted to put my tests inside Scala @main methods — I didn’t want to have some code under src/main and other code under src/test in my Scala/sbt projects.

So, in the end, I created my own testing “framework,” which I named SimpleTest. It’s really not a framework, it’s just a very little library that lets me run tests in @main methods.

In the process of writing the Scala Cookbook for Scala 3, there were days when it was hard to find a working testing framework. As a result, I decided to write my own Scala 3 testing framework. Calling it a framework is a bit of a joke, as it’s only about 88 lines of source code. I named that library SimpleTest, and you can find it at github.com/alvinj/SimpleTest.

So I can easily find the source code later, I’m putting Version 0.3 of the source code here:

“I have to get out of here because there are people in other places. There’s a whole world out there that I don’t know anything about.”

~ David Byrne of the Talking Heads, in this article

I debated about whether or not to share this story publicly, but I think it may potentially be helpful for two groups of people, so I’m sharing it here. First:

  1. For victims of parental abuse, I want you to know that you’re not alone, and that your feelings (anger, disappointment, fear, unworthiness, lack of self-confidence, etc.) are perfectly normal.
  2. Second, for people who meditate, I want to let you know that both good and bad memories can pop into your mind spontaneously as your meditation practice advances.

And now for the brief story:

As I noted in this tweet on July 26, 2021, my book, Functional Programming, Simplified, was the #2 best-seller in Amazon’s functional programming category that is actually about functional programming.

Functional Programming, Simplified: An FP best-seller

“I am a survivor. You can throw me in the jungle, and I’m going to come out with a fur coat, and a headband I made out of some leaves.”

~ Teddy Bridgewater, Broncos QB, July 28, 2021

As a brief note today, this is a sample Git .gitignore file that I use for Scala projects, including Scala CLI projects, sbt projects, and using VS Code or IntelliJ IDEA as your IDE:

Over the last week or two, no matter what else I do during the day or night — such as working on the Scala Cookbook v2, for Scala 3 — I’ve been taking the time to watch the beautiful sunsets here in Colorado. This is the sunset in Longmont, Colorado on July 18, 2021.

Sunset in Longmont, Colorado on July 18, 2021

Overhead the albatross
Hangs motionless upon the air

Strangers passing in the street
By chance, two separate glances meet
And I am you and what I see is me

And do I take you by the hand
And lead you through the land
And help me understand the best I can?

(Lyrics by Pink Floyd, slightly edited by me. The photo is of a rain cloud in Longmont, Colorado, on July 15, 2021.)

A rain cloud in Longmont, Colorado, on July 15, 2021

Dateline July 15, 2021:

The book is about 250 pages long, and I could easily charge $25 for it. But I want to make them available at as low a cost as possible to make it as inexpensive to learn Scala as possible.

Note that this book was released in October, 2018, and covers Scala 2. If you want a free version of a similar book, the online version of the Scala 3 Book is completely free.

This was the sunset in Longmont, Colorado on July 14, 2021. I missed most of it, but caught it right here near the end.

Sunset in Longmont, Colorado on July 14, 2021

These are some very brief notes on what I just did to get a 500GB microSD card to work with an Amazon Kindle Fire 10, so that I can store some very large files on that microSD card inside the Kindle Fire 10. The notes are cryptic, but hopefully they’ll make sense to me in the future, and may make sense to you as well.

A lot of times people ask me, “How can I learn Scala 3?” Or, “I have this Scala 3 question, can you answer it for me?” I don’t mind doing that when I can, but there are still a lot of things I don’t know off the top of my head.

So, in an effort to help people find Scala 3 resources, here’s a quick list:

Also, if you’re using Scala 3 and have a specific question about it, I recommend asking that question here:

If you have a more general question about Scala 3, or even an idea on how to improve it, I recommend asking those types of questions here:

In summary, if you need some direct links to Scala 3 learning resources, I hope those are helpful.

As a brief tip today, in Scala 3 you can run a script as follows. First, put this Scala 3 code into a file named Hello.scala:

@main def hello = println("Hello, world")

Next, at your operating system command line, run your script like this:

$ scala Hello.scala
Hello, world

For a little script with no dependencies, that’s all you need to do.

Putting a JAR file on the classpath with your script

If you happen to need a JAR file when running your Scala 3 script, you can run it like this:

scala -cp MyNecessaryJarFile.jar Test.scala

Here in October, 2021, I just confirmed that this works as desired.

You are not your thoughts.

As you learn in this meditation technique, it’s easily possible to sit back and observe all the crap that spews out of your brain. As you’ll quickly find out, “you” are the observer, and all those thoughts — I’m too fat, I’m not smart enough, I’m too sexy for my shirt — just keep spewing out of your socially-conditioned brain machine.

Observing the thoughts is the beginning of ending them.

Shinzen Young hear/rest noting medtation technique

The sunset in Longmont, Colorado on July 9, 2021.

The sunset in Longmont, Colorado on July 9, 2021

When I was writing Functional Programming, Simplified (FPS), I looked for ways to make everything easier. Then I found this game. The idea is to learn chess moves in a small setting, so you can then take them to a full chess board. It’s one reason FPS ended up with 130 micro-lessons.

Solitaire Chess, and making functional programming easier

Apparently I have sleep apnea. But during the day. During meditation.

When I was meditating this morning my body stopped breathing several times for more than a minute and a half. At first I observed and wondered about it, but then I just let it be. The new normal.

~ July 6, 2021