//Implementation of CloudDiag............
public class CloudDiag {
public static void main(
String args[])
{
System.out.println("CloudDiag Implementation");
int x;
int number_of_nodes=100;
int virtualmachine[ ];
int MID;
int RequestID;
float CV;
float alpha,beta;
int replica;
}
}
public class RPCA {
private int numVertices;
private float[][] Dk, Dk_minus_one;
private int[][] Pk, Pk_minus_one;
public void initialize(int numVertices) {
this.numVertices = numVertices;
map(String collectdata , String assemlbedata)
{
for ( int w=0; w < collectdata; w++)
{
emit (w, 1);
}
reduce(String
word, Iterator partialCounts)
// word: a word
// partialCounts: a list of aggregated partial counts
int sum = 0;
for each pc in partialCounts:
sum += ParseInt(pc)
emit (word, sum)
// Initialize Dk matrices.
Dk = new float[numVertices][];
Dk_minus_one = new float[numVertices][];
for (int i = 0; i < numVertices; i++) {
Dk[i] = new float[numVertices];
Dk_minus_one[i] = new float[numVertices];
}
// Initialize Pk matrices.
= new int[numVertices][];
Pk_minus_one = new int[numVertices][];
for (int i = 0; i < numVertices; i++) {
[i] = new int[numVertices];
Pk_minus_one[i] = new int[numVertices];
}
}
private void emit(int w, int i)
{
throw new UnsupportedOperationException("Not supported yet.");
}
private void reduce(Type String)
{
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
private void map(Type String)
{
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
private static class function
{
public function()
{
}
}
}
public class CloudDiag {
public static void main( String args[])
{
System.out.println("CloudDiag Implementation");
int x;
int number_of_nodes=100;
int virtualmachine[ ];
int MID;
int RequestID;
float CV;
float alpha,beta;
int replica;
}
}
package io.com.mrbool import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.input.TextInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
import org.apache.hadoop.mapreduce.lib.output.TextOutputFormat;
public class MrBoolDriver { public static void main(String[] args) throws Exception {
// Create config and load xml files
Configuration config = new Configuration();
config.addResource(new Path("/usr/etc/hadoop/core-site.xml"));
config.addResource(new Path("/usr/etc/hadoop/hdfs-site.xml"));
// Create MapReduce job Job mapjob = new Job(config,"MrBoolDriver.class");
mapjob.setJarByClass(MrBoolDriver.class); mapjob.setJobName("Mrbool MapReduce");
// Set output kay and value class mapjob.setOutputKeyClass(Text.class);
mapjob.setOutputValueClass(Text.class);
// Set Map class mapjob.setMapperClass(MrBoolMap.class);
mapjob.setNumReduceTasks(30);
// Set reducer class
mapjob.setCombinerClass(MrBoolReducer.class);
mapjob.setReducerClass(MrBoolReducer.class);
mapjob.setMapOutputKeyClass(Text.class);
mapjob.setMapOutputValueClass(Text.class);
// Set number of reducer tasks
mapjob.setNumReduceTasks(10);
mapjob.setInputFormatClass(TextInputFormat.class);
mapjob.setOutputFormatClass(TextOutputFormat.class);
FileInputFormat.addInputPath(mapjob, new Path("/usr/inputs/workspace/Sent_Analysis_Twitter/input/"));
FileOutputFormat.setOutputPath(mapjob,new Path("/usr/inputs/workspace/Sent_Analysis_Twitter/output"));
// Start MapReduce job
mapjob.waitForCompletion(true);
}
}
// CloudDiag implementation
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>
JSP Page</title>
<script type="text/javascript">
function as(){
setTimeout(function () {
window.location.href = "clouddiagresult.jsp"; //will redirect to your blog page (an ex: blog.html)
}, 10000);
}
</script>
</head>
<body onload="as();"><center>
<br/>
<br/>
<br/>
<br/>
<h1>Simulation under process, please wait...</h1>
<img src="processing.gif" alt=""/>
</center>
</body>
</html>
import java.rmi.server.Operation;
import java.util.Scanner;
public class BigTable {
// private static Object scanner;
// private static Object Scanner;
public static void main(String args[])
{
int T = 0;
int Table;
//open table
// Table *T = OpenOrDie("/bigtable/web/webtable");
Object RowMutation;
// Write a new anchor and delete an old anchor
// RowMutation = null r1T, "com.cnn.www");
r1.Set("anchor:www.c-span.org", "CNN");
r1.Delete("anchor:www.abc.com");
Operation op = null;
// Apply(&op, &r1);
// Object ;
// Scanner = null scannerT);
//ScanStream *stream;
// stream = scanner.FetchColumnFamily("anchor");
// stream->SetReturnAllVersions();
// scanner.Lookup("com.cnn.www");
//for (; !stream->Done(); stream->Next())
// printf("%s %s %lld %s\n", scanner.RowName(), stream->ColumnName(), stream->MicroTimestamp(), stream->Value());
}
}
//Data splitting
import java.io.File;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
try {
File f = new File("people.ser");
Scanner sc = new Scanner(f);
List<Person> people = new ArrayList<Person>();
while(sc.hasNextLine()){
String line = sc.nextLine();
String[] details = line.split(":");
String gender = details[0];
String name = details[1];
int age = Integer.parseInt(details[2]);
Person p = new Person(gender, name, age);
people.add(p);
}
for(Person p: people){
System.out.println(p.toString());
}
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
}
class Person{
private String gender;
private String name;
private int age;
public Person(String gender, String name, int age){
this.gender = gender;
this.setName(name);
this.age = age;
}
/**
* @return the gender
*/
public String getGender() {
return gender;
}
/**
* @param gender the gender to set
*/
public void setGender(String gender) {
this.gender = gender;
}
/**
* @param name the name to set
*/
public void setName(String name) {
this.name = name;
}
/**
* @return the name
*/
public String getName() {
return name;
}
/**
* @return the age
*/
public int getAge() {
return age;
}
/**
* @param age the age to set
*/
public void setAge(int age) {
this.age = age;
}
public String toString(){
return this.gender + " " + this.name + " " + this.age;
}
}
// data collection
import java.util.*;
public class CollectionTest {
public static void main(String [] args) {
System.out.println( "Collection Example!\n" );
int size;
HashSet collection = new HashSet ();
String str1 = "Yellow", str2 = "White", str3 =
"Green", str4 = "Blue";
Iterator iterator;
collection.add(str1);
collection.add(str2);
collection.add(str3);
collection.add(str4);
System.out.print("Collection data: ");
iterator = collection.iterator();
while (iterator.hasNext()){
System.out.print(iterator.next() + " ");
}
System.out.println();
size = collection.size();
if (collection.isEmpty()){
System.out.println("Collection is empty");
}
else{
System.out.println( "Collection size: " + size);
}
System.out.println();
}
}