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
library(rmr2) | |
rmr.options(backend = "local") | |
#hdfs.init() | |
lm.map = | |
function(., line) { | |
keyval( line[[1]], paste(line[[2]], line[[3]], sep="|")) | |
} |
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
# Spark scala project | |
mvn archetype:generate -B -DarchetypeGroupId=net.alchim31.maven -DarchetypeArtifactId=scala-archetype-simple -DarchetypeVersion=1.5 -DgroupId=org.apache.spark -DartifactId=<Project name> -Dversion=0.1-SNAPSHOT -Dpackage=org.apache.spark | |
# flink project | |
mvn archetype:generate \ | |
-DarchetypeGroupId=org.apache.flink \ | |
-DarchetypeArtifactId=flink-quickstart-scala \ | |
-DarchetypeVersion=0.9.1 \ | |
-DgroupId=org.apache.flink.quickstart \ | |
-DartifactId=flink-scala-project \ |
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
location / { | |
root /usr/domain.com/nginx/html; | |
index index.jsp; | |
post_action /aftertouching; | |
} | |
location /aftertouching { | |
proxy_pass http://10.25.0.11/count.do?resource=$request&status=$request_completion&fromIp=$remote_addr&body_bytes_sent=$body_bytes_sent; | |
internal; | |
} |
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 example.pig; | |
import javassist.CannotCompileException; | |
import javassist.ClassPool; | |
import javassist.CtClass; | |
import javassist.CtMethod; | |
import javassist.NotFoundException; | |
public class FixHadoopOnWindows { |
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
int i = 0; | |
File file = new File("out2.csv") | |
file << "Id,Action\n" | |
new File('out.csv').eachLine { line -> | |
if(i > 0) { | |
file.append i | |
file.append ',' | |
file.append Double.valueOf(line) > 0.6 ? 1 : 0; | |
file.append '\n' |
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
class Node { | |
def val | |
def left | |
def right | |
} | |
/* | |
root | |
A B |
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
def levenshtain(String s1, String s2, int i, int j) { | |
if(i == -1 && j == -1) { | |
return 0 | |
} else if( j == -1 && i > -1 ) { | |
return i | |
} else if(i == -1 && j > -1) { | |
return j | |
} else { | |
return min( | |
levenshtain(s1, s2, i, j-1)+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
/* | |
<dependencies> | |
<dependency> | |
<groupId>com.rabbitmq</groupId> | |
<artifactId>amqp-client</artifactId> | |
<version>3.1.1</version> | |
</dependency> | |
</dependencies> | |
*/ |
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
class Constants { | |
static final goods = [ | |
'Apple', 'Orange', 'Pineaple', 'Cherry', 'Beef', 'Sugar', 'Milk', | |
'Pear', 'Limon', 'Blubbery', 'IceCream', 'Cake', 'Orange', 'Milk', | |
'Cola', 'Bread', 'Coffe', 'Cookies', 'Beer', 'Tea', 'Salmon', 'Steal Water', 'Nuts'] | |
} | |
rand = new Random() |
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 the R package arules if required | |
#install.packages("arules"); | |
#load the arules package | |
library("arules"); | |
# read the transaction file as a Transaction class | |
txn = read.transactions(file="d:\\work\\R\\items.csv", rm.duplicates= FALSE, format="basket",sep=","); | |
#To visualize the item frequency in txn file | |
itemFrequencyPlot(txn); |
OlderNewer