[Lift] Re: XML - JSON converter?
On Fri, Sep 25, 2009 at 1:21 AM, Timothy Perrett timo...@getintheloop.euwrote: Are there any plans to supersede the JsObj stuff with what is in lift- json ? Seems like that would make a lot more sense, no? Yes. Cheers, Tim On 24 Sep 2009, at 22:13, Indrajit Raychaudhuri wrote: On 24/09/09 2:34 PM, Timothy Perrett wrote: Nice stuff Joni! Indeed. That this module gets lots of love shows. Everything nice and tidy in a neat little package. Did I mention that it's test cases serve as docs too? /Indrajit Cheers, Tim On 24 Sep 2009, at 08:24, Joni Freeman wrote: Hi, There is now improved XML support in lift master. See a short section in README: http://github.com/dpp/liftweb/tree/master/lift-json/ and some executable examples: http://github.com/dpp/liftweb/blob/master/lift-json/src/test/scala/net/liftweb/json/XmlExamples.scala Cheers Joni On Sep 2, 9:27 pm, harryhhar...@gmail.com wrote: Is there anything built into lift that will doXML- JSON conversion? For example: foos foo id1/id nameHarry/name /foo foo id2/id nameDavid/name /foo /foos to: { foos: { foo: [{ id: 1, name: Harry }, { id: 2, name: David } ] } Just checking to see if there was something Lift friendly to do this before writing my own (or picking a java library to use). -harryh -- 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: XML - JSON converter?
Sorry Dave, but the brevity of your reply left me somewhat confused... yes it makes sense to do that or yes, we'll be replacing everything with lift-json ? Cheers, Tim On 25 Sep 2009, at 14:07, David Pollak wrote: On Fri, Sep 25, 2009 at 1:21 AM, Timothy Perrett timo...@getintheloop.eu wrote: Are there any plans to supersede the JsObj stuff with what is in lift- json ? Seems like that would make a lot more sense, no? Yes. Cheers, Tim On 24 Sep 2009, at 22:13, Indrajit Raychaudhuri wrote: On 24/09/09 2:34 PM, Timothy Perrett wrote: Nice stuff Joni! Indeed. That this module gets lots of love shows. Everything nice and tidy in a neat little package. Did I mention that it's test cases serve as docs too? /Indrajit Cheers, Tim On 24 Sep 2009, at 08:24, Joni Freeman wrote: Hi, There is now improved XML support in lift master. See a short section in README: http://github.com/dpp/liftweb/tree/master/lift-json/ and some executable examples: http://github.com/dpp/liftweb/blob/master/lift-json/src/test/scala/net/liftweb/json/XmlExamples.scala Cheers Joni On Sep 2, 9:27 pm, harryhhar...@gmail.com wrote: Is there anything built into lift that will doXML- JSON conversion? For example: foos foo id1/id nameHarry/name /foo foo id2/id nameDavid/name /foo /foos to: { foos: { foo: [{ id: 1, name: Harry }, { id: 2, name: David } ] } Just checking to see if there was something Lift friendly to do this before writing my own (or picking a java library to use). -harryh -- 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: Canceling a ActorPing.scheduleAtFixedRate task
So why not keep the method for the Lift-Actors branch? ... because there is no concept of linking actors there? Br's, Marius On Sep 24, 6:52 pm, David Pollak feeder.of.the.be...@gmail.com wrote: I strongly recommend against using scheduleAtFixedRate because: - Internally, it creates an actor that's linked to your actor and that leads one of the Scala Actor memory problems - The turning off issue that you've identified - On the Scala-Actor-free branch of Lift, I've removed the method. Instead, I'd suggest scheduling a new actorping each time you receive one. On Wed, Sep 23, 2009 at 2:17 PM, Xavi Ramirez xavi@gmail.com wrote: I think I figured out a way to get around this: class SomeCometActor extends CometActor { private var tempActor: Actor = null override def localSetup() { val cometActor = this var tempActor = actor{ loop { react { case TaskMessage = cometActor ! TaskMessage case UnSchedule = exit } } } ActorPing.scheduleAtFixedRate(tempActor, TaskMessage, 15 seconds, 15 seconds) } override def lowPriority = { case TaskMessage = DoSomething() if(someCondition) { tempActor ! UnSchedule } } } Instead of registering the comet actors for the scheduled task, I register a temporary actor. During its execution, scheduleAtFixedRate creates an actor. Let's call this the Scheduled Task Actor. The scheduled task actor is then linked(see http://www.scala-lang.org/docu/files/api/scala/actors/Actor.html#link... ) to the temporary actor i passed in. So now, when I need to stop the scheduled task actor, I can shutdown the temporary actor. This works because when an actor is shutdown, all actors it's linked to are shut down as well. This is kinda nuts, but I guess it works. I'm just sharing in case someone else runs into this problem. Thanks, Xavi On Wed, Sep 23, 2009 at 4:13 PM, Xavi Ramirez xavi@gmail.com wrote: There isn't much to show... but maybe an example clarify things. class SomeCometActor extends CometActor { override def localSetup() { ActorPing.scheduleAtFixedRate(this, TaskMessage, 15 seconds, 15 seconds) } override def lowPriority = { case TaskMessage = DoSomething() if(someCondition) { /* stop the scheduled task... What do I put here?*/ } } } If scheduleAtFixedRate returned either the Future or the Actor it creates, then stopping the scheduled task would be fairly straight forward. Then again, I might be missing something. Thanks, Xavi On Wed, Sep 23, 2009 at 3:54 PM, Timothy Perrett timo...@getintheloop.eu wrote: Xavi, Can you show some code? There might be a way of doing it depending what you have... Cheers, Tim Sent from my iPhone On 23 Sep 2009, at 20:50, Xavi Ramirez xavi@gmail.com wrote: Hello, Is there any way to cancel a task created with a ActorPing.scheduleAtFixedRate? From looking at the source ( http://scala-tools.org/scaladocs/liftweb/1.0/net/liftweb/util/ActorPi... ) it seem that scheduleAtFixedRate creates an actor which accepts an UnSchedule message. Unfortunately this actor is not returned to the caller. Thanks in advance, Xavi -- 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: Canceling a ActorPing.scheduleAtFixedRate task
Hi, When you call scheduleAtFixedRate that actor is sending your actor a Scheduled message, hence you can capture the correct sender. You don't need to create a different actor. David's points are quite valid regarding the correct Scala actors' state. Br's, Marius On Sep 23, 4:17 pm, Xavi Ramirez xavi@gmail.com wrote: I think I figured out a way to get around this: class SomeCometActor extends CometActor { private var tempActor: Actor = null override def localSetup() { val cometActor = this var tempActor = actor{ loop { react { case TaskMessage = cometActor ! TaskMessage case UnSchedule = exit } } } ActorPing.scheduleAtFixedRate(tempActor, TaskMessage, 15 seconds, 15 seconds) } override def lowPriority = { case TaskMessage = DoSomething() if(someCondition) { tempActor ! UnSchedule } } } Instead of registering the comet actors for the scheduled task, I register a temporary actor. During its execution, scheduleAtFixedRate creates an actor. Let's call this the Scheduled Task Actor. The scheduled task actor is then linked(seehttp://www.scala-lang.org/docu/files/api/scala/actors/Actor.html#link...) to the temporary actor i passed in. So now, when I need to stop the scheduled task actor, I can shutdown the temporary actor. This works because when an actor is shutdown, all actors it's linked to are shut down as well. This is kinda nuts, but I guess it works. I'm just sharing in case someone else runs into this problem. Thanks, Xavi On Wed, Sep 23, 2009 at 4:13 PM, Xavi Ramirez xavi@gmail.com wrote: There isn't much to show... but maybe an example clarify things. class SomeCometActor extends CometActor { override def localSetup() { ActorPing.scheduleAtFixedRate(this, TaskMessage, 15 seconds, 15 seconds) } override def lowPriority = { case TaskMessage = DoSomething() if(someCondition) { /* stop the scheduled task... What do I put here?*/ } } } If scheduleAtFixedRate returned either the Future or the Actor it creates, then stopping the scheduled task would be fairly straight forward. Then again, I might be missing something. Thanks, Xavi On Wed, Sep 23, 2009 at 3:54 PM, Timothy Perrett timo...@getintheloop.eu wrote: Xavi, Can you show some code? There might be a way of doing it depending what you have... Cheers, Tim Sent from my iPhone On 23 Sep 2009, at 20:50, Xavi Ramirez xavi@gmail.com wrote: Hello, Is there any way to cancel a task created with a ActorPing.scheduleAtFixedRate? From looking at the source (http://scala-tools.org/scaladocs/liftweb/1.0/net/liftweb/util/ActorPi... ) it seem that scheduleAtFixedRate creates an actor which accepts an UnSchedule message. Unfortunately this actor is not returned to the caller. Thanks in advance, Xavi --~--~-~--~~~---~--~~ 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: XML - JSON converter?
On Fri, Sep 25, 2009 at 6:19 AM, Timothy Perrett timo...@getintheloop.euwrote: Sorry Dave, but the brevity of your reply left me somewhat confused... yes it makes sense to do that or yes, we'll be replacing everything with lift-json ? Eventually, we'll be integrating all of lift-json into the existing Lift JavaScript infrastructure. Cheers, Tim On 25 Sep 2009, at 14:07, David Pollak wrote: On Fri, Sep 25, 2009 at 1:21 AM, Timothy Perrett timo...@getintheloop.euwrote: Are there any plans to supersede the JsObj stuff with what is in lift- json ? Seems like that would make a lot more sense, no? Yes. Cheers, Tim On 24 Sep 2009, at 22:13, Indrajit Raychaudhuri wrote: On 24/09/09 2:34 PM, Timothy Perrett wrote: Nice stuff Joni! Indeed. That this module gets lots of love shows. Everything nice and tidy in a neat little package. Did I mention that it's test cases serve as docs too? /Indrajit Cheers, Tim On 24 Sep 2009, at 08:24, Joni Freeman wrote: Hi, There is now improved XML support in lift master. See a short section in README: http://github.com/dpp/liftweb/tree/master/lift-json/ and some executable examples: http://github.com/dpp/liftweb/blob/master/lift-json/src/test/scala/net/liftweb/json/XmlExamples.scala Cheers Joni On Sep 2, 9:27 pm, harryhhar...@gmail.com wrote: Is there anything built into lift that will doXML- JSON conversion? For example: foos foo id1/id nameHarry/name /foo foo id2/id nameDavid/name /foo /foos to: { foos: { foo: [{ id: 1, name: Harry }, { id: 2, name: David } ] } Just checking to see if there was something Lift friendly to do this before writing my own (or picking a java library to use). -harryh -- 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 -- 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: XML - JSON converter?
This is really great, making XML as easy to generate as JSON was something I thought I'd never see. On Fri, Sep 25, 2009 at 7:27 AM, David Pollak feeder.of.the.be...@gmail.com wrote: On Fri, Sep 25, 2009 at 6:19 AM, Timothy Perrett timo...@getintheloop.eu wrote: Sorry Dave, but the brevity of your reply left me somewhat confused... yes it makes sense to do that or yes, we'll be replacing everything with lift-json ? Eventually, we'll be integrating all of lift-json into the existing Lift JavaScript infrastructure. Cheers, Tim On 25 Sep 2009, at 14:07, David Pollak wrote: On Fri, Sep 25, 2009 at 1:21 AM, Timothy Perrett timo...@getintheloop.eu wrote: Are there any plans to supersede the JsObj stuff with what is in lift- json ? Seems like that would make a lot more sense, no? Yes. Cheers, Tim On 24 Sep 2009, at 22:13, Indrajit Raychaudhuri wrote: On 24/09/09 2:34 PM, Timothy Perrett wrote: Nice stuff Joni! Indeed. That this module gets lots of love shows. Everything nice and tidy in a neat little package. Did I mention that it's test cases serve as docs too? /Indrajit Cheers, Tim On 24 Sep 2009, at 08:24, Joni Freeman wrote: Hi, There is now improved XML support in lift master. See a short section in README: http://github.com/dpp/liftweb/tree/master/lift-json/ and some executable examples: http://github.com/dpp/liftweb/blob/master/lift-json/src/test/scala/net/liftweb/json/XmlExamples.scala Cheers Joni On Sep 2, 9:27 pm, harryhhar...@gmail.com wrote: Is there anything built into lift that will doXML- JSON conversion? For example: foos foo id1/id nameHarry/name /foo foo id2/id nameDavid/name /foo /foos to: { foos: { foo: [{ id: 1, name: Harry }, { id: 2, name: David } ] } Just checking to see if there was something Lift friendly to do this before writing my own (or picking a java library to use). -harryh -- 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 -- 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: How can I replace SHtml.a with a Loc
David, Thanks for the reply. The Loc, itself, though. How do I write that to create the Ajax link. I want to be able to modify an html element when the link is clicked, as in SetHtml(item-save, edit(item)). Glenn On Sep 24, 5:05 pm, David Pollak feeder.of.the.be...@gmail.com wrote: val myLoc: Loc[_] = ... bind(item, xhtml, addNew - a href={myLoc.createDefaultLink}Hello/a) On Wed, Sep 23, 2009 at 11:25 AM, glenn gl...@exmbly.com wrote: I have a snippet that creates a Ajax link. bind(item, xhtml, addNew - {SHtml.a({ ()= SetHtml(item-save, edit(item))}, Text(MenuTitle_Add) )} ) How would I, instead, create the same or similar link using a Loc? Glenn -- 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: How can I replace SHtml.a with a Loc
On Fri, Sep 25, 2009 at 8:13 AM, glenn gl...@exmbly.com wrote: David, Thanks for the reply. The Loc, itself, though. How do I write that to create the Ajax link. I want to be able to modify an html element when the link is clicked, as in SetHtml(item-save, edit(item)). Sorry... didn't quite understand. Are you using your own menu generator or the standard Lift menu generator? I'm thinking that we have to uniquely identify (put a knowable id on) each a href that is generated. If you're doing your own menu generation from SiteMap, you can probably get your code to work by using the name of the Loc as the id. If you're using the standard Lift Menu snippet to create your menus, you'll have to open a ticket, I'll prioritize the ticket, then we'll wait for review board and then you'll get your change. Glenn On Sep 24, 5:05 pm, David Pollak feeder.of.the.be...@gmail.com wrote: val myLoc: Loc[_] = ... bind(item, xhtml, addNew - a href={myLoc.createDefaultLink}Hello/a) On Wed, Sep 23, 2009 at 11:25 AM, glenn gl...@exmbly.com wrote: I have a snippet that creates a Ajax link. bind(item, xhtml, addNew - {SHtml.a({ ()= SetHtml(item-save, edit(item))}, Text(MenuTitle_Add) )} ) How would I, instead, create the same or similar link using a Loc? Glenn -- 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 -- 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] ProtoUser superUser versus Role
Hello, I'm implementing a Role in my model to ultimately replace the functionality provided by ProtoUser.superUser Please let me know what the argument against having this functionality in Lift is, and if you'd like to see this implemented, I'd gladly commit my changes. Please also suggest sensible defaults. I would imagine initial roles like: 0=super 1=normal ...and then setting new User instances to role=1. Thanks, Juan --~--~-~--~~~---~--~~ 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: access to raw HttpServletRequest/Response
On Wed, Sep 23, 2009 at 9:03 AM, harryh har...@gmail.com wrote: You can do it today like this: S.containerRequest.map(r = (r.asInstanceOf[HTTPRequestServlet]).req) eh? I'm getting this error: [error] value req is not a member of net.liftweb.http.provider.servlet.HTTPRequestServlet [error] val request: HttpServletRequest = S.containerRequest.map(r = (r.asInstanceOf[HTTPRequestServlet]).req).open_! Once this review-board change is accepted, the above code will work: http://reviewboard.liftweb.net/r/12/ -harryh -- 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: Concurrent Web Service Requests?
On Thu, Sep 24, 2009 at 11:33 AM, Naftoli Gugenheim naftoli...@gmail.comwrote: If you like the idea of having them all as attributes but don't like the idea of using a single attribute ('xx:eager_eval=true xx:parallel=true' rather than 'xx:eval=eager parallel' as I suggested, where xx is the prefix to be chosen) then maybe the prefix should be 'eval'. I've changed the code to: liftx:eager_eval=true liftx:par=true | liftx:parallel=true The reasons for not combining them: - They are evaluated in different parts of the code, thus eager/parallel doesn't make sense from a code path perspective - I am reserving the value of liftx:par for future implementation to allow farming the snippet evaluation to another mechanism. Right now, it's hard-coded to use LiftActors. I can see a time when it would work with Akka actors or some other parallelization mechanism As far as ajax evaluation I'm not sure I'm understanding. Could you show me what you're thinking? If I have a snippet lift:MySnippet / what would be the syntax to have it inserted via ajax? lift:Ajax !-- the snippet name will not be ajax, but you get the idea -- lift:MySnippet/ /lift:Ajax - Ross Mellgrendri...@gmail.com wrote: My 2 cents, I'm not sure I'm a fan of do: namespace, though I agree it would be nice to have a common one. Maybe snippet:parallel, snippet:eager_eval? -Ross On Sep 24, 2009, at 12:46 PM, David Pollak wrote: On Wed, Sep 23, 2009 at 11:43 AM, Naftoli Gugenheim naftoli...@gmail.com wrote: What do you mean by as a normal snippet? The parallel snippet processing is implemented deep inside LiftSession. It's not a snippet. All the lift:xxx/ tags, even those with defaults built into Lift, are implemented as snippets and are invoked with normal snippet invocation mechanisms. That you will nest your snippet inside a special snippet? There is no special snippet. I used the word normal to highlight that it's functionality that doesn't require a change to LiftSession or other parts of Lift to function correctly. To me it seems worthwhile to have a consistency between the two syntax-wise, since they have some common denominator semantics-wise. Actually, maybe throw in eager_eval to the mix. Maybe we could have one eval or lift:eval or liftx:eval or whatever attribute, which can contain a space separated list of specifiers--eager, ajax, parellel. Anything that's prefixed with lift: is a snippet. I'm open to unifying eager_eval and do:lazy (or do:par or do:parallel) into a unified namespace. - David Pollakfeeder.of.the.be...@gmail.com wrote: On Wed, Sep 23, 2009 at 10:40 AM, Naftoli Gugenheim naftoli...@gmail.com wrote: A snippet attribute can be invoked with something other than lift:snippet=Class.method? There's a short syntax? What is it? There may be a short syntax (e.g., lift:Class.method) in the future. What was used for the feature that inserts a snippet asynchronously via Ajax? That feature isn't done yet, but that feature is likely to be done as a normal snippet. My concern is that as more features are thought up and added they shouldn't all end up with different prefixes. Also, if the prefix is nothing special I would go with the more verbose parallel because otherwise it's not obvious what it does. If it's prefixed with lift: at least you know it's a lift tag and you can look it up somewhere or ask on the list etc. But if you come back to some old template that says do:par you may be left clueless. - David Pollakfeeder.of.the.be...@gmail.com wrote: On Wed, Sep 23, 2009 at 3:59 AM, Naftoli Gugenheim naftoli...@gmail.com wrote: Could that be changed to lift:concurrent or lift:par etc. (see email on scala-user from Marting Odersky mentioned the future use of 'seq' and 'par' in concurrent collections)? Why use a different prefix than everything else built in to lift? And 'lazy' is arguably not what's happening. We're using a different prefix because if we use a lift:xxx prefix, the snippet execution machinery will be invoked on the attribute and we don't want that. I'm cool with do:par unless anyone has a better suggestion. Thanks, David Thanks. - Jeppe Nejsum Madsenje...@ingolfs.dk wrote: David Pollak feeder.of.the.be...@gmail.com writes: I've added code (it's in review board right now) that will automatically farm any snippet with the do:lazy='true' attribute set. So, lift:foo/ will execute the foo snippet inline. lift:foo do:lazy=true/ will execute the foo snippet in parallel and join the result back to page
[Lift] Re: How can I replace SHtml.a with a Loc
David, In this case, I was trying to see if there was a way to use the standard Lift menu generator to create a link with a callback for ajax handling, similar to SHtml.a. I don't know about menu generation from SiteMap. Perhaps that's what I really need. What would that look like? Glenn On Sep 25, 8:22 am, David Pollak feeder.of.the.be...@gmail.com wrote: On Fri, Sep 25, 2009 at 8:13 AM, glenn gl...@exmbly.com wrote: David, Thanks for the reply. The Loc, itself, though. How do I write that to create the Ajax link. I want to be able to modify an html element when the link is clicked, as in SetHtml(item-save, edit(item)). Sorry... didn't quite understand. Are you using your own menu generator or the standard Lift menu generator? I'm thinking that we have to uniquely identify (put a knowable id on) each a href that is generated. If you're doing your own menu generation from SiteMap, you can probably get your code to work by using the name of the Loc as the id. If you're using the standard Lift Menu snippet to create your menus, you'll have to open a ticket, I'll prioritize the ticket, then we'll wait for review board and then you'll get your change. Glenn On Sep 24, 5:05 pm, David Pollak feeder.of.the.be...@gmail.com wrote: val myLoc: Loc[_] = ... bind(item, xhtml, addNew - a href={myLoc.createDefaultLink}Hello/a) On Wed, Sep 23, 2009 at 11:25 AM, glenn gl...@exmbly.com wrote: I have a snippet that creates a Ajax link. bind(item, xhtml, addNew - {SHtml.a({ ()= SetHtml(item-save, edit(item))}, Text(MenuTitle_Add) )} ) How would I, instead, create the same or similar link using a Loc? Glenn -- 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 -- 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: Concurrent Web Service Requests?
Looks great :-) can't wait to see this in master. Cheers, Tim Sent from my iPhone On 25 Sep 2009, at 18:02, David Pollak feeder.of.the.be...@gmail.com wrote: On Thu, Sep 24, 2009 at 11:33 AM, Naftoli Gugenheim naftoli...@gmail.com wrote: If you like the idea of having them all as attributes but don't like the idea of using a single attribute ('xx:eager_eval=true xx:parallel=true' rather than 'xx:eval=eager parallel' as I suggested, where xx is the prefix to be chosen) then maybe the prefix should be 'eval'. I've changed the code to: liftx:eager_eval=true liftx:par=true | liftx:parallel=true The reasons for not combining them: They are evaluated in different parts of the code, thus eager/ parallel doesn't make sense from a code path perspective I am reserving the value of liftx:par for future implementation to allow farming the snippet evaluation to another mechanism. Right now, it's hard-coded to use LiftActors. I can see a time when it would work with Akka actors or some other parallelization mechanism As far as ajax evaluation I'm not sure I'm understanding. Could you show me what you're thinking? If I have a snippet lift:MySnippet / what would be the syntax to have it inserted via ajax? lift:Ajax !-- the snippet name will not be ajax, but you get the idea -- lift:MySnippet/ /lift:Ajax - Ross Mellgrendri...@gmail.com wrote: My 2 cents, I'm not sure I'm a fan of do: namespace, though I agree it would be nice to have a common one. Maybe snippet:parallel, snippet:eager_eval? -Ross On Sep 24, 2009, at 12:46 PM, David Pollak wrote: On Wed, Sep 23, 2009 at 11:43 AM, Naftoli Gugenheim naftoli...@gmail.com wrote: What do you mean by as a normal snippet? The parallel snippet processing is implemented deep inside LiftSession. It's not a snippet. All the lift:xxx/ tags, even those with defaults built into Lift, are implemented as snippets and are invoked with normal snippet invocation mechanisms. That you will nest your snippet inside a special snippet? There is no special snippet. I used the word normal to highlight that it's functionality that doesn't require a change to LiftSession or other parts of Lift to function correctly. To me it seems worthwhile to have a consistency between the two syntax-wise, since they have some common denominator semantics-wise. Actually, maybe throw in eager_eval to the mix. Maybe we could have one eval or lift:eval or liftx:eval or whatever attribute, which can contain a space separated list of specifiers--eager, ajax, parellel. Anything that's prefixed with lift: is a snippet. I'm open to unifying eager_eval and do:lazy (or do:par or do:parallel) into a unified namespace. - David Pollakfeeder.of.the.be...@gmail.com wrote: On Wed, Sep 23, 2009 at 10:40 AM, Naftoli Gugenheim naftoli...@gmail.com wrote: A snippet attribute can be invoked with something other than lift:snippet=Class.method? There's a short syntax? What is it? There may be a short syntax (e.g., lift:Class.method) in the future. What was used for the feature that inserts a snippet asynchronously via Ajax? That feature isn't done yet, but that feature is likely to be done as a normal snippet. My concern is that as more features are thought up and added they shouldn't all end up with different prefixes. Also, if the prefix is nothing special I would go with the more verbose parallel because otherwise it's not obvious what it does. If it's prefixed with lift: at least you know it's a lift tag and you can look it up somewhere or ask on the list etc. But if you come back to some old template that says do:par you may be left clueless. - David Pollakfeeder.of.the.be...@gmail.com wrote: On Wed, Sep 23, 2009 at 3:59 AM, Naftoli Gugenheim naftoli...@gmail.com wrote: Could that be changed to lift:concurrent or lift:par etc. (see email on scala-user from Marting Odersky mentioned the future use of 'seq' and 'par' in concurrent collections)? Why use a different prefix than everything else built in to lift? And 'lazy' is arguably not what's happening. We're using a different prefix because if we use a lift:xxx prefix, the snippet execution machinery will be invoked on the attribute and we don't want that. I'm cool with do:par unless anyone has a better suggestion. Thanks, David Thanks. - Jeppe Nejsum Madsenje...@ingolfs.dk wrote: David Pollak feeder.of.the.be...@gmail.com writes: I've added code (it's in review board right now) that will automatically farm any snippet with the do:lazy='true' attribute set.
[Lift] Re: redirectTo throwing net.liftweb.http.ResponseShortcutException: Shortcut
Thank you, that mostly worked! I forgot to mention that I'm using StatefulSnippet, and the place where the redirect is happening should redirect to a different url, but the different url is backed by the same StatefulSnippet instance. So when I use JsCmds.RedirectTo I'm not getting the same StatefulSnippet instance. Is there a way to redirect that will preserve my StatefulSnippet instance? url/a(StatefulSnippet) - links to url/b(StatefulSnippet) using super.link() url/b - redirects back to url/a url/a is a grid, with a starting 'page' number, and url/b is a edit form. When the user is done with url/b they click 'save' which sends them back to url/a, hopefully at the same place in the grid. When returning to the grid from the edit page, the grid is reloading from the beginning. I need a way to preserve the original StatefulSnippet instance. Thanks, Dave On Sep 25, 4:26 am, Timothy Perrett timo...@getintheloop.eu wrote: Just realised your using ajaxForm... in that case you need to do RedirectTo JsCmd which will effectively send a window.location.href to the browser. Cheers, Tim On 24 Sep 2009, at 21:49, David wrote: Hello lifters, I have the following form and bind: SHtml.ajaxForm( bind(ajax, xhtml, view - doView _, save - SHtml.ajaxButton( Save, {() = Log.info(Got a 'save' AJAX call) this.redirectTo(/redirect1) //workflow/index2 }, (class, ui-state-default ui-corner-all When the 'Save' ajax button is called, the redirect should be invoked, that is working. However I get the exception below. Based on what I've read, this exception should be handled by lift. I don't have any explicit exception handling in my code. Is there a bug here, is my redirect correct? I've also tried adding this to my Boot.scala: LiftRules.dispatch.prepend { case Req(redirect1 :: _, _, _) = () = Full(RedirectWithState(/workflow/index2, RedirectState(() = println(Called on redirect!), My error - NoticeType.Error))) Thanks for any suggestions or help. -Dave 16:44:14.097 [12569...@qtp-1983971-5] WARN lift.warn:114 - Request for /ajax_request/F664660567847L4N/ failed Shortcut net.liftweb.http.ResponseShortcutException: Shortcut at net.liftweb.http.ResponseShortcutException$.redirect (ResponseShortcutException.scala:31) [lift-webkit-1.1-SNAPSHOT.jar:na] at net.liftweb.http.ResponseShortcutException$.redirect (ResponseShortcutException.scala:35) [lift-webkit-1.1-SNAPSHOT.jar:na] at net.liftweb.http.S$.redirectTo(S.scala:759) [lift-webkit-1.1- SNAPSHOT.jar:na] at net.liftweb.http.StatefulSnippet$class.redirectTo(Stateful.scala: 77) [lift-webkit-1.1-SNAPSHOT.jar:na] at snippet.Workflow.redirectTo(Workflow.scala:31) [classes/:na] at snippet.Workflow$$anonfun$edit$2.apply(Workflow.scala:151) [classes/:na] at snippet.Workflow$$anonfun$edit$2.apply(Workflow.scala:149) [classes/:na] at net.liftweb.http.S$NFuncHolder$$anonfun$apply$40.apply(S.scala: 1843) [lift-webkit-1.1-SNAPSHOT.jar:na] at net.liftweb.http.S$NFuncHolder$$anonfun$apply$40.apply(S.scala: 1843) [lift-webkit-1.1-SNAPSHOT.jar:na] at scala.List.map(List.scala:812) [scala-library-2.7.5.jar:na] at net.liftweb.http.S$NFuncHolder.apply(S.scala:1843) [lift- webkit-1.1-SNAPSHOT.jar:na] at net.liftweb.http.LiftSession$$anonfun$buildFunc$1$2.apply (LiftSession.scala:323) [lift-webkit-1.1-SNAPSHOT.jar:na] at net.liftweb.http.LiftSession$$anonfun$6$$anonfun$apply$17.apply (LiftSession.scala:338) [lift-webkit-1.1-SNAPSHOT.jar:na] at net.liftweb.http.LiftSession$$anonfun$6$$anonfun$apply$17.apply (LiftSession.scala:338) [lift-webkit-1.1-SNAPSHOT.jar:na] at scala.List.map(List.scala:812) [scala-library-2.7.5.jar:na] at net.liftweb.http.LiftSession$$anonfun$6.apply(LiftSession.scala: 338) [lift-webkit-1.1-SNAPSHOT.jar:na] at net.liftweb.http.LiftSession$$anonfun$6.apply(LiftSession.scala: 327) [lift-webkit-1.1-SNAPSHOT.jar:na] at scala.List.flatMap(List.scala:1132) [scala-library-2.7.5.jar:na] at net.liftweb.http.LiftSession.runParams(LiftSession.scala:327) [lift-webkit-1.1-SNAPSHOT.jar:na] at net.liftweb.http.LiftServlet.handleAjax(LiftServlet.scala:286) [lift-webkit-1.1-SNAPSHOT.jar:na] at net.liftweb.http.LiftServlet.net$liftweb$http$LiftServlet$ $dispatchStatefulRequest(LiftServlet.scala:253) [lift-webkit-1.1- SNAPSHOT.jar:na] at net.liftweb.http.LiftServlet$$anonfun$3.apply(LiftServlet.scala: 172) [lift-webkit-1.1-SNAPSHOT.jar:na] at net.liftweb.http.LiftServlet$$anonfun$3.apply(LiftServlet.scala: 172) [lift-webkit-1.1-SNAPSHOT.jar:na] at net.liftweb.http.S$.net$liftweb$http$S$$wrapQuery(S.scala:904) [lift-webkit-1.1-SNAPSHOT.jar:na] at
[Lift] Re: Struggling with mapping a list of objects
Just an update ... I did manage to get maven to pull down 1.1-M5, not sure what was up with it before, but it worked in the morning. I couldn't resolve the class MappedOneToMany, or Owned, even though I can see them in the lift-mapper-1.1-M5.jar . Used the import import net.liftweb.mapper._ Oh well, I got around it in a horrible way by in effect serializing the list of objects I wanted to save as XML and storing them in a MappedText field. It works, but its grim. Thanks for your help though everyone, the support on this list is great, and lift is a breath of fresh air. Cheers, Ben --~--~-~--~~~---~--~~ 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: redirectTo throwing net.liftweb.http.ResponseShortcutException: Shortcut
Try calling registerThisSnippet in the redirect function. - Daviddavid.b...@gmail.com wrote: Thank you, that mostly worked! I forgot to mention that I'm using StatefulSnippet, and the place where the redirect is happening should redirect to a different url, but the different url is backed by the same StatefulSnippet instance. So when I use JsCmds.RedirectTo I'm not getting the same StatefulSnippet instance. Is there a way to redirect that will preserve my StatefulSnippet instance? url/a(StatefulSnippet) - links to url/b(StatefulSnippet) using super.link() url/b - redirects back to url/a url/a is a grid, with a starting 'page' number, and url/b is a edit form. When the user is done with url/b they click 'save' which sends them back to url/a, hopefully at the same place in the grid. When returning to the grid from the edit page, the grid is reloading from the beginning. I need a way to preserve the original StatefulSnippet instance. Thanks, Dave On Sep 25, 4:26 am, Timothy Perrett timo...@getintheloop.eu wrote: Just realised your using ajaxForm... in that case you need to do RedirectTo JsCmd which will effectively send a window.location.href to the browser. Cheers, Tim On 24 Sep 2009, at 21:49, David wrote: Hello lifters, I have the following form and bind: SHtml.ajaxForm( bind(ajax, xhtml, view - doView _, save - SHtml.ajaxButton( Save, {() = Log.info(Got a 'save' AJAX call) this.redirectTo(/redirect1) //workflow/index2 }, (class, ui-state-default ui-corner-all When the 'Save' ajax button is called, the redirect should be invoked, that is working. However I get the exception below. Based on what I've read, this exception should be handled by lift. I don't have any explicit exception handling in my code. Is there a bug here, is my redirect correct? I've also tried adding this to my Boot.scala: LiftRules.dispatch.prepend { case Req(redirect1 :: _, _, _) = () = Full(RedirectWithState(/workflow/index2, RedirectState(() = println(Called on redirect!), My error - NoticeType.Error))) Thanks for any suggestions or help. -Dave 16:44:14.097 [12569...@qtp-1983971-5] WARN lift.warn:114 - Request for /ajax_request/F664660567847L4N/ failed Shortcut net.liftweb.http.ResponseShortcutException: Shortcut at net.liftweb.http.ResponseShortcutException$.redirect (ResponseShortcutException.scala:31) [lift-webkit-1.1-SNAPSHOT.jar:na] at net.liftweb.http.ResponseShortcutException$.redirect (ResponseShortcutException.scala:35) [lift-webkit-1.1-SNAPSHOT.jar:na] at net.liftweb.http.S$.redirectTo(S.scala:759) [lift-webkit-1.1- SNAPSHOT.jar:na] at net.liftweb.http.StatefulSnippet$class.redirectTo(Stateful.scala: 77) [lift-webkit-1.1-SNAPSHOT.jar:na] at snippet.Workflow.redirectTo(Workflow.scala:31) [classes/:na] at snippet.Workflow$$anonfun$edit$2.apply(Workflow.scala:151) [classes/:na] at snippet.Workflow$$anonfun$edit$2.apply(Workflow.scala:149) [classes/:na] at net.liftweb.http.S$NFuncHolder$$anonfun$apply$40.apply(S.scala: 1843) [lift-webkit-1.1-SNAPSHOT.jar:na] at net.liftweb.http.S$NFuncHolder$$anonfun$apply$40.apply(S.scala: 1843) [lift-webkit-1.1-SNAPSHOT.jar:na] at scala.List.map(List.scala:812) [scala-library-2.7.5.jar:na] at net.liftweb.http.S$NFuncHolder.apply(S.scala:1843) [lift- webkit-1.1-SNAPSHOT.jar:na] at net.liftweb.http.LiftSession$$anonfun$buildFunc$1$2.apply (LiftSession.scala:323) [lift-webkit-1.1-SNAPSHOT.jar:na] at net.liftweb.http.LiftSession$$anonfun$6$$anonfun$apply$17.apply (LiftSession.scala:338) [lift-webkit-1.1-SNAPSHOT.jar:na] at net.liftweb.http.LiftSession$$anonfun$6$$anonfun$apply$17.apply (LiftSession.scala:338) [lift-webkit-1.1-SNAPSHOT.jar:na] at scala.List.map(List.scala:812) [scala-library-2.7.5.jar:na] at net.liftweb.http.LiftSession$$anonfun$6.apply(LiftSession.scala: 338) [lift-webkit-1.1-SNAPSHOT.jar:na] at net.liftweb.http.LiftSession$$anonfun$6.apply(LiftSession.scala: 327) [lift-webkit-1.1-SNAPSHOT.jar:na] at scala.List.flatMap(List.scala:1132) [scala-library-2.7.5.jar:na] at net.liftweb.http.LiftSession.runParams(LiftSession.scala:327) [lift-webkit-1.1-SNAPSHOT.jar:na] at net.liftweb.http.LiftServlet.handleAjax(LiftServlet.scala:286) [lift-webkit-1.1-SNAPSHOT.jar:na] at net.liftweb.http.LiftServlet.net$liftweb$http$LiftServlet$ $dispatchStatefulRequest(LiftServlet.scala:253) [lift-webkit-1.1- SNAPSHOT.jar:na] at net.liftweb.http.LiftServlet$$anonfun$3.apply(LiftServlet.scala: 172) [lift-webkit-1.1-SNAPSHOT.jar:na] at net.liftweb.http.LiftServlet$$anonfun$3.apply(LiftServlet.scala: 172) [lift-webkit-1.1-SNAPSHOT.jar:na]