Skip to content

Instantly share code, notes, and snippets.

Avatar

Brian L. Troutwine blt

View GitHub Profile
View gist:913055
scala> import akka.actor.Actor.registry
import akka.actor.Actor.registry
scala> registry
res4: akka.actor.ActorRegistry = akka.actor.ActorRegistry@76800e
scala> registry.actorFor("blt")
<console>:9: error: overloaded method value actorFor with alternatives:
(uuid: akka.actor.package.Uuid)Option[akka.actor.ActorRef] <and>
[T <: akka.actor.Actor](implicit manifest: scala.reflect.Manifest[T])Option[akka.actor.ActorRef]
View Boot.scala
package us.troutwine.botty
import akka.config.Supervision._
import akka.actor._
object Boot {
Supervisor(
SupervisorConfig(
OneForOneStrategy(List(classOf[Exception]), 3, 1000),
Supervise(
View gist:914947
00:41:31.709 [akka:event-driven:dispatcher:global-10] ERROR akka.actor.Actor$ - Problem
java.lang.IllegalStateException: 7 => 1
at org.eclipse.jetty.client.HttpExchange.setStatus(HttpExchange.java:322) ~[jetty-client-7.3.0.v20110203.jar:7.3.0.v20110203]
at org.eclipse.jetty.client.HttpClient.send(HttpClient.java:146) ~[jetty-client-7.3.0.v20110203.jar:7.3.0.v20110203]
at com.fluentstream.smsbridge.SMSAgent$$anonfun$receive$1.apply(SMSAgent.scala:82) ~[smsbridge-0.3.0.jar:na]
at com.fluentstream.smsbridge.SMSAgent$$anonfun$receive$1.apply(SMSAgent.scala:77) ~[smsbridge-0.3.0.jar:na]
at akka.actor.Actor$$anonfun$4.apply(Actor.scala:481) ~[akka-actor-1.0.jar:na]
at akka.actor.Actor$$anonfun$4.apply(Actor.scala:464) ~[akka-actor-1.0.jar:na]
at akka.actor.Actor$class.apply(Actor.scala:435) ~[akka-actor-1.0.jar:na]
at com.fluentstream.smsbridge.SMSAgent.apply(SMSAgent.scala:18) ~[smsbridge-0.3.0.jar:na]
View compilation.txt
[info] Compiling main sources...
[warn] /home/blt/projects/smsproject/src/main/scala/com/fluentstream/smsbridge/Company.scala:15: non variable type-argument String in type pattern scala.collection.immutable.Set[String] is unchecked since it is eliminated by erasure
[warn] case Some(u:Set[String]) =>
[warn] ^
[warn] one warning found
View akka.conf
akka {
version = "1.1-M1" # Akka version, checked at startup.
enabled-modules = ["camel"]
time-unit = "seconds" # Time unit for all timeout properties throughout the config
event-handlers = ["akka.event.slf4j.Slf4jEventHandler"]
event-handler-level = "DEBUG"
View jid.scala
import scala.util.matching.Regex
object JID {
private val jidRe = new Regex("""(?i)(\w+)@([^/]+)/?+(.+)?+""")
def apply(parts: Seq[String]): String =
parts.size match {
case 2 => """%s@%s""".format(parts:_*)
case 3 => """%s@%s/%s""".format(parts:_*)
}
View gist:952084
Loading config [akka.conf] from the application classpath.
==================================================
t
t t t
t t tt t
tt t t tt t
t ttttttt t ttt t
t tt ttt t ttt t
t t ttt t ttt t t
tt t ttt ttt ttt t
View transaction.scala
case object transaction {
import java.sql.Connection
def apply[T](query: => T):Option[T] = {
val conn:Connection = play.db.DB.getConnection
val auto:Boolean = conn.getAutoCommit
try {
conn.setAutoCommit(false)
Some(query)
} catch {
View orth.scala
def orthoganol[S,T](l:Manifest[S], r:Manifest[T]):Boolean = {
try {
l.erasure.asInstanceOf[T]
true
} catch {
case e:java.lang.ClassCastException => false
}
}
View gist:1012787
$ sudo tcpdump -vvi lo port 3306
tcpdump: listening on lo, link-type EN10MB (Ethernet), capture size 65535 bytes
14:09:02.465336 IP (tos 0x0, ttl 64, id 56507, offset 0, flags [DF], proto TCP (6), length 60)
localhost.localdomain.39272 > localhost.localdomain.mysql: Flags [S], cksum 0xfe30 (incorrect -> 0x8877), seq 1037592087, win 32792, options [mss 16396,sackOK,TS val 36223660 ecr 0,nop,wscale 6], length 0
14:09:02.465370 IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto TCP (6), length 60)
localhost.localdomain.mysql > localhost.localdomain.39272: Flags [S.], cksum 0xfe30 (incorrect -> 0x2519), seq 1029531955, ack 1037592088, win 32768, options [mss 16396,sackOK,TS val 36223660 ecr 36223660,nop,wscale 6], length 0
14:09:02.465404 IP (tos 0x0, ttl 64, id 56508, offset 0, flags [DF], proto TCP (6), length 52)
localhost.localdomain.39272 > localhost.localdomain.mysql: Flags [.], cksum 0xfe28 (incorrect -> 0x0c3c), seq 1, ack 1, win 513, options [nop,nop,TS val 36223660 ecr 36223660], length