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

This photo is from the Talkeetna Air Taxi Facebook page. Back in the day, I lived about 100 yards from where this photo was taken.

Talkeetna, Alaska, in the early winter

El Sanctuario de Chimayo, near Santa Fe, New Mexico, in the winter.

El Sanctuario de Chimayo, in the winter

Another great photo of Anchorage, Alaska from the Alaska Dispatch Facebook page. (I would link to their page, but this looks suspiciously like a postcard I used to have.)

Anchorage, Alaska: Full moon over the mountains

From a very funny Doc Martin episode.

Doc Martin: The Baker, The Colonel

A picture of four sled dog paintings from a motel in Healy, Alaska.

A picture of four sled dog paintings from a motel in Healy, Alaska

A snow covered road in Wasilla, Alaska, from the winter of 2010/2011. They don't plow the roads much in Alaska, especially the side roads.

A snow covered road in Wasilla, Alaska

Was Yoda based on this Buddhist master? A post on Lion’s Roar says he was.

Was Yoda based on this Buddhist master?

In a recent attempt at freeing up some disk space, I wrote this little Unix shell script to go through all of my Scala/SBT project directories, and run the sbt clean command in each directory:

#!/bin/sh

# WARNING: make sure you have backed up your files
# and directories before running this script.
for file in `cat sbt_dirs`
do
    dir=`dirname $file`
    echo "WORKING ON $dir"
    cd $dir
    sbt clean
    cd -
done

This script assumes that you have a list of the desired subdirectories in a file named sbt_dirs.

Sadly, I forgot to check the before and after disk space comparison, so I can only guess that it helped by deleting all the SBT project and target subdirectories it generates.

As a brief note, my Mac/macOS system disk was pretty full, so I started looking at things I could delete easily. One thing I found is that the Scala-CLI/Coursier cache is location in this Mac directory:

/Users/al/Library/Caches/Coursier

I don’t know yet if it’s safe to delete anything in that directory/folder, but it’s using 7.2GB of space, so I’m about to look into it.

Unix/Linux tip: How to change/edit the content on thousands of files using awk and a Unix shell script.

As a note to self, today I had to delete the same lines (or line patterns) from over 10,000 files on this Unix/Linux server. Basically I was looking in each file for a specific pattern, and if that pattern was found, a ceertain number of lines should be deleted, starting at that point.

I worked with ChatGPT today to solve the following Unix/Linux problem:

If I have a file that has one or more filename paths like this:

If you ever need to determine the length of one or more video files (MP4 files) on a MacOS system, I can confirm that this ffmpeg command works:

“This is what I practice for, to play against the best players in the world. It’s going to be tough. This, I know. I will control the controllable, which is giving 100%, having the right attitude, fighting for every ball. And then we see the outcome, no? More than this we cannot do.”

~ Jannik Sinner, before playing Novak Djokovic in 2024

My 100% FREE “Introduction to Functional Programming” online video training course is now finished! To make things a little easier, here are links to all of the free videos in the training course:

January 28, 2020: In a dream this morning a bunch of people came into my apartment uninvited. All but one of them were maintenance people, and they started renovating my apartment. I argued with them that a little notice would have been nice.

While that was going on, I saw that the other person was a Tibetan monk. While the maintenance people started drilling and cutting, the monk walked around breaking all of my things. He’d pick up a glass thing and let it drop to the floor and break, and work harder to break other things. I ran over to him and asked, “Why are you breaking all of my things?”

He didn’t reply, but broke some DVDs in his hands. For some reason this made me more lucid in the dream, so I stepped on some of the DVDs he had dropped to the floor so I could crunch them more. “I get it,” I said, “it’s the whole ‘impermanence’ thing, right?” Then I thought of something and said, “Stay right here for a moment. Break something if you need to, but I’ll be right back.”

Then I went over to my DVD collection and grabbed my Dalai Lama video collection. I went back to the monk, handed him the DVDs, and said, “Here, you can break these, too. Or watch them. I don’t care.” Then I remembered that my tv started on fire when the maintenance people did something, but it didn’t matter, he took the DVDs and sat down silently.

Adam Warski shared code similar to this image during his video titled “Why Scala?”:

Adam Warski flatMap example and anonymous function with case statements

(To see his exact code, see that video.)

allStreets, flatMap, case statements, and function literals

Now he walks in quiet solitude
The forest and the streams
Seeking grace
In every step he takes
His sight is turned inside himself
To try and understand

~ John Denver

Snow on the Rocky Mountains (and John Denver lyrics)

I will continue to be.
But you have to be very attentive to see me.
I will be a flower or a leaf.
I will be in those forms and I will say hello to you.
If you are attentive enough, you will recognize me, and you may greet me.
I will be very happy about it.

This article contains a collection of quotes on industrial design from former Apple chief designer Jonathan Ive (or “Jony Ive,” as Steve Jobs called him). As an interesting note, Mr. Ive prefers to refer to himself as a “builder” or “maker” as opposed to a designer.

For those who don’t know of him, Jonathan Ive is credited with designing almost every Apple product from 1997 until roughly 2020. I (re)discovered Apple with an iPod in 2004, and given that very long string of success, I became interested in what Mr. Ive has to say about design, and to that end, here’s a collection of Jonathan Ive design interview quotes I’ve gathered over the last few years.