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 socket | |
import json | |
import sys | |
HOST = 'logging.developmentci.rebb.baseless.nl' | |
PORT = 1514 | |
try: | |
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
except socket.error, msg: |
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 socket | |
import json | |
import sys | |
HOST = 'logging.developmentci.rebb.baseless.nl' | |
#HOST = '127.0.0.1' | |
PORT = 1514 | |
try: | |
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) |
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
//Message and event classes | |
case class UpdateAccountBalance(userId:Long, amount:Long) | |
case class BalanceUpdated(userId:Long) | |
//Actor that performs account updates | |
class AccountManager extends Actor{ | |
val dao = new AccountManagerDao | |
def receive = { | |
case UpdateAccountBalance(userId, amount) => |
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
def coalesce(x:List[String], y:List[Int]):List[(String, Int)] = | |
(x zip y).groupBy(_._1) | |
.values | |
.map{_.reduce((i,j) => (i._1, (i._2 + j._2)))} | |
.toList | |
.sorted | |
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
ODataQuery( | |
URL("http://odata.io/odata.svc"), | |
ResourcePath("Schema",Number("231"),ResourcePath("Customer",EmptyExp(),EmptyExp())), | |
QueryOperations( | |
List(Top(Number("2")), | |
Filter( | |
EqualToExp( | |
CallExp( | |
Property("concat") | |
, List(Property("City"), Property("Country")) |
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
ODataQuery( | |
URL("http://odata.io/odata.svc"), | |
ResourcePath("Schema",Number("231"),ResourcePath("Customer",EmptyExp(),EmptyExp())), | |
QueryOperations( | |
List(Top(Number("2")), | |
Filter( | |
EqualToExp( | |
CallExp( | |
Property("concat") | |
, List(Property("City"), Property("Country")) |
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
lazy val oDataQuery: PackratParser[SourceNode]={ | |
serviceURL ~ resourcePath ~ opt(queryOperationDef) ^^ { | |
case uri ~ path ~ None => ODataQuery(uri, path, QueryOperations(Seq.empty)) | |
case uri ~ path ~ Some(exp) => ODataQuery(uri, path,QueryOperations(exp)) | |
} | |
} |
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
lazy val resourcePath: PackratParser[Expression] =( | |
"/" ~> idn ~ ("(" ~> predicate <~ ")") ~ opt(resourcePath) ^^ { | |
case Property(name) ~ keyPredicate ~ None => ResourcePath(name, keyPredicate, EmptyExp()) | |
case Property(name) ~ keyPredicate ~ Some(expr) => ResourcePath(name, keyPredicate, expr) | |
} | |
| "/" ~> idn~ opt(resourcePath) ^^ { | |
case Property(e)~None => ResourcePath(e, EmptyExp(), EmptyExp()) | |
case Property(e)~Some(expr) => ResourcePath(e, EmptyExp(), expr) | |
} | |
) |
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
lazy val serviceURL: PackratParser[Expression] = | |
"""^.*.svc""".r ^^ { | |
case s => URL(s) | |
} |
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
lazy val expression: PackratParser[Expression] = | |
expression ~ ("add" ~> termExpression) ^^ {case l ~ r => PlusExp(l, r)} | | |
expression ~ ("sub" ~> termExpression) ^^ {case l ~ r => MinusExp(l, r)} | | |
termExpression | |
lazy val termExpression: PackratParser[Expression] = | |
termExpression ~ ("mul" ~> factor) ^^ {case a ~ b => MultiplyExp(a, b)} | | |
termExpression ~ ("div" ~> factor) ^^ {case a ~ b => DivideExp(a, b)} | | |
termExpression ~ ("mod" ~> factor) ^^ {case a ~ b => ModExp(a, b)} | | |
factor |
OlderNewer