Parsing Simple Grammars in Scala With parboiled2

parboiled2 is a Macro-Based PEG Parser Generator written in Scala. It has become our preferred tool for creating parsers for simple grammars. It offers a fairly simple syntax for creating parsers and boasts significantly better performance over Scala Combinators.

To illustrate its use, we will use this post to build a parser for a simplified version of the Slack Assisted Search. Read more “Parsing Simple Grammars in Scala With parboiled2”

According to Our Readers: Threat Stack’s Top 10 Blog Posts for 2016 (and More)

One of our goals at Threat Stack is sharing information that will help you learn about the current cloud security threat landscape in order to effectively and more easily manage your organization’s security issues — and confidently get on with running your business.

To this end, the Threat Stack blog is a terrific repository of articles that cover a range of security topics. If you’re not a regular reader, we encourage you to start exploring — and in the meantime, have a look at the ten most-read posts of 2016. Read more “According to Our Readers: Threat Stack’s Top 10 Blog Posts for 2016 (and More)”

Ramping up on Finch: Avoiding Common Gotchas

While we have been using Scala for awhile at Threat Stack, we haven’t been overly satisfied with the HTTP servers that we have used. So a few months ago, we audited a number of options and ultimately decided to try out Finch. We chose Finch for its readable and idiomatic API for constructing HTTP endpoints, solid performance, and some other bells and whistles. We also brought in Circe to handle our JSON serialization needs. Circe was a clear pick for its solid performance and generic derivation.
Read more “Ramping up on Finch: Avoiding Common Gotchas”

My Journey in Scala, Part 3: None is Better Than Undefined

Here’s the situation: At Threat Stack we consume a torrent of security event data every day, and as many new customers come on board, the amount of data we need to ingest, transform, store, and retrieve just keeps growing. About a year ago, we implemented a caching layer to allow us to display more aggregated information to customers on our Dashboard, which was powered by ElasticSearch Aggregates.

Read more “My Journey in Scala, Part 3: None is Better Than Undefined”

Scala @ Scale, Part 2: Compose Yourself!

Function composition is an extremely useful tool for creating modular, testable programs. One of the most natural applications of functional composition that I’ve found is creating a lightweight, composable HTTP request builder, and with that objective in focus, this post will equip you with the tools you need to simplify your HTTP clients.

Read more “Scala @ Scale, Part 2: Compose Yourself!”

Useful Scala Compiler Options Part 2: Advanced Language Features

Scala offers a number of advanced language features that are disabled by default. If you try to use any of them, the compiler will generate a warning informing you of their usage. There are a number of reasons that you might want to enable features (or keep them disabled). In this post, we will explore what each language feature is and under which circumstances you might want to enable them. (For a discussion of basic Scala Compiler options that we find useful at Threat Stack, see Part 1 of this series.)

Read more “Useful Scala Compiler Options Part 2: Advanced Language Features”

SELECT This! Scala Data Access Library Review, Part 1

At Threat Stack we love databases, and as we started to expand our Scala code base, we quickly realized we wanted to standardize on a way to talk to the RDMS within our Scala projects. As we explored the realm, we came across four projects that seemed to have the most potential: ScalikeJDBC, Quill, Jooq, and Doobie. We had already been playing with ScalikeJDBC for awhile, but these other libraries offered interesting features, so we began to investigate.

In this post, we’ll take a look at some of the pros and cons of ScalikeJDBC and Quill. In a followup, we’ll discuss Jooq and Doobie.

Read more “SELECT This! Scala Data Access Library Review, Part 1”

Useful Scala Compiler Options for Better Scala Development: Part 1

At Threat Stack, we like to leverage our tools to the fullest. Since we use Scala, it only makes sense for us to always be looking into ways of getting the most out of the Scala Compiler to enhance our productivity. And, as it turns out, the Scala Compiler offers a number of features that makes our lives way better! 

Read more “Useful Scala Compiler Options for Better Scala Development: Part 1”

My Journey in Scala, Part 1: Awakenings

When I started at Threat Stack over a year ago, I came in as a Platform Engineer expecting to work on JavaScript. I had no idea that Threat Stack would get bit by the Scala bug. But our first Scala app, created by another team member, went into production a couple of months after I joined, and I soon learned that Scala was way more than a passing fad at Threat Stack.

Read more “My Journey in Scala, Part 1: Awakenings”