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

Functional Programming, Simplified — currently 5-star rated on Gumroad.com, 4.5-star rated on Amazon, and one of the all-time best-selling books on functional programming — is currently on sale in three formats (prices shown in USD):

PDF Format
$10 on Gumroad

PDF version of Functional Programming, Simplified

Paperback Book
$39.99 on Amazon

Print version of Functional Programming, Simplified

Kindle eBook
$9.99 on Amazon

Kindle version of Functional Programming, Simplified

NOV., 2022: My new book, Learn Functional Programming The Fast Way, is currently an Amazon Java and functional programming #1 new release. The book is now available in three formats:

PDF Format
$10 on Gumroad.com

Learn Functional Programming The Fast Way! (PDF Version)

Paperback
$30 on Amazon

Learn Functional Programming The Fast Way (Paperback)

Kindle
$10 on Amazon

Learn Functional Programming The Fast Way! (Kindle Edition)

I’ve been slowly working on a series of new Scala programming books, and today I’m proud to announce the first of these:

Learn Scala 3 The Fast Way! (book cover)

Starting today you can buy the PDF version of Learn Scala 3 The Fast Way! for just ten dollars — $10 (USD) — at this Gumroad.com URL.

As a brief note today, I just released the first version of a new, free book/booklet that I’ve titled Learning Recursion.

Learning Recursion: A free booklet by Alvin Alexander

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

Some of the computer programming books on the right side of this image are amazing, and I would never discourage anyone from reading the great ones.

But if you’re an object-oriented programming (OOP) developer who wants to start understanding functional programming (FP) over a weekend or a few nights of reading, that’s the goal of the new little book on the left: Learn Functional Programming The Fast Way. It takes you from Java/OOP to functional programming in the simplest possible step-by-step learning process.

FP for Java/Kotlin/OOP developers

I taught Java and OOP for many years, and have used other OOP languages like Kotlin, Python, and Flutter/Dart, so I understand both OOP and FP, and I think that helped to make this a simple book for learning FP.

I also wrote the FP book in the middle — Functional Programming, Simplified — and it’s about three times larger than the little book on the left. I based it on most of the FP books on the right, and it goes into many details that the book on the left doesn’t go into. It’s big, but it’s still easier than reading all the books on the right.

For OOP developers: The smallest, simplest functional programming book

From this article on how “Breath-based meditation shifts the brain into a deeply relaxed state”:

“We found that rhythmic breathing practice like Sudarshan Kriya Yoga allows an easier access to a deep state of meditation,” Tripathi told PsyPost. “EEG from participants were recorded before, during and after they were practicing the technique. EEG records brain activity which can be quantified into different rhythms like alpha, beta, theta, delta and gamma.”

“What we found was that the breathing activated the theta rhythms in the brain which allowed a practitioner to easily transition to a relaxed state with heightened theta-delta activity. This activity is somewhere between fully awake (alpha/beta dominant) to fully asleep (slow waves and delta dominant), suggesting that the practitioner is in a relaxed yet aware state which traditional texts of meditation have referred to as Turiya (fourth state of consciousness, the others being sleeping, awake and dreaming).”

One thing you learn when you really become dedicated to mindfulness practice is that every moment you aren’t being mindful, you’re feeding your ego. Any thought about the past or future solidifies this “ego-cage” you have built up in your mind.

(Note: I saw the term ego-cage in a book, but I don’t remember which one.)

Another good interview question of late was something like, “Who are some of your heroes, or people who have motivated you?”

I forgot to mention Bernie Glassman, from whom I learned that you don’t have to go off and meditate in the mountains to become enlightened.

You can learn more about him here on Wikipedia if you’re interested. And here’s a link to The Dude and the Zen Master on Amazon.

Interview question: Who are your heroes, or people who have motivated you (Bernie Glassman)

This page provides a comprehensive overview of error-handling strategies in ZIO 2. My hope is that you can use this decision tree to determine good/best approaches for handling errors in your ZIO effects. Each section includes a use case (question/answer), brief explanation, and ZIO 2 example.

As a brief note, I have ensured that the following examples compile, but at some point I need to take the time to double-check my work.

I haven’t interviewed for a job in many years, and yesterday I had my first interview in 14 years. I thought I could just pick up where I left off many years ago without any practice, but boy was I wrong.

I *did* want to talk about my health saga from 2012-2019 because it’s an important part of who I am today, but I talked about it too much. All I wanted to say was that (a) I got very sick and went unconscious many times before Doctor #26 found that I was born with a rare blood disease, (b) everything is fine now, and (c) the important part of that saga is that I gained much more empathy for people going through things, and I also learned that I wanted to be more of service to other people. But I blabbed on about the health stuff for too long, and I regret that. If they offer me a second interview after that, they will be very kind, indeed.

(I also could have added something useful like, “If you’re constantly itchy, have hives, or frequently get sick, feel free to ask me any questions you want later.”)

In my mind I thought that because I had written about this stuff many times before that I didn’t need to talk about it, but in retrospect I realized that it would have helped to talk about this stuff with other people before any interviews.

I also thought that I had conquered a lot of things with my ego, but this was another kick-in-the-butt reminder of where I really am.

“I slept and dreamt that life was joy. I awoke and saw that life was service. I acted and behold, service was joy.”

~ Rabindranath Tagore

My favorite garbage dumpster in Seward, Alaska: “Look for peace, look for love, look for good things, look for moose.”

A garbage dumpster in Seward, Alaska

AppleScript FAQ: Can you share some iTunes/Music AppleScript examples (example scripts)?

As I've been working a lot with macOS speech recognition software lately, AppleScript has once again become important in my life. I've been writing a lot of small AppleScript scripts — including AppleScript iTunes scripts — and I thought I'd share snippets of code from those iTunes scripts here for anyone else they might benefit.

2021 Update: Wherever it says “iTunes” below, substitute the word “Music”, as Apple has renamed the iTunes application to Music.


It was driving me crazy that the quality of the songs I was streaming from a website known as Bandcamp sounded better than the quality of the songs I was playing from my iTunes (now Music) collection. In my case, I recently bought a Marian Call CD named “Something Fierce”, and had imported the songs from that CD into iTunes. But the songs I streamed from Bandcamp sounded better than the songs I imported from the CD; how could this be?

I dug into the problem and found two simple fixes, both in iTunes. In this article I'll show you how to make those fixes to dramatically increase your iTunes sound/music quality.

I recently took an online “assessment” test with a company named SHL. In general it was good and interesting, but after thinking about it, one thing it really lacked was a concept of “context.”

For instance, one question was something like, “Are you comfortable talking to strangers?” Well, that depends on the context of the situation. In the context of being at a grocery store I generally have my earbuds in and leave strangers alone until I talk to the cashier, but in the context of work, I pretty much talk to everyone. Two different contexts, two totally different answers.

So as I’m answering the questions I keep asking myself, “What’s the context?” Unfortunately I didn’t share this at the end of the SHL test when they give you a little room to comment, so I thought I’d share that here in hopes someone there might see this.

As I wrote in Different meditation/mindfulness practices, different cultures, and they all talk about witnessing/noting, mindfulness and meditation masters (teachers) from different cultures, countries, and styles of practice often teach the same thing in different ways: a style of mindfulness meditation known as witnessing or noting.

To me, a simple way to think about this is that as your body goes along with its daily life, all you have to do is simply narrate what your body is doing at all times, in the present moment.

If you like, you can think of yourself as being the witness/soul, watching the body, and noting what it’s doing, like a birdwatcher does when they note what birds are doing in a forest. It’s that simple.

(This is a recounting of a long dream from October 1, 2016.)

We were playing at our camp when my older brother — who was standing on higher ground than I — saw something in the distance. He stood upright, then perfectly still. After a few moments he turned to me in a look of panic I had never seen before, pointed in a direction opposite from where he was looking, and screamed, “Run! Run!” I was startled at his behavior but I knew that something was very wrong, so I ran. And I ran.

I ran as fast as I could, weaving through the brush and constantly changing my course as I was chased by a white man on a dark horse. I thought I might be close to safety when I darted through some bushes, but I ran right into a creek that was too wide to jump across. As I paused for a moment to decide how to continue, the white man shot me in the back.

In intense pain and sudden shock, I stumbled forward into the creek, bent over with one hand in the creek. As I attempted to stand up and regain my balance, I was shot in the back again. This time my body flew forward towards the opposite side of the creek. I tried to control my fall but could not, and my torso slammed against the land. The right side of my face was pressed against the ground, my eyes still open. My right arm was trapped under my body, my left arm was somewhere down my left side. My legs lay in the creek’s water.

If you’re interested in logging in a ZIO application, the following example shows a collection of different ways you can write log messages. I also show how to create your own custom log format, so the output logging from this application looks like this: