[Lift] Re: Some Comet questions
Everything works fine now, Thank you for the quick fix! On Sep 1, 12:50 pm, David Pollak feeder.of.the.be...@gmail.com wrote: The problem was that JBoss was not returning the correct modified date for the JAR/WAR-based resource. I've worked around the issue:http://github.com/dpp/liftweb/commit/ea1fda384deb095c6d2eb247f71cb51b... http://github.com/dpp/liftweb/commit/ea1fda384deb095c6d2eb247f71cb51b...The changes are checked in and once Hudson does its thing, you'll be fine. On Tue, Sep 1, 2009 at 8:47 AM, Michel Klijn michel.kl...@gmail.com wrote: On Aug 31, 10:45 pm, David Pollak feeder.of.the.be...@gmail.com wrote: On Mon, Aug 31, 2009 at 3:06 PM, Michel Klijn michel.kl...@gmail.com wrote: On Aug 31, 5:39 pm, David Pollak feeder.of.the.be...@gmail.com wrote: On Mon, Aug 31, 2009 at 2:32 PM, Michel Klijn michel.kl...@gmail.com wrote: ... Since i had JBOSS 4.2.3AG already on my system i tried this, but without succes... What's the failure? Does the Lift examples/example app run okay on JBoss? What happens in Firebug? The table won't update because JQuery is not loaded My javascript console tells me: jQuery is not defined http://localhost:8080/MyGame-1.0-SNAPSHOT/ajax_request/ liftAjax.js Line 157 and FireBugs net log: a 304 Not Modified for get jquery.js all works fine in Jetty This is very, very strange. A 304 means that the file hasn't changed and the browser should use the cached version. I'm downloading JBoss and will run some stuff tomorrow. In the mean time, try clearing the browser cache and see what happens. Ok. I tried to clear the cache, but didn't work. I found out some other thing though. I'm using this firefox add-in called web developer. It allows you to turn off cashing here are the results: without cache: GET JQuery.js - 304 GET LiftAjax.js - 200 GET cometAjAX.js - 200 with chache: GET JQuery.js - 304 GET LiftAjax.js - 304 GET cometAjAX.js - 304 I also tried debugging Javascript in safari 4 and i get the same Java script exception: ReferenceError: Can't find variable: jQuery .Though I can't find the status codes for the requests in safari's debugger. I can look at the contents of the responses of the GETs. When I look at the resources right after loading the page, Safari is unable to load all three of the JS files. Then I pick one of the js files and specially reload it (right mouse then reload) after the reload JQuery.js is the only GET with an empty response (first time all three had empty responses). ... 3. The three case classes: NewGame(g: Game),RemoveGame(g: Game),UpdateGame(g: Game) all extend GameMsg. In the partial function highPriority i have tried to match: NewGame(g), RemoveGame(g) and UpdateGame(g) that doesn't seem to work, but why? Because you're not matching UpdateGame(g), you're matching (g: Game, NewGame()) = ... Yes, because that seemed to work ;). What I meant is: that i was trying it this way before: case NewGame(g) = partialUpdate etc.. case RemoveGame(g) = partialUpdate etc.. case UpdateGame(g) = partialUpdate etc.. In the Game Object the createUpdate method returns one of these three GameMsg types What is the declaration of your case classes? How are you sending the message to the Actor? Message is send trough the ListenerManger. class GameMsg case class NewGame(g:Game) extends GameMsg case class NewGame(g:Game) extends GameMsg case class NewGame(g:Game) extends GameMsg object Game extends Actor with ListenerManager{ private var games: List[Game] = Nil def getGames(): List[Game] = games private var newMsgs: GameMsg protected def createUpdate: GameMsg = newMsgs ... case class Create(s:String,ss:String,i:Int) case class Delete(g:Game) case class Update(g:Game) override def highPriority = { case Create(a,b,c) = createGame(a,b,c) updateListeners() case Delete(g) = removeGame(g) updateListeners() case Update(g) = updateGame(g) updateListeners() } } Cheers, Michel class GameList extends CometActor with CometListenee{ override def defaultPrefix = Full(entry) override def parentTag = tbody/tbody override def devMode = false override def hasOuter = false protected def registerWith = Game override def render = new RenderOut( (Game.getGames.flatMap (bindGameRow(_))).toSeq ) override def highPriority: PartialFunction[Any,Unit] = { case (g:Game, NewGame()) = partialUpdate(PrependHtml (this.uniqueId,bindGameRow(g)))
[Lift] Re: Some Comet questions
On Aug 31, 10:45 pm, David Pollak feeder.of.the.be...@gmail.com wrote: On Mon, Aug 31, 2009 at 3:06 PM, Michel Klijn michel.kl...@gmail.comwrote: On Aug 31, 5:39 pm, David Pollak feeder.of.the.be...@gmail.com wrote: On Mon, Aug 31, 2009 at 2:32 PM, Michel Klijn michel.kl...@gmail.com wrote: ... Since i had JBOSS 4.2.3AG already on my system i tried this, but without succes... What's the failure? Does the Lift examples/example app run okay on JBoss? What happens in Firebug? The table won't update because JQuery is not loaded My javascript console tells me: jQuery is not defined http://localhost:8080/MyGame-1.0-SNAPSHOT/ajax_request/ liftAjax.js Line 157 and FireBugs net log: a 304 Not Modified for get jquery.js all works fine in Jetty This is very, very strange. A 304 means that the file hasn't changed and the browser should use the cached version. I'm downloading JBoss and will run some stuff tomorrow. In the mean time, try clearing the browser cache and see what happens. Ok. I tried to clear the cache, but didn't work. I found out some other thing though. I'm using this firefox add-in called web developer. It allows you to turn off cashing here are the results: without cache: GET JQuery.js - 304 GET LiftAjax.js - 200 GET cometAjAX.js - 200 with chache: GET JQuery.js - 304 GET LiftAjax.js - 304 GET cometAjAX.js - 304 I also tried debugging Javascript in safari 4 and i get the same Java script exception: ReferenceError: Can't find variable: jQuery .Though I can't find the status codes for the requests in safari's debugger. I can look at the contents of the responses of the GETs. When I look at the resources right after loading the page, Safari is unable to load all three of the JS files. Then I pick one of the js files and specially reload it (right mouse then reload) after the reload JQuery.js is the only GET with an empty response (first time all three had empty responses). ... 3. The three case classes: NewGame(g: Game),RemoveGame(g: Game),UpdateGame(g: Game) all extend GameMsg. In the partial function highPriority i have tried to match: NewGame(g), RemoveGame(g) and UpdateGame(g) that doesn't seem to work, but why? Because you're not matching UpdateGame(g), you're matching (g: Game, NewGame()) = ... Yes, because that seemed to work ;). What I meant is: that i was trying it this way before: case NewGame(g) = partialUpdate etc.. case RemoveGame(g) = partialUpdate etc.. case UpdateGame(g) = partialUpdate etc.. In the Game Object the createUpdate method returns one of these three GameMsg types What is the declaration of your case classes? How are you sending the message to the Actor? Message is send trough the ListenerManger. class GameMsg case class NewGame(g:Game) extends GameMsg case class NewGame(g:Game) extends GameMsg case class NewGame(g:Game) extends GameMsg object Game extends Actor with ListenerManager{ private var games: List[Game] = Nil def getGames(): List[Game] = games private var newMsgs: GameMsg protected def createUpdate: GameMsg = newMsgs ... case class Create(s:String,ss:String,i:Int) case class Delete(g:Game) case class Update(g:Game) override def highPriority = { case Create(a,b,c) = createGame(a,b,c) updateListeners() case Delete(g) = removeGame(g) updateListeners() case Update(g) = updateGame(g) updateListeners() } } Cheers, Michel class GameList extends CometActor with CometListenee{ override def defaultPrefix = Full(entry) override def parentTag = tbody/tbody override def devMode = false override def hasOuter = false protected def registerWith = Game override def render = new RenderOut( (Game.getGames.flatMap (bindGameRow(_))).toSeq ) override def highPriority: PartialFunction[Any,Unit] = { case (g:Game, NewGame()) = partialUpdate(PrependHtml (this.uniqueId,bindGameRow(g))) case (g:Game, RemoveGame()) = partialUpdate(RemoveById (+g.gid)) case (g:Game, UpdateGame()) = partialUpdate(ReplaceWithById (+g.gid, bindGameRow(g))) } private def bindGameRow(g:Game) = tr id={+g.gid} {bind(id - g.gid, name - SHtml.link(/game, () = CurrentGame(Full(g)), Text(g.gname)), players - g.playerStatus, owner - g.creator, timestamp - b{g.createdOn.toString}/b, joinlink - SHtml.ajaxButton(Delete game!, {() = Game ! Game.DeleteGame(g);Noop}))
[Lift] Re: Some Comet questions
The problem was that JBoss was not returning the correct modified date for the JAR/WAR-based resource. I've worked around the issue: http://github.com/dpp/liftweb/commit/ea1fda384deb095c6d2eb247f71cb51ba473499c http://github.com/dpp/liftweb/commit/ea1fda384deb095c6d2eb247f71cb51ba473499cThe changes are checked in and once Hudson does its thing, you'll be fine. On Tue, Sep 1, 2009 at 8:47 AM, Michel Klijn michel.kl...@gmail.com wrote: On Aug 31, 10:45 pm, David Pollak feeder.of.the.be...@gmail.com wrote: On Mon, Aug 31, 2009 at 3:06 PM, Michel Klijn michel.kl...@gmail.com wrote: On Aug 31, 5:39 pm, David Pollak feeder.of.the.be...@gmail.com wrote: On Mon, Aug 31, 2009 at 2:32 PM, Michel Klijn michel.kl...@gmail.com wrote: ... Since i had JBOSS 4.2.3AG already on my system i tried this, but without succes... What's the failure? Does the Lift examples/example app run okay on JBoss? What happens in Firebug? The table won't update because JQuery is not loaded My javascript console tells me: jQuery is not defined http://localhost:8080/MyGame-1.0-SNAPSHOT/ajax_request/ liftAjax.js Line 157 and FireBugs net log: a 304 Not Modified for get jquery.js all works fine in Jetty This is very, very strange. A 304 means that the file hasn't changed and the browser should use the cached version. I'm downloading JBoss and will run some stuff tomorrow. In the mean time, try clearing the browser cache and see what happens. Ok. I tried to clear the cache, but didn't work. I found out some other thing though. I'm using this firefox add-in called web developer. It allows you to turn off cashing here are the results: without cache: GET JQuery.js - 304 GET LiftAjax.js - 200 GET cometAjAX.js - 200 with chache: GET JQuery.js - 304 GET LiftAjax.js - 304 GET cometAjAX.js - 304 I also tried debugging Javascript in safari 4 and i get the same Java script exception: ReferenceError: Can't find variable: jQuery .Though I can't find the status codes for the requests in safari's debugger. I can look at the contents of the responses of the GETs. When I look at the resources right after loading the page, Safari is unable to load all three of the JS files. Then I pick one of the js files and specially reload it (right mouse then reload) after the reload JQuery.js is the only GET with an empty response (first time all three had empty responses). ... 3. The three case classes: NewGame(g: Game),RemoveGame(g: Game),UpdateGame(g: Game) all extend GameMsg. In the partial function highPriority i have tried to match: NewGame(g), RemoveGame(g) and UpdateGame(g) that doesn't seem to work, but why? Because you're not matching UpdateGame(g), you're matching (g: Game, NewGame()) = ... Yes, because that seemed to work ;). What I meant is: that i was trying it this way before: case NewGame(g) = partialUpdate etc.. case RemoveGame(g) = partialUpdate etc.. case UpdateGame(g) = partialUpdate etc.. In the Game Object the createUpdate method returns one of these three GameMsg types What is the declaration of your case classes? How are you sending the message to the Actor? Message is send trough the ListenerManger. class GameMsg case class NewGame(g:Game) extends GameMsg case class NewGame(g:Game) extends GameMsg case class NewGame(g:Game) extends GameMsg object Game extends Actor with ListenerManager{ private var games: List[Game] = Nil def getGames(): List[Game] = games private var newMsgs: GameMsg protected def createUpdate: GameMsg = newMsgs ... case class Create(s:String,ss:String,i:Int) case class Delete(g:Game) case class Update(g:Game) override def highPriority = { case Create(a,b,c) = createGame(a,b,c) updateListeners() case Delete(g) = removeGame(g) updateListeners() case Update(g) = updateGame(g) updateListeners() } } Cheers, Michel class GameList extends CometActor with CometListenee{ override def defaultPrefix = Full(entry) override def parentTag = tbody/tbody override def devMode = false override def hasOuter = false protected def registerWith = Game override def render = new RenderOut( (Game.getGames.flatMap (bindGameRow(_))).toSeq ) override def highPriority: PartialFunction[Any,Unit] = { case (g:Game, NewGame()) = partialUpdate(PrependHtml (this.uniqueId,bindGameRow(g))) case (g:Game, RemoveGame()) = partialUpdate(RemoveById (+g.gid)) case (g:Game, UpdateGame()) = partialUpdate(ReplaceWithById (+g.gid,
[Lift] Re: Some Comet questions
On Mon, Aug 31, 2009 at 2:32 PM, Michel Klijn michel.kl...@gmail.comwrote: Hello, I have created a simple test application to play around with comet. it's a live CRUD table the comet updates its clients with every change to the records( There is no database, just a List[Game] in the Game object). I have three questions about this: 1.I know that Comets won't work with GAE-J, but which application servers can i use? Anything except GAE. Or is there one that's recommended? Jetty is my favorite. Glassfish will do particularly well once the Servlet 3.0 spec is baked into a production version. Since i had JBOSS 4.2.3AG already on my system i tried this, but without succes... What's the failure? Does the Lift examples/example app run okay on JBoss? What happens in Firebug? 2.Is the way i'am using JQuery right way? or maybe, is there a better way to this? Looks reasonable to me. 3. The three case classes: NewGame(g: Game),RemoveGame(g: Game),UpdateGame(g: Game) all extend GameMsg. In the partial function highPriority i have tried to match: NewGame(g), RemoveGame(g) and UpdateGame(g) that doesn't seem to work, but why? Because you're not matching UpdateGame(g), you're matching (g: Game, NewGame()) = ... Cheers, Michel class GameList extends CometActor with CometListenee{ override def defaultPrefix = Full(entry) override def parentTag = tbody/tbody override def devMode = false override def hasOuter = false protected def registerWith = Game override def render = new RenderOut( (Game.getGames.flatMap (bindGameRow(_))).toSeq ) override def highPriority: PartialFunction[Any,Unit] = { case (g:Game, NewGame()) = partialUpdate(PrependHtml (this.uniqueId,bindGameRow(g))) case (g:Game, RemoveGame()) = partialUpdate(RemoveById (+g.gid)) case (g:Game, UpdateGame()) = partialUpdate(ReplaceWithById (+g.gid, bindGameRow(g))) } private def bindGameRow(g:Game) = tr id={+g.gid} {bind(id - g.gid, name - SHtml.link(/game, () = CurrentGame(Full(g)), Text(g.gname)), players - g.playerStatus, owner - g.creator, timestamp - b{g.createdOn.toString}/b, joinlink - SHtml.ajaxButton(Delete game!, {() = Game ! Game.DeleteGame(g);Noop})) } /tr } //some javascript stuff object RemoveById { def apply(uid: String) = new RemoveById(uid) } class RemoveById(val uid: String) extends JsCmd { def toJsCmd = try{jQuery(+ (#+uid).encJs + ).remove();} catch (e) {} } object ReplaceWithById { def apply(uid: String, nsq: NodeSeq) = new ReplaceWithById(uid, nsq.toString) } class ReplaceWithById(val uid: String, val content:String) extends JsCmd { def toJsCmd = try{jQuery(+(#+uid).encJs+).replaceWith($('+ content.encJs +'));} catch (e) {} } -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp Git some: http://github.com/dpp --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Some Comet questions
On Aug 31, 5:39 pm, David Pollak feeder.of.the.be...@gmail.com wrote: On Mon, Aug 31, 2009 at 2:32 PM, Michel Klijn michel.kl...@gmail.comwrote: ... Since i had JBOSS 4.2.3AG already on my system i tried this, but without succes... What's the failure? Does the Lift examples/example app run okay on JBoss? What happens in Firebug? The table won't update because JQuery is not loaded My javascript console tells me: jQuery is not defined http://localhost:8080/MyGame-1.0-SNAPSHOT/ajax_request/ liftAjax.js Line 157 and FireBugs net log: a 304 Not Modified for get jquery.js all works fine in Jetty ... 3. The three case classes: NewGame(g: Game),RemoveGame(g: Game),UpdateGame(g: Game) all extend GameMsg. In the partial function highPriority i have tried to match: NewGame(g), RemoveGame(g) and UpdateGame(g) that doesn't seem to work, but why? Because you're not matching UpdateGame(g), you're matching (g: Game, NewGame()) = ... Yes, because that seemed to work ;). What I meant is: that i was trying it this way before: case NewGame(g) = partialUpdate etc.. case RemoveGame(g) = partialUpdate etc.. case UpdateGame(g) = partialUpdate etc.. In the Game Object the createUpdate method returns one of these three GameMsg types Cheers, Michel class GameList extends CometActor with CometListenee{ override def defaultPrefix = Full(entry) override def parentTag = tbody/tbody override def devMode = false override def hasOuter = false protected def registerWith = Game override def render = new RenderOut( (Game.getGames.flatMap (bindGameRow(_))).toSeq ) override def highPriority: PartialFunction[Any,Unit] = { case (g:Game, NewGame()) = partialUpdate(PrependHtml (this.uniqueId,bindGameRow(g))) case (g:Game, RemoveGame()) = partialUpdate(RemoveById (+g.gid)) case (g:Game, UpdateGame()) = partialUpdate(ReplaceWithById (+g.gid, bindGameRow(g))) } private def bindGameRow(g:Game) = tr id={+g.gid} {bind(id - g.gid, name - SHtml.link(/game, () = CurrentGame(Full(g)), Text(g.gname)), players - g.playerStatus, owner - g.creator, timestamp - b{g.createdOn.toString}/b, joinlink - SHtml.ajaxButton(Delete game!, {() = Game ! Game.DeleteGame(g);Noop})) } /tr } //some javascript stuff object RemoveById { def apply(uid: String) = new RemoveById(uid) } class RemoveById(val uid: String) extends JsCmd { def toJsCmd = try{jQuery(+ (#+uid).encJs + ).remove();} catch (e) {} } object ReplaceWithById { def apply(uid: String, nsq: NodeSeq) = new ReplaceWithById(uid, nsq.toString) } class ReplaceWithById(val uid: String, val content:String) extends JsCmd { def toJsCmd = try{jQuery(+(#+uid).encJs+).replaceWith($('+ content.encJs +'));} catch (e) {} } -- Lift, the simply functional web frameworkhttp://liftweb.net Beginning Scalahttp://www.apress.com/book/view/1430219890 Follow me:http://twitter.com/dpp Git some:http://github.com/dpp --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Some Comet questions
On Mon, Aug 31, 2009 at 3:06 PM, Michel Klijn michel.kl...@gmail.comwrote: On Aug 31, 5:39 pm, David Pollak feeder.of.the.be...@gmail.com wrote: On Mon, Aug 31, 2009 at 2:32 PM, Michel Klijn michel.kl...@gmail.com wrote: ... Since i had JBOSS 4.2.3AG already on my system i tried this, but without succes... What's the failure? Does the Lift examples/example app run okay on JBoss? What happens in Firebug? The table won't update because JQuery is not loaded My javascript console tells me: jQuery is not defined http://localhost:8080/MyGame-1.0-SNAPSHOT/ajax_request/ liftAjax.js Line 157 and FireBugs net log: a 304 Not Modified for get jquery.js all works fine in Jetty This is very, very strange. A 304 means that the file hasn't changed and the browser should use the cached version. I'm downloading JBoss and will run some stuff tomorrow. In the mean time, try clearing the browser cache and see what happens. ... 3. The three case classes: NewGame(g: Game),RemoveGame(g: Game),UpdateGame(g: Game) all extend GameMsg. In the partial function highPriority i have tried to match: NewGame(g), RemoveGame(g) and UpdateGame(g) that doesn't seem to work, but why? Because you're not matching UpdateGame(g), you're matching (g: Game, NewGame()) = ... Yes, because that seemed to work ;). What I meant is: that i was trying it this way before: case NewGame(g) = partialUpdate etc.. case RemoveGame(g) = partialUpdate etc.. case UpdateGame(g) = partialUpdate etc.. In the Game Object the createUpdate method returns one of these three GameMsg types What is the declaration of your case classes? How are you sending the message to the Actor? Cheers, Michel class GameList extends CometActor with CometListenee{ override def defaultPrefix = Full(entry) override def parentTag = tbody/tbody override def devMode = false override def hasOuter = false protected def registerWith = Game override def render = new RenderOut( (Game.getGames.flatMap (bindGameRow(_))).toSeq ) override def highPriority: PartialFunction[Any,Unit] = { case (g:Game, NewGame()) = partialUpdate(PrependHtml (this.uniqueId,bindGameRow(g))) case (g:Game, RemoveGame()) = partialUpdate(RemoveById (+g.gid)) case (g:Game, UpdateGame()) = partialUpdate(ReplaceWithById (+g.gid, bindGameRow(g))) } private def bindGameRow(g:Game) = tr id={+g.gid} {bind(id - g.gid, name - SHtml.link(/game, () = CurrentGame(Full(g)), Text(g.gname)), players - g.playerStatus, owner - g.creator, timestamp - b{g.createdOn.toString}/b, joinlink - SHtml.ajaxButton(Delete game!, {() = Game ! Game.DeleteGame(g);Noop})) } /tr } //some javascript stuff object RemoveById { def apply(uid: String) = new RemoveById(uid) } class RemoveById(val uid: String) extends JsCmd { def toJsCmd = try{jQuery(+ (#+uid).encJs + ).remove();} catch (e) {} } object ReplaceWithById { def apply(uid: String, nsq: NodeSeq) = new ReplaceWithById(uid, nsq.toString) } class ReplaceWithById(val uid: String, val content:String) extends JsCmd { def toJsCmd = try{jQuery(+(#+uid).encJs+).replaceWith($('+ content.encJs +'));} catch (e) {} } -- Lift, the simply functional web frameworkhttp://liftweb.net Beginning Scalahttp://www.apress.com/book/view/1430219890 Follow me:http://twitter.com/dpp Git some:http://github.com/dpp -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp Git some: http://github.com/dpp --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---