I'm not trying to change the subject but I was wondering if you looked at Databinder Dispatch http://databinder.net/dispatch/About for your url calls?
On Nov 12, 3:26 pm, Jack Widman <jack.wid...@gmail.com> wrote: > David, > > I have attached my code. It runs but does not behave as I intended it to. > The code does a web search on the term "scala" and displays a list of URLs > of the results. Next to each URL it says "Page Length : -1". A process is > running in the background which takes each URL, goes out and gets the page > and takes the length of the page. The length of that page is then supposed > to immediately appear on the page next to that URL. I put the lengths on a > queue, as they come in, and I have the Comet page poll the queue and display > the results. It would probably be better to have the results send a message > to the Comet class so the page is only re-rendered when there is a change > but for now I am polling. > > I can see the lengths coming in and being put on the queue, but the Comet > page is not getting them till they are all retrieved. (This takes way too > long and nothing changes on the screen till its too late). I need them to > appear as they come in. Occasionally I can see a length being retrieved and > the Comet page finds it but even then it is not displayed until all the > lengths are in. I know this is not very clear but I think it will be clear > from the code. > > I also know there are a lot of places in the code which can be improved and > I welcome all of your input but what I would love is to have these numbers > appear on the page as they they are retrieved. I have been stumped by this > for a while and I suspect that somebody who knows Lift well might see the > problem right away. > > The class that retrieves the page lengths is called Calculator and the queue > is called SourceQueue. The classes are pretty small so hopefully it will be > clear what is going on. I want you to know I think it is incredible how > responsive you and the group are and I look forward to using Lift in the > future. > > Thanks so much. > > Jack > > On Tue, Nov 10, 2009 at 1:27 AM, David Pollak <feeder.of.the.be...@gmail.com > > > wrote: > > > On Mon, Nov 9, 2009 at 10:10 PM, Jack Widman <jack.wid...@gmail.com>wrote: > > >> The only difference between your working code and mine is that mine has a > >> process in the background that is always running and puts Foo objects on a > >> queue whenever they are ready. Where can I start this long running process > >> so that it doesn't interfere with the lowPriority method that takes things > >> off the queue and rerenders the page. I tried starting the process in its > >> own Actor that I start in localSetup but it seems somehow to be blocking > >> the > >> lowPriority method from doing its thing. > > > I have no idea what this means... sorry. > > > Please post actual runnable code and we can help you debug. > > >> On Sun, Nov 8, 2009 at 11:35 PM, David Pollak < > >> feeder.of.the.be...@gmail.com> wrote: > > >>> 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 frameworkhttp://liftweb.net > >>> Beginning Scalahttp://www.apress.com/book/view/1430219890 > >>> Follow me:http://twitter.com/dpp > >>> Surf the harmonics > > >> -- > >> Jack Widman > > >> co-founder / cto, Authoritude, Inc. > > >> 203-641-9355 > > > -- > > 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 > > > > widman.tgz > 187KViewDownload --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---