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

Kudos to whoever came up with this image. I just added the text.

The Trump/Obama convention speech

I don’t remember where I first found this line of code, but if you put it in your Mac OS X ~/.bash_profile file, it’s an easy way to set your Mac Java version:

export JAVA_HOME=`/usr/libexec/java_home -v 1.8`

I can confirm this works with the Bash shell on Mac OS X 10.10. When I run the java -version command after opening a new Mac Terminal window, the output is 1.8.0_25.

A slightly more difficult way to set your Mac Java version is to look under the /Library/Java/JavaVirtualMachines directory to see which versions are installed, and then manually set the version.

I try to leave no stone unturned when writing a book, so I’m taking a little time to learn Erlang to write my book about functional programming in Scala. The two books are Programming Erlang and Learn You Some Erlang for Great Good.

Erlang programming books

In a previous blog post I demonstrated how to use sed to insert text before or after a line in many files, and in this example I'd like to demonstrate how to delete a range of lines using sed.

sed delete - How to delete a range of lines using sed

The problem I had today was that I just re-generated 99 HTML files for my Introduction to Unix/Linux tutorial using Latex2HTML, and it generates a bunch of "junk" in my HTML files that looks like this:

“Are you stressed? Stress is caused by being ‘here’ but wanting to be ‘there.’”

I don’t know who originally created this image, but I like it.

There's a fine line between genius and crazy

Today’s song of the day is one of my favorite videos of all time, a song named Dreams, by Van Halen. The video reminds me of my work in the aerospace industry, and staying at Virginia Beach, where fighter jets often fly over your head. It also reminds me of one very fun summer.

If you ever see that I’ve used the number 5150 in a software project — such as using it instead of port 8888 for testing a web app — it’s a nod to the album this song is from.

One of my favorite things about working as a consultant is that managers treat your time with respect. As a regular salaried employee, managers will say, “I need you to stay late tonight,” with the implication being, “suck it up.”

As a consultant who’s paid by the hour, when a manager says “I need you to stay late tonight,” you can always say, “No problem, I don’t mind staying if you don’t mind paying double time (as stipulated in the contract).”

In reality you rarely have to say anything like that. Good managers realize that when they ask you to work overtime they’re also saying that they’re going to pay your overtime rate. But if you’re dealing with a first-time manager you sometimes have to say something to that effect to make sure they understand what they’re asking for.

I can’t tell you how many times a manager told their regular employees that they had to stay late, and then they’d look at me and say, “Not you. You go home.” You might think the salaried employees would be angry at you for this preferential treatment, but I’ve always found that they understand that it’s part of the system. Back in the day when I was a regular employee I wasn’t angry with the consultants, I just found myself being envious about their situation.

(I write more about lessons like this in my book, A Survival Guide for New Consultants.)

I like baseball’s ERA+ stat. It gives you a way to compare completely different eras in a logical way. In technology it’s like saying which feat is better, creating a huge website like Facebook, or creating the first versions of Unix or Mac OS? All of them are great feats of engineering, but the tools available in each generation are so different that there’s no way to compare them, but in baseball the ERA+ stats lets you do exactly that.

MLB - Baseball's ERA+ stat

I’m posting this two days late, but according to this tweet, Alaska was hit with 25,000 lightning strikes in two days.

25,000 lightning strikes in two days

One last quote from Joe Armstrong, which highlights how a person looks at something based on their background: “If you’re coming from the Erlang/Haskell world you’ll think, ‘Swift is verbose and a bit of a mess,’ but if you’re coming from Objective-C you’ll think, ‘Swift is concise and elegant.’”

We should grow things (software applications) by adding more small communicating objects, rather than making larger and larger non-communicating objects.

Concentrating on the communication provides a higher level of abstraction than concentrating on the function APIs used within the system. Black-box equivalence says that two systems are equivalent if they cannot be distinguished by observing their communication patterns. Two black-boxes are equivalent if they have identical input/output behavior.

When we connect black boxes together we don't care what programming languages have been used inside the black boxes, we don't care how the code inside the black boxes has been organized, we just have to obey the communication protocols.

Erlang programs are the exception. Erlang programs are intentionally structured as communicating processes — they are the ultimate micro-services.

Large Erlang applications have a flat “bus like” structure. They are structured as independent parallel applications hanging off a common communication bus. This leads to architectures that are easy to understand and debug and collaborations which are easy to program.

~ From this post by Joe Armstrong, author of the book Programming Erlang: Software for a Concurrent World

scientificamerican.com has a nice little article on SpaceX landing their fifth rocket booster last night, this time after helping to deliver some cargo to the International Space Station (ISS).

SpaceX lands fifth rocket booster

“Ironically, the bounty was made possible when the Kepler space telescope's pointing system broke.”

For more information on this story, see this phys.org link.

Kepler confirms more than 100 planets in single trove

In the “Maintaining the Erlang View of the World” section of his book Programming Erlang: Software for a Concurrent World, Joe Armstrong writes, “The Erlang view of the world is that everything is a process, and that processes can interact only by exchanging messages. Having such a view of the world imposes conceptual integrity on our designs, making them easier to understand.”

Tip of the day: Just because someone is trying to intimidate you doesn’t mean that they’re smart or that they’re right. It just means that they’re a bully.

I’m looking into going to Alaska for Christmas and New Year’s this year. On New Year’s Eve there’s a great fireworks celebration that starts at about 5 or 6 pm, or at least it used to start then. (It gets dark there very early in the winter.)

About ten years ago I gave a friend a book on Zen. It wasn’t anything she asked for. I had just read some stories in it that I thought might be helpful for what she was going through at that time, so I gave it to her.

The next time we saw each other, she gave me a book on Christianity. My immediate reaction was, “What the heck, I’m not into Christianity. I feel offended!”

Within a few minutes I laughed at myself as I realized that I had created this situation. It hit me that I offended her first by saying, “Here’s some stuff about (what you might perceive as) a religion,” and then she responded in kind. (My exact thought was, “OMG Al, you’ve become a Religion Pusher.”)

As a result, these days I don’t offer anyone any books on Zen or mindfulness. If someone is at my place and asks if they can have one of my books, I always tell them to take whatever they want. (By doing this I think I’m on my fourth copy of Zen Master Raven.) But my days of offering unsolicited books ended ten years ago.

Even when I feel the urge to do this — when I see someone struggling with things that mindfulness can help, such as people bringing stress onto themselves like a sponge absorbs water — I have learned how offensive it is for other people to push their religious beliefs on me, so I don’t go there.

(I was reminded of this recently when someone else tried to push their religious beliefs onto me.)

ME: I have chronic pain. It flares up whenever someone challenges my beliefs.

FRIEND: That’s not really how chronic pain works.

ME: ow owwww ...

What programmers say vs what they really mean. From this Twitter post.