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

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.

FLiB is a fast, free internet browser for Android devices. Read on for more details ...

Just like my Jenny Lane Cottage painting, this is another small version of a “faux painting” I recently created from a photo. This one is of a sidewalk in Santa Fe, New Mexico. The complexity of this image was in removing several modern aspects from the original photo, including signs that were on those green columns, and modern automobiles that were in the background. Everything after that is what has become fairly standard work with Gimp for me, including making it look like an oil painting, and dramatically modifying and enhancing the colors.

I use my favorite images as screensavers, and this “hoodie” image of Luke Skywalker from Star Wars Movie #7 is a recent favorite. I found an image online, then worked with it in Gimp to get a decent effect. This Luke Skywalker sketch shows another approach you can take with Gimp.

Luke Skywalker "hoodie"

This is another sketch of Luke Skywalker from whatever the last Star Wars movie was called. I started with this earlier image I created, then converted it to a Gimp “life sketch” by going to Beautify > Beautify > Art > Life Sketch > 100%.

While I’m in the neighborhood, I also created this fake Luke Skywalker “hoodie” oil painting.

Luke Skywalker black and white sketch

As a brief note, today I tried to list the files in my Android application, which was running on a physical Android device — a Nexus 9 — with this adb shell command:

adb shell com.alvinalexander.mybrowser ls /data/data/com.alvinalexander.mybrowser

When I did that, I got an Android/ADB “permission denied” error.

The short story is that a solution to this problem is to run the same command, but with the run-as argument, like this:

On the same day I learned that the Cookie Lady of Denver died, I just read that the Remix OS from Jide is also dead. (In inner circles I’m known as a bit of a cookie monster, so I’m sad that I never met or even knew of the Cookie Lady.)

The best advice I’ve gotten for practicing mindfulness meditation while not sitting in meditation – i.e., in active meditation – is to make something of a game of it. When I wash the dishes it’s like, “How deep can I get while I wash these dishes?” Or when talking to another person, you both put down the cellphones and think, “Okay, we’re both here right now, how much can we focus only on each other and be here in this moment while we talk? How deep can we go?”

I was reminded of this when I read this line recently: “Finally, I got it! The menial tasks I had been assigned to around the temple were meant to be an exercise in meditation. Whatever I was doing, my job was to try to stay in samadhi.”

(That quote comes from the book, The Science of Meditation.)

If you like to watch movies and videos on your tablet, this tablet stand is very cool. The up-and-down rotation is nice and stiff, so you can set it at any angle, and it has rubber cushions in the right places to keep your tablet from sliding or getting damaged. I just bought this a few days ago, and it’s a definite “thumbs up.” It works great with my Nexus 9, and an old iPad 2 (that I only use for music these days).

(I show it next to an apple because the shiny images on Amazon may give you the impression that it’s larger.)

Great tablet stand

Just saw this: “Never let your boss convince you that ‘work ethic’ is working extra hours for free. It’s the same as writing a check to the business owner.”

Technically that’s true, a good observation, and I can’t argue with it.

Conversely, when I got out of college, my wife’s grandfather told me the phrase, “If you do more for what you’re paid to do, you’ll eventually be paid more for what you do.” As an employee, I made a lot of money with his philosophy, rapidly doubling and tripling my income.

Later, as the owner of a small business, I didn’t mind it when employees didn’t work overtime – and we always paid for overtime. I respect people who want to work forty hours a week and have a balanced life. But I also knew that those people would never become partners in our business. I never thought of it as good or bad, just a fact of business life.

I needed to use Gnuplot a little bit over the last few days, mostly to create 2D line charts, and these are my brief notes on how to get started with Gnuplot. If you haven’t used it before, it’s a pretty amazing tool.

Jumping right in ...

Back to top

Installing gnuplot

Use MacPorts or Homebrew to install Gnuplot on Mac OS X systems:

port install gnuplot
brew install gnuplot
Back to top

Sample data files

My examples use the following 2-column and 4-column data files:

Back to top

Every once in a while when something hits you, you really remember it; it stands out in your mind as an “Aha” moment. One of those moments for me was when I saw a particular “Model/View/Controller” (MVC) diagram, and the light bulb went on. This diagram made the MVC pattern very simple, and I’ve never forgotten it.

This is a nice quote about attitude during competition from Garbine Muguruza, who just won the 2017 Women’s Wimbledon tournament:

“I knew she (Venus Williams) was going to make me suffer and fight for it. When I had those set points against me, I’m like, ‘Hey, it's normal. I’m playing Venus here.’ So I just kept fighting. I knew that if I was playing like I was playing during the two weeks, I was going to eventually have an opportunity. So I was calm. If I lose the first set, I still have two more. Let’s not make drama.”

Apple didn’t put a little home in each of its stores, but TechCrunch reports, “Apple has unveiled interactive HomeKit experiences in 46 of its retail stores worldwide ... when you go into Apple’s new retail stores you’ll be able to use the Home app from either an Apple Watch, iPhone or iPad to control devices like the Philips Hue light bulb, the Hunter ceiling fan and many others.”

SI.com has a good article on what the Colorado Rockies and their pitchers have done to try to pitch successfully at Coors Field in Denver, Colorado, where at nearly 5,200 altitude, the air is 20% thinner than at sea level.

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