[Lift] Re: JS event source in a server side handler
I encountered the same problem and the only solution I found is the same as your's. But that doesn't seem to be the Lift way ;) Anyone knows? -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@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] Hook into snippet creation
Hi all, is there a way to hook into the creation of snippets? I'd like to gain control over their creation. I tried to find something in LiftRules but couldn't find anything that might be suitable for this purpose. But maybe I missed something. Any hints? Cheers, Chris -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@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: Hook into snippet creation
I thought about using a DI framework with Lift, having it manage a snippet's dependencies. On 17 Jan., 21:28, Marius marius.dan...@gmail.com wrote: Why do you need this? Br's, Marius On Jan 17, 10:24 pm, ced docpom...@googlemail.com wrote: Hi all, is there a way to hook into the creation of snippets? I'd like to gain control over their creation. I tried to find something in LiftRules but couldn't find anything that might be suitable for this purpose. But maybe I missed something. Any hints? Cheers, Chris -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@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] Replace HTML element after AJAX call
Hello, I'm wondering if there is a way to replace an HTML element after an AJAX call? I've found the SetHtml JsCmd, but this one replaces the content. But I'd like to replace the element itself. Any idea anyone? -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@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: Replace HTML element after AJAX call
Sorry, but I can't find it. Which version of Lift do you use? I'm using version 1.0. In the scaladoc I can't find it either. On 18 Jan., 18:21, greekscala hellectro...@gmail.com wrote: Hello, I looked at the source and there is JsCmds.Replace which replaces a Node with another. I am always using div as containers for replacement best regards On 18 Jan., 17:41, ced docpom...@googlemail.com wrote: Hello, I'm wondering if there is a way to replace an HTML element after an AJAX call? I've found the SetHtml JsCmd, but this one replaces the content. But I'd like to replace the element itself. Any idea anyone? -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@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: Ajax text onKeyPress
You may try this: def ajaxLiveText(value: String, func: String = JsCmd, attrs: (String, String)*): Elem = { S.fmapFunc(S.SFuncHolder(func)) {funcName = (attrs.foldLeft(input type=text value={value}/)(_ % _)) % (onkeyup - makeAjaxCall(JsRaw(' + funcName + =' + encodeURIComponent(this.value } } It works like SHtml.ajaxText, but calls the server after each key press. Cheers, Chris On 18 Jan., 07:36, Jay Cain cain@gmail.com wrote: Is there a SHtml.ajaxText equivalent that will perfrom an ajax call when the onkeyPress is invoked? I want the ability to query the db to see if a particular username is available or unavailable each time the user types in a letter within the input field. I can only get this accomplished on blur. I tried the following: SHtml.text(user.username, user.username = _) % (onkeyPress - ajaxCall(JE.JsRaw($('#username').attr('value')), s = isUsernameAvailable(s))) } but no bueno Jay C. -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@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: Replace HTML element after AJAX call
Found it in the repository. Thanks! On 18 Jan., 18:46, greekscala hellectro...@gmail.com wrote: Hello, the Replace JsCmd is not present in 1.0. workaround wrap it with an div. best regards On 18 Jan., 18:39, ced docpom...@googlemail.com wrote: Sorry, but I can't find it. Which version of Lift do you use? I'm using version 1.0. In the scaladoc I can't find it either. On 18 Jan., 18:21, greekscala hellectro...@gmail.com wrote: Hello, I looked at the source and there is JsCmds.Replace which replaces a Node with another. I am always using div as containers for replacement best regards On 18 Jan., 17:41, ced docpom...@googlemail.com wrote: Hello, I'm wondering if there is a way to replace an HTML element after an AJAX call? I've found the SetHtml JsCmd, but this one replaces the content. But I'd like to replace the element itself. Any idea anyone? -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@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: Hook into snippet creation
Do you perhaps have an example function at hand? On 19 Jan., 06:12, David Pollak feeder.of.the.be...@gmail.com wrote: On Sun, Jan 17, 2010 at 12:24 PM, ced docpom...@googlemail.com wrote: Hi all, is there a way to hook into the creation of snippets? I'd like to gain control over their creation. I tried to find something in LiftRules but couldn't find anything that might be suitable for this purpose. LiftRules.snippets LiftRules.snippetDispatch No need for DI. You add PartialFunctions and Lift takes care of the rest. But maybe I missed something. Any hints? Cheers, Chris -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/liftweb?hl=en. -- 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 lift...@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] Embedding comet actor in ModalDialog
Hi all, I'm trying to create some sort of progress notification for a long lasting request. The idea is to answer an ajax request with a JqJsCmds.ModalDialog which embeds a comet actor like so: ajaxButton(Start process, () = ModalDialog(divdivProgress/ divlift:comet type=Progress//div)) Unfortunately this doesn't work, the dialog doesn't get displayed. Embedding a normal snippet works just fine though. The code returned in the response to the button click seems ok also. As a workaround I place the comet actor in the page enclosed in a hidden div id=progress-actorlift:comet type=Progress//div. Then I return the ModalDialog(divdivProgress/divdiv id=actor- goes-here/div) along with some JS-code that takes the progress- actor div, moves it into the actor-goes-here div and makes it visible. Does anyone tried something similar? Any help is appreciated... Chris -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@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: Embedding comet actor in ModalDialog
@David: Thanks. Now the approach is clear. Is that your use-case ? so see async intems coming from server only when the dialog is opened? @Marius: Yes, it is. I'd like to display a progressbar in the dialog. It seemed to me quite natural to deliver it (the comet component) along with the dialog, but as I now know that this is not possible, it's really no problem to have it prepared in the page and bring it to life when needed, i.e. make it visible. Another solution would be to redirect to a whole new page with the progressbar on it, but I wanted to look it more like a desktop application. Thanks, Chris On 20 Jan., 23:22, Marius marius.dan...@gmail.com wrote: I really don't see the need for such use-case. I mean if one wants to see async stuff in a dialog only when the dialog is opened this could be easily done via Ajax requests that will activate/deactivate async messages to client by sending from the ajax functions messages to the comet actor. Is that your use-case ? so see async intems coming from server only when the dialog is opened? Br's, Marius On Jan 20, 11:00 pm, ced docpom...@googlemail.com wrote: Hi all, I'm trying to create some sort of progress notification for a long lasting request. The idea is to answer an ajax request with a JqJsCmds.ModalDialog which embeds a comet actor like so: ajaxButton(Start process, () = ModalDialog(divdivProgress/ divlift:comet type=Progress//div)) Unfortunately this doesn't work, the dialog doesn't get displayed. Embedding a normal snippet works just fine though. The code returned in the response to the button click seems ok also. As a workaround I place the comet actor in the page enclosed in a hidden div id=progress-actorlift:comet type=Progress//div. Then I return the ModalDialog(divdivProgress/divdiv id=actor- goes-here/div) along with some JS-code that takes the progress- actor div, moves it into the actor-goes-here div and makes it visible. Does anyone tried something similar? Any help is appreciated... Chris -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@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] Communication between snippet and comet actor via RequestVar
Hi all, I've got the following scenario: A comet actor renders a link like this: SHtml.link(myURL, handleClick, Text(linkText), target - new_window) The handleClick function then stores some information in a RequestVar. Embedded into the page referenced by myURL, is a snippet that accesses the RequestVar. My problem now is that the RequestVar, when accessed by the snippet is always empty. What I know is that the handleClick really stores something into the RequestVar. What am I doing wrong? Any help is appreciated. Thanks, Chris -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@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: Communication between snippet and comet actor via RequestVar
David, thanks for the explanation! Let me explain my use case in more depth. Maybe another solution would be suitable that I don't see. I use the comet actor to display a list of files which is sent by an actor object monitoring a directory in turn. This is done via comet because changes of the monitored directory can happen frequently and it's not suitable for the user to reload the page to look for new files having arrived. Each file should be displayed as a link so you can click on it to get some detailed information. Another approach, which seems not so elegant to me, would be to render links that take the file's name or some sort of file id as a parameter, so that the snippet can resolve it to the file again. - Chris On 29 Jan., 21:40, David Pollak feeder.of.the.be...@gmail.com wrote: CometActors do not have a request context and thus do not support request vars. The function generated during the execution of a CometActor is run in the context of the CometActor. This is an interesting and novel use case... Let me think about it for a little while. On Fri, Jan 29, 2010 at 12:31 PM, ced docpom...@googlemail.com wrote: Hi all, I've got the following scenario: A comet actor renders a link like this: SHtml.link(myURL, handleClick, Text(linkText), target - new_window) The handleClick function then stores some information in a RequestVar. Embedded into the page referenced by myURL, is a snippet that accesses the RequestVar. My problem now is that the RequestVar, when accessed by the snippet is always empty. What I know is that the handleClick really stores something into the RequestVar. What am I doing wrong? Any help is appreciated. Thanks, Chris -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/liftweb?hl=en. -- 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 lift...@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: Communication between snippet and comet actor via RequestVar
David, thanks for taking your time to give such an in-depth explanation. That gave me/all some valuable insights. - Chris On 30 Jan., 00:24, David Pollak feeder.of.the.be...@gmail.com wrote: On Fri, Jan 29, 2010 at 12:56 PM, ced docpom...@googlemail.com wrote: David, thanks for the explanation! Let me explain my use case in more depth. Maybe another solution would be suitable that I don't see. I use the comet actor to display a list of files which is sent by an actor object monitoring a directory in turn. This is done via comet because changes of the monitored directory can happen frequently and it's not suitable for the user to reload the page to look for new files having arrived. Each file should be displayed as a link so you can click on it to get some detailed information. Another approach, which seems not so elegant to me, would be to render links that take the file's name or some sort of file id as a parameter, so that the snippet can resolve it to the file again. This is one approach and likely to be the easiest in the short run... basically, have a SessionVar that maps GUID to file name and just include the GUID as a query param for the new window. We will have to come up with a longer term solution to this issue. The big problem is that Actors are guaranteed to only execute code in one thread. If you have a function that's bound to an Actor's instance variables, having that function execute code on another thread can have catastrophic impact. And there's no way to figure out if the function passed to the SHtml.link() method closed over CometActor instance variables. If it did, the function has to be executed in the context of the CometActor and can't have access to RequestVars. So, my first two ideas will not work: - Have functions passed to link always execute in the Request context rather than the context based on where they were created. - Have functions executed during a full page load (rather than during an Ajax operation) execute in the Request context What we could do is execute the functions synchronously on the CometActor and capture the RequestVar scope from the CometActor and merge that RequestVar context back into the main RequestVar context of the main request servicing thread. Marius -- do you have any thoughts on this issue? - Chris On 29 Jan., 21:40, David Pollak feeder.of.the.be...@gmail.com wrote: CometActors do not have a request context and thus do not support request vars. The function generated during the execution of a CometActor is run in the context of the CometActor. This is an interesting and novel use case... Let me think about it for a little while. On Fri, Jan 29, 2010 at 12:31 PM, ced docpom...@googlemail.com wrote: Hi all, I've got the following scenario: A comet actor renders a link like this: SHtml.link(myURL, handleClick, Text(linkText), target - new_window) The handleClick function then stores some information in a RequestVar. Embedded into the page referenced by myURL, is a snippet that accesses the RequestVar. My problem now is that the RequestVar, when accessed by the snippet is always empty. What I know is that the handleClick really stores something into the RequestVar. What am I doing wrong? Any help is appreciated. Thanks, Chris -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com liftweb%2bunsubscr...@googlegroups.comliftweb%252bunsubscr...@googlegroup s.com . For more options, visit this group at http://groups.google.com/group/liftweb?hl=en. -- 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 lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/liftweb?hl=en. -- 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 lift...@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] addClass / removeClass attribute helper
Sometimes I need to manipulate the class attribute of html elements, adding or removing classes. As I couldn't find any helpers to perform this task I wrote them myself. Maybe someone finds them useful. Cheers, Chris import scala.xml._ /** Add a value to the class attribute, removing any duplicates. */ def addClass(e: Elem, cls: String): Elem = { val m = e.attributes e % ( m(class) match { case null = m append (new UnprefixedAttribute(class, cls, Null)) case classes = m append (new UnprefixedAttribute(class, (Set(classes.text.split(\\s+): _*) + cls) mkString , Null)) }) } /** * Remove a value from the class attribute. If no values remains, the whole class attribute is removed. */ def removeClass(e: Elem, cls: String): Elem = { val m = e.attributes m(class) match { case null = e case classes = Set(classes.text.split(\\s+): _*) - cls match { case s if s.size == 0 = Elem(e.prefix, e.label, m.remove(class), e.scope, e.child: _*) case s = e % m.append(new UnprefixedAttribute(class, s mkString , Null)) } } } -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@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] JSON forms and multiple submit buttons
I've implemented a JSON form similar to the one described in the Lift book. I need two submit buttons, each triggering a different action. So how to distinguish the submits? Unfortunately, the submit buttons themselves are not taken into account for the transferred JSON so that something like input type=submit name=save value=Save/ does not work. With a little bit of Javascript it may be possible to set a hidden input field prior to JSON serialization, but the normal form-with- multiple-submit-buttons approach would definitely be cooler. Would it be possible to support this? Cheers, Chris -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@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] Snippet attribute pass through
I want to set a node attribute in the template markup exactly like it is done in example 7.13 from the Lift Book. I'll paste it here: // the markup lift:Ledger.balance ledger:time ledger:id=myId/ /lift:Ledger.balance // The snippet class class Ledger { def balance (content : NodeSeq ) : NodeSeq = { bind (ledger, content, time - span{(new java.util.Date).toString}/span) } } Unfortunately I can't get it to work. Is there something I have to set/ enable to get this feature working? I'm using Lift 1.1-M8 Thanks, Chris -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@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] JsonHandler capturing state from enclosing snippet
Hi everybody, I'm having a JsonHandler object inside a snippet and I want to access some vals from to enclosing snippet. But unfortunately this doesn't work, because it seems that there is just one single instance per session and class name maintained by Lift. Having a fresh handler per snippet would let me easily capture some state from the enclosing snippet instance, but as the same JsonHandler gets reused in setting up the Javascript for callback, this is not working. Is there a way to remove the registered handler from the session? LiftSession.set and unset aren't accessible for the outside world. Or to enforce to have a new handler everytime? I'm using Lift 1.1-M8. Thanks for any ideas, Chris -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@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: JsonHandler capturing state from enclosing snippet
I've subclassed JsonHandler: abstract class MyJsonHandler extends JsonHandler { private def handlers: (JsonCall, JsCmd) = S.buildJsonFunc(this.apply) override def call: JsonCall = handlers._1 override def jsCmd: JsCmd = handlers._2 } I think that should do what you're suggesting. My handler object now subclasses MyJsonHandler. The problem now, is that the form submission results in creating a new snippet. Because of the captured val is calculated from a request param and this param isn't available any more (it's just there in the request that sets up the page) it crashes. The code in short: class MySnippet { val value = S.param(param).open_! // the actual code is different, just to show that value relies on a req param def head = ... def form(xhtml: NodeSeq): NodeSeq = jsonForm(jsonHandler, xhtml) object jsonHandler extends MyJsonHandler { def apply(in: Any): JsCmd = { // access value } } } - Chris On 11 Feb., 00:50, David Pollak feeder.of.the.be...@gmail.com wrote: On Wed, Feb 10, 2010 at 2:47 PM, ced docpom...@googlemail.com wrote: Hi everybody, I'm having a JsonHandler object inside a snippet and I want to access some vals from to enclosing snippet. But unfortunately this doesn't work, because it seems that there is just one single instance per session and class name maintained by Lift. Having a fresh handler per snippet would let me easily capture some state from the enclosing snippet instance, but as the same JsonHandler gets reused in setting up the Javascript for callback, this is not working. Is there a way to remove the registered handler from the session? LiftSession.set and unset aren't accessible for the outside world. Or to enforce to have a new handler everytime? I'm using Lift 1.1-M8. If you use this: val (call: JsonCall, jsCmd: JsCmd) = S.buildJsonFunc{ case ... = ... } You'll get a new JSON Handler, closed over the variables in your snippet for each new instance of your snippet. Is that what you're looking for? Thanks for any ideas, Chris -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/liftweb?hl=en. -- 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 lift...@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: Transactions with Mapper
Ah great! Thanks! - Chris On Mar 2, 2:37 pm, Jeppe Nejsum Madsen je...@ingolfs.dk wrote: ced docpom...@googlemail.com writes: When I use Mapper outside a request, say in an actor, how do I wrap it in a transaction? I know that I do a S.addAround(DB.buildLoanWrapper) to have transactions within a request. Can anyone provide a simple code snippet? You can use use :-) DB.use(DefaultConnectionIdenfifier) {connection = User.findAll } /Jeppe -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@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: Is CometActor the right tool for this job?
I have a similar use case and from my experience using a CometActor is just great for this. 1) I assume each page get their own instance of the actor so they can hold their own data. Is this correct? Yes. 2) When is a CometActor shutdown? Sometime after the user navigates away from page? CometActors have a time to live. Override override def lifespan: Box[TimeSpan] = Full(2 minutes) in your implementation and when the actor doesn't get queried for that amount of time it receives a shutdown. 3) How do I get access to the CometActor instance on the page? I need to send a message to it from a function bound to e.g. an ajaxSelect You need another Actor that dispatches messages to your CometActors. Say you have ChartCometActor, then implement something like object ChartManager extends Actor { ... } where all your CharCometActors register at creation time. Override localSetup() for this. Also override localShutdown() to unregister. Your snippet function then sends a message to the ChartManager who's responsible for dispatching to all/one actor/s. I use a solution where I register the CometActors an a session basis, so I can send a message either to all or just one CometActor. I have some code available that eases the registration/deregistration and the sending of messages on a per-session basis. Hope that helps, -Chris -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@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: Transactions with Mapper
Another question: Is it possible to nest DB.use? I'd like to have the same behavior as with the @Transaction annotation from Spring. On 2 Mrz., 14:55, ced docpom...@googlemail.com wrote: Ah great! Thanks! - Chris On Mar 2, 2:37 pm, Jeppe Nejsum Madsen je...@ingolfs.dk wrote: ced docpom...@googlemail.com writes: When I use Mapper outside a request, say in an actor, how do I wrap it in a transaction? I know that I do a S.addAround(DB.buildLoanWrapper) to have transactions within a request. Can anyone provide a simple code snippet? You can use use :-) DB.use(DefaultConnectionIdenfifier) {connection = User.findAll } /Jeppe -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@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: Transactions with Mapper
Great! The default behavior with Spring's @Transactional annotation is the propagation of an existing transaction or, if none is active, the creation. So behavior is equal. On 2 Mrz., 17:09, David Pollak feeder.of.the.be...@gmail.com wrote: On Tue, Mar 2, 2010 at 7:03 AM, ced docpom...@googlemail.com wrote: Another question: Is it possible to nest DB.use? I'd like to have the same behavior as with the @Transaction annotation from Spring. DB.use nests. Only when the last DB.use is exited does the transaction commit. I don't know how Spring does stuff. On 2 Mrz., 14:55, ced docpom...@googlemail.com wrote: Ah great! Thanks! - Chris On Mar 2, 2:37 pm, Jeppe Nejsum Madsen je...@ingolfs.dk wrote: ced docpom...@googlemail.com writes: When I use Mapper outside a request, say in an actor, how do I wrap it in a transaction? I know that I do a S.addAround(DB.buildLoanWrapper) to have transactions within a request. Can anyone provide a simple code snippet? You can use use :-) DB.use(DefaultConnectionIdenfifier) {connection = User.findAll } /Jeppe -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/liftweb?hl=en. -- 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 lift...@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: Is CometActor the right tool for this job?
1) I assume each page get their own instance of the actor so they can hold their own data. Is this correct? Yes. No, it's not correct. There's one CometActor of a given type/name per session. Sorry for this. I just hat the relation one page - user (== session) in mind... -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@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: JSON help...
The approach I take to decompose JSON data delivered by JsonHandler (which is in the form of Map[String, _]) is to use extractors that act as converters, so that the code looks pretty much like in Joni's first posting. for{param - json (messageId, IsInt(messageId)) - param} yield ... object IsInt { def unapply(a: String): Option[Int] = try { Some(a.toInt) } catch { case _ = None } } You can set up nice extractors for all kind of types or to automatically urldecode or check strings for being not empty and so on. -Chris On 4 Mrz., 21:52, Joni Freeman freeman.j...@gmail.com wrote: Tried it myself and that version does not work. You probably need nested for-comprehension which parses the JSON: for { user - WorkerMgr.find(UserId(user)) ?~ User not found json - r.json data - Box(for { JField(messageId, JInt(messageId)) - json JField(timestamp, JInt(timemillis)) - json } yield (messageId, timemillis)) } yield ... Cheers Joni On Mar 4, 9:55 pm, Joni Freeman freeman.j...@gmail.com wrote: Hi David, Does this work? for { user - WorkerMgr.find(UserId(user)) ?~ User not found json - r.json JField(messageId, JInt(messageId)) - json JField(timestamp, JInt(timemillis)) - json } yield .. Cheers Joni On Mar 4, 9:28 pm, David Pollak feeder.of.the.be...@gmail.com wrote: Folks, I'm working on parsing through some JSON that's posted/put as part of a request. I'd like to find the messageId field and only get it if its type is JInt. I'm doing this within a for comprehension that has a Box at the top of it, so the resulting expression must play well with Box. What I've got is: for { user - WorkerMgr.find(UserId(user)) ?~ User not found json - r.json (_, messageJson) - (json \ classOf[JField]).find(_._1 == messageId) messageId - Box.asA[JInt](messageJson) (_, timemillisJson) - (json \ classOf[JField]).find(_._1 == timestamp) timemillis - Box.asA[JInt](timemillisJson) } yield ... The lines that look for messageId and timestamp and insure they are JInts are kinda verbose. Is there a better way to do what I'm trying to do? Thanks, David -- 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 lift...@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: Newbie Q: how to append html on ajaxForm submission
There is an AppendHtml object in net.liftweb.http.js.jquery.JqJsCmds that generates a JsCmd. AppendHtml(my-element-id, spanappend me/span) Is this what you're looking for? On 5 Mrz., 09:57, Lukasz Kuczera kuk...@gmail.com wrote: Hi Folks, I've hard time to figure out how to append html snippet after ajaxForm is submitted. I know how to make it in jQuery but i would prefer to have it in one place. My code is:http://pastebin.com/wgAXd2ag I would love to have AppendHtml(afterId: String, body: NodeSeq) method. -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@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: superficial first impressions from a rails junkie
This thread is another nice example of the kindly atmosphere within the Lift community! It's already late so I don't want to join the discussion in detail ;) The only thing I'd like to add to the documentation talk is that I'd really appreciate to have an up-to-date aggregated scaladoc of all the Lift modules at hand. When looking for a new framework or library the first thing I'd like to have a look at after reading the homepage is the javadoc/scaladoc. This always gives me a good impression of the state of a project. Unfortunately this is not very good with Lift. All the links I've found either point to old versions (the prominent one placed on http://liftweb.net/ shows the 1.0 API) or they just show one module with all the links into another modules being broken. Generating a complete scaladoc with mvn site works, but documenation is scattered into pieces located into the various target/site directories. However, I think presenting the API prominently to the outside world is a good (and not so expensive) advertisement for a project at least for the developer audience. Cheers, Chris PS. Keep up the great work! -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@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.