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

While reading the excellent Scala/FP book, Advanced Scala with Cats, I was just reminded that Scala’s Either class was redesigned in Scala 2.12. Prior to 2.12, Either was not biased, and didn’t implement map and flatMap methods. As the image from the book shows, Either is redesigned in 2.12 to include those methods, so it can now be used in Scala for-expressions as shown.

(I write about biasing in my book, Learning Functional Programming in Scala.)

Scala 2.12: Either is biased, implements map and flatMap

I haven’t used Scala Native yet, but at v0.1 it looks very cool. The image is from scala-lang.org, you can read much more about it at scala-native.org, and follow the developers here on Twitter.

The Scala Native project

“Pleasure in the job puts perfection in the work.”

~ Aristotle

I recently started working on a project that may or may not make it into my book on Scala and functional programming. I’m currently calling it “Akkazon Ekko” — or “Ekko” — because it’s a little like the Amazon Echo, but written with Scala and Akka.

Benedict Cumberbatch narrates a film about Vietnamese Buddhist monk Thich Nhat Hanh titled, Walk With Me. You can see the movie preview here on YouTube, and learn more at WalkWithMeFilm.com.

“If you speak and act with a pure mind, happiness will follow you as a shadow clings to a form.”

~ from the Kung Fu tv series

Android FAQ: When is the Android Fragment onCreateOptionsMenu method called?

I was just working through a problem with an Android Menu and MenuItem, and added some debug code to the methods in my Android Fragment, and found that the onCreateOptionsMenu method is called after onStart. I didn’t put Log/debug code in every activity lifecycle method, but for the ones I did add logging code to, the specific order of the fragment method calls looked like this:

  1. onCreate
  2. onCreateView
  3. onActivityCreated
  4. onStart
  5. onCreateOptionsMenu

I was surprised, I thought onCreateOptionsMenu was called earlier — which led to my null pointer exceptions — but this is the way the calls worked with Android 7.x.

The Android method lifecycle image comes from this android.com page.

When is the Android Fragment onCreateOptionsMenu method called?

After 84 days, the Sun finally set in Barrow, Alaska (now known as Utqiaġvik) on August 2, 2017.

(Image from this Twitter page.)

The Sun finally sets in Barrow, Alaska

Apparently there’s a honey badger roaming around the University of Colorado campus in Boulder. For more information, see the DailyCamera.com.

A honey badger at the University of Colorado

“It is the sign of a great mind to dislike greatness, and to prefer things in measure to things in excess.”

~ Seneca

“Your attitude is such an important topic, I want to end this book by getting you to look at yourself the way other people see you.”

A quote from the last chapter of my book, A Survival Guide for New Consultants.

Here’s one of my favorite lessons from my consulting book, titled “Who are your customers?

A decent article: Ten things Idris improved over Haskell. I noticed that Martin Odersky tweeted this, and mentioned that Scala made the same improvements.

In the next day or two I hope to finish moving my book, A Survival Guide for New Consultants, to this website. As with my other books, I like the idea of having all of my books on this website so I (and you) can easily search for them, and also easily find related content.

QZ.com published information about a scientific study to capture images of your brain on LSD. Quotes from the article:

“Nutt’s study ... was the first to use brain imaging to show the effects of LSD ... it showed that the drug weakens the rhythm of alpha brainwaves, which are known to be stronger in humans than other animals, and are considered a signature of high-level consciousness.”

“The study also found that LSD causes brain activity to become less coordinated in regions that make up the brain’s ‘default mode network,’ which is responsible for maintaining a stable sense of self. The greater the drug’s effect on the brain, the more participants experienced ego-dissolution, where the self melds with world around you.”

From the accompanying video: “LSD can also make people lose their sense of self ... as the higher-level network disintegrates, and normally estranged parts of the brain begin to interact, people’s thoughts and the outside world start to feel like the same thing.”

A scientific study to capture images of your brain on LSD

I’m spending my weekend moving the HTML version of my book, How I Sold My Business: A Personal Diary, over to this website. I had it on a separate website, but I’m trying to simplify my life, and I also like the idea of having all of my content searchable on this site.

(If you’d like to read the paperback version of the book, you can find it here on Amazon.com.)

This is a smart photo about impermanence from this Twitter page.

Sun Microsystems, Facebook, and impermanence

Scala 2.12.3 has been released, and compiler performance has improved significantly.