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
| val query = ScalasticSearch.boolQuery( | |
| cond ( | |
| must( | |
| 'nickname -> "Superman", // is equivalent to... | |
| term('nickname -> "Superman"), // this | |
| term("nickname" -> "Superman") // or this | |
| ), | |
| should( | |
| 'nickname -> "Superman", // is equivalent to... | |
| term('nickname -> "Superman"), // this |
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
| val query = ScalasticSearch.boolQuery( | |
| cond ( | |
| must( | |
| 'nickname -> "Superman", // is equivalent to... | |
| term('nickname -> "Superman"), // this | |
| term("nickname" -> "Superman") // or this | |
| ), | |
| should( | |
| 'nickname -> "Superman", // is equivalent to... | |
| term('nickname -> "Superman"), // this |
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
| Building Sensei from Source | |
| --------------------------------------------- | |
| ==> ./bin/zookeeper-server-start.sh resources/zookeeper.properties | |
| 12/01/20 17:22:40 INFO quorum.QuorumPeerConfig: Reading configuration from: resources/zookeeper.properties | |
| 12/01/20 17:22:40 WARN quorum.QuorumPeerMain: Either no config or no quorum defined in config, running in standalone mode | |
| 12/01/20 17:22:40 DEBUG SecurityLogger.additivity: preRegister called. Server=com.sun.jmx.mbeanserver.JmxMBeanServer@4157aa53, name=log4j:logger=SecurityLogger.additivity | |
| 12/01/20 17:22:40 DEBUG SecurityLogger.additivity: preRegister called. Server=com.sun.jmx.mbeanserver.JmxMBeanServer@4157aa53, name=log4j:logger=SecurityLogger.additivity | |
| 12/01/20 17:22:40 ERROR jmx.AppenderDynamicMBean: Could not add DynamicLayoutMBean for [console,layout=org.apache.log4j.PatternLayout]. |
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
| val pattern = java.util.regex.Pattern.compile ("""(?xs) ("(.*?)"|) ; ("(.*?)"|) (?: \r?\n | \z ) """) | |
| val matcher = pattern.matcher (input) | |
| while (matcher.find) { | |
| val col1 = matcher.group (2) | |
| val col2 = matcher.group (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
| import com.espertech.esper.client.{Configuration, EventBean, UpdateListener, EPServiceProviderManager} | |
| import java.util.HashMap | |
| import scala.collection.JavaConversions._ | |
| object Sandbox | |
| { | |
| def main(args: Array[String]) { | |
| val config = new Configuration(); | |
| val eventType = new HashMap[String, AnyRef]() | |
| eventType.put("itemName", classOf[String]) |
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
| package demo1 | |
| import com.espertech.esper.client.EventBean | |
| import com.espertech.esper.client.EPAdministrator | |
| import com.espertech.esper.client.UpdateListener | |
| import com.espertech.esper.client.EPListenable | |
| import com.espertech.esper.client.EPServiceProvider | |
| object EsperUtil { |
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
| package net.addictivesoftware.scala.akkaactors | |
| import akka.actor.{Actor, PoisonPill} | |
| import Actor._ | |
| import akka.routing.{Routing, CyclicIterator} | |
| import Routing._ | |
| import collection.mutable.{HashMap, Map} | |
| import java.util.concurrent.CountDownLatch |
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 scala.io.Source | |
| def parseLines[T](file: String, transform: (Iterator[String]) => T): T = { | |
| val log = Source.fromFile(file) | |
| val logLines = log.getLines() | |
| try { transform(logLines) } finally { log.close } | |
| } | |
| // Example usage. | |
| // parseLines("verybigfile.txt", iterator.take(100).foreach(println)) |
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 scala.io.Source | |
| def parseLines[T](file: String, transform: (Iterator[String]) => T): T = { | |
| val log = Source.fromFile(file) | |
| val logLines = log.getLines() | |
| try { transform(logLines) } finally { log.close } | |
| } | |
| // Example usage. | |
| // parseLines("verybigfile.txt", iterator.take(100).foreach(println)) |
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
| package akka.unfiltered | |
| import akka.actor._ | |
| import akka.dispatch.Future | |
| import akka.pattern.ask | |
| import akka.util.duration._ | |
| import akka.util.Timeout | |
| import unfiltered.Async | |
| import unfiltered.request._ |