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
-- Create directory cards under home | |
mkdir cards | |
-- Copy largedeck.txt file to the gateway node and place it in cards directory under home directory | |
-- On lab file is placed under /data directory where any one can read | |
cp /data/cards/* ~/cards | |
-- If you want to copy other files you have to use scp/winscp from your PC to gateway | |
-- Confirm largedeck.txt is available under your home directory | |
ls -ltr ~/cards |
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
--Login to mysql CLI | |
mysql -u retail_dba -h nn01.itversity.com -p | |
show databases; | |
use retail_db; | |
show tables; | |
select * from departments; |
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
object hw { | |
def main(args: Array[String]) { | |
println("Hello World!") | |
} | |
} |
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
//Immutable | |
val i = 10 //Smart enough to figure out the data type | |
val i: Int = 0 //Data type can be defined explicitly as well | |
//This does not work i = i + 1, as i is defined as immutable (val) | |
//Mutable | |
var j = 20 | |
j = j + 1 | |
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
//Creating functions | |
def addIntegers(i: Int, j: Int): Int = { | |
i + j | |
} | |
//Anonymous function assigned to a variable | |
val addIntegers = (i: Int, j: Int) => { | |
i + j | |
} |
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
// closure example | |
def m2: Int => Int = { | |
val factor = 2 | |
val multiplier = (i: Int) => i * factor | |
multiplier | |
} | |
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
for i in sc.textFile("/public/randomtextwriter/part-m-00000"). \ | |
flatMap(lambda rec: rec.split(" ")). \ | |
map(lambda rec: (rec, 1)). \ | |
reduceByKey(lambda total, value: total + value). \ | |
take(100): | |
print(i) |
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
val conf = new SparkConf(). | |
setAppName("Word Count). | |
setMaster("local") |
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
dev.host = nn01.itversity.com | |
dev.port = 3306 | |
dev.db = hr | |
dev.user = hr_ro | |
dev.pw = itversity |
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
name := "wlabs" | |
version := "1.0" | |
scalaVersion := "2.11.8" | |
libraryDependencies += "mysql" % "mysql-connector-java" % "5.1.36" | |
libraryDependencies += "com.typesafe" % "config" % "1.3.1" |
OlderNewer