On Wed, Jul 1, 2009 at 4:00 PM, Peter Robinett <pe...@bubblefoundry.com>wrote:

>
> On Jul 1, 3:38 pm, David Pollak <feeder.of.the.be...@gmail.com>
> wrote:
> > Are you coming from Java/C# or Ruby/Python?
>
> PHP, Python and Javascript


Okay... makes sense.

Yes, the reference contained a Loc, but the compiler could not verify that
it contained a Loc.  At compile time, the compiler knows the common
superclass between Loc[_] and String is Object.  Thus the type of l in your
code was Object and Object doesn't have the foundParam method.


>
>
> > I don't think you have to pull the value out of the for comprehension...
> do
> > all the work inside the for comprehension.
> >
> > When you're doing your design, think about transformation.  You'll
> > transforming input to output.  In this particular instance, what kind of
> > transformation are you performing?
>
> To the extent that you can call it transformation, I'm trying to
> transform the Node the user selected (via clicking on a link in the
> format /nodes/view/<some node id>) to a Flot graph of the Node's
> Packets. So, I'm writing a snippet to display a Flot graph of all the
> recent Packets of a Node. This snippet is called in the viewTemplate
> of the CRUDified Node model (hence the title of this thread).
>
> So based upon the Flot examples I have been seeking to have my snippet


I'd put your snippet in your Loc.  That way you have access to the
foundParam.

Loc.Snippet("time", time)

And then in your Loc, you put the time method below.  In that case, you'll
have direct access to foundParam without any goofiness.



>
> be something of the format:
> def time (xhtml: NodeSeq) = {
>        def graph () = {
>                val node = <the Node the user requested>
>                val s = new FlotSerie () {
>                        override val data = Packet.findAll(By(Packet.node,
> node.id), OrderBy


You could also write this as:

override val data = Packet.findAll(By(Packet.node, for (req <- S.request;
loc <- req.location) yield loc.asInstanceOf[Loc[Node]].foundParam.is),
MaxRows(1000)....




>
> (Packet.dt, Descending), MaxRows(1000)).map(p =>
> (p.dt.getTime.toDouble, p.temp.is))
>                }
>
>                ... various Flot code, including adding the s FlotSerie to
> options
> FlotOptions ...
>
>                Flot.render("ph_graph", s :: Nil, options,
> Flot.script(xhtml),
> overview)
>        }
>        bind ("flot", xhtml, "graph" -> graph)
> }
>
> Am I going about this in the correct way?
>
> Again, thanks for the help,
> Peter
> >
>


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

Reply via email to