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
//to compile a java class | |
javac | |
//to include jars in classpath | |
java -cp | |
//to run jar | |
java -jar jarfile.jar | |
//to give args |
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
ls <options> | |
-l -> detailed view | |
S -> sort in decending order | |
r -> reverse | |
ls -lS -> decending order | |
ls -lSr -> ascending order |
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
Installing java in ubuntu | |
Commands : | |
sudo apt-get update | |
sudo apt-get install default-jre | |
sudo apt-get install default-jdk | |
https://www.digitalocean.com/community/tutorials/how-to-install-java-with-apt-get-on-ubuntu-16-04 |
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
public static void main(String[] args) { | |
int i = 10; | |
while(--i > 0) { | |
System.out.println(i); | |
i = i%4; | |
} | |
while(i>0) { | |
System.out.println(i); | |
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
JavaRDD<String> uniqueRDD = SparkUtils.getInstance().getSparkContext() | |
.parallelize(Arrays.asList(Preprocessor.getInstance().getVocabulary())); | |
Map<Long, String> vocabMap = uniqueRDD.zipWithIndex().mapToPair(f -> f.swap()).collectAsMap(); | |
JavaPairRDD<Long, Integer> dataPair = tfidf.select("tf").toJavaRDD().flatMapToPair( r -> { | |
SparseVector vec = r.getAs(0); | |
List<Tuple2<Long, Integer>> results = new ArrayList<>(); | |
for(int i : vec.indices()) { | |
results.add(new Tuple2<Long, Integer>((long)i, (int) vec.apply(i))); |
NewerOlder