Scala, Java, Unix, MacOS tutorials (page 46)

Ongoing dreams are one of the top five or ten most interesting side effects of meditation. This morning I was in this rinky-dink dive motel, and I thought nobody knew I was there. Then there’s a knock at the door. I open it, and a woman tries to walk in. “Hey, hey, hey, slow down,” I say as I stop her from coming in.

“You don’t remember,” she asks.

I look at her hard, but no, I don’t remember.

So she holds up a newspaper clipping, and I look at it. It’s something I wrote. She starts to explain, “You wrote this,” but then it all comes flooding back to me before she says any more. “Okay, that’s good,” I say, holding up my hand. “I remember it all. Come in.”

“Thank god,” she says, and walks into the room and plops down on a bed, face down. “I’m beat.” Then I turn around and more people start to come in, but it’s all good, I remember them, and the dream continues from where we left off. One person has brought several containers of taco ingredients, and the meat mixture smells amazing. We begin to put them together quietly at a makeshift counter while the woman rests.

As the tacos are made, we take them outside. It’s a bright, sunny day, and there’s a Jaguar parked outside my room in this crappy motel in the desert...

Those who know me know that I was born with a rare blood disease, mast cell activation syndrome (MCAS), also known as “Bubble Boy” disease. MCAS is an autoimmune disease, and I’ve written about this in quite a few places over the last five years, including these articles:

This probably won’t make sense to anyone else, but these are my notes related to installing Wiki.js and Postgresql on an Ubuntu 20.04 system. Everything here is related to setting up a new Ubuntu system and then running Wiki.js:

As a quick note, this is how I run the Postgresql pg_dump command to make a database backup while using a password:

pg_dump --no-owner \
        --dbname=postgresql://username:password@localhost:5432/databasename > database.sql

There are other ways to do this, as described on this SO page, but I prefer this solution, which I found on this page. Personally I’d rather have the database password right next to the command, rather than in some file I’ll forget about two weeks from now.

“I’m not a great programmer; I’m just a good programmer with great habits.”

~ Kent Beck

I recently visited some family, and this is one of the photos from the drive home, somewhere in rural Colorado on June, 27, 2021. I don’t remember my exact location at this time, but it was right before or after I passed through Limon.

Somewhere in rural Colorado on June, 27, 2021

Akka Actors Problem: You want to see the proper way to shut down Akka Typed actors.

(Note: This tutorial is written for Akka 2.6.)

Solution

There are two main ways to shut down Akka Typed actors:

  • Send them a “graceful shutdown” message, and let them shut themselves down by calling Behaviors.stopped

  • As a parent, stop a child actor with actorContext.stop(actorRef)

Akka Actors Problem: You know that an actor that “blocking” is bad for your Akka system, so you want to create actors that don’t block.

Solution

When using Akka actors, the mantra is always, “Delegate, delegate, delegate.” It’s important that high-level actors delegate work to lower-level actors, so the high-level actors can be free to receive new messages and respond to them immediately. This example shows how to implement non-blocking actors.

As I was writing the Scala Cookbook, 2nd Edition — and debating writing a book about Scala.js — I had to start thinking about how to implement Scala.js applications in the real world. When I did that, I began to look at these Scala.js libraries:

Akka Problem: In some situations you can’t pass an ActorRef to another actor, so you want to see how to “look up” an Akka Typed actor so you can send a message to it.

Solution

There are at least two ways to find other Akka Typed actors, and both involve using the Akka Receptionist. The example shown here in the solution shows how to find an actor asynchronously, and the example shown in the Discussion shows how to use the ask method to find another actor synchronously.

In both examples I’ll use the idea of creating an actor system that works like Amazon Echo devices. The basic idea is that a device like this has ears to listen to you, a mouth to speak to you, and a brain to do all of its work. In these examples the Brain actor will need to discover the Mouth actor.

As a brief lesson on “the time value of money,” I’ve paid over $175,000 for caregiving services for my mom, which has forced me to sell my beloved Apple stock (which I had owned since 2009), as well as some Shopify stock that has multiplied even more than Apple. As you can easily tell from this one image, that $175,000 — which I started paying in 2014 — would be worth well over $1,000,000 today.

So, as an example, if I could have kept that $175,000 in the market at the beginning of 2017, it would be worth at least 5x since that time. This is one example of why a certain amount of money now can be worth much more.

Conversely, if you just keep your money in the bank, with the cost of living increasing at about 4% per year, $1 in 2003 is worth about 50 cents today. (Using the “Rule of 72”.)

AAPL stock, 2016-2021

May 17, 2021: At the moment I don’t expect/plan to write a book on Scala.js, but in my research I came across this terrific set of short videos by Mark Lewis on the Play Framework and creating web applications with Scala. At video #69 he starts to talk about Scala.js.

Interesting discussion of the day: A young woman who helped me at Best Buy today told me that one reason she works there is so she has something she can talk about with her father (tech stuff).

~ May 16, 2014

I prefer the phrase, “Sun does not set.” #talkeetna #alaska

Talkeetna, Alaska: Sun does not set

This is a photo from May 10, 2011. The long bike-riding path in Palmer, Alaska was  one of my favorite things about living there. As you can see, it’s a nice, big path, separated from the road.

Bike path in Palmer, Alaska

I don’t remember where exactly in Palmer, Alaska I took this photo, but my best guess is that I was on a bike ride near some of the farms. I just found this photo this morning, so I thought I’d share it here.

Mountain range in Palmer, Alaska

Mama always told me not to look into the eye’s of the Sun ... sunrise in Virginia Beach, April, 2017.

Sunrise in Virginia Beach, April, 2017

Today (April 8, 2020) is a day off for me, so I woke up at 4:30am and went up on the roof of the apartment complex garage, and took a few photos of the Pink Moon. These are some small versions of the best Moon photos, along with one of the Sun, which was coming up behind me from the east as the Moon set in the west over the Rocky Mountains.

First, the “Pink Moon” setting over the Rockies:

Pink Moon setting over the Rocky Mountains

Last night I was chasing people who were putting bombs in buildings and flying shape-shifters (who I would later realize were on my side). When I started to catch up to them I’d find myself yelling, “please comply.” I give a “thumbs up” for the action/adventure part of the dream, but the writing and line delivery were just horrible.

~ a dream from April 8, 2017

Doctors have been treating me for “suspicion of mast cell activation syndrome (MCAS)” since 2016, and I recently got my first Covid vaccination shot. Here’s a quick summary of the experience.

Before the shot I took one Allegra pill, as usual, and then two Xyzal pills (where I normally take one a day, but as many as four).

I got the Pfizer vaccine shot, and quickly developed these symptoms: