Creating Grammar Parsers in Java and Scala with Parboiled

Parboiled is a modern. lightweight and easy to use library to parse expression grammars in Java or Scala and in my humble opinion it is perfect for use cases where you need something between regular expressions and a complex parser generator like ANTLR. In the following tutorial we’re going to create a simple grammar to specify a task list and write an implementation of a parser also as unit tests for each grammar rule in Java. ...

January 26, 2014 · 11 min · 2176 words · Micha Kops

Micro Benchmarking your Tests using JUnit and JUnitBenchmarks

I recently stumbled upon a nice framework that allows to convert simple JUnit tests into micro benchmarks named JUnitBenchmarks. It allows to set basic benchmark options and and to generate charts by adding some simple annotations and a test rule to your tests. One might argue if it is wise to mix the aspects, testing and benchmarking and I’d agree for sure – nevertheless I think this framework can be handy sometimes so let’s create some benchmarks using JUnit and JUnitBenchmarks.. ...

March 10, 2013 · 8 min · 1508 words · Micha Kops

Using Apache Camel with Scala and the Camel Scala DSL

Whenever I encounter a situation where I have to mix a blend of different services and endpoints and apply one or more of the traditional enterprise integration patterns then Apache Camel often is my weapon of choice. I simply love how easy it is to set up some datasources, add some routing magic, data transformers, load balancers, content enrichers and enjoy the result. Another thing that I’m beginning to love is Scala and so this is the perfect time to write an article about using Scala and Apache Camel together. ...

February 13, 2013 · 15 min · 3186 words · Micha Kops

Lucene Snippets: Faceting Search

The latest snippet from my Lucene examples demonstrates how to achieve a facet search using the Lucene 4.0 API and how easy it is to define multiple category paths to aggregate search results for different possible facets. In the following example we’re indexing some books as a classical example and create multiple category paths for author, publication date and category afterwards .. Lucene Dependencies We simply need two dependencies here .. lucene-core of course and in addition the lucene-facet library .. I’ve added the declarations needed for Maven and SBT here .. if you’re using Gradle or Buildr you should’t have a problem to transfer the information needed ;) ...

August 28, 2012 · 4 min · 837 words · Micha Kops

Scala Snippets

SBT – Eclipse Plugin Add to your ~/.sbt/plugins/plugins.sbt addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.1.1")

March 1, 2010 · 1 min · 13 words · Micha Kops