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

Ah, the Chicken Oil Company ... once I discovered it when I went to school at Texas A&M, I ate quite a few Deathburgers. I’m glad to see that they’re still in business. (Image from this link.)

Chicken Oil Company, Bryan, Texas

Dateline: July 27, 2010, Wasilla, Alaska.

“It looks like she passed away around 4:30,” Al said, holding his neighbor’s just-deceased cat, and looking at the clock on the wall.

“No,” Neighbor #1 replies, wiping her eyes with her kleenex. “That clock doesn’t work. It’s almost 8:30.”

“Oh,” says Al, looking out the window of the second-floor apartment and seeing what appears to be afternoon light in the treetops. Funny how the Alaskan summer sun still throws the perception of time out of balance.

“Can you give us a ride to the hospital? My wife just cut her finger open,” yells unemployed car-less Neighbor #2, suddenly appearing at the open front door. His wife screams from somewhere down below. Neighbor #3, a former police deputy, instinctively gets up to help, but Neighbor #4 says, “I’ve got this one,” and hops off the couch and out the door behind #2. He looks comfortable in his shorts and t-shirt in the mid-40s temperature, as Al shivers.

As they run out the door, Neighbor #5, just home from her job at Carr’s, stands in the doorway, looks around, sees three neighbors and a dead cat in the apartment next to hers, and doesn’t seem to know what she should say or do ...

Young Buddhist monks in flight training school. :)

Young Buddhist monks in flight training class

I love this idea from Ryan Carson. From his tweet, “This is what I look at first, every day, when I wake up. It's my WHY.” Reading your life goals/mission first thing in the morning is a great implementation of the idea of a tombstone test.

What I look at first every day when I wake up

I’m not yet sure if I like the book Functional and Reactive Domain Modeling, but one thing is for sure: I couldn’t begin to understand it if I didn’t first do the research to write Learning Functional Programming in Scala. The author immediately jumps into monads as if they are commonly understood, and also designs his functions as “modules” in a very Haskell-ish way. I’m not saying the book is bad, just that it has a high barrier to entry.

Android 7 comes with a cool new “split screen” feature where you can look at two apps running at the same time. This little pictorial/tutorial shows how to use this split-screen feature.

Linux grep commands FAQ: Can you share some Linux/Unix grep command examples?

Sure. The name grep means "general regular expression parser", but you can think of the grep command as a "search" command for Unix and Linux systems: it's used to search for text strings and more-complicated "regular expressions" within one or more files.

I think it's easiest to learn how to use the grep command by showing examples, so let's dive right in.

Fun with Scala functions, including andThen and compose:

scala> val add1 = (i: Int) => i + 1
add1: Int => Int = <function1>

scala> val double = (i: Int) => i * 2
double: Int => Int = <function1>

scala> val addThenDouble = add1 andThen double
addThenDouble: Int => Int = <function1>

scala> addThenDouble(1)
res0: Int = 4

scala> val doubleThenAdd = add1 compose double
doubleThenAdd: Int => Int = <function1>

scala> doubleThenAdd(1)
res1: Int = 3

(Inspired by the book, Functional and Reactive Domain Modeling, and my own book, Learning Functional Programming in Scala.)

I have a couple of Ubuntu Linux systems, including Raspberry Pi systems, test servers, and production servers. It seems like every time I have to use an apt-get or other apt command, I always have to search for the command I need. To put an end to that, I’m creating this “apt-get reference page.” It’s very terse, as I’ve just written it for myself, but I hope it’s also helpful for others.

Have you ever felt like you were having someone else’s dream? This morning I was having a “back to school (college)” dream, and thought, okay, whatever, I’m bored, I’ll go with it.

The short story is that when I woke up I remembered that one of the teachers was named Don Monk. I figured that was a name made up by my brain, but I googled it just now and found two college professors with that name, one at Rutgers, and the other just down the road at the University of Colorado, Boulder.

As a quick note, I was just reminded that you can populate a Scala List using a Range, like this:

scala> (1 to 5).toList
res0: List[Int] = List(1, 2, 3, 4, 5)

scala> (1 to 10 by 2).toList
res1: List[Int] = List(1, 3, 5, 7, 9)

scala> (5 to 11).toList
res2: List[Int] = List(5, 6, 7, 8, 9, 10, 11)

scala> ('d' to 'h').toList
res3: List[Char] = List(d, e, f, g, h)

Those are just a few examples. For many more ways to populate Scala lists with sample data, see How to populate Scala collections with a Range, How to generate random numbers, characters, and sequences in Scala, and Different ways to create and populate Lists in Scala.

In sad news, Talkeetna’s Mayor Stubbs passed away at the age of 20 on July 22, 2017.

I recently read that moose tend to attack dogs, and therefore people with dogs, because they look at dogs as a potential predator. Given that background, here’s a nice story on adn.com about a person and their dog in Alaska.

July 22, 2017 will go down as the day I (finally) switched this website to using HTTPS instead of HTTP. (See the padlock icon in the URL field of your browser.) I’ve been using a self-signed certificate to log in to this site for a long time, but yesterday I finally switched to “HTTPS for everyone.”

As a brief “note to self,” this is how I just updated a Drupal 8 website using Drush.

First, do these things:

I’ve currently written this document as a “note to self” about how the Android AsyncTask works. It’s currently incomplete, but if you want to know how an AsyncTask works, most of the answers are generally here. I provide documentation for most aspects of the AsyncTask, though my coverage of (a) updating progress/status and (b) canceling an AsyncTask is a little weak atm.

I just ran across this image. I created it way back when I was first learning how to create artistic effects with Gimp. I don’t know for sure because I didn’t save the working file, but I suspect that I created this image by starting with an image from a YouTube video, then blurred it a little bit, then applied the “oilify” effect to it one or more times.

P.S. — If you’re old enough, you can identify the pitcher and the batter, despite the Gimp artistic effects. :)

Gimp image: Cubs Ferguson Jenkins pitching to Pete Rose

I just got back into using an Android AsyncTask, and it took me a little while to re-load the concepts in my head. I used AsyncTask’s a few years ago, but haven’t used them since.

To help remember how they work, I created a little AsyncTask example project, and I’ve included all of the source code for that project here. I’ll show all of the source code for my classes and configuration files, and then explain the code at the end.

I was just working with an example of how to use Android’s new Room Persistence Library, and the example I was working with ran some of its code on the main Android thread, also known as its “UI thread.” I knew this was bad, but I wanted to start with someone’s example, and then figure out a good way to get the Room method calls to run on a background thread, such as using an AsyncTask. (The Android docs don’t specify a “best practice” for this atm.)

A series of recent emails has me thinking about “life-changing events.” These are events where your life is clearly headed down one path, and then perhaps in an instant it’s no longer on that same path.

For me there is just one “major” event, which happened when I was a teenager. I’ll call this a Level 1 event. After that there are a series of other important events that are all at a similar level of importance (Level 2), but they are not as direction-altering as the Level 1 event(s).

It's been an interesting thought process. There are at least two moments that didn’t seem too important at the time, but when I look back at those events years later I can see how they changed my direction.