Evaluating the state and development of Scala
O’Reilly has an article titled Scaling Scala. The article talks about Scala, Akka, Spark, Kafka, Dotty, Cats vs Scalaz, and more.
O’Reilly has an article titled Scaling Scala. The article talks about Scala, Akka, Spark, Kafka, Dotty, Cats vs Scalaz, and more.
Hopefully at some point this will come out as an article, but right now it’s this tweet with some Q&A afterwards.
Here’s a link to Verizon’s open source Scala libraries.
This image shows how to use color syntax highlighting in the Scala REPL. In short, just start the REPL like this:
$ scala -Dscala.color
The photo is from this Twitter post.
Viktor Klang has a series of blog posts about Futures in Scala 2.12.
Lightbend has a good interview with Raymond Roestenburg, co-author of Akka In Action.
I’ve been developing a new Scala application named Cato that requires some command-line parameters, and I just had to figure out how to configure Eclipse so my application would get those parameters. Doing this with Scala in Eclipse is different than configuring Java command line parameters in Eclipse, so I thought I’d share the recipe.
Fortunately it’s just a two-step process. First, click the drop-down icon next to the “Run” button and choose “Run Configurations”, as shown here:
Summary: A Scala YAML parsing example using the Snakeyaml parser.
If you need some Scala YAML parsing examples using Snakeyaml parser, you've come to the right place. I just worked through some Snakeyaml issues related to Scala, in particular converting YAML to JavaBean classes written in Scala, so I thought I'd share the source code here.
I just ran into the following Scala jar (class) is broken error:
If you ever want to have a little fun with Scala, try experimenting with the Scala parallel collections. The following example gives you a little idea of what can happen in the most simple case of creating and using a parallel collection:
Something I learned the hard way yesterday ... JavaFX ships with JDK 7, but it’s not in the classpath. This image shows the solution for when you want to use JavaFX in a Scala/SBT application. I found this answer on the ScalaFX website.
I won’t link to it (because it’s a link-bait article), but I was surprised to see that medium.com ran a little article (very little), titled, “Functional Programmers are Better Programmers.” This image shows the crux of the article. I was surprised that the authors come right out and state, “Yes, FP is more difficult.”
To run external shell commands in SBT, first start SBT from your operating system command line:
$ sbt
Then run the consoleProject
task/command:
> consoleProject
After some output you’ll see this prompt:
scala>
Now you can execute shell commands by including them in double quotes, and following them by an exclamation mark, like this:
scala> "ls -al" !
For more information, see the SBT consoleProject documentation page.
Problem: You need to perform deep XML searches, combining the \
and \\
methods, and possibly searching directly for tag attributes.
Combine the \\
and \
methods as needed to search the XML. When you need to extract tag attributes, place an @
character before the attribute name.
Given this simplified version of the Yahoo Weather RSS Feed:
Problem: Your XML data has an array of elements, and you need to extract the first element, second element, or more generally, the Nth element, using Scala.
The following simplified version of the XML from the Yahoo Weather API has three <forecast>
elements:
Scala FAQ: How can I pass an array back and forth between Scala and Java code?
The first link in the See Also section states, “Scala arrays correspond one-to-one to Java arrays,” and as a result of this, passing arrays back and forth between Java and Scala code is easier than the example shown in Recipe 17.1 in the Scala Cookbook, “Going to and from Java Collections.”
FWIW, I don’t think I’ll be posting any new chapters for my “Functional Programming in Scala” book this weekend. I had a bad episode at the grocery store this morning (I started shaking, dropped a half-gallon of milk, it exploded and flew everywhere), so I’m back to seeing doctors again. I’ll post an update here as soon as I’m able to release any new book chapters.
If you’re interested in the details of how Scala works, such as its compiler, this medium.com article by Grzegorz Kossakowski is a good read. In the summary he states:
“I believe the architecture of Hack’s highly parallel and distributed typechecker can be stolen and brought to Scala. Scala’s rich type system poses some challenges that Hack’s typechecker implementators didn’t need to worry about but I don’t see inferred return types or path-depent types as showstoppers.”
In this article titled, Generalized type constraints in Scala (without a PhD), Erik Bruchez explains Scala’s “sad with a hat” operator.
As a quick note, I just found this getUrlInputStream
method in an old Scala project. It needs to be updated and cleaned-up, but if you are looking for some code to get you started with opening a URL as an InputStream in Scala, this may be helpful: