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

This is definitely not my thing, but if you’re interested in eating squirrel meat, head over to Bentonville, Arkansas for the World Championship Squirrel Cook Off (which I learned about while sitting at the Subaru dealership in Boulder a few days ago).

When planning my brother-in-law’s funeral with a woman at the funeral home (I don’t know if she is considered a funeral director or something else), my father-in-law decided to get a limousine for the immediate family members. The limo would take everyone from the funeral home to church, then to the cemetery, and finally back to the funeral home.

When we were told that the limo could hold seven people and we calculated there were eight people we wanted to get in, I was voted off limo-island, but the funeral home woman said I could ride in the hearse. After clarifying whether I’d be sitting in the front or laying in the back – she said the front – I asked if I could drive the hearse. While she never said “yes,” I think she said, “Um, sure,” and I know that she later told a co-worker that I would be driving.

Something I just realized when writing a friend is that after my parents were divorced, everyone but my dad was much happier. During my senior year of high school my parents were still married and my dad had a child with a woman who wasn’t my mother, which led to the divorce. He could be verbally abusive at times — extremely so — and in our high school photos we often looked like the most depressed family in the world. But after he left, everyone felt more free to be themselves without fear of reprisal.

If you like free things, here’s a link to a free preview of the new version of my book, “Hello, Scala.” The book is 257 pages long, and the free preview contains the first 120 pages of it, so I hope it’s a significant preview.

The new version of the book isn’t currently available for sale, but I hope to release print, PDF, and Kindle versions of it in the next few weeks.

Hello, Scala (free preview)

I doubt that most people know it, but authors always enjoy receiving letters of “thanks” like this one. Writing is often a lonely, solitary business, and to hear that your work has helped other people is always satisfying. If there’s a book you’ve read that you really enjoyed, I encourage you to write the author a brief letter of thanks. They’ll appreciate it more than you’ll know.

Author love letters of thanks

JMH is an SBT plugin for running OpenJDK JMH benchmarks. Per its docs, “JMH is a Java harness for building, running, and analysing nano/micro/milli/macro benchmarks written in Java and other languages targeting the JVM.”

They also recommend reading an article titled Nanotrusting the Nanotime if you’re interested in writing your own benchmark tests.

I just saw that this is a way you can easily determine the blocksize of a filesystem, at least a Mac/Unix/Linux filesystem:

$ echo foo > foo

$ du -h foo
4.0K    foo

I tried to do the same thing with touch foo, but that didn’t work. Without digging into it more, the key seems to be in having very little text in the file, at which point the du command shows the minimum block size for the file.

I drove back from Kentucky to Colorado today following the death of my brother-in-law, and got to enjoy a beautiful view of a full moon for much of the day, including a stop at a rest area in Indiana this morning.

Full moon over an Indiana rest area

Since my brother-in-law passed away on Monday I haven’t felt like working — and I haven’t had any time to work — but on the rare occasions I’ve thought about work, I’ve thought that Scala is a beautiful programming language, and I’m fortunate to be able to work with it.

After a long illness, my brother-in-law passed away this morning, August 20, 2018. Godspeed, Kenny.

If you’re interested in a simple, pretty, instrumental song, Rain, by Simply Three might fit the bill. I especially like the little bicycle rider guy in the taxi cabi window.

Zachary: I ran into one of my brother’s work buddies, he introduced me to Tai Chi. It saved me.

Longmire: How so?

Zachary: I like to put it like this ... I went to church a lot as a kid, and we were always taught to love our enemies. Tai Chi taught me something new — to love the enemy inside me, as well. So I don’t look at peace as the absence of conflict any more. I see it as the acceptance of conflict.

(From the tv series Longmire)

This page contains a large collection of examples of how to use the Scala ArrayBuffer class.

Use the ArrayBuffer class when you want to use a general-purpose, mutable indexed sequence in your Scala applications:

I thought about writing a “functional programming in Kotlin” book, but I think that Kotlin and Scala are similar enough that Functional Programming, Simplified will be good for Kotlin programmers as well as Scala programmers.

August 15, 2011, Palmer, Alaska: I just got a flush letter from a local hospital. I guess I shouldn’t have put “You have my gallbladder” and “Your nurses seem really nice” as my top reasons for wanting to work there.

When using Scala, if you ever need to list the subdirectories in a directory, or the files under a directory, I hope this example is helpful:

import java.io.File

object FileTests extends App {

    // list only the folders directly under this directory (does not recurse)
    val folders: Array[File] = (new File("/Users/al"))
        .listFiles
        .filter(_.isDirectory)  //isFile to find files
    folders.foreach(println)

}

If it helps to see it, a longer version of that solution looks like this:

I just learned that Warren Buffett’s shareholder letters can be found here in PDF format.

The first time I started to go back to work after moving to Colorado, I ended up with thyroid cancer. Then I went unconscious seven times, had two fake heart attacks, and eventually learned I have a rare blood disease that caused those problems and more. Then I had diverticulitis twice, possibly epiploic appendagitis several times more, and ended up having to have part of my colon removed. Come September I’m not going to look for work, I’m just going to be like Kramer and show up at someone’s office.

As a quick note, here’s an example of how to use the Kotlin sortedWith syntax with an anonymous function (lambda). Given this list of integers:

val list = listOf(7,3,5,9,1,3)

Here’s an example of how to use sortedWith using a Comparator and lambda:

“And when things got hard, you started looking for something to blame, like a big shadow. Let me tell you something you already know. The world ain’t all sunshine and rainbows. It’s a very mean and nasty place and I don’t care how tough you are, it will beat you to your knees and keep you there permanently if you let it. You, me, or nobody is gonna hit as hard as life. But it ain’t about how hard you hit. It’s about how hard you can get hit and keep moving forward. How much you can take and keep moving forward. That’s how winning is done.”

I enjoyed this quote from Rocky Balboa the first time I saw the movie, and I appreciate it even more now after getting my a** kicked by this f-ing blood disease, but still grinding along every day.

It's about how hard you can get hit and keep moving forward