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

“The greatest action movie ever made”
Terminator 2

This is a photo of some white-tipped trees on a cloudy, overcast day in Louisville, Colorado, March, 2016 (a few miles east and south of Boulder, Colorado).

Louisville, Colorado: White trees on a cloudy day

A “Boulderstrong” sign at the King Soopers in Louisville, Colorado, to honor the people who were killed at the mass shooting in Boulder last week.

Boulderstrong: King Soopers in Louisville, Colorado

I got vaccinated this past week at Boulder Community Hospital, in Boulder, Colorado.

I got vaccinated (Boulder, Colorado)

Functional programming is interesting. On the one hand it’s very (extremely!) disciplined. But on the other hand, people can’t agree on certain definitions. As an example, here are the “three principles of functional programming,” from this tweet:

1. Orthogonal composability
2. Maximum polymorphism
3. Maximum deferment

Conversely, here are the “three pillars of functional programming,” from Functional and Reactive Domain Modeling:

1. Referential transparency
2. Substitution model
3. Equational reasoning

When I learned OOP I saw that it was based on several principles that everyone agrees upon. When I started learning FP (and later took two years to write Functional Programming, Simplified) I was surprised there wasn’t a single accepted definition of functional programming. I ran across the principles/pillars in the last two days and was reminded of that again.

macOS FAQ: How do I show a file’s character encoding?

On macOS you show a file’s character encoding using the -I option of the file command:

$ file -I file.txt
file.txt: text/plain; charset=utf-8

Here are two more examples, with and without the file command’s -I option:

$ file -I 00-intro.adoc
00-intro.adoc: text/plain; charset=utf-8

$ file 00-intro.adoc
00-intro.adoc: UTF-8 Unicode text, with very long lines

March 23, 2021, a day after the horrible assault rifle mass shooting in Boulder, Colorado, gave a us a day that looked a bit like Alaska. The ground here in Colorado never looks like Alaska, but today the mist in the mountains and overcast sky looked like Alaska, and made me feel a bit more like I was at home here.

An Alaskan day in Colorado

When I edit my own text, I make comments like those shown in the images. A few of my own:

  • Nice start — dig deeper
  • Just say what you mean
  • You lost me
  • Feels fake — write from the heart (or, write to your muse)
  • Passive!

When I write books I try to complete a chapter, then get away from it for at least a month, then come back and edit it like this.

The images here are from the excellent movie, Finding Forrester.

On editing writing

The Scala 2.13 collections updates introduced two new “chaining operations” named pipe and tap. Here’s a quick look at how they work, plus a little extra fun at the end.

pipe

pipe works like a Unix pipe, passing values to functions. For example, given this setup:

import scala.util.chaining._
import scala.language.implicitConversions

def plus1(i: Int) = i + 1
def double(i: Int) = i * 2
def square(i: Int) = i * i   // we’ll use this one later

As a brief note today, for the last year or so I’ve been experiencing various “visions” when I wake up at night. I mentioned them to a doctor recently, and he said, “No, you’re not crazy, they’re referred to as hypnagogic hallucinations.” I found out that more accurately, the ones I’m experiencing are known as hypnopompic hallucinations.

If you’re interested in what these look like, here are three that I experienced recently. I regularly see images of “splatter” on the ceiling, and they can be all sorts of color. Last night they were mostly black, but the night before that they were red and pink:

Hypnopompic hallucinations - color splatter on ceiling

Some time ago I was at a party, and there was a woman there that I didn’t know, but I felt like I knew her. It was a strange feeling, kind of like deja vu, but it had nothing to do with this party, just the feeling that I knew this woman. Maybe I had seen somewhere before, but I couldn’t place it.

When that thought first came to me I was talking to some other people, so I shrugged it off for the time being. It was relatively early and I figured we’d meet soon enough. A little while later a trash can became full, so I took the bag out of the can and walked it to a garbage can outside by the detached garage. After I put the bag in the can outside I turned around, only to be startled to see the woman standing there.

“How do I know you,” she asked.

Imagine being 30 years old, and life is good. You’re healthy, vibrant, and even astonishingly good at math.

But then just a few moments later you can’t make sense of the world. You don’t know what’s real and what’s not.

You begin hearing voices that aren’t there.

Shortly after this you’re put into a “mental institution.”

That’s what happened to my mom. For whatever reason, shortly after I was born, she was stricken with schizophrenia.

(If you’ve ever seen the tv series Fringe, my mom is almost exactly like Walter Bishop, or vice-versa.)

Git FAQ: How do I view the detailed commit history for a file?

Solution: When you want the detailed git commit history for a file, this is the best git command I know:

This is a sunset from my old apartment complex in Broomfield, Colorado, on March 17, 2020.

Rocky Mountain sunset, March 17, 2020

In 2011 I was living in Palmer, Alaska, and I just started to look into renting this small brown building to be a home for my software-consulting business when some family issues came up and I moved back to the Lower-48.

There probably wasn’t enough work in the Palmer/Wasilla area — also known as the Mat-Su Valley — but I loved the area so much I wanted to give it a try.

Little office building in Palmer, Alaska

A Rocky Mountain sunset, near Boulder, Colorado, November 24, 2016.

A Rocky Mountain sunset, near Boulder, Colorado

When I was very sick in 2015-2016, I used to tell my doctors it felt like I had been “drugged.” When I could see that they couldn’t understand or believe that, I’d tell them that it felt the way you feel after surgery, groggy and woozy.

For the most of this year I’ve been eating very well, but yesterday I went to see a movie (Logan) and had some popcorn. Shortly after eating the popcorn I started to feel sick, and today I feel like I’ve been drugged.

This — as I have learned — is life with mast cell activation disease, known as MCAD or MCAS.

This is a photo of some snowy trees in Louisville, Colorado, on March 27, 2018. I had to get up early to go to a physical therapy appointment and I was rewarded with this view.

Snowy trees, Louisville, Colorado

“I’ve seen a lot of my friends lose their passion and end up in a rut, afraid to take a chance. ‘Night Moves’ is about romantic passion, but ‘Ship of Fools’ is about passion for life. Maybe a guy’s working a job he doesn’t like, and he sees an ad about the Alaska pipeline or something that excites him. But there are problems. His family says it’s too cold in Alaska or whatever. So he passes it up and just keeps on with something he hates.”

~ From Bob Seger, about his song, Ship of Fools

“The greatest action movie ever made”
Terminator 2