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

I can appreciate this sentiment, seen outside a local Whole Foods store.

Mom is a survivor

Well played, Photoshopper. :)

Speed checked by Radar

When you want to do a SQL INSERT or UPDATE using the Flutter sqflite package, I’ve found that it’s best to use their insert and update methods (as shown below) so you don’t have to worry about escaping single- and double-quotes. This is similar to the reason why Java developers switched from Statement to PreparedStatement way back in the late 1900s.

As an example, given this SQLite database table:

I like most of Dana Stabenow’s work, and while I didn’t particularly like Dead in the Water, I did enjoy some of the quotes in the book, such as, “Always perform the work that has to be done without attachment,” which comes from the Bhagavad Gita, of which there are many translations (such as this one, this one, and this one).

Always perform the work that has to be done without attachment

“Your time is limited, so don’t waste it living someone else’s life. Don’t be trapped by dogma — which is living with the results of other people’s thinking. Don’t let the noise of others’ opinions drown out your own inner voice. And most important, have the courage to follow your heart and intuition. They somehow already know what you truly want to become.”

~ Steve Jobs

If you want to create a Dart project, probably the best way to do that currently is to use Stagehand:

Once you install that you can create new Dart command-line applications like this:

// create a command-line application
stagehand console-full

However, if you just want to create a little Dart project manually, you can also just follow the steps below:

PHP FAQ: How can I run a PHP script from the Linux/Unix command line?

Solution: To run a PHP script from a Unix command line you can use this syntax:

php -f myscript.php

June 2, 2016: I don’t think my chest is as hairy as Steve Carell’s, but I got three chest-waxings at the hospital last week, and it is really, really painful. (They put the heart monitor leads on, take them off, put them back on, etc.) Someone told me Mr. Carell did this for real for the movie. If so, wow, that’s dedication.

Chest waxing at the hospital (40 Year Old Virgin)

When I went to Texas A&M University, we discovered a restaurant just down the road in Bryan, Texas, called the “Chicken Oil Company.” Once there, we discovered that they made something called a “Deathburger,” known in this photo as the, “Hamburguesa de Muerte.”

The Chicken Oil Company “Deathburger”

When I lived in Talkeetna, Alaska, I lived about two minutes walk from Talkeetna Air Taxi. Technically I think there were two houses closer to them than my cabin was, but personally, I enjoyed listening to the sounds of the airplanes at the little Talkeetna airport.

Talkeetna Air Taxi, Alaska

When I first moved to Alaska I took a really nice camera with me, and I took some fun photos I would have never thought to take with a regular camera. In this photo I was more or less laying down in a field of wildflowers (some weeds) at the Talkeetna Airport, bees and everything.

Wildflowers at the Talkeetna, Alaska airport

These are some terrific words from a blog post titled, I’m Not The Radical Left, I’m The Humane Middle:

I believe in full LGBTQ rights.
I believe we should protect the planet.
I believe everyone deserves healthcare.
I believe all religions are equally valid.
I believe the world is bigger than America.
I believe to be “pro-life,” means to treasure all of it.
I believe whiteness isn’t superior and it is not the baseline of humanity.
I believe we are all one interdependent community.
I believe people and places are made better by diversity.
I believe people shouldn’t be forced to abide by anyone else’s religion.
I believe non-American human beings have as much value as American ones.
I believe generosity is greater than greed, compassion better than contempt, and kindness superior to derision.
I believe there is enough in this world for everyone: enough food, enough money, enough room, enough care — if we unleash our creativity and unclench our fists.

I just noticed that some of the MySQL files on this website had grown very large, so I wanted to be able to list all of the files in the MySQL data directory and sort them by filesize, with the largest files shown at the end of the listing. This ls command did the trick, resulting in the output shown in the image:

ls -Slhr

The -S option is the key, telling the ls command to sort the file listing by size. The -h option tells ls to make the output human readable, and -r tells it to reverse the output, so in this case the largest files are shown at the end of the output.

'ls' command output sorted by filesize

When I originally saw the first image, I thought it was a “This would be nice in Scala 3 (Dotty)” idea. But then I found the “No parentheses in control structures” pull request shown in the second image. Here’s a link to that pull request.

Scala 3: No parentheses in control structures

From a friend on Facebook, this is a great way to look at the two possibilities about climate change:

  • If scientists are wrong, hey, we’ll have a cleaner world
  • If they’re right, we’re all dead

Your choice.

If climate change is wrong, at least we’ll have a cleaner world

I’ve been working with Flutter and Dart for several weeks now, and I was surprised to read several times that Dart is single-threaded, knowing that it has a concept of a Future (or futures) and async methods. Last night I read this excellent article about Dart’s event loop, which sums up Dart futures very nicely in that statement:

“the code of these Futures will be run as soon as the Event Loop has some time. This will give the user the feeling that things are being processed in parallel (while we now know it is not the case).”

Earlier in the article the author also states:

“An async method is NOT executed in parallel but following the regular sequence of events, handled by the Event Loop, too.”

So, in summary, Dart has a single-threaded event loop, and futures and async methods aren’t handled by a separate thread; they’re handled by the single-threaded event loop whenever it has nothing else to do.

I just wanted to note this here for myself today, but for many more details, please see that article, which also discusses Dart isolates, which are like a more primitive form of Akka actors.

Today I learned that for several reasons, Flutter Debug mode may be significantly slower than Production mode. As just one reason, Debug mode is compiled using JIT while Production mode uses AOT. You can read more about the reasons on the Flutter UI Performance page.

A very important note on that page is that if you’re using a real hardware device (as opposed to an emulator), you can run your code in Profile mode like this:

When using Flutter (and Dart), if you need to compare two TimeOfDay values, I can confirm that it helps to first convert the TimeOfDay to a double using this function:

/// note: 'hour' is in 24-hour format
double _timeOfDayToDouble(TimeOfDay tod) => tod.hour + tod.minute/60.0;

If you ever need to run multiple Dart futures in parallel (simultaneously), I can confirm that this approach works:

So I pour some root beer in a Ball jar glass I use to drink from. I put some ice in it, then set it on the counter because I realize I left my glasses in the bedroom. In the bedroom I hear a cracking noise from the kitchen, but when I come back I can’t figure out what it was, so I assume it was the ice cracking in the root beer.

I pick up the Ball glass, take it to the computer area, then realize I now left my glasses in the kitchen. So I start walking to the kitchen, and the bottom of one of my feet feels a little wet. I can’t make sense of that, unless the Ball glass already started perspiring and dripped.

I come back to the computer area and find a little puddle of root beer under my glass. “Oh,” I think, “the root beer must have overflowed after I put the ice in. Strange I didn’t feel it on my hands.”

So I pick up the Ball glass and think, “Huh, that’s a lot of root beer under there,” so I take it back to the kitchen to rinse the glass under the sink. When I put the glass under the sink the bottom explodes and falls out.

Ball jar glass cracks, explodes