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 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 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._ | |
case class Book(title: String, authors: List[String]) | |
class BookPublisher extends Actor { | |
def receive = { | |
case book: Book => { | |
println(s"Yeah! Publishing a new book: $book") | |
context.system.eventStream.publish(book) |
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.event.{LookupClassification, EventBus} | |
import akka.event.ActorEventBus | |
case class Book(title: String, authors: List[String]) | |
class AuthorBookBus(author: String) extends EventBus | |
with LookupClassification | |
with ActorEventBus { | |
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
/** | |
* D Holbrook | |
* | |
* Code Club: PO1 | |
* | |
* (*) Define a binary tree data structure and related fundamental operations. | |
* | |
* Use whichever language features are the best fit (this will depend on the language you have selected). The following operations should be supported: | |
* | |
* Constructors |
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
Latency Comparison Numbers (~2012) | |
---------------------------------- | |
L1 cache reference 0.5 ns | |
Branch mispredict 5 ns | |
L2 cache reference 7 ns 14x L1 cache | |
Mutex lock/unlock 25 ns | |
Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
Compress 1K bytes with Zippy 3,000 ns 3 us | |
Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |