This file contains hidden or 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
/** | |
* Copyright (c) 2013 Apurv Verma | |
*/ | |
package org.anahata.hadoop.illustrations; | |
import java.io.IOException; | |
import java.util.HashMap; | |
import java.util.Map; | |
import org.anahata.commons.hadoop.io.IntInt; |
This file contains hidden or 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
import org.scribe.builder.ServiceBuilder; | |
import org.scribe.builder.api.TwitterApi; | |
import org.scribe.model.Token; | |
import org.scribe.model.Verifier; | |
import org.scribe.oauth.OAuthService; | |
public class TwitterStreamOAuth { | |
private final static String ACCESS_TOKEN_KEY = "273014559-FevjK1FCxmHqXe1QIPcA4CnHFe6TAsJ0YefpITts"; | |
private final static String ACCESS_TOKEN_SECRET = "PRNXlURgfEcCU6Fs4s7kG9QU6yyhJ8SNzGCDUf1mgI"; |
This file contains hidden or 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
#include <jni.h> | |
/* Header for class Hello */ | |
#ifndef _Included_Hello | |
#define _Included_Hello | |
#ifdef __cplusplus | |
extern "C" { | |
#endif | |
/* | |
* Class: Hello |
This file contains hidden or 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 class Hello{ | |
static{ | |
System.loadLibrary("Hello"); | |
} | |
public native void sayHello(int length); | |
public static void main(String args[]){ | |
String str = "Hello World, JNI"; | |
Hello h = new Hello(); |
This file contains hidden or 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
#include<stdio.h> | |
#include<jni.h> | |
#include "Hello.h" | |
JNIEXPORT void JNICALL Java_Hello_sayHello(JNIEnv *env, jobject object, jint len){ | |
printf("This is printed from native code\n"); | |
} |
This file contains hidden or 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
Job Finished in 3.337 seconds | |
A TextPair{MatchVertex=B, Component=L} | |
B TextPair{MatchVertex=A, Component=R} | |
C TextPair{MatchVertex=D, Component=L} | |
D TextPair{MatchVertex=C, Component=R} |
This file contains hidden or 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
13/01/04 20:02:32 INFO bsp.BSPJobClient: Running job: job_localrunner_0001 | |
13/01/04 20:02:32 INFO bsp.LocalBSPRunner: Setting up a new barrier for 1 tasks! | |
13/01/04 20:02:35 INFO bsp.BSPJobClient: Current supersteps number: 13 | |
13/01/04 20:02:35 INFO bsp.BSPJobClient: The total number of supersteps: 13 | |
13/01/04 20:02:35 INFO bsp.BSPJobClient: Counters: 12 | |
13/01/04 20:02:35 INFO bsp.BSPJobClient: org.apache.hama.graph.GraphJobRunner$GraphJobCounter | |
13/01/04 20:02:35 INFO bsp.BSPJobClient: ITERATIONS=10 | |
13/01/04 20:02:35 INFO bsp.BSPJobClient: MULTISTEP_PARTITIONING=1 | |
13/01/04 20:02:35 INFO bsp.BSPJobClient: INPUT_VERTICES=4 | |
13/01/04 20:02:35 INFO bsp.BSPJobClient: org.apache.hama.bsp.JobInProgress$JobCounter |
This file contains hidden or 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
@Override | |
public void compute(Iterator<TextPair> messages) | |
throws IOException { | |
if(isMatched()){ | |
voteToHalt(); | |
return; | |
} | |
switch((int)getSuperstepCount() % 4){ |
This file contains hidden or 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
"A L:B D" | |
"B R:A C" | |
"C L:B D" | |
"D R:A C" |
This file contains hidden or 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
/** | |
* Searches a 2D array sorted by row and col in logarithmic time. | |
*/ | |
public static boolean contains(int[][] A, int elem){ | |
int R = A.length-1; | |
int C = A[0].length-1; | |
return contains(A, elem, 0, R, 0, C); | |
} | |
private static boolean contains(int[][] A, int elem, int xmin, int xmax, |