Alvin Alexander | Java, Scala, Unix, Perl, Mac OS X

Buddha was asked, “What have you gained from meditation?”

He replied, “Nothing!” Then he continued, “However, let me tell you what I have lost: anger, anxiety, depression, insecurity, and fear of old age an death.”

Without much introduction or discussion, here’s a Scala example that shows how to read from one text file while simultaneously writing the uppercase version of the text to a second output file:

Way back in the 1990s I created some “cheat sheets” for Unix training classes that I taught. Somewhere in the 2000s I updated them to make sure they worked with Linux as well, Here then are two Unix/Linux cheat sheets I created (way back when) that you can print out if you’re just learning Linux and the vi/vim editor:

Table of Contents1 - Benefits of automated GUI testing2 - Keys to automated GUI testing and continuous integration3 - Beware automated GUI testing software sales pitches and recorders

Introduction: I first wrote this article about automated GUI testing many years ago, but I find that it still holds today.

I just wrote most of the following note on the Apple Mac Java-dev mailing list, and I'd like to share it here as well, because I think it captures my thoughts on the benefits of automated GUI testing and GUI testing software.

I’ve read before that practicing attitudes like gratitude and humility can help re-program the brain in a positive way. Conversely, you (or your toxic parents) can also train the neural network in your brain to tend towards negative thoughts. I thought of this when I saw this article by Annie Wood titled, How complaining rewires your brain for negativity (and how to break the habit).

“To have never taken a solitary road trip across country? I mean, everybody’s got to take a road trip, at least once in their lives. Just you and some music.”

~ Claire in Elizabethtown

I’m so glad I listened to The Book Thief on my recent travels. The movie is okay, but the book is 100% better.

This documentation page shares a good reason to use “sealed” traits and classes: When you do this, the compiler can easily tell all of the subtypes of your class or trait, and therefore you don’t need to add a default, “catch-all” case in your Scala match expressions.

Scala sealed traits - No need for a default, catch-all case in match expression

Being interested in baseball, Tom Seaver, and Alaska, this article about Tom Seaver’s first game in Fairbanks, Alaska is interesting.

I’m sitting here writing a book on how to write better software using functional programming techniques, then I go to the Boulder Community Hospital website to pay my bill (powered by, and they don’t tell you how much you owe, you’re just supposed to type in how much you think you owe. It’s like calling Kramer on Seinfeld to get a list of movies: “Why don’t you just tell me where you want to see the movie?” *crazy* How much do you think you owe?

Somebody was like, “Let’s get a mast cell — a type of white blood cell — from a bone marrow biopsy, magnify it 1,000 times, piss it off, and see what happens.”

The result? Ka-boom! It looks like a little firework went off when it released its histamine, tryptase, serotonin, superoxide, heparin, thromboxane, PGD2, PAF, and other granules.

That’s pretty much what it feels like, lol. I used to tell doctors that it felt like I had been drugged, and indeed, I was.

(Image from this research paper.)

MCAD: What an activated mast cell looks like

Tho’ much is taken, much abides; and tho’
We are not now that strength which in old days
Moved earth and heaven, that which we are, we are;
One equal temper of heroic hearts,
Made weak by time and fate, but strong in will
To strive, to seek, to find, and not to yield.

~ Part of the poem Ulysses, by Lord Alfred Tennyson

(True story: In the process of writing my latest book, I had to make thirteen trips to the ERs (emergency departments, actually) of three different hospitals. So this poem has some meaning to me.)

If for some reason you want a Covfefe coffee mug, here you go.

Covfefe coffee mug

putStrLn doesn’t print to standard out, it returns a value — of type IO () — which describes how to print to standard out, but stops short of actually doing it.”

From the article, An IO Monad for Cats.

As a quick note, if you’re interested in using the IO monad described in this IO Monad for Cats article, here’s the source code for a complete Scala App based on that article:

The people at have made their books on Scala and functional programming free (or “donationware,” if you prefer). I’ve found the Advanced Scala with Cats book to be particularly good, and well worth a donation.

(Full disclosure: I didn’t pay for the Advanced Scala book when I first downloaded it, then went back and tried to pay for it, but the Gumroad website wouldn’t let me do that.) books

After the 0.1.2 release of Learning Functional Programming in Scala, it occurs to me that I need to be more explicit about my goals for the book. Some people seem to think that I’m trying to “sell” functional programming. That’s not the case at all. I’m just trying to be a reporter and explain what I’ve learned about FP after reading dozens (hundreds?!) of articles and many books on FP, learning Haskell, trying to apply these techniques to my own code, etc. I’ll explain this further in the next release of the book.

I haven’t watched all of this video yet, but it’s about how to build Scala projects with a tool named CBT.

"Enlightenment of the wave". From the book, Zen Speaks, Shouts of Nothingness. The book is filled with wonderful cartoons like this.

Zen Speaks: Enlightenment of the wave

“The mind can proceed only so far upon what it knows and can prove. There comes a point where the mind takes a higher plane of knowledge, but can never prove how it got there. All great discoveries have involved such a leap.”

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