Jack,

I reproduced your code and it seems to work fine.  I've enclosed a working
copy.

Some comments about your code:

   - The foos variable and the foo variable may be getting confused in the
   code... the render method may be rendering the same thing based on the
   unchanging foos variable.
   - Doing null testing is a sign that you have logic errors in your code.
   I strongly recommend using either Box or Option for everything that can
   logically not contain a value/reference.  If you're bridging out to Java
   code and are expecting null from the Java code, write a small bridge that
   will wrapper the Java return values in Box/Option.
   - You have a case class (Tick) that contains no parameters.  Please use a
   case object instead.
   - Your Tick look is a spin loop.  You fire a Tick message as part of
   processing the Tick message.  I would suggest that if you're polling, that
   you have a reasonable poll interval, otherwise you'll starve your CPU.
   Further, having reRender on each loop through means that you're forcing a
   lot of bytes over the wire rather than only doing a reRender on changed
   values.

Thanks,

David

On Sun, Nov 8, 2009 at 3:47 PM, Jack Widman <jack.wid...@gmail.com> wrote:

> Sorry. Here it is:   As I said, I know that when render is called,
> foo.getValue has the right value. But it does not show on the screen, unless
> I refresh the browser.
>
> package com.foo.comet
>
> import net.liftweb._
> import http._
> import js._
> import JsCmds._
> import net.liftweb.util._
> import net.liftweb.http._
> import _root_.scala.xml._
> import scala.actors._
> import com.authoritude.snippet._
> import scala.collection.mutable.Queue
> import net.liftweb.http.SessionVar
>
>
> class MyComet extends CometActor {
>
>   override def defaultPrefix = Full("auth")
>
>   private var foos = FooManager.getFoos
>
>   def createDisplay(foos:List[Foo]):NodeSeq = {
>     <span id="go"><table>
>     {
>       for {foo <- foos} yield <tr><td>{foo.getValue}</td></tr>
>     }
>
>     </table></span>
>   }
>
>   def render = { bind("foo" -> createDisplay(foos)) }
>
>   override def localSetup = {
>     super.localSetup
>     this ! Tick
>   }
>
>   var foo:Foo = null
>   override def lowPriority = {
>     case Tick => {
>       foo=FooQueue.getLatest
>       if (foo!=null && foo.getValue > -1) {
>     blogs = FooManager.process(foo, foos)
>       } else if (foo!=null){
>     foos = foos.remove((f:Foo)=>(f.id==foo.id))
>       }
>       reRender(false)
>       this ! Tick
>     }
>   }
> }
>
> case class Tick
>
>
>
> On Sun, Nov 8, 2009 at 5:31 AM, Timothy Perrett 
> <timo...@getintheloop.eu>wrote:
>
>>
>> Without posting your code it's going to be tough to help you.
>>
>> Cheers, Tim
>>
>> Sent from my iPhone
>>
>> On 8 Nov 2009, at 08:14, jack <jack.wid...@gmail.com> wrote:
>>
>> >
>> > By the way, I know that when render is called, all the variables have
>> > the right values. I just don't see it on the screen unless I refresh
>> > it.
>> >
>> > On Nov 8, 3:12 am, jack <jack.wid...@gmail.com> wrote:
>> >> I have a CometActor. render is called when it is supposed to be but I
>> >> don't see the changes. If I refresh the page at anytime, I do see the
>> >> changes. Any idea what might cause this?
>> > >
>> >
>>
>>
>>
>
>
> --
> Jack Widman
>
> co-founder / cto,  Authoritude, Inc.
>
> 203-641-9355
>
>
> >
>


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

Attachment: yaker.tgz
Description: GNU Zip compressed data

Reply via email to