Cheat Sheet – Scala

///////////////////////////////////////////////// // 0. Basics ///////////////////////////////////////////////// /* Setup Scala: 1) Download Scala – http://www.scala-lang.org/downloads 2) Unzip/untar to your favorite location and put the bin subdir in your `PATH` environment variable */ /* Try the REPL Scala has a tool called the REPL (Read-Eval-Print Loop) that is analogous to commandline interpreters in many other languages. You may…

Linux Directory Structure

If you’re coming from Windows, the Linux file system structure can seem particularly alien. The C:\ drive and drive letters are gone, replaced by a / and cryptic-sounding directories, most of which have three letter names. The Filesystem Hierarchy Standard (FHS) defines the structure of file systems on Linux and other UNIX-like operating systems. However,…

Ways to run Scala code

For running example in this tutorial, make sure that, you have latest Java distribution and Scala distribution installed on your machine and environment variable SCALA_HOME points to base directory of the Scala installation and %SCALA_HOME%/bin added to PATH variable. Using Scala REPL It is basically command line interactive shell called as REPL short for Read-Eval-Print-Loop. To start…

Scala in IntelliJ IDE

IntelliJ IDEA lets you run Scala Console to quickly evaluate an expression or a code selection. NOTE the differences from using Scala SDK terminal: If you want the console to execute when you hit enter, go to Preferences > Keymap > Plug-ins > Scala, and right-click ScalaConsole.Execute. Select Add Bookmark and hit enter in the…

Kafka Producer And Consumer Example

A simple producer/consumer application The Kafka producer will retrieve user input from the console and send each new line as a message to a Kafka server. The consumer will retrieve messages for a given topic and print them to the console. The producer and consumer components in this case are your own implementations of kafka-console-producer.sh…