scala

SBT: Group annotated tests to run in forked JVMs

SbtTestGrouping Running tests that use a HiveContext On our current project, we utilize Spark SQL and have several ScalaTest based suites which require a SparkContext and HiveContext. These are started before a suite runs and shut down after it completes via the BeforeAfterAll mixin trait. Unfortunately due to this bug (also see this related pull … Read More

Slick 3.1.0, Oracle 11g, and UUID columns

SlickUUIDs UUIDs to the rescue I recently decided to change our primary key strategy from an auto-incrementing Long to UUID (aka globally unique IDs). Early on in a project, this should be a relatively simple refactoring (neither the software nor any data has been released yet). First of all and most importantly, UUIDs provide uniqueness … Read More

Binding custom types in plain SQL queries in Slick

Hierarchical Queries Hierarchical Queries and Oracle Not everything is as fun as the first time you discover the power of monads and for-comprehensions, or realize the state machine you wrote with pattern matching is super easy to read and follow! Some days its business as usual, which as a software developer means you’re usually trying … Read More

Philly ETE 2015 #50 – Jamie Allen, Erik Osheim, Brendan McAdams, Michael Pilquist, Brian Clapper – Typesafe Scala, Typelevel Scala: What’s Going On Anyway?

From the abstract: Last year, Miles Sabin wrote that “there is … a significant constituency at the core of the Scala community whose needs are not being fully met [by Typesafe’s focus on stability and Java 8 compatibility].” That statement summarizes the mission behind Typelevel.org, a project that currently consists of a fork of the … Read More

Microbenchmarking Scala with JMH

Many times we find that there are multiple ways to write a piece of code and sometimes the choice may be determined by which implementation executes fastest. We might want to have a shootout between the different implementations to find out which one is fastest. The Java Microbenchmark Harness (JMH) tool can help us get … Read More

Simple Akka Clustering

https://youtu.be/6RQb7Hz_TPw Setting up Akka clustering is quite easy and provides a way to distribute work across multiple machines in the cluster. In many cases this requires no changes to an Actor compared to a non-cluster deployment. In this screencast, I walk through setting up a cluster and compare deploying an actor in a local actor … Read More

Better Scala Tuples With shapeless

Shapeless provides a little syntax sugar that makes a standard Tuple behave like a collection. Learn more about this API in a tutorial by Scala and Akka trainer, mentor and consultant Michael Pigg.

Basic Akka Actors

Anyone working on concurrent and distributed applications on the JVM should be familiar with Akka. Akka is an implementation of the Actor model that can be used from Scala or Java applications to provide a concurrency model that is designed from the ground up for systems spanning multiple machines. Defining an Actor The key abstraction … Read More

Peeking Under The Covers in Scala

Chariot consultant Michael Pigg takes a look at using the Scala compiler’s -Xprint option to show us what’s happening under the covers.