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…

Manual offsets in Kafka Consumers Example

The consumer code in Kafka Producer And Consumer Example so far auto-commits records every 5 seconds. Now let’s update the consumer to take a third argument that manually sets your offset consumption. If you use the value of the last argument equal to 0, the consumer will assume that you want to start from the beginning,…

Partitioning in Kafka Example

DefaultPartitioner is good enough for most cases for sending messages to each partition on a round robin basis to balance out the load. But if you want to control which partition your messages are sent to you need to implement a custom partitioner instead. For this example, let’s assume that we have a retail site that consumers can…

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…

Installing Hadoop

Here we set up and configure a single-node Hadoop installation so that you can quickly perform simple operations using Hadoop MapReduce and the Hadoop Distributed File System (HDFS). Installation is easy on Linux platforms than on Windows. Windows requires building Hadoop from source or using a pre-compiled binary for windows which is available here. Version…

Building Apps for Amazon FireTV using Fire App Builder

Amazon Fire TV is a streaming TV service available on Amazon’s Fire TV hardware and FireTV stick. The platform is based on Android and building apps is as simple as building apps in Android Studio and compiling for the Amazon Fire TV service. The Fire App Builder is an open source SDK comprised of common…

Using CURL to test HTTP Requests

$ curl -i -X POST -H “Content-Type:application/json”-d ‘{ “firstName” : “Frodo”, “lastName” : “Baggins” }’ http://localhost:8080/people HTTP/1.1201CreatedServer:Apache-Coyote/1.1Location: http://localhost:8080/people/1Content-Length:0Date:Wed,26Feb201620:26:55 GMT -i ensures you can see the response message including the headers. The URI of the newly created Person is shown -X POST signals this a POST used to create a new entry -H “Content-Type:application/json” sets the…

Creating MongoDB instance using Docker

MongoDB can be installed and run within a docker container with its port=27017 dbpath=/data/db for storage. The docker run can start the process in the container and attach the console to the process’s standard input, output, and standard error. It can even pretend to be a TTY (this is what most command line executables expect)…