library

Fixing the Scala error: java.lang.NoSuchMethodError: scala.Product.$init$

As a note to self, when you see a Scala error message that looks like this:

java.lang.NoSuchMethodError: scala.Product.$init$(Lscala/Product;)V

it probably means that you have a mismatch in the Scala versions you’re using in your project. For instance, I just tried to use a library I compiled with Scala 2.12 with Spark, which was compiled with Scala 2.11, and I got that error message. In this case I was able to resolve the problem by recompiling my library with Scala 2.11.

Butter Knife alvin March 10, 2019 - 3:29pm

Butter Knife is an Android library that can help you get rid of all those ugly findViewById calls. Android Data Binding may be a better solution, but at the moment I prefer the tag/annotation approach of Butter Knife.

I put my Scala String Utilities library on Github alvin February 12, 2019 - 10:56am

I put my Scala String Utilities library on Github a few days ago. It includes my Q String Interpolator, and several other string utility functions. It also demonstrates how to write ScalaTest and ScalaCheck tests with an SBT project.

What types are special to the Scala compiler or runtime? alvin January 15, 2019 - 4:09pm

From the URL:

Q: Scala makes a big deal about how what seem to be language features are implemented as library features. Is there a list of types that are treated specially by the language?

A: The following types are crucial to Scala's type system. They have an influence on how type checking itself is performed.

It’s interesting that you can do some research on this by looking at Definitions.scala.

A Scala “Word of the day” shell script

I have a 19" monitor on the counter between my kitchen and living room, and it’s powered by a Raspberry Pi. I use the Linux Phosphor screen saver to show a scrolling “news and stock ticker” on the display, which I’ve programmed to show news from several different sources (Atom and Rss feeds, along with other news and data sources). An old version of the display looks like this:

My Raspberry Pi news ticker display

Today I added a new “Word of the day” feature to the display, and as with all of the other code, I wrote a Scala shell script to generate the output.

Scala: Popular tools, libraries, and frameworks alvin June 15, 2018 - 9:53am
Table of Contents1 - Build tools2 - Testing tools3 - Database4 - Functional Programming5 - Asynchronous/parallel/concurrent programming6 - Web frameworks7 - JSON8 - HTTP clients9 - Configuration/properties10 - Many more

This page is a collection of popular tools, libraries, and frameworks for the Scala programming language.

Back to top

Build tools

How to use the Lightbend Config library in a Scala or Java application alvin May 12, 2018 - 7:01pm
Table of Contents1 - Adding the Lightbend Config dependency2 - A Scala application that uses Lightbend Config3 - The Lightbend Config configuration file4 - Discussion

If you want to use Lightbend Config configuration files in your Scala or Java application, here’s a quick example of how to configure and use Lightbend Config in your application. In this case I’m specifically using Scala and SBT.

uJSON - Another Scala JSON library alvin March 31, 2018 - 10:51am

Li Haoyi has created a JSON library he named uJSON.

Asked for a book on Pavlov’s dog and Schrodinger’s cat alvin February 20, 2018 - 9:52am

I went to the library and asked for a book on Pavlov’s dog and Schrodinger’s cat. The librarian said it rang a bell but she didn’t know if it was there or not.

A little Scala “date” utilities class alvin January 20, 2018 - 2:36pm

Nothing major here today, but here’s some source code to start a little Scala “date utilities” class: