Skip to content

Instantly share code, notes, and snippets.

object InjuryTester {
implicit val dateRW = new BSONReader[BSONDateTime,Date] with BSONWriter[Date,BSONDateTime] {
def read(bson: BSONDateTime): Date = new Date(bson.value)
def write(date: Date): BSONDateTime = BSONDateTime(date.getTime)
}
implicit val pijHandler = Macros.handler[PlayerInjury]
implicit val ijHandler = Macros.handler[Injury2]
[
{
"game_id": 3862,
"gametime": "2013-12-02T13:00:00.000Z",
"datetime": "2013-12-02T13:25:21.000Z",
"seq_id": 10,
"details": {
"location": "Soldier Field",
"status": "IP",
"quarter": "1",
error {
case e => {
val logger = LoggerFactory.getLogger(getClass)
logger.info("an exception occurred: " + e.printStackTrace())
//logger.info("the request body is: " + request)
NotFound("An error occurred, please contact [email protected]")
}
}
{13-10-09 15:14}[2.0.0-p247]normandy:~/Projects/streaming sf% ruby atmosphere_test.rb
<!-- ---------------------------------------------------------------- http://github.com/Atmosphere ------------------------------------------------------------------------ -->
<!-- Welcome to the Atmosphere Framework. To work with all the browsers when suspending connection, Atmosphere must output some data to makes WebKit based browser working.-->
<!-- --------------------------------------------------------------------------------------------------------------------------------------------------------------------- -->
<!-- --------------------------------------------------------------------------------------------------------------------------------------------------------------------- -->
<!-- --------------------------------------------------------------------------------------------------------------------------------------------------------------------- -->
<!-- ---------------------------------------------------------
import sbt._
import Keys._
import org.scalatra.sbt._
import org.scalatra.sbt.PluginKeys._
import com.mojolly.scalate.ScalatePlugin._
import ScalateKeys._
object AtmosphereBuild extends Build {
val Organization = "com.example"
val Name = "Scalatra Atmosphere Example"
html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
<title>Error 500 No AtmosphereHandler found.</title>
</head>
<body><h2>HTTP ERROR 500</h2>
<p>Problem accessing /the-chat. Reason:
<pre> No AtmosphereHandler found.</pre></p><h3>Caused by:</h3><pre>org.atmosphere.cpr.AtmosphereMappingException: No AtmosphereHandler found.
at org.atmosphere.cpr.AsynchronousProcessor.action(AsynchronousProcessor.java:190)
at org.atmosphere.cpr.AsynchronousProcessor.suspended(AsynchronousProcessor.java:167)
name := "tsn-api-live"
version := "1.0-SNAPSHOT"
libraryDependencies ++= Seq(
jdbc,
anorm,
cache,
"net.debasishg" % "redisclient_2.10" % "2.11"
)
package com.sportsnetwork.stream.models
import akka.actor.{ ActorSystem, Props }
import play.api.libs.iteratee._
import play.api.libs.json._
import play.api.Logger
import com.redis._
class ScoresStream extends Actor with akka.actor.ActorLogging {
//log.info("We've got yet another pigdog on our hands")
var members = Set.empty[String]
val (scoresEnumerator, scoresChannel) = Concurrent.broadcast[JsValue]
case class Message(kind: String, user: String, message: String)
implicit val messageReads = Json.reads[Message]
implicit val messageWrites = Json.writes[Message]
{
"gamedate": "12/02/2013",
"updated_at": "2013-12-02 17:35:22 UTC",
"games": [
{
"game": {
"home_team_name": "Washington",
"game_id": 18413,
"visiting_team_name": "Orlando",
"home_team_id": 113,