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
library(RJSONIO) | |
library(ggplot2) | |
api.uri <- "http://api.infochimps.com/" | |
acs.topline <- "social/demographics/us_census/topline/search?" | |
api.key <- "apikey=xxxxxxxxxx" # replace the x's with your Infochimps API key | |
radius <- 10000 # in meters | |
lat <- 44.768202 | |
long <- -91.491603 |
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
geocode = function(location) { | |
library(RJSONIO) | |
api.uri = "http://api.infochimps.com/" | |
geocode.uri = "geo/utils/geolocate?" | |
api.key = "apikey=xxxxxxxxxxxx" | |
print(location) | |
uri = paste(api.uri, geocode.uri, api.key, "&f.address_text=", location, sep="") | |
raw.data = readLines(uri, warn="F") | |
results = fromJSON(raw.data) |
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
(defn standard-tokenizer [text] | |
"Uses the Lucene StandardTokenizer to tokenize the given text. Returns a vector containing | |
the tokens." | |
(let [analyzer (StandardAnalyzer. Version/LUCENE_31) | |
tokenstream (.tokenStream analyzer "field" (StringReader. text)) | |
termatt (.addAttribute tokenstream TermAttribute) | |
terms []] | |
(while (.incrementToken tokenstream) | |
(print (.term termatt))))) |
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
(ns transaction.queries | |
(:use [cascalog.api]) | |
(:require [cascalog.ops :as c] | |
[cascalog.tap :as tap] | |
[cascalog.workflow :as w]) | |
(:import [com.google.common.hash Hashing] | |
[org.joda.time.format DateTimeFormat] | |
[cascading.scheme.hadoop TextDelimited]) | |
(:gen-class)) |
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
@Test | |
public void changeNameTest() { | |
MutableClass original_name = new MutableClass("my name"); | |
MutableClass expected_name = original_name; | |
NameFilter filter = new NameFilter(); | |
MutableClass new_name = filter.changeName(original_name, | |
"new name"); | |
assertEquals(new_name, expected_name); |
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
@Test | |
public void changeNameTest() { | |
MutableClass original_name = new MutableClass("my name"); | |
MutableClass expected_name = new MutableClass("my name"); | |
NameFilter filter = new NameFilter(); | |
MutableClass new_name = filter.changeName(original_name, | |
"new name"); | |
assertEquals(new_name, expected_name); |
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 MutableClass changeName(MutableClass oldNameClass, String newName) { | |
MutableClass newNameClass = new MutableClass(); | |
newNameClass = oldNameClass; | |
newNameClass.setName(newName); | |
return newNameClass; | |
} | |
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
/* If I execute only the clientQuery or only the emailQuery by themselves everything works right. | |
I set breakpoints inside the ExtractClientEdgeFields() and ExtractClientId() functions and they | |
are called with only the Data objects with the correct property types. | |
However, if I execute this query as it is shown here then only one of the two functions is called | |
with all of the Data objects from both taps. */ | |
public static Subquery clientEmail(String pailPath) { | |
PailTap clientEdgeTap = clientEdgeTap(pailPath); | |
PailTap clientTap = petOwnerTap(pailPath); |
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
import org.apache.hadoop.conf.Configuration; | |
import org.apache.hadoop.conf.Configured; | |
import org.apache.hadoop.fs.Path; | |
import org.apache.hadoop.io.IntWritable; | |
import org.apache.hadoop.io.LongWritable; | |
import org.apache.hadoop.io.Text; | |
import org.apache.hadoop.mapreduce.Job; | |
import org.apache.hadoop.mapreduce.Mapper; | |
import org.apache.hadoop.mapreduce.Reducer; | |
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat; |
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
grammar MinRtf ; | |
document : (control | text )+ ; | |
text : TEXT ; | |
control : KEYWORD INT? SPACE? ; | |
KEYWORD : '\\' (ASCIILETTER)+ ; |
OlderNewer