Skip to content

Instantly share code, notes, and snippets.

View seenimohamed's full-sized avatar
🎯
Focusing

Seeni Mohamed seenimohamed

🎯
Focusing
View GitHub Profile
@seenimohamed
seenimohamed / java_commands.txt
Created January 4, 2018 04:52
Java command line commands
//to compile a java class
javac
//to include jars in classpath
java -cp
//to run jar
java -jar jarfile.jar
//to give args
@seenimohamed
seenimohamed / lscommand.txt
Created January 3, 2018 09:46
List of important options in ls command
ls <options>
-l -> detailed view
S -> sort in decending order
r -> reverse
ls -lS -> decending order
ls -lSr -> ascending order
@seenimohamed
seenimohamed / install_java_ubuntu.txt
Created January 3, 2018 09:40
Links that are useful while development
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
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--;
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)));