Skip to content

Instantly share code, notes, and snippets.

View ranjankumar03's full-sized avatar

ranjan kumar ranjankumar03

View GitHub Profile
@ranjankumar03
ranjankumar03 / SendObjectsOverSockets.java
Created February 8, 2022 07:45 — forked from chatton/SendObjectsOverSockets.java
Example of how to send an Object over a Socket in Java.
import java.io.Serializable;
// must implement Serializable in order to be sent
public class Message implements Serializable{
private final String text;
public Message(String text) {
this.text = text;
}
@ranjankumar03
ranjankumar03 / install-kafka.txt
Created September 14, 2018 11:12 — forked from jarrad/install-kafka.txt
Install Kafka on OSX via Homebrew
$> brew cask install java
$> brew install kafka
$> vim ~/bin/kafka
# ~/bin/kafka
#!/bin/bash
zkServer start
kafka-server-start.sh /usr/local/etc/kafka/server.properties
@ranjankumar03
ranjankumar03 / README.md
Created July 24, 2018 06:56 — forked from hofmannsven/README.md
My simply Git Cheatsheet
@ranjankumar03
ranjankumar03 / BackgroundLogger.java
Created August 18, 2017 16:55 — forked from ajsutton/BackgroundLogger.java
Disruptor Example of Background Logging
import com.lmax.disruptor.RingBuffer;
import com.lmax.disruptor.dsl.Disruptor;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
public class BackgroundLogger
{
private static final int ENTRIES = 64;

Getting Started in Scala

This is my attempt to give Scala newcomers a quick-and-easy rundown to the prerequisite steps they need to a) try Scala, and b) get a standard project up and running on their machine. I'm not going to talk about the language at all; there are plenty of better resources a google search away. This is just focused on the prerequisite tooling and machine setup. I will not be assuming you have any background in JVM languages. So if you're coming from Python, Ruby, JavaScript, Haskell, or anywhere…  I hope to present the information you need without assuming anything.

Disclaimer It has been over a decade since I was new to Scala, and when I was new to Scala, I was coming from a Java and Ruby background. This has probably caused me to unknowingly make some assumptions. Please feel free to call me out in comments/tweets!

One assumption I'm knowingly making is that you're on a Unix-like platform. Sorry, Windows users.

Getting the JVM

Error Handling in Scala

Scala does not have checked exceptions like Java, so you can't do soemthing like this to force a programmer to deal with an exception:

public void stringToInt(String str) throws NumberFormatException {
  Integer.parseInt(str)
}