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 pairs = sc.parallelize(List(("aa", 1), ("bb", 2), | |
("aa", 10), ("bb", 20), | |
("aa", 100), ("bb", 200))) | |
/* aggregateByKey takes an initial accumulator (here an empty list), | |
a first lambda function to merge a value to an accumulator, and a | |
second lambda function to merge two accumulators */ | |
pairs.aggregateByKey(List[Any]())( | |
(aggr, value) => aggr ::: (value :: Nil), | |
(aggr1, aggr2) => aggr1 ::: aggr2 |
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
Step 0. You must have the latest & greatest version of R, and scala 2.10.1, for all of this to work. | |
Step 1. Download and unzip the MacOS X Binary jvmr_1.0.4.tgz from here: http://cran.r-project.org/web/packages/jvmr/index.html | |
Step 2. Create a lib folder, and copy jvmr_2.10-1.0.4.jar to that folder. | |
Step 3. Start R | |
Step 4. At the R console | |
>install.packages("jvmr") |
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
crypto = require('crypto'); | |
#Quick MD5 of text | |
text = "MD5 this text!" | |
md5hash1 = crypto.createHash('md5').update(text).digest("hex") | |
#MD5 of text with updates | |
m = crypto.createHash('md5') | |
m.update("MD5 ") | |
m.update("this ") |