Alvin Alexander | Java, Scala, Unix, Perl, Mac OS X

This image is from an article titled, Why don’t people use formal methods? I like the parts about writing “precise, unambiguous specifications,” and some other parts.

What are the barriers that prevent widespread adoption of formal methods?

I think this white van has been parked in Talkeetna, Alaska, for as long as I've been living and visiting there.

The white van, Talkeetna, Alaska

Worked on pickup lines with my nieces in Illinois last night. I usually go with, “Excuse me, do you know how to bake cookies?”;  “Oreos: Regular, or Double Stuf?”; or the classic, “What did you do when Hostess went bankrupt?” But thanks to them I’m working on my repertoire:

You’re so hot you must’ve started global warming.

Did it hurt? When you fell from heaven?

If you were a booger I’d pick you first. (might be best used in grade school)

Is it hot in here, or is it just you? (may be good if the woman appears to be having hot flashes)

Do you have a map? I just got lost in your eyes.

Stop, drop, and roll, baby. You are on fire.

Woo baby, you’re hotter than donut grease. (works best at Krispy Kreme and Dunkin’ Donuts)

Linux grep commands FAQ: Can you share some Linux/Unix grep command examples?

Sure. The name grep means "general regular expression parser", but you can think of the grep command as a "search" command for Unix and Linux systems: it's used to search for text strings and more-complicated "regular expressions" within one or more files.

I think it's easiest to learn how to use the grep command by showing examples, so let's dive right in.

Me: Alexa, play 70s folk music.

*Alexa starts playing a James Taylor song*

Me: Alexa, never play songs by James Taylor.

Alexa: Shuffling James Taylor playlist, on Amazon Music.

Two moose fighting in Palmer, Alaska.

Two moose fighting in Palmer, Alaska

I love this short video of a primary school principal leading his students in a dance, in an effort to get them exercising and off their computers.

If you’d like to donate some money to a worthy cause, my niece is studying to be a nurse, and she’s helping to raise money for sick and injured children. Here’s a blurb from that page:

“I'm on a mission to help sick and injured kids in my local community and I need your help. My local Children’s Miracle Network Hospital treats thousands of children each year, regardless of their illness, injury, or even their family’s ability to pay. These kids are facing scary stuff like cancer, cystic fibrosis, and injuries they may get from just being a kid.”

Any help is appreciated!

An “Alaska Stud Muffin” coffee mug. Back in the day I bought fine coffee mugs like these for friends and family.

Alaska Stud Muffin coffee mug
Table of Contents1 - Sample data2 - From match expressions to higher-order functions3 - Notes4 - Resources5 - Comments

I originally wrote a long introduction to this article about Scala Options, but I decided to keep that introduction for a future second article in this series. For this article I’ll just say:

  • idiomatic Scala code involves never using null values
  • because you never use nulls, it’s important for you to become an expert at using Option, Some, and None
  • initially you may want to use match expressions to handle Option values
  • as you become more proficient with Scala and Options, you’ll find that match expressions tend to be verbose
  • becoming proficient with higher-order functions (HOFs) like map, filter, fold, and many others are the cure for that verbosity
Table of Contents1 - Effects are related to monads2 - Not a side effect, but the main effect3 - Effectful functions return F[A] rather than [A]4 - Summary5 - Notes

When you get started with functional programming (FP) a common question you’ll have is, “What is an effect in functional programming?” You’ll hear advanced FPers use the words effects and effectful, but it can be hard to find a definition of what these terms mean.

“By a lie a man throws away and, as it were, annihilates his dignity as a man. A man who himself does not believe what he tells another … has even less worth than if he were a mere thing … makes himself a mere deceptive appearance of man, not man himself.”

~ Immanuel Kant (via Dan Rather)

Once upon a time I was recommended for a college baseball scholarship.

Once upon a time I was recommended for a college baseball scholarship

I don’t know if it was just coincidence, but I went to Lowe’s yesterday for the first time in seven months, then I had a Lowe’s ad on Twitter first thing this morning. So “Allow some” is now “Off.” (See the Location and Personalization settings in the images.)

On Twitter privacy settings and personalized ads

“If you try to drive through Canada in the winter with those summer tires you’re going to end up as a statistic.”

~ A nice RCMP person, after looking at my car, March, 2011. She was very close to being right, as I got stranded for five days in Dease Lake, British Columbia.

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.

If you happen to be using Dotty (Scala 3) and find that the f string interpolator isn’t working, it’s a known bug. (It was implemented with a macro, and the old, experimental macro system has been dropped.) I’m writing this in January, 2019; I don’t know when it will work again. You can use the Java/Scala String.format method until it’s fixed:

val pi = scala.math.Pi
println( "%1.5f".format(pi) )

I was reading this post by Martin Odersky (Make the Scala runtime independent of the standard library) and came across this comment by Li Haoyi: “This would also make it more feasible to use Scala for tiny bootstrap scripts; current Mill’s launcher is written in Java because the added classloading needed to use scala.Predef (even just println) easily adds a 200-400ms of initialization overhead.” I haven’t written anything where the startup time of a Scala application was a huge problem, but that was interesting to read.

(Though I should say that I wish all Scala/Java command-line apps started faster. It’s one reason I occasionally think about using Haskell for small scripts, so I can compile them to an executable.)

“You become what you give your attention to. If you yourself don’t choose what thoughts and images you expose yourself to, someone else will ... and their motives may not be the highest.”

~ Epictetus

Back in the 90s I was a Unix admin on a NASA project. Rumor was there was going to be a 14% layoff. The next day my boss tells me to go to HR. I’m thinking, “Me???”

I get there, and they tell me they can’t print their Postscript layoff reports in landscape mode, ask if I can help. In the end I got a great Pico de Gallo recipe out of it. :)