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 scala.actor._ | |
import scala.actor.Actor._ | |
sealed trait DoSomething | |
case class SaySomething(text: String) extends DoSomething | |
case class YellSomething(text: String) extends DoSomething | |
object DuncanExample { | |
def main(args: Array[String]) { | |
val nActors = 5 |
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
scala> Map("0110529461001" -> Set("0010ddecf7", "0010da6be5"), "0110519163601" -> Set("0010edc96f"), "0110513382403" -> Set("0010edcaee"), "0110519771404" -> Set("0010ddee12")) | |
res0: scala.collection.immutable.Map[java.lang.String,scala.collection.immutable.Set[java.lang.String]] = Map(0110529461001 -> Set(0010ddecf7, 0010da6be5), 0110519163601 -> Set(0010edc96f), 0110513382403 -> Set(0010edcaee), 0110519771404 -> Set(0010ddee12)) | |
scala> Map("0010da6be5" -> Set("!|", "!("), "0010ddecf7" -> Set( "!_"), "0010ddee12" -> Set( "!&"), "0010edcaee" -> Set( "|&"), "0010edc96f" -> Set( "!|", "!&", "|_")) | |
res1: scala.collection.immutable.Map[java.lang.String,scala.collection.immutable.Set[java.lang.String]] = Map(0010ddee12 -> Set(!&), 0010edcaee -> Set(|&), 0010da6be5 -> Set(!|, !(), 0010edc96f -> Set(!|, !&, |_), 0010ddecf7 -> Set(!_)) | |
scala> Map("!&" -> Set("91", "32859"), "!I" -> Set("60", "32838", "61", "88", "63", "32856", "62", "58", "32807", "32802", "145149", "40", "32803", "1", "32808", "59", "39", "34" |
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 com.comcast.ues.vcwloader | |
import scala.io.Source | |
import scala.collection.mutable.{MultiMap, HashMap => MHash, Set => MSet} | |
object VcwLoader extends App { | |
override def main(args: Array[String]) { | |
new VcwLoader().loadData | |
} | |
} |
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
/** | |
* I'm trying to create a basic supervisor hierarchy with four actors. If any fail for | |
* any reason, tear them all down and restart them to re-process any unhandled | |
* data. When I run, I see the "Blowing up!" log output. I expect the ensuing throw | |
* to blow up my actors, and then I should see all of my actors restarted per my | |
* supervision strategy, but I just get a message timeout (None response to the | |
* producer). | |
* | |
* The online Akka docs say this about sending a message with a ?: "The receiving | |
* actor should reply to this message, which will complete the future with the |
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 scala.annotation.switch | |
/** | |
* Simple test of how quickly Scala can perform typed pattern | |
* matches, both of primitive types and complex object types. | |
*/ | |
object PatternMatchTest extends App { | |
val numberOfOperations = 10000000 | |
println("Performing baseline test...") |
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 scala.annotation.switch | |
/** | |
* Simple test of how quickly Scala can perform typed pattern matches, both of primitive types and complex object types. | |
*/ | |
object PatternMatchRunner extends App { | |
val numberOfOperations = 10000000 |
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
name := "Akka ActorSystem Test" | |
version := "1.0" | |
scalaVersion := "2.9.1-1" | |
resolvers += "Typesafe Repository" at "http://repo.typesafe.com/typesafe/releases/" | |
libraryDependencies += "com.typesafe.akka" % "akka-actor" % "2.0.1" |
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 scala.annotation.switch | |
/** | |
* Simple test of how quickly Scala can perform typed pattern matches, both of primitive types and complex object types. | |
*/ | |
object PatternMatchRunner extends App { |
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 akka.actor._ | |
import akka.pattern.ask | |
import akka.util._ | |
import akka.util.duration._ | |
import scala.util.control.Exception._ | |
/** | |
* To test, execute this code and use this command in a shell: "telnet localhost 8080" | |
* At the prompt, type in numbers and press enter, and they will be accumulated, returning | |
* the total value each time. |
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
scalaVersion := "2.9.2" | |
name := "Console Playground" | |
scalacOptions ++= Seq("-unchecked", "-deprecation", "-optimize") | |
resolvers ++= Seq("akka-snapshots" at "http://repo.akka.io/snapshots", | |
"akka-releases" at "http://repo.akka.io/releases", | |
"Atmos Repo" at "http://repo.typesafe.com/typesafe/atmos-releases", | |
"Cloudera Repo" at "https://repository.cloudera.com/content/groups/public", |
OlderNewer