[Lift] Re: CometActor timeout problem

2009-10-04 Thread jack

Atsuhiko,

With the code exactly as you wrote it, how would you modify it to do
this?

Whenver the Comet Page gets loaded, it resets itself.

On Oct 3, 12:47 am, Atsuhiko Yamanaka atsuhiko.yaman...@gmail.com
wrote:
 Hi,

 On Sat, Oct 3, 2009 at 1:05 PM, jack jack.wid...@gmail.com wrote:

  Atsuhiko,

  The way I have modified the code, each thread is returning its Package
  object at different times. But its seems the screen updates only when
  they all have completed. Could you tell me what piece of the code
  makes the screen update?

 Can you show your code?
--~--~-~--~~~---~--~~
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: CometActor timeout problem

2009-10-04 Thread Atsuhiko Yamanaka
Hi,

On Mon, Oct 5, 2009 at 8:16 AM, jack jack.wid...@gmail.com wrote:
 With the code exactly as you wrote it, how would you modify it to do
 this?

 Whenver the Comet Page gets loaded, it resets itself.

How about wrapping your CometActor page with the snippet?

Please refer to attached diff file.


Sincerely,
--
Atsuhiko Yamanaka
JCraft,Inc.
1-14-20 HONCHO AOBA-KU,
SENDAI, MIYAGI 980-0014 Japan.
Tel +81-22-723-2150
+1-415-578-3454
Skype callto://jcraft/

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---

diff -Naur src/main/scala/com/authoritude/snippet/JoopCometWrapper.scala 
src.new/main/scala/com/authoritude/snippet/JoopCometWrapper.scala
--- src/main/scala/com/authoritude/snippet/JoopCometWrapper.scala   
1970-01-01 00:00:00.0 +
+++ src.new/main/scala/com/authoritude/snippet/JoopCometWrapper.scala   
2009-10-05 04:06:00.0 +
@@ -0,0 +1,12 @@
+package com.authoritude.snippet
+
+import _root_.scala.xml.NodeSeq
+
+class JoopCometWrapper {
+  def render(node:NodeSeq) = {
+TSGetterLauncher.tick
+node
+  }
+}
+  
+  
diff -Naur src/main/webapp/test.html src.new/main/webapp/test.html
--- src/main/webapp/test.html   2009-09-29 21:09:18.0 +
+++ src.new/main/webapp/test.html   2009-10-05 04:01:42.0 +
@@ -1,7 +1,9 @@
 
 lift:surround with=default at=content
- lift:comet type=JoopComet name=Other
-auth:joop/auth:joop
-  /lift:comet
+ lift:JoopCometWrapper
+   lift:comet type=JoopComet name=Other
+  auth:joop/auth:joop
+   /lift:comet
+ /lift:JoopCometWrapper
 /lift:surround
 


[Lift] Re: CometActor timeout problem

2009-10-04 Thread jack

Excellent. Thanks.

On Oct 5, 12:14 am, Atsuhiko Yamanaka atsuhiko.yaman...@gmail.com
wrote:
 Hi,

 On Mon, Oct 5, 2009 at 8:16 AM, jack jack.wid...@gmail.com wrote:
  With the code exactly as you wrote it, how would you modify it to do
  this?

  Whenver the Comet Page gets loaded, it resets itself.

 How about wrapping your CometActor page with the snippet?

 Please refer to attached diff file.

 Sincerely,
 --
 Atsuhiko Yamanaka
 JCraft,Inc.
 1-14-20 HONCHO AOBA-KU,
 SENDAI, MIYAGI 980-0014 Japan.
 Tel +81-22-723-2150
     +1-415-578-3454
 Skype callto://jcraft/

  diff.txt
 1KViewDownload
--~--~-~--~~~---~--~~
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: CometActor timeout problem

2009-10-03 Thread jack

Yes, I will send you this. In the mean time, could you at least tell
me how to reset the code. I.E. I would like that everytime you refresh
the page, it starts again.

On Oct 3, 12:47 am, Atsuhiko Yamanaka atsuhiko.yaman...@gmail.com
wrote:
 Hi,

 On Sat, Oct 3, 2009 at 1:05 PM, jack jack.wid...@gmail.com wrote:

  Atsuhiko,

  The way I have modified the code, each thread is returning its Package
  object at different times. But its seems the screen updates only when
  they all have completed. Could you tell me what piece of the code
  makes the screen update?

 Can you show your code?
--~--~-~--~~~---~--~~
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: CometActor timeout problem

2009-10-02 Thread jack

Atsuhiko,

The way I have modified the code, each thread is returning its Package
object at different times. But its seems the screen updates only when
they all have completed. Could you tell me what piece of the code
makes the screen update?
Thanks.

Jack

On Oct 1, 11:19 am, David Pollak feeder.of.the.be...@gmail.com
wrote:
 Thanks!

 On Thu, Oct 1, 2009 at 1:11 AM, Atsuhiko Yamanaka 





 atsuhiko.yaman...@gmail.com wrote:
  Hi,

  On Thu, Oct 1, 2009 at 1:11 PM, Jack Widman jack.wid...@gmail.com wrote:
   David,
   I have attached a (non) working example. It compiles and runs and does a
   part of what I want it to do but not completely. It first displays a
  couple
   of links and the link body for both links is just 0. It then spawns a
  couple
   of threads each of which generates a random number and then   puts two
  Page
   objects on a PageQueue. The comet page is supposed to reRender the screen
   whenever a new page object is added to the Queue. Before it does this it
   calls a method called insertRandomNumber which changes the zero to some
   random value.
   There is not much code and i think its pretty self-explanatory. The html
   page is test.html.
   I really do appreciate your help and understand if you can't go through
  the
   whole thing.

  Frankly to say, I could not understand the internal logic, and it
  seems it has be broken,
  but attached modified src.zip will work as the demonstration of
  CometActor at least.
   * JoopComet implements CometListenee
   * TSGetterLauncer has been rewritten, and will start TSGetters in
  every 3 seconds.
     The previous version has really short life.
   * TSCatcher implements ListenerManager.
   * url links on the web page will be updated in every 3 seconds.

  Sincerely,
  --
  Atsuhiko Yamanaka
  JCraft,Inc.
  1-14-20 HONCHO AOBA-KU,
  SENDAI, MIYAGI 980-0014 Japan.
  Tel +81-22-723-2150
     +1-415-578-3454
  Skype callto://jcraft/

 --
 Lift, the simply functional web frameworkhttp://liftweb.net
 Beginning Scalahttp://www.apress.com/book/view/1430219890
 Follow me:http://twitter.com/dpp
 Surf the harmonics
--~--~-~--~~~---~--~~
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: CometActor timeout problem

2009-10-02 Thread Atsuhiko Yamanaka

Hi,

On Sat, Oct 3, 2009 at 1:05 PM, jack jack.wid...@gmail.com wrote:

 Atsuhiko,

 The way I have modified the code, each thread is returning its Package
 object at different times. But its seems the screen updates only when
 they all have completed. Could you tell me what piece of the code
 makes the screen update?

Can you show your code?

--~--~-~--~~~---~--~~
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: CometActor timeout problem

2009-10-01 Thread Jack Widman
Thanks Atsuhiko very much. I really appreciate your effort and this helps
alot.
Jack

On Thu, Oct 1, 2009 at 4:11 AM, Atsuhiko Yamanaka 
atsuhiko.yaman...@gmail.com wrote:

 Hi,

 On Thu, Oct 1, 2009 at 1:11 PM, Jack Widman jack.wid...@gmail.com wrote:
  David,
  I have attached a (non) working example. It compiles and runs and does a
  part of what I want it to do but not completely. It first displays a
 couple
  of links and the link body for both links is just 0. It then spawns a
 couple
  of threads each of which generates a random number and then   puts two
 Page
  objects on a PageQueue. The comet page is supposed to reRender the screen
  whenever a new page object is added to the Queue. Before it does this it
  calls a method called insertRandomNumber which changes the zero to some
  random value.
  There is not much code and i think its pretty self-explanatory. The html
  page is test.html.
  I really do appreciate your help and understand if you can't go through
 the
  whole thing.

 Frankly to say, I could not understand the internal logic, and it
 seems it has be broken,
 but attached modified src.zip will work as the demonstration of
 CometActor at least.
  * JoopComet implements CometListenee
  * TSGetterLauncer has been rewritten, and will start TSGetters in
 every 3 seconds.
The previous version has really short life.
  * TSCatcher implements ListenerManager.
  * url links on the web page will be updated in every 3 seconds.


 Sincerely,
 --
 Atsuhiko Yamanaka
 JCraft,Inc.
 1-14-20 HONCHO AOBA-KU,
 SENDAI, MIYAGI 980-0014 Japan.
 Tel +81-22-723-2150
+1-415-578-3454
 Skype callto://jcraft/

 


--~--~-~--~~~---~--~~
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: CometActor timeout problem

2009-10-01 Thread Jack Widman
Atsuhiko,
How would I make one small change? I would like each link to refresh only
once and I would like that to happen as soon as the TSCatcher objects catch
a package. Thanks in advance.

Jack

On Thu, Oct 1, 2009 at 4:11 AM, Atsuhiko Yamanaka 
atsuhiko.yaman...@gmail.com wrote:

 Hi,

 On Thu, Oct 1, 2009 at 1:11 PM, Jack Widman jack.wid...@gmail.com wrote:
  David,
  I have attached a (non) working example. It compiles and runs and does a
  part of what I want it to do but not completely. It first displays a
 couple
  of links and the link body for both links is just 0. It then spawns a
 couple
  of threads each of which generates a random number and then   puts two
 Page
  objects on a PageQueue. The comet page is supposed to reRender the screen
  whenever a new page object is added to the Queue. Before it does this it
  calls a method called insertRandomNumber which changes the zero to some
  random value.
  There is not much code and i think its pretty self-explanatory. The html
  page is test.html.
  I really do appreciate your help and understand if you can't go through
 the
  whole thing.

 Frankly to say, I could not understand the internal logic, and it
 seems it has be broken,
 but attached modified src.zip will work as the demonstration of
 CometActor at least.
  * JoopComet implements CometListenee
  * TSGetterLauncer has been rewritten, and will start TSGetters in
 every 3 seconds.
The previous version has really short life.
  * TSCatcher implements ListenerManager.
  * url links on the web page will be updated in every 3 seconds.


 Sincerely,
 --
 Atsuhiko Yamanaka
 JCraft,Inc.
 1-14-20 HONCHO AOBA-KU,
 SENDAI, MIYAGI 980-0014 Japan.
 Tel +81-22-723-2150
+1-415-578-3454
 Skype callto://jcraft/

 


--~--~-~--~~~---~--~~
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: CometActor timeout problem

2009-10-01 Thread Jack Widman
Thanks so much Atsuhiko. You are very kind.

On Thu, Oct 1, 2009 at 11:01 AM, Atsuhiko Yamanaka 
atsuhiko.yaman...@gmail.com wrote:

 Hi,

 On Thu, Oct 1, 2009 at 9:42 PM, Jack Widman jack.wid...@gmail.com wrote:
  Atsuhiko,
  How would I make one small change? I would like each link to refresh only
  once and I would like that to happen as soon as the TSCatcher objects
 catch
  a package. Thanks in advance.

 How about the attached src.zip?
 It will refresh each links only once.
 A package will be sent from JoopComet#localSetup and
 that method will be invoked only once during the life of JoopComet.
 This means that even if you leave test.html page and re-vist there,
 that method will not be invoked again.


 Sincerely,
 --
 Atsuhiko Yamanaka
 JCraft,Inc.
 1-14-20 HONCHO AOBA-KU,
 SENDAI, MIYAGI 980-0014 Japan.
 Tel +81-22-723-2150
+1-415-578-3454
 Skype callto://jcraft

 


--~--~-~--~~~---~--~~
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: CometActor timeout problem

2009-10-01 Thread David Pollak
Thanks!

On Thu, Oct 1, 2009 at 1:11 AM, Atsuhiko Yamanaka 
atsuhiko.yaman...@gmail.com wrote:

 Hi,

 On Thu, Oct 1, 2009 at 1:11 PM, Jack Widman jack.wid...@gmail.com wrote:
  David,
  I have attached a (non) working example. It compiles and runs and does a
  part of what I want it to do but not completely. It first displays a
 couple
  of links and the link body for both links is just 0. It then spawns a
 couple
  of threads each of which generates a random number and then   puts two
 Page
  objects on a PageQueue. The comet page is supposed to reRender the screen
  whenever a new page object is added to the Queue. Before it does this it
  calls a method called insertRandomNumber which changes the zero to some
  random value.
  There is not much code and i think its pretty self-explanatory. The html
  page is test.html.
  I really do appreciate your help and understand if you can't go through
 the
  whole thing.

 Frankly to say, I could not understand the internal logic, and it
 seems it has be broken,
 but attached modified src.zip will work as the demonstration of
 CometActor at least.
  * JoopComet implements CometListenee
  * TSGetterLauncer has been rewritten, and will start TSGetters in
 every 3 seconds.
The previous version has really short life.
  * TSCatcher implements ListenerManager.
  * url links on the web page will be updated in every 3 seconds.


 Sincerely,
 --
 Atsuhiko Yamanaka
 JCraft,Inc.
 1-14-20 HONCHO AOBA-KU,
 SENDAI, MIYAGI 980-0014 Japan.
 Tel +81-22-723-2150
+1-415-578-3454
 Skype callto://jcraft/

 



-- 
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Surf the harmonics

--~--~-~--~~~---~--~~
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: CometActor timeout problem

2009-09-29 Thread David Pollak
On Tue, Sep 29, 2009 at 8:00 AM, Jack Widman jack.wid...@gmail.com wrote:

 Thanks. I will adapt these changes and if its still not working I will post
 the code so you can run it. Also, I admit, I have a ways to go in the art of
 functional programming.


Rule #1 - don't use anything mutable unless you have a good reason.
 Document your reason in your code.  That'll make you think
Rule #2 - take advantage of the type system.  having built-in XML means not
devolving into Strings which are pretty much untyped





 On Tue, Sep 29, 2009 at 12:50 AM, David Pollak 
 feeder.of.the.be...@gmail.com wrote:



 On Mon, Sep 28, 2009 at 7:29 PM, Jack Widman jack.wid...@gmail.comwrote:

 Thanks David so much for this example. It is very cool to accomplish this
 in such a small amount of code! I am trying to adapt my code to work like
 this and it would help me if you could look at this (short) piece of code
 and tell me whats wrong with it. This code is supposed to display a list of
 pages and then actors in the background process each page. As each page is
 processed, the processed page is put into a Queue called PageQueue, and as
 each new page occurs in the Queue, the main page is rerendered. When I run
 it, the following happens:

1. The initial list of pages is successfully displayed
2. The actors in the background do their thing but the main page
never shows the modified pages
3. If I wait awhile and then refresh the main page, the modified
pages do appear.
4. Then I see the following exception:

 This page contains the following errors: error on line 14 at column 16:
 Namespace prefix auth on score is not defined
 Below is a rendering of the page up to the first error.


 Without a complete running (or failing) example, I can't really help out a
 lot... but I have put a few comments inline.


 Here is the code:

 package com.authoritude.comet

 import net.liftweb.http.SHtml
 import net.liftweb.http.S
 import _root_.net.liftweb.http.js.JE._
 import _root_.net.liftweb.http.js.JsCmds._
 import scala.xml._
 import net.liftweb.http.S
 import net.liftweb.http.CometActor
 import net.liftweb.http.SessionVar
 import net.liftweb.util._
 import _root_.scala.xml._
 import _root_.net.liftweb.util.Helpers._
 import scala.actors._
 import scala.collection.mutable.Queue


 class BlogComet extends CometActor {

   override def defaultPrefix = Full(auth)

   var pages:List[Page] = PageManager.getPages


 state should be private to the Actor, not public.



   def createDisplay(pages:List[Page]):NodeSeq = {

 var output:String=span id=\score\table
 for (page-pages) {
   output += trtda href={page.url}{page.render}/a/td/tr
 }
 XML.loadString(output+/table/span)
   }


 Why String + XML - XML?
 Why intermediate mutable state?

 How about
 span id=scoretable
 {
   for {page - pages} yield trtda
 href={page.url}{page.render/a/td/tr
 }
 /table/span





   def render = bind(score - listOfPages)

   //new Page objects are arriving in the PageQueue from other threads
   def listOfPages = {
 var page = PageQueue.getLatest
 //modifyPage takes page.getID, finds this page in
 // pages, and modifies it.
 pages = PageManager.modifyPage(page,pages)
 createDisplay(pages)
   }

   ActorPing.schedule(this, Tick, 1000L)

   override def lowPriority : PartialFunction[Any, Unit] = {

 case Tick = {
   partialUpdate(SetHtml(score, createDisplay(pages)))


 Why partialUpdate rather than just doing a reRender?  You're only saving a
 span/span which is not much of a savings.


ActorPing.schedule(this,Tick, 1000L)


 Why do this once a second?  Why not send a message from PageQueue when
 things change?


 }
   }
 }

 case object Tick


 I hope this is not to much to ask...



 On Mon, Sep 28, 2009 at 12:36 PM, David Pollak 
 feeder.of.the.be...@gmail.com wrote:

 Jack,
 Here's a working example.

 Here's the source for the CometActor:


 package com.liftcode.comet
 import net.liftweb._
 import http._
 import util._

 class Background extends CometActor {
   private val values = new Array[Box[Int]](100)

   // render the information
   def render =
   div
 ul
   {
 values.zipWithIndex.map{
   case (Full(v), idx) = liItem: {idx} is {v}/li
   case (_, idx) = liItem: {idx} iCalculating/i/li
 }
   }
 /ul
   /div

   // receive the update and re-render
   override def lowPriority = {
 case (idx: Int, value: Int) =
   values(idx) = Full(value)
   reRender(false)
   }

   // fork 100 thread
   override def localSetup() {
 super.localSetup()
 values.zipWithIndex.foreach {
   case (_, idx) =
 (new Thread(
 new Runnable {
   def run() {
 Thread.sleep(1 + Helpers.randomLong(1))
 Background.this ! (idx, Helpers.randomInt(1000))
   }
 }
 )).start()
 }
   }
 }


 Note that the render method cannot block.  You 

[Lift] Re: CometActor timeout problem

2009-09-28 Thread David Pollak
Jack,
Here's a working example.

Here's the source for the CometActor:


package com.liftcode.comet
import net.liftweb._
import http._
import util._

class Background extends CometActor {
  private val values = new Array[Box[Int]](100)

  // render the information
  def render =
  div
ul
  {
values.zipWithIndex.map{
  case (Full(v), idx) = liItem: {idx} is {v}/li
  case (_, idx) = liItem: {idx} iCalculating/i/li
}
  }
/ul
  /div

  // receive the update and re-render
  override def lowPriority = {
case (idx: Int, value: Int) =
  values(idx) = Full(value)
  reRender(false)
  }

  // fork 100 thread
  override def localSetup() {
super.localSetup()
values.zipWithIndex.foreach {
  case (_, idx) =
(new Thread(
new Runnable {
  def run() {
Thread.sleep(1 + Helpers.randomLong(1))
Background.this ! (idx, Helpers.randomInt(1000))
  }
}
)).start()
}
  }
}


Note that the render method cannot block.  You must always render the page
and put placeholders where you will be updating values.

Note also that this code re-renders the entire comet component on each
update.  This is network inefficient.  Please take a look a the Comet Chat
example for how to user partial update which is much more network efficient.

Thanks,

David


On Sun, Sep 27, 2009 at 8:09 PM, jack jack.wid...@gmail.com wrote:


 I am still having this problem so I will post a simple example. Say I
 want to display a list of the numbers 1 to 100. And suppose I have an
 object Foo and a method bar, which takes an integer and returns an
 integer. And bar takes about 10 seconds to return. So I want to
 display the numbers, run Foo.bar on each of them in the background,
 and then update the display via comet to replace each integer with bar
 of it. I got the Clock example to work and I think I understand what
 is going on there. Could somebody show me how to do this example in
 terms of the Clock example? Or just a few lines of code to suggest how
 to do it?








 On Sep 18, 12:09 pm, marius d. marius.dan...@gmail.com wrote:
  On Sep 17, 11:09 pm,jackjack.wid...@gmail.com wrote:
 
   I have a CometActor which displays a list of urls and at the same time
   launches a bunch of threads each of which gets information about the
   urls and then puts messages about that information in a Queue. On each
   new tick, the CometActor checks the queue and updates its urls.
 
   The problem is that I am launching the threads from the CometActor and
   the page is never coming back. It times out.
 
  So the page never gets rendered? I would recommend using actors and
  not really threads but even with threads it shouldn't impact you. But
  it also depends on what your code does. Can you post a minimalistic
  example?
 
 
 
 
 
   Is there some general principle about launching threads from a
   CometActor that might explain this behavior?
 



-- 
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Surf the harmonics

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



comet_foo.tgz
Description: GNU Zip compressed data


[Lift] Re: CometActor timeout problem

2009-09-27 Thread jack

I am still having this problem so I will post a simple example. Say I
want to display a list of the numbers 1 to 100. And suppose I have an
object Foo and a method bar, which takes an integer and returns an
integer. And bar takes about 10 seconds to return. So I want to
display the numbers, run Foo.bar on each of them in the background,
and then update the display via comet to replace each integer with bar
of it. I got the Clock example to work and I think I understand what
is going on there. Could somebody show me how to do this example in
terms of the Clock example? Or just a few lines of code to suggest how
to do it?








On Sep 18, 12:09 pm, marius d. marius.dan...@gmail.com wrote:
 On Sep 17, 11:09 pm,jackjack.wid...@gmail.com wrote:

  I have a CometActor which displays a list of urls and at the same time
  launches a bunch of threads each of which gets information about the
  urls and then puts messages about that information in a Queue. On each
  new tick, the CometActor checks the queue and updates its urls.

  The problem is that I am launching the threads from the CometActor and
  the page is never coming back. It times out.

 So the page never gets rendered? I would recommend using actors and
 not really threads but even with threads it shouldn't impact you. But
 it also depends on what your code does. Can you post a minimalistic
 example?





  Is there some general principle about launching threads from a
  CometActor that might explain this behavior?
--~--~-~--~~~---~--~~
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: CometActor timeout problem

2009-09-18 Thread marius d.



On Sep 17, 11:09 pm, jack jack.wid...@gmail.com wrote:
 I have a CometActor which displays a list of urls and at the same time
 launches a bunch of threads each of which gets information about the
 urls and then puts messages about that information in a Queue. On each
 new tick, the CometActor checks the queue and updates its urls.

 The problem is that I am launching the threads from the CometActor and
 the page is never coming back. It times out.

So the page never gets rendered? I would recommend using actors and
not really threads but even with threads it shouldn't impact you. But
it also depends on what your code does. Can you post a minimalistic
example?


 Is there some general principle about launching threads from a
 CometActor that might explain this behavior?
--~--~-~--~~~---~--~~
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: CometActor timeout problem

2009-09-18 Thread Jack Widman
Yes, the page never gets rendered. I am actually using Actors. I will post a
code example tonight. Thanks for your response.

On Fri, Sep 18, 2009 at 12:09 PM, marius d. marius.dan...@gmail.com wrote:




 On Sep 17, 11:09 pm, jack jack.wid...@gmail.com wrote:
  I have a CometActor which displays a list of urls and at the same time
  launches a bunch of threads each of which gets information about the
  urls and then puts messages about that information in a Queue. On each
  new tick, the CometActor checks the queue and updates its urls.
 
  The problem is that I am launching the threads from the CometActor and
  the page is never coming back. It times out.

 So the page never gets rendered? I would recommend using actors and
 not really threads but even with threads it shouldn't impact you. But
 it also depends on what your code does. Can you post a minimalistic
 example?

 
  Is there some general principle about launching threads from a
  CometActor that might explain this behavior?
 


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---