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

People who knew us at the end might be surprised by this, but one thing I wish I had asked my business partner more often was, “How are you doing? Really, how are you?”

While working with the sbt and Mill build tools recently, and updating Scala and Java versions like crazy, I’ve been trying to verify some things in my Scala applications. Just now I wrote this little Scala 3 / Dotty application to print out all system environment variables and properties:

Kind of a weird situation: I’ve been thinking about moving lately, and that led to the thought that if a doctor told me I only had six months left to live, I know where I would live. But I generally like a lot of things about Colorado, so I live here. Hmm...

SBT FAQ: How do I show the Scala version that SBT is using?

Short answer: Issue the scalaVersion command at the SBT prompt.

Longer answer: I was having a problem getting a certain Scala feature to work when I compiled my code with SBT, and even though I knew I had set the Scala version in my build.sbt file, I wanted a way to double-check that SBT was indeed using that Scala version. That’s when I found I can issue the scalaVersion at the SBT prompt.scalaVersion

I always wondered if this ever happened: Three people were injured when a whale collided with a boat (or vice-versa) in the waters just north of Juneau, Alaska.

This is a photo of a sidewalk in front of an art museum in Santa Fe, New Mexico. (Sorry, I don’t remember the name of the museum and I’m too lazy atm to look it up.)

I applied a Gaussian Blur effect to the cars on the right and the bright stuff at the end of the corridor (using Gimp), and it’s amazing how much that makes the rest of the image “pop” out. Nothing else has been altered.

Santa Fe, New Mexico art museum sidewalk

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 cars that were in the street. Everything after that is what has become fairly standard work with Gimp for me, including making it look like an oil painting, and signficantly modifying and enhancing the colors.

Sidewalk in Santa Fe, New Mexico

This is a photo of a sidewalk that I took somewhere in Santa Fe, New Mexico. I love the colors and artistry of the city.

A sidewalk, somewhere in Santa Fe, New Mexico

July 19, 2015: Lately I have been thinking about writing a functional programming book, and if I decide to do that, I might include a variation of this Ward Cunningham example of how to parse HTML <table> tags recursively. His code is written in Java, and you can read about it here.

Ward Cunningham example of recursively parsing HTML tables

In a Buddha there has never been
anything that could be said to be there.
Just as a magician
Does not get caught up in his illusions
And therefore by his knowledge
Is not attached to magic forms,
So also the wise in Perfect Enlightenment
Know the three worlds to be like a magic show.
Liberation is merely the end of error.

~ Gampopa

(I saw this quote in the book Be Love Now by Ram Dass.)

On June 25, 2020, I tweeted that Coursier was providing a way to make installing Scala and Scala-related tools easier. I’ll look into that more soon, but in this tutorial I’ll show something different: How to install multiple JVMs/JDKs with Coursier.

My book, Functional Programming, Simplified — 4.5-star rated on Amazon — is currently on sale in three formats:

PDF Format
Just $15 on Gumroad.com
(December sale!)

PDF version of Functional Programming, Simplified

Paperback Book
$39.99 on Amazon
 

Print version of Functional Programming, Simplified

Kindle eBook
$14.99 on Amazon
 

Kindle version of Functional Programming, Simplified

My favorite line from this “Bear Safety” sign in Alaska:

“Play dead unless it starts to eat you, then fight back.

bear safety sign in Alaska

This is one of my favorite traffic signs in all of the world. You can find it if you drive north from Anchorage, Alaska towards Wasilla and Palmer. When I lived in Alaska in 2010-2011, I would take the exit to the right to go to Palmer. If you keep going straight you’ll go to Wasilla, followed by Willow, Talkeetna, and eventually Denali and then Fairbanks. (If you’re really gung-ho, as I was, you can also keep driving to Prudhoe Bay, if you don’t mind 400 miles of dirt roads in the Arctic Circle.)

And as you can tell from the highway numbers 1 & 3, there aren’t many main roads in Alaska. :)

Highway traffic sign to Wasilla and Palmer, Alaska

A favorite sign in Alaska. Anchorage to the right, Fairbanks to the left. Keep it simple.

A favorite Alaska sign (Anchorage/Fairbanks)

If you want to create and populate a Java ArrayList with Java 9, 11, and newer, you can use this syntax:

List<> ints = ArrayList<Integer>(List.of(1,2,3));

As shown, this uses the usual ArrayList constructor and the Java List.of method. Once you have an ArrayList like this you can continue to add new elements to it as usual:

ints.add(4);

The front of my current apartment complex in Broomfield, Colorado faces the Rocky Mountains, and the back-right portion of the complex has these neigh-bors.

The neigh-bors (horses in Broomfield, Colorado)

FWIW, my week leading up to the Memorial Day weekend went like this:

Tuesday: Went to the liver doctor, he said my numbers are greatly improved, no worries, keep up the good work. A couple of hours later I started having chest pain, and eventually went to the ER. Their first two tests didn’t show any heart issues, but they wanted me to take a stress test the next day.

For anyone interested in the radioactive iodine treatment instructions I received from the hospital back in 2014 (for the post-surgical treatment of thyroid cancer)(which I’ll be going through again), here you go. As I note in the image, as a writer I appreciate the strong finish. :)

Radioactive iodine treatment instructions (for thyroid cancer)

Wow, this radiation is good stuff. I just woke from a very long dream sequence where I was in three and then four dimensions, all at one time. It was similar to what happened to Picard in the last episode of STNG. In my case I was trying to help the people in the third dimension, who I originally thought may have had an earthquake, but as I later found out, they were in some sort of battle or war. As Spock would say, fascinating.