Lightbend has a case study of how Groupon uses Akka and Play to meet their demanding performance needs. The article doesn’t say if they use Scala or Java,
Alvin Alexander | Java, Scala, Unix, Perl, Mac OS X
AskAMathematician.com has a good answer to, Why was it so hard to take a picture of a black hole?
If you’re ever working on a really small Scala project — something that contains only a few source code files — and don’t want to use SBT to create a JAR file, you can do it yourself manually. Let’s look at a quick example. Note that the commands below work on Mac and Linux systems, and should work on Windows with minor changes.
If you run into a problem where a Scala shell script won’t run on MacOS — it hangs indefinitely without doing anything — hopefully this bug report will help. The solution is to change this line at the beginning of the Scala shell script:
exec scala -savecompiled "$0" "$@"
exec scala -nocompdaemon -savecompiled "$0" "$@"
I just had this problem with Scala 2.12.x and Java 8 running on MacOS 10.14.4, and I can confirm that adding
-nocompdaemon solved the problem for me.
I generally have a pretty good feel for how Scala traits work, and how they can be used for different needs. As one example, a few years ago I learned that it’s best to define abstract fields in traits using
def. But there are still a few things I wonder about.
Today I had a few free moments and I decided to look at what happens under the covers when you use
var fields in traits, and then mix-in or extend those traits with classes. So I created some examples, compiled them with
scalac -Xprint:all, and then decompiled them with JAD to see what everything looks like under the covers.
I was initially going to write a summary here, but if you want to know how things work under the hood, I think it helps to work through the examples, so for today I’ll leave that as an exercise for the reader.
Sometimes people write to tell me that they like my writing style, that I’m good at explaining things. Other people write and say that if they wrote a book, they would have written it just like mine.
The truth is, when I first started working with Scala I fell in love with the language, so wanting to write about it was easy. After that, I’m not that smart, so I have to break complex things down so I can understand them myself. So I think that by breaking things down and looking for meaningful examples, people seem to appreciate what I’ve written (or I hope they do).
After I wrote the Scala Cookbook and people sent me notes like that, I struggled with writing for a little while. Then I decided to just try to write for a younger version of myself and ignore what other people were saying. I just ask myself, “Would this have helped Al two years ago?” Since then I’ve been fine.
“What is it about elevators?”
~ Christian Grey
“I was dreaming when I wrote this, forgive me if it goes astray.”
~ Prince Rogers Nelson
As a brief note today, here’s an example of stackable modifications in Scala.
Lately I was curious about what
super means when you mix Scala traits into a class or object. A simplified answer is that
super refers to the last trait that’s mixed in, though I should be careful and note that this is an oversimplification.
This can be demonstrated in an example that uses both inheritance and mixins with traits. Given this combination of traits and classes:
Just when Margaret thought Frank was going to say something else ...
I call this one, “Up With the Sun, Gone With the Wind.”
(April 13, 2017)
Working with yoga is often interesting. You stretch and twist and focus, trying to be very conscious and aware of your movements, and then one day in the middle of a twisting pose you see your left foot coming out from behind your right ear. At first that’s a real surprise, a shock. You think, “Well, that can’t be my foot over there”, and then you realize it is your foot, and with that comes a strong sense of accomplishment, and maybe a little smile.
Then you do the same pose in the opposition direction, but twist and stretch as you might, your right foot doesn’t come out from behind your left ear. You know you can’t push it any more, at least not while doing the pose properly, so you realize you have a little imbalance. You accept that you have some work to do, but it’s a good thing, so you push on.
I think life is like that too, or can be like that. If you enjoy the struggle, if it’s a worthy struggle — a path with heart — the effort comes willingly, and with its own rewards.
For many years I struggled with how to combine two of my main interests, Zen and work. I had read that the Zen mind is the mind before thinking, so it seemed like Zen and work must be totally unrelated. But over time I came to understand phrases like, “When working, just work.”
This article contains a collection of quotes that have been helpful to me in understanding the relationship between Zen and work. Please note that I don’t wrap each quote in double quotes, and I also try to attribute each quote to the correct author/speaker. If you’re interested in how to combine Zen and work, I hope you’ll find them helpful.
I’m horrible at date calculations — what do you mean by “between”? — but I do know that April 10th is the 100th day of all non-leap year years.
Her, romantically: I can feel you tremble when we touch.
Me: Oh, sorry, that’s just the mast cell disease.
(A conversation somewhat inspired by the Survivor song, I Can’t Hold Back.)
Note: The print version of Hello, Scala on Amazon will be going up to $20 (USD) this Saturday, April 13, 2019. It’s currently just $10, so you know, buy it while it’s on sale and all that. :)
If you like free things, here’s a link to a free preview (PDF) of the new version of my book, “Hello, Scala.” The book is 257 pages long, and the free preview contains the first 120 pages of it, so I hope it’s a significant preview. Hello, Scala is now available for sale, so you can buy the PDF, Kindle ebook, and/or printed book at this link.
Two years ago today I saw this sunrise when I stayed in Virginia Beach for a few weeks. No filters have been applied, that is what it looked like.
“Never argue with a fool. Onlookers may not be able to tell the difference.”
~ Mark Twain (used recently in reference to Antonio Brown on Twitter)
bbc.com has an interesting story about how and why Japan exploded a small bomb on an asteroid.
While this photo looks like a sunset, it was actually a sunrise. I took it in Virginia Beach on April 17, 2017.