This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// How to convert a JDBC iterator to a Scala iterator | |
/* A data model to reflect the content of ResultSet */ | |
case class Movie(mId: Int, title: String, rId: Int, ratingDate: String) | |
import java.sql.{ ResultSet, Statement } | |
val stmt: Statement = ??? | |
val rs: ResultSet = statement.executeUpdate("SELECT * FROM movie".stripMargin) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
if [[ -f /etc/lsb-release ]]; then | |
RED=$(tput setaf 1) | |
GREEN=$(tput setaf 2) | |
YELLOW=$(tput setaf 3) | |
NO_COLOUR=$(tput sgr0) | |
else | |
RED="\033[91m" | |
GREEN="\033[92m" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install SSH on the machine | |
sudo apt install openssh-server | |
sudo systemctl enable ssh | |
sudo systemctl start ssh | |
# Create a new user | |
sudo useradd -m -d /home/iraj/ -s /bin/bash -G sudo iraj | |
sudo passwd iraj | |
## pick a password |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
month | rainfall | umbrellas_sold | |
---|---|---|---|
Jan | 82 | 15 | |
Feb | 92.5 | 25 | |
Mar | 83.2 | 17 | |
Apr | 97.7 | 28 | |
May | 131.9 | 41 | |
Jun | 141.3 | 47 | |
Jul | 165.4 | 50 | |
Aug | 140 | 46 | |
Sep | 126.7 | 37 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Run Spark shell using spark-shell --packages datastax:spark-cassandra-connector:2.4.0-s_2.11 command | |
Check the versions compatibility on https://github.com/datastax/spark-cassandra-connector#version-compatibility | |
*/ | |
import com.datastax.spark.connector._ | |
import org.apache.spark.sql._ | |
val spark = SparkSession.builder(). | |
appName("Spark SQL practice").master("local[*]"). | |
config("spark.cassandra.connection.host", "localhost"). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package ir.iraj.ericsson; | |
import ir.iraj.ericsson.exceptions.IllegalBasePayException; | |
import ir.iraj.ericsson.exceptions.OverWorkException; | |
public class EricssonCorporation { | |
/** | |
* Minimum legal base pay | |
*/ |
NewerOlder