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
@SuppressWarnings({ "rawtypes", "unchecked" }) | |
public static Stream getSentenceStream(TridentTopology topology, ITridentSpout spout){ | |
Stream sentenceStream = null; | |
if(spout == null){ | |
FixedBatchSpout fixedSpout = new FixedBatchSpout(new Fields("sentence"), 3, | |
new Values("the cow jumped over the moon"), | |
new Values("the man went to the store and bought some candy"), | |
new Values("four score and seven years ago"), | |
new Values("how many apples can you eat"), | |
new Values("to be or not to be the person")); |
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 test() { | |
Date start = new Date(); | |
//GraphHopper gh = new GraphHopper().forServer(); //<- this works, line below doesn't | |
GraphHopper gh = new GraphHopper().forServer().contractionHierarchies(true); | |
gh.load("./london.osm"); | |
Date end = new Date(); | |
System.out.println("Load Time: " + (end.getTime() - start.getTime())); | |
GHRequest request = new GHRequest(51.430896,0.115356, | |
51.564266,-0.219727); |
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
package storm.cookbook.tfidf.functions; | |
import java.util.Map; | |
import storm.trident.operation.MultiReducer; | |
import storm.trident.operation.TridentCollector; | |
import storm.trident.operation.TridentMultiReducerContext; | |
import storm.trident.tuple.TridentTuple; | |
import backtype.storm.tuple.Values; |
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
In order to | |
* paste the text from the file in the gist: sudo vim /usr/local/sbin/configure-pat.sh | |
* Make it executable: sudo chmod u+x /usr/local/sbin/configure-pat.sh | |
* Edit /etc/rc.local: "sudo vim /etc/rc.local" and add the following line: "/usr/local/sbin/configure-pat.sh" | |
* Reboot the instance |
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
trait M[A] { | |
def op( a1: A, a2: A): A | |
def zero: A | |
} | |
val sumIntMonoid = new M[Int]{ | |
val zero = 0 | |
def op(a1:Int, a2:Int) = a1 + a2 | |
} |
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
calc.gini <- function(y) | |
{ | |
num.pos <- sum(y==1) | |
num.neg <- sum(y==0) | |
tpr <- cumsum(y==1)/num.pos | |
fpr <- cumsum(y==0)/num.neg | |
area <- (tpr[-1] + tpr[1:(length(tpr)-1)]) %*% (fpr[-1] - fpr[1:(length(fpr)-1)]) | |
1 - as.numeric(area) | |
} |
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
There is a pathing issue with qiBuild. when I run qibuild configure I always get the following error: | |
Current build worktree: xxxx | |
Using toolchain: mytoolchain | |
Build type: Debug | |
[ERROR]: Could not find qibuild cmake framework path | |
Please file a bug report with the details of your installation | |
When I run the command in debug mode I see some paths that don't match my system: | |
Build type: Debug |
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 sbt._ | |
import Keys._ | |
import sbtassembly.Plugin._, AssemblyKeys._ | |
object build extends Build { | |
type Sett = Project.Setting[_] | |
lazy val standardSettings: Seq[Sett] = | |
Defaults.defaultSettings ++ Seq[Sett]( |
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
val IncludeInLib = Configurations.config("include-lib") | |
def addSpecifiedDependenciesToLibInAssembly = inConfig(IncludeInLib)(Defaults.configSettings) ++ Seq( | |
(libraryDependencies in IncludeInLib) := Nil, // needed otherwise scala library gets included. | |
(assembledMappings in assembly) <<= (libraryDependencies in IncludeInLib, externalDependencyClasspath in IncludeInLib, assembledMappings in assembly) map ((specified, managed, mappings) => { |
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
object OpsMain { | |
def main(args : Array[String]) { | |
hadoop.util.ToolRunner.run(new hadoop.mapred.JobConf, new Tool[XXX]({args => new XXX(args)}), args) | |
} | |
} |
OlderNewer