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

Table of Contents1 - A “Hello, world” MacOS AppleScript notification2 - AppleScript: Mac notification with a sound3 - How to add a title and subtitle to your notification4 - Running from Scala or Java5 - See also6 - Summary

Summary: This tutorial demonstrates how to fire MacOS system notifications with AppleScript (and Scala or Java).

In this article I assume that you already know at least a little bit about how to use AppleScript, and just want to know how to trigger a MacOS notification. At the end of the tutorial I show how to invoke the AppleScript code using Scala and Java.

“When you turn directly toward your own true nature, you discover that your spirit, your consciousness, is always free. With that discovery comes a wellbeing that manifests as joy.”

~ Jack Kornfield

As a quick note, I used this shell script to copy many files with the same name into a directory named tmpdir, giving them all new names during the copy process:

count=1
for i in `cat myfiles`
do
    fname=`basename $i`
    cp $i tmpdir/${count}-${fname}
    count=`expr $count + 1`
done

Curl FAQ: How do I use curl to get the headers from a website URL?

Short answer: Use curl's -I option, like this:

$ curl -I URL

Here's a specific example, including a real URL and results:

A few days ago a bear walked into a liquor store in Juneau, Alaska. On the video it seems to be looking for a candy bar.

A bear walks into a liquor store in Juneau, Alaska

In my new book on functional programming in Scala, I’m not a salesman trying to “sell” anyone on functional programming. I prefer to think of myself as a reporter who reports what he has learned. I describe this as the reporter metaphor.

“When people feel connected to others, that brings out their best selves. When people feel disconnected, their worst impulses often come out.”

From an interview with a Zen priest, who also happens to be the director of analytics for Facebook’s News Feed.

“He suffers more than necessary, who suffers before it is necessary.”

~ Seneca (as seen in this tweet)

“I was very happy to hear from you, and that you have such a position in the Research Laboratories. Unfortunately your letter made me unhappy for you seem to be truly sad. It seems that the influence of your teacher has been to give you a false idea of what are worthwhile problems.”

“The worthwhile problems are the ones you can really solve or help solve, the ones you can really contribute something to. A problem is grand in science if it lies before us unsolved and we see some way for us to make some headway into it. I would advise you to take even simpler, or as you say, humbler, problems until you find some you can really solve easily, no matter how trivial. You will get the pleasure of success, and of helping your fellow man, even if it is only to answer a question in the mind of a colleague less able than you. You must not take away from yourself these pleasures because you have some erroneous idea of what is worthwhile.”

The next release of my book on Scala and functional programming will include at least two lessons on ScalaCheck.

“There is always a Netflix to your Blockbuster. Nothing is static. Keep learning, or face the consequences.”

That’s a good quote from this Twitter link. It reminds me of the text in The Heart Sutra that says, “Gate, Gate, Paragate, Parasamgate, Bodhi Svaha.” I read once that the first part of it can be translated as, “Gone, gone, totally gone, totally completely gone.” That reminds me of Blockbuster.

Seeking enlightenment? There is no door. There is no spoon, either. ;)

Seeking enlightenment? There is no door (cartoon)

This is a fun article on Wired: A retiree discovers an elusive math proof, and nobody notices. The mind doesn’t stop working just because you’re retired.

“Ten things fab leaders do,” a nice graphic from Helen Bevan.

Ten things fab leaders do

“Live in the now.” From a favorite book by Eckhart Tolle, Guardians of Being.

Guardians of Being: Live in the now

I just ordered The Science of Enlightenment: How Meditation Works by Shinzen Young. I haven’t read it yet, but he’s someone that I trust implicitly, and the preview of the book looks like what I’d expect from him. Like me — but way ahead of me — he’s interested in the science of meditation.

The Science of Enlightenment: How Meditation Works

The sbt-errors-summary plugin looks cool. Here’s a summary from its author:

“A simple plugin that makes the error reporter a bit more concise. I find it useful when doing refactoring: I get a lot of compilation errors, and I waste a lot of time switching between files and looking for line numbers in the error message, when I can immediately see what's wrong when looking at the faulty line.”

SBT errors summary plugin

At the 2013 Buddhist Geeks Conference, Shinzen Young gave a talk about The Meaning of Life. I just found this image on my phone, and apparently the meaning is in there somewhere. :) The graphic was created by Kelly Kingman.

The Meaning of Life, by Shinzen Young

“Shut your mouth, work extremely hard and be the first one in there, last one to leave, and to lead by example.”

Denver Broncos QB Chad Kelly, talking about the advice he got from his uncle, Hall of Fame QB Jim Kelly.