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

A Programming Classic!
Design
Patterns

My two favorite books on functional programming (FP) are, Learn You a Haskell for Great Good and Real World Haskell (RWH). This quote from RWH was a real eye-opener for me. In the programming book industry’s rush to create Scala/FP books, a lot of what I’ve read sounds like, “I’m new to FP but blah blah blah monad blah blah,” but if you can make it through Haskell’s syntax, these older books are very good. This quote in particular was a real mind opener. (RWH is freely available online, and this quote comes from this page.)

This is a photo of the Blood Moon this morning. We had a great view here in the Boulder, Colorado area, but this great photo comes from this Twitter post.

Andreessen Horowitz partner Marc Andreessen (also a founder of Netscape) recently released a series of 18 tweets regarding his concerns over cash burn rates at startups. He wrote his tweets as he agreed with a man named Bill Gurley, who told the Wall Street Journal that Silicon Valley “is taking on an excessive amount of risk right now.”

Here is the text from Mr. Andreessen’s 18 tweets:

I can see why Richard Sherman is upset about having his dreadlocks pulled, but the more important question is, “Why wasn’t Sherman flagged for interference?” He had his hands all over Pierre Garcon 10, 15, 20 yards down the field. The NFL is supposed to be calling that a penalty.

“I hate reading other people’s code.” (This cartoon is making the rounds again.)

I ran into a strange problem this weekend where I noticed a huge difference between the way a Scala Future and a Thread worked for the exact same code. I think I’m pretty aware of the obvious differences between futures and threads, so this really caught me by surprise. If/when I figure out why there was such a difference in behavior for the given problem I’ll post that information here.

A Scala Thread example

While that problem will haunt me for a while, what I really want to post here today is a simple Scala Thread example:

I saw this image on this Twitter link. I originally saw it on Veerle’s Twitter stream, and was reminded of her excellent “Inspiration Stream.”

You can show used, free, total, and max memory (RAM) available in a Scala application just like you do in Java. The lines of code look like this:

To set Java/JVM command line arguments when running a Scala application with the scala command, set the JAVA_OPTS environment variable before running your application, something like this:

$ JAVA_OPTS="-Xmx256m -Xms64m -Xss16M"

$ scala my_scala_app.jar

I found this information on this scala man page document, where they also state this about the JAVA_OPTS variable:

I wrote about the proper way to use Futures with the Scala for comprehension in the Scala Cookbook, and this short blog post shows a similar example.

The 2014 Buddhist Geeks Conference is coming soon, and I’m looking forward to these talks, and many more. If you’re at the conference, be sure to find me. I’ll be volunteering there again this year.

This JConsole page has some nice Java/JVM garbage collector terminology, including the following definitions:

Java/JVM FAQ: How can I see which garbage collector is running when I run a java command?

Use the -XX:+PrintCommandLineFlags command line argument, as shown here:

Summary: This article shares some source code that shows how to see Java Virtual Machine JVM command line arguments/parameters from within a running Java (or Scala) application.

A Programming Classic!
Design
Patterns