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

I was watching a Season 4 episode of Maine Cabin Masters and heard an interesting saying that Ryan has about Sunday and Monday:

“Don’t let your Monday ruin your Sunday.”

Initially Ashley and Jedi were talking about this, and then I think Ryan talked about it as well. They started the conversation when they found a sign in someone’s cabin, and Ashley noted that Ryan says that all the time.

The basic idea is that you know you have to go to work on Monday, but don’t let that ruin your Sunday, meaning that Sunday is still your day off, and you should enjoy it, rather than worrying about Monday all Sunday like many people do.

They also mention this saying in this Facebook post.

This is a “cheat sheet” for the Scala 3 programming language. I initially wrote it for my book Learn Functional Programming The Fast Way, but I thought I’d share it here as well.

If you want to see many more details about Scala 3, see:

If you’d like to see a blast from the past — like from about 40 years ago — here’s an old mug/tumbler from the Sundance Club in College Station, Texas, circa 1986 or so.

If you happened to go to school at Texas A&M back then, you may recall the Sundance Club, which was a nightclub in the Hilton Hotel. The last I heard, the hotel was converted into a dormitory, but I don’t know if that’s true or not.

Mug from the Sundance Club, in College Station, Texas

Spent the last few hours dreaming of living in a colony on the Moon. Every moment was a new experience – bad pay, canned food, watching a movie in a makeshift theater — which reminded me of the M*A*S*H movie and tv series — but also several different beings and cultures that I found fascinating. Then I suddenly had the idea for a new book that I wanted to call, “Moon’s First Murder.” I started scribbling down some notes, but knew I didn’t know enough about the cultures, so I recruited a friend to help me with that.

~ a lucid dream note from April 2, 2014

(Note: This is one of over 1,000 lucid dreams that I have had and made notes about. For some reason I have had lucid dreams (and sleep paralysis) quite often, so at some point I started making notes about the dreams.)

I fell asleep very slowly last night, so I was able to stay awake through the whole falling-asleep process, i.e., the usual sleep paralysis part. As I was still awake I started to hear the usual “here/there sucking sounds,” and just told myself that I shouldn’t be afraid, I’ve done this hundreds of times before.

And then the instant I fell asleep here I found myself in a hospital there. A doctor and nurse were looking at a bandage on the lower-right part of my abdomen, above the appendix, and closer to the center of the stomach.

As I looked at “myself,” I noted that the skin color was lighter than mine, and that my arms were smaller and skinnier, and there wasn’t much hair on the abdomen or arms. After the inspection the doctor asked if I had any questions, and I said, “Yes. Who am I? And where am I?”

As a brief note today, this is a very little ZIO HTTP Server application. I’m sharing it here because it’s currently a fairly simple example, and also because I show how to include the necessary ZIO dependencies using Scala-CLI:

Back in the day I was living in Palmer, Alaska, and I just started to look into renting this small brown building to be a home for my software-consulting business during the day and yoga classes during the night, when some family issues came up and I moved back to the Lower-48.

There probably wasn’t enough work in the Palmer/Wasilla area — also known as the Mat-Su Valley — but I loved the area so much I wanted to give it a try.

Little office building in Palmer, Alaska

A big part of meditating for me has been getting to a point of completely dropping the self-conscious B.S., as I call it. (Which is why I may never be a meditation teacher, lol.) You just have to get to a point where there is no “you.”

(To expand on that, you get rid of your self-consciousness. There are no thoughts like, “I’m meditating,” “I’m too fat,” “I’m too skinny,” “My name is Alvin,” or even, “What was that sound?” If you’re interested in what I’m talking about, it’s described more in this article on the three nen actions.)

The Arctic Circle sign off the Dalton Highway in Alaska. If I remember right, this is less than an hour's drive from Fairbanks.

Arctic Circle sign, Dalton Highway, Alaska

I’ve probably documented over 1,000 lucid dreams in the last 20 years or so, and here’s another one from this morning. To me, the most important part about this one is the hypnopompic hallucination stuff I note at the end.

Had a long dream — approximately 2:30-4am — about “my wife” doing drugs without me knowing it.

I starts with us driving in a seedy part of town. She had mentioned that she knew someone who could get us some drugs if I/we wanted to try them. We ended up getting something that looked like a small rock or stone.

I’m not sure how many people can understand this, but once you’ve been through nine syncope events (unconsciousness), dozens of other pre-syncope events, and four cardiac events (“fake heart attacks”, also known as allergic angina), and a five-month heart infection (pericarditis), you just accept that death is going to happen, and it’s not in your control. So, personally, I just try to be grateful, and hopefully help others along the way, because I know that my time here is limited.

If I have died, please call ...

Here’s a photo of a snow white tree in Louisville, Colorado, one day in March, 2018. I was headed to a doctor’s appointment in Louisville, so this was probably somewhere between 7-8:30am. The full size image (not shown here) may be the prettiest photo I’ve ever taken in Colorado.

A snow white tree, Louisville, Colorado

This is a photo of some snowy trees in Louisville, Colorado, on March 27, 2018. I had to get up early to go to a physical therapy appointment and I was rewarded with this view.

Snowy trees, Louisville, Colorado

If you’d ever like to pay it forward — or in this case, backwards — all of my free Scala and functional programming video training courses are sponsored by Ziverge, and if you ever need to supplement your development team, please see their On-Demand Team Extension Service. They have qualified developers that work with Scala, Rust, artificial intelligence, and many other technologies.

Scala FAQ: How can I use the startsWith method on a Scala String to match multiple possible patterns in a match expression?

Solution

As shown in the following example, you can use the startsWith method on a String to match multiple possible patterns in a match expression. startsWith checks to see if a String starts with the prefix (or substring) you specify, so although in these examples I use complete strings, you can also use regular expression patterns.

Example: startsWith + match expression

Scala FAQ: How do I perform pattern matching on a regular expression string in a match expression?

Using Scala 3, I was just trying to perform some pattern matching on a regular expression (regex) string in a match expression, and while working with ChatGPT, I came up with this solution, which you can easily verify in the Scala REPL:

Since I’ve written two functional programming (FP) books, I thought it might help to provide a comparison of them.

The short story is that both FP books have “limited technical jargon,” and as shown, The Little FP Book essentially has one purpose, which is to help Java/Kotlin/OOP developers learn functional programming as fast as possible, using a technique that I “discovered” over the last few years.

Conversely, The Big FP Book covers many topics in great detail.

If you’re interested in more details, here are links to the two books:

Functional programming books, comparison

A few days ago I found this black paint that “turns any surface into a chalkboard.” I’ve been painting the backs of some cheap cabinets, whose backs are now exposed after I moved some furniture around. If you know me, you know I like to have surfaces I can write on. :)

Black paint that "turns any surface into a chalkboard"

As the caption says, Margaret Hamilton, Apollo flight software designer, stands next to a tall stack of software code that was printed out, circa 1969. Image from this Twitter page.

Update: There’s more about Margaret Hamilton on this vox.com page.

Margaret Hamilton, Apollo software designer, next to her code

Per the BoulderCast website, these are the largest snowstorms in the history of Boulder, Colorado.

Boulder, Colorado: Largest snowstorms in history