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

As a quick note, the Dart ternary operator syntax is the same as the Java ternary operator syntax. The general syntax is:

result = testCondition ? trueValue : falseValue

A few examples helps to demonstrate Dart’s ternary syntax:

“All things that appear in this world are illusion. If you view all appearance as nonappearance, you will see your true nature.”

“There he goes. One of God's own prototypes. A high-powered mutant of some kind never even considered for mass production. Too weird to live, and too rare to die.”

~ Hunter S. Thompson, Fear and Loathing in Las Vegas

Here’s a little example of how to pass a Dart function into another function or method. The solution is basically a three-step process.

Step 1: Define a method that takes a function parameter

First, define a method that takes a function as a parameter, such as this exec method:

As a brief note, if you ever need to use the Flutter CupertinoDatePicker — a spinning wheel chooser — in “time-picker/time-chooser” mode, I can confirm that this example works:

I initially thought you couldn’t pass functions around in Dart (you can!), so I had to remember what we used to have to do with interfaces and inheritance. (See the image.)

Put another way, when you have the ability to pass functions into functions, it eliminates this kind of code interface/inheritance code.

What your source code looks like when you can’t pass functions around

At one point when I was recovering from a surgery I wasn’t feeling very well, so I ended up watching a lot of movies, including 13 Going on 30. I was struck not only by the humor of this particular scene in the movie, but also the empathy. When I worked as a manager, I always appreciated it when employees could see my situation from time to time. It shows a certain maturity that is rare to find in employees.

An example of empathy (from “13 Going on 30”)

When I first studied Zen, I had a very hard time with this concept. I tried to focus very hard on the present moment, and also on being kind, and as a result, I didn’t always do what was really best for the situation. Over time, you figure out how to respond properly.

Zen - Accepting the “just this” of a situation

If you’ve ever had a Siberian Husky, you’ll probably find that these drawings and captions are accurate. (Image from

Siberian Husky body language

After some more medical tests tomorrow (Tuesday) I hope to be able to return to work as early as Wednesday. I don’t really have much energy yet, but hopefully I can get back to writing Scala code and blog posts for two to four hours a day initially.

My ideal job would be to work as a QA guy for the Talkeetna Roadhouse bakery but after getting my full energy back I’ll probably settle for some sort of programming gig instead. :)

The Talkeetna Roadhouse (Talkeetna, Alaska)

The Dancer Upstairs may be a little slow for most other people, but it’s one of my favorite movies (except for the dog parts).

Released in 2002, it was the first or second movie I saw Javier Bardem in, and when you watch it not knowing who he is, you say to yourself, “This guy has it,” that special something that makes you want to watch. As a friend once said, Tom Hanks is like that; if they made a movie about a guy stranded on an island and he was the only one in the movie, she’d watch the movie just because it was him (as did many other people).

The Dancer Upstairs

I was writing with a friend recently about trying to find a way to love all beings, and she sent me this quote:

“I leave you free to be yourself: to think your thoughts, indulge your tastes, follow your inclinations, behave in ways that you decide are to your liking.”

When I read that it made me think something like, “I love you (your spirit), and I acknowledge that you’re a separate being here on Earth. I can’t control you, I can’t make you act in a way that I want you to behave (i.e., in a non-harmful way), so I just have to let you be, so you can work out your own karma.”

For some reason that gives me hope that there is a way I can love all beings (not just the good ones).

Namaste, Al

A few more September colors from Talkeetna, Alaska

September colors, Talkeetna, Alaska

September, 2014, represented a changing of the guard for me. The old Toyota RAV4 was both a good and bad experience, and today I traded it in for the official car of Colorado, a Subaru Outback. As you can see from the photos, the two cars are somewhat similar in design and color. (The top photo was taken in Coldfoot, Alaska, a very small “town” about halfway between Fairbanks and Deadhorse, Alaska.)

Changing of the guard (Toyota RAV4 to Subaru)

At the time of this writing (September 19, 2019), there’s a lot of bad information in books and on the internet about how to use a Flutter FutureBuilder. That bad information caused me to waste a lot of time over the last two days. I don’t have time today to explain everything, but in short, here’s a technically correct FutureBuilder example:

If you ever need a Dart/Flutter method to format a TimeOfDay variable — i.e., convert a TimeOfDay to a String — I can confirm that this method works:

String formatTimeOfDay(TimeOfDay tod) {
    final now = new;
    final dt = DateTime(now.year, now.month,, tod.hour, tod.minute);
    final format =;  //"6:00 AM"
    return format.format(dt);

494 miles north of Fairbanks, Alaska. No services for 240 miles. 30 degree temps, fog, and very little visibility. That was a long, cold day in July. (August, actually.) Somehow I drove all the way from Deadhorse (Prudhoe Bay) to Talkeetna, about 770 miles.

494 miles north of Fairbanks, Alaska

I’ve written this before, but when I saw this “pseudocode to Scala code” example in the book Functional Thinking, I thought it was worth mentioning again: If you have trouble grokking the Scala map method, think of it as being named transform instead. It transforms an input collection to an output collection, based on the algorithm you supply.

For those coming from the OOP world, I think “transform” is a better word because it is more meaningful, at least initially.

Inspired by a conversation with a friend recently about “trying to love everyone,” I dug into things a little more and found the following information from Ram Dass, Zen masters, the Maharaj-ji (Neem Karoli Baba), and Yoda.

As I keep trying to figure out what Ram Dass means when he says, “love everyone,” I dug through his book, be love now and found these two quotes: