Skip to content

Instantly share code, notes, and snippets.

View milindjagre's full-sized avatar
💭
❤️ DATA ❤️

Milind Jagre milindjagre

💭
❤️ DATA ❤️
View GitHub Profile
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.github.milind;
import java.io.IOException;
import java.util.StringTokenizer;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.github.milind;
import java.io.IOException;
import java.util.StringTokenizer;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.github.milind;
import java.io.IOException;
import java.util.StringTokenizer;
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany</groupId>
<artifactId>twitter-sentiments</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.7</maven.compiler.source>
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.mycompany.twitter.sentiments;
import java.io.BufferedWriter;
import java.io.FileInputStream;
import java.io.FileWriter;
1 Watching a nice movie
0 The painting is ugly, will return it tomorrow...
1 One of the best soccer games, worth seeing it
1 Very tasty, not only for vegetarians
1 Super party!
0 Too early to travel..need a coffee
0 Damn..the train is late again...
0 Bad news, my flight just got cancelled.
1 Happy birthday mr. president
1 Just watch it. Respect.
Following are the steps which you need to follow in order to install Scala 2.11.6 on Ubuntu 14.04
Assumptions : username is hduser
Step 1 : JAVA Installation
If you have already installed JAVA, then you can skip this step.
If JAVA is not installed, then please follow below steps in order to install JAVA 1.7
command 1 : sudo apt-get update
command 2 : sudo apt-get install openjdk
cd
wget http://download.netbeans.org/netbeans/8.0.2/final/bundles/netbeans-8.0.2-javase-linux.sh
chmod +x netbeans*
sh netbeans-8.0.2-javase-linux.sh
Following are the steps which you need to follow in order to install Spark 1.6.1 on Ubuntu 14.04
Assumptions : username is hduser
Step 1 : JAVA Installation
If you have already installed JAVA, then you can skip this step.
If JAVA is not installed, then please follow below steps in order to install JAVA 1.7
command 1 : sudo apt-get update
command 2 : sudo apt-get install openjdk
val input_file=sc.textFile("input.txt")
val step1=input_file.flatMap(line => line.split(" "))
val step2=step1.map(word => (word,1))
val step3=step2.reduceByKey(_+_)
step3.saveAsTextFile("wordcount")