[Lift] Re: Lift vs JSF?
LOL ! On May 19, 7:45 am, Meredith Gregory lgreg.mered...@gmail.com wrote: Marius, No, seriously, tell us how you really feel. ;-) Best wishes, --greg On Mon, May 18, 2009 at 12:22 PM, marius d. marius.dan...@gmail.com wrote: I've been working on JSF projects in the past and IMO lift is nothing like JSF. I wouldn't do another JSF project, period because it is simply pointless as personally I find the whole JSF concet much inferior to Lift and even to Spring + Velocity. ... just a personal rant. Br's, Marius On May 18, 6:56 am, Narayanaswamy, Mohan mohan.narayanasw...@credit- suisse.com wrote: I am learning lift(and so scala) for the past 7 days. Myself and one of my friend were discussing about lift for our new project. When I was introducing the TODO project code and how to setup using mvn. He was able to understand quite easily and I really amazed about it as he is newer to lift than me. He mentioned that lift may actually constructing the object and invoking the method as similar to JSF. He went on saying that, convention makes simpler in Lift, whereas JSF configuration made jsf complex. He even compared how Facelet and Lift template snippet were quite similar. How fare it is true that lift is constructing the object similar to JSF? Is there any relation to JSF and LIFT? Mohan Code we used for our discussion lift:TD.add form=post table tr tdDescription:/td tdtodo:descTo Do/todo:desc/td 19 /tr tr td Priority /td td todo:priority selectoption1/option/select /todo:priority /td /tr tr tdnbsp;/td td todo:submit buttonNew/button /todo:submit /td /tr /table /lift:TD.add == Please access the attached hyperlink for an important electronic communications disclaimer: http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html == -- L.G. Meredith Managing Partner Biosimilarity LLC 1219 NW 83rd St Seattle, WA 98117 +1 206.650.3740 http://biosimilarity.blogspot.com --~--~-~--~~~---~--~~ 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] How to use lift-paypal?
Hi, I would like to use the PayPal module. First: Is it considered production ready? Second: If yes, please point me to some documentation or examples. Thanx Heiko -- My blog: heikoseeberger.name Follow me: twitter.com/hseeberger OSGi on Scala: www.scalamodules.org Lift, the simply functional web framework: liftweb.net --~--~-~--~~~---~--~~ 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 to use lift-paypal?
Hey Heiko, Yes, it's production ready. Currently both PDT and IPN are supported. I'll bash together a sample later if you need one (at work now). Alternitivly, the lift book has a small sample of it's usage. Cheers, Tim Sent from my iPhone On 19 May 2009, at 08:49, Heiko Seeberger heiko.seeber...@googlemail.com wrote: Hi, I would like to use the PayPal module. First: Is it considered production ready? Second: If yes, please point me to some documentation or examples. Thanx Heiko -- My blog: heikoseeberger.name Follow me: twitter.com/hseeberger OSGi on Scala: www.scalamodules.org Lift, the simply functional web framework: liftweb.net --~--~-~--~~~---~--~~ 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 to use lift-paypal?
Hi Tim, Yes, it's production ready. Currently both PDT and IPN are supported. Great! I'll bash together a sample later if you need one (at work now). I would appreciate that a lot! Alternitivly, the lift book has a small sample of it's usage. Yes, but that's indeed very small :-( I have never used PayPal before, hence I could need a little more. Of course that's not the main focus of the book ... Cheers Heiko --~--~-~--~~~---~--~~ 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: Scala Sass Compiler
I'm not quite a SASS fan but this looks pretty cool. If there is a lot of buy in for SASS out there maybe in time it will make sense for Lift to provide SASS support out of the box Br's, Marius On May 19, 6:35 am, David Pollak feeder.of.the.be...@gmail.com wrote: Very nifty stuff. On Mon, May 18, 2009 at 8:09 PM, Derek Williams de...@nebvin.ca wrote: Hi I discovered Scala and Lift about a month ago and have since been porting my webpage over to it from Ruby's Merb framework. Moving from Haml to HTML wasn't much of a problem as my HTML is usually quite simple, but keeping CSS organized is a pain. I liked the nested approach of Sass (which is the CSS side oh Haml) but didn't want to depend on Ruby to compile it to CSS, so as an introduction to parser combinators I bashed together a basic Sass compiler. It is nowhere near 100% compatible, but it compiles my scripts with no problem. To use it in Lift I am currently compiling my Sass files in Boot and storing them in a Map, which is accessed by a custom dispatch function. It is probably not the best solution but I don't know Maven well enough yet to have it compile the Sass files for me. I need to clean up the code quite a bit and document it, but I thought I'd make what I have available if anyone else would rather work with Sass instead of CSS. http://github.com/nebbie/scala-sass-compiler Derek Williams -- Lift, the simply functional web frameworkhttp://liftweb.net Beginning Scalahttp://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] How to use DTO(data transfer object) in lift
Hi, How to use DTO(data transfer object) in lift. e.g In Java ,i have user defined object i.e Employee with name ,address,emp Id, salary,department attribute. i want to display employee details on UI. for that i will make query for Db for particular employee. Will retrieve all attribute and create new employee object above details. So in scala, can we define such employee class(DTO) with getter setter method? is there any other way for this in scala? Thanks in advance --~--~-~--~~~---~--~~ 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: Some DispatchSnippet Qs
David, Aren't I declaring the methods my snippet supports by including them as public methods of the snippet itself? I think that requiring every StatefulSnippet to also be a DispatchSnippet is at odds with the code-by-convention and don't- repeat-yourself principles. If all my dispatch PF does is map each method name to the corresponding method (as in my example), then all I've done is re-implement the default behavior in order to satisfy the compiler. I would prefer that DispatchSnippet and StatefulSnippet were unrelated, allowing the application developer to make the dispatch vs. reflection and stateless vs. stateful choices independently. Is there a technical reason why this would be impossible? I appreciate that you might think it presumptuous of me to show up in this group, having only a few days' experience with Lift and Scala, and opine about the design of the framework. Nevertheless I hope you'll consider my point of view. I like Lift precisely because it isn't rigid and structured. It's powerful but doesn't prescribe a particular web application architecture like every URL invokes a controller or everything is a component. Even the view-first principle is simply the default strategy and can be changed. That's why the StatefulSnippets-DispatchSnippet coupling stands out for me. W On May 18, 10:36 pm, David Pollak feeder.of.the.be...@gmail.com wrote: It's better practice to use DispatchSnippets. Snippets by convention are the easy toe in the water, but once you're dealing with state, etc., you should be graduating to declaring the methods that your snippets support, thus enforcing the DispatchSnippet being the base class of StatefulSnippet. On Mon, May 18, 2009 at 6:04 PM, Willis Blackburn willis.blackb...@gmail.com wrote: I'm back with another question. I see that StatefulSnippet extends DispatchSnippet. I understand what DispatchSnippet is about. But what is the reason that a StatefulSnippet must also be a DispatchSnippet? Aren't these concepts (stateful vs. stateless, dispatch vs. reflection) unrelated? Most of the StatefulSnippet examples that I've seen look like this: class MySnippet extends StatefulSnippet { def dispatch = { case add = add _ case edit = edit _ case foo = foo _ } def add(xhtml : NodeSeq) : ... ... } The dispatch definition doesn't seem to provide much value here. W -- Lift, the simply functional web frameworkhttp://liftweb.net Beginning Scalahttp://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: problems logging
On May 18, 11:52 pm, sailormoo...@gmail.com sailormoo...@gmail.com wrote: I think in your exception handler only Production is defined. Are you running on Production Mode? Aha, I don't think I am. I just use RunWebApp. I'll look into that thanks. --~--~-~--~~~---~--~~ 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: Some DispatchSnippet Qs
Willis, I appreciate your point of view. Getting stuff done more quickly is good. Having a maintainable, flexible code base is good. Sometimes these things are at odds. I've found that over my various projects, using DispatchSnippets is better. They tend to lead to fewer bugs. That's why I think it's a better practice to use them. Let's look at a couple of examples: class MySnippet { def doIt(in: NodeSeq): NodeSeq = bind(s, in, a - b) } class MyDispSnip extends DispatchSnippet { def dispatch = Map(doIt - doIt _) def doIt(in: NodeSeq): NodeSeq = bind(s, in, a - b) } Or, if I'm feeling DRY: object MyDS extends DispatchSnippet { def dispatch = { case doIt = bind(s, _, a - b) } } Ooo... in the last example, we didn't even have to define our parameter name or type or the return type... so technically, it's the most DRY of all. :-) In all seriousness, I appreciate your comments and perspective. It's good to hear from newbies. And I really do appreciate the balance between convention and configuration. I am gently pushing toward configuration because it's been my experience that in this case, it works better. Thanks, David On Tue, May 19, 2009 at 3:32 AM, Willis Blackburn willis.blackb...@gmail.com wrote: David, Aren't I declaring the methods my snippet supports by including them as public methods of the snippet itself? I think that requiring every StatefulSnippet to also be a DispatchSnippet is at odds with the code-by-convention and don't- repeat-yourself principles. If all my dispatch PF does is map each method name to the corresponding method (as in my example), then all I've done is re-implement the default behavior in order to satisfy the compiler. I would prefer that DispatchSnippet and StatefulSnippet were unrelated, allowing the application developer to make the dispatch vs. reflection and stateless vs. stateful choices independently. Is there a technical reason why this would be impossible? I appreciate that you might think it presumptuous of me to show up in this group, having only a few days' experience with Lift and Scala, and opine about the design of the framework. Nevertheless I hope you'll consider my point of view. I like Lift precisely because it isn't rigid and structured. It's powerful but doesn't prescribe a particular web application architecture like every URL invokes a controller or everything is a component. Even the view-first principle is simply the default strategy and can be changed. That's why the StatefulSnippets-DispatchSnippet coupling stands out for me. W On May 18, 10:36 pm, David Pollak feeder.of.the.be...@gmail.com wrote: It's better practice to use DispatchSnippets. Snippets by convention are the easy toe in the water, but once you're dealing with state, etc., you should be graduating to declaring the methods that your snippets support, thus enforcing the DispatchSnippet being the base class of StatefulSnippet. On Mon, May 18, 2009 at 6:04 PM, Willis Blackburn willis.blackb...@gmail.com wrote: I'm back with another question. I see that StatefulSnippet extends DispatchSnippet. I understand what DispatchSnippet is about. But what is the reason that a StatefulSnippet must also be a DispatchSnippet? Aren't these concepts (stateful vs. stateless, dispatch vs. reflection) unrelated? Most of the StatefulSnippet examples that I've seen look like this: class MySnippet extends StatefulSnippet { def dispatch = { case add = add _ case edit = edit _ case foo = foo _ } def add(xhtml : NodeSeq) : ... ... } The dispatch definition doesn't seem to provide much value here. W -- Lift, the simply functional web frameworkhttp://liftweb.net Beginning Scalahttp://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 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: Menus active/inactive with/without redirect
Sorry... got swamped with other things... hope to work on it Weds or Thurs. On Fri, May 15, 2009 at 4:14 PM, denew de...@clear.net.nz wrote: David, Hope I haven't offended protocols, just not sure the best way to send this. I've just uploaded a teensy mod to hello-lift (hello-lift-denew) which should show what I'm waffling on about. I do appreciate your help, but please don't spend too much time on it - I'm sure you have bigger fish to fry On May 16, 9:38 am, David Pollak feeder.of.the.be...@gmail.com wrote: Can you put together a super-simple project that demonstrates what you want to do and I'll work it up so the menus highlight the right way. On Fri, May 15, 2009 at 1:49 PM, denew de...@clear.net.nz wrote: No - the menus should always show, but be inactive when you are on that page. For example, 'Home' is not selectable when you are on the Home page. This seems to be the default behaviour and is exactly right. Other 'simple' pages (i.e. just accessing a template, no redirects in Boot) work the same way. It seems however, that in the presence of a redirect, the original menu stays selectable after landing. To be consistent it should still appear, but be inactive. I didn't include this line in my original post... Menu(Loc(product_redirect_target, (content :: product :: Nil) - true, Product Redirect, Hidden)) :: ... but it was there. As I say everything 'works' ok and I can live with it - it just looks a bit inconsistent On May 16, 6:01 am, David Pollak feeder.of.the.be...@gmail.com wrote: You might try putting a Hidden object on the specials menu... that way it won't show up... is this what you mean? On Thu, May 14, 2009 at 10:35 PM, denew de...@clear.net.nz wrote: A few days new to Lift, but stumbling along ok. A small issue (I hope this abbrv. code is sufficient): ... Menu(Loc(specials, (content :: specials :: Nil) - true, Specials)) :: ... case RewriteRequest(ParsePath(content :: specials :: page :: Nil, _, _,_), _, _) = RewriteResponse(List(content, product, index), Map (page - page, category - specials)) I have a number of categories that redirect to the same page. On this page there is then the usual paging (next, last, numbers, etc.). All other menu items that are not redirected (i.e. just 'normal' ones) 'grey out' (as they should--nice) when accessed, but this doesn't. Its a minor, because paging and categories work happily as expected, but it looks wrong to see that menu still active when other page's aren't after landing Clear as mud I suppose... -- Lift, the simply functional web frameworkhttp://liftweb.net Beginning Scalahttp://www.apress.com/book/view/1430219890 Follow me:http://twitter.com/dpp Git some:http://github.com/dpp-Hide quoted text - - Show quoted text - -- Lift, the simply functional web frameworkhttp://liftweb.net Beginning Scalahttp://www.apress.com/book/view/1430219890 Follow me:http://twitter.com/dpp Git some:http://github.com/dpp- Hide quoted text - - Show quoted text - -- 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: Odd Jetty failure during ToDo tutorial
Are you running on OS X by any chance? I sometimes get 138 and from what I've found it appears to be a combo of Apple's Java and Maven 2.0.9. The solution, albeit ham-fisted, is to simply run the command again. I have not tested 2.0.10 or SoyLatte, but I will as soon as I have time. On May 19, 5:49 am, Paul Caton pnca...@gmail.com wrote: I have been following the Starting with Lift tutorial, on a MacBook Pro with MacOs 10.5, Java 1.5, and Maven 2.0.9. I am working on the ToDo application, and the initial build went fine. I then got to Section 2.8, the second time for issuing mvn jetty:run. This time I got the following error: [ERROR] BUILD FAILURE [INFO] [INFO] command line returned non-zero value:138 I took the offered advice and ran the command again with the -e switch, but instead of getting the error again with more info, Jetty went ahead and created the todo table in the database and started the server as normal. I haven't used Jetty much so this behaviour is new to me. Does this have anything at all to do with the Lift code, or is it just a wierdness unrelated to the tutorial? Thanks, Paul. --~--~-~--~~~---~--~~ 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: Odd Jetty failure during ToDo tutorial
As a quick follow-up, I just jump to mvn 2.1.0 and two builds resulted in no 138 errors. Can you give that a shot? Below are my Java, Scala and Maven versions. ~/g/liftweb [master] ] java -version java version 1.5.0_16 Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_16- b06-284) Java HotSpot(TM) Client VM (build 1.5.0_16-133, mixed mode, sharing) ~/g/liftweb [master] ] scala -version Scala code runner version 2.7.4.final -- Copyright 2002-2009, LAMP/ EPFL ~/g/liftweb [master] ] mvn -version Apache Maven 2.1.0 (r755702; 2009-03-18 15:10:27-0400) Java version: 1.5.0_16 Java home: /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/ Home Default locale: en_US, platform encoding: MacRoman OS name: mac os x version: 10.5.7 arch: i386 Family: unix On May 19, 10:28 am, TylerWeir tyler.w...@gmail.com wrote: Are you running on OS X by any chance? I sometimes get 138 and from what I've found it appears to be a combo of Apple's Java and Maven 2.0.9. The solution, albeit ham-fisted, is to simply run the command again. I have not tested 2.0.10 or SoyLatte, but I will as soon as I have time. On May 19, 5:49 am, Paul Caton pnca...@gmail.com wrote: I have been following the Starting with Lift tutorial, on a MacBook Pro with MacOs 10.5, Java 1.5, and Maven 2.0.9. I am working on the ToDo application, and the initial build went fine. I then got to Section 2.8, the second time for issuing mvn jetty:run. This time I got the following error: [ERROR] BUILD FAILURE [INFO] [INFO] command line returned non-zero value:138 I took the offered advice and ran the command again with the -e switch, but instead of getting the error again with more info, Jetty went ahead and created the todo table in the database and started the server as normal. I haven't used Jetty much so this behaviour is new to me. Does this have anything at all to do with the Lift code, or is it just a wierdness unrelated to the tutorial? Thanks, Paul. --~--~-~--~~~---~--~~ 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: MappedDecimal question
Cool. Glad it was that simple :) On Mon, May 18, 2009 at 11:12 PM, Andrew Scherpbier and...@scherpbier.orgwrote: Thanks Derek! I hadn't noticed the bigDecimal member of scala.BigDecimal. (I'm still so used to looking for explicit getter methods!) I now have my code do this: Text(String.format($%,.2f, item.amount.bigDecimal)) instead of my old Text(item.amount.toString) --Andrew Derek Chen-Becker wrote: The BigDecimal value of a MappedDecimal field is Scala's BigDecimal, which itself wraps the Java BigDecimal. At the very least you can use java.text.DecimalFormat to format the underlying java.math.BigDecimal. Let me know if you have any further questions. Derek On Mon, May 18, 2009 at 6:19 PM, Andrew Scherpbier and...@scherpbier.orgwrote: How does one format a BigDecimal? I don't want to .toString()... I'm using a MappedDecimal and I would to format its value. I've tried using java.lang.String.format() but it doesn't know what a scala.BigDecimal is... Help! BTW, I'm using 1.1-SNAPSHOT --Andrew --~--~-~--~~~---~--~~ 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 to use lift-paypal?
If Tim puts together an expanded example I can add it to the (growing) list of things to add back into the book. Derek On Tue, May 19, 2009 at 2:52 AM, Heiko Seeberger heiko.seeber...@googlemail.com wrote: Hi Tim, Yes, it's production ready. Currently both PDT and IPN are supported. Great! I'll bash together a sample later if you need one (at work now). I would appreciate that a lot! Alternitivly, the lift book has a small sample of it's usage. Yes, but that's indeed very small :-( I have never used PayPal before, hence I could need a little more. Of course that's not the main focus of the book ... Cheers Heiko --~--~-~--~~~---~--~~ 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 to use DTO(data transfer object) in lift
You should be able to define getters and setters on a Scala class just like you would in Java and it should work just fine. That's one of the was that you can set up your entities for JPA, too. For example: @Entity class Person { private var id : Long = _ private var name = @Id def getId() = id def setId(nid : Long) { id = nid } @Basic{ val optional = false } def getName() = name def setName(nname : String) { name = nname } } Derek On Tue, May 19, 2009 at 3:07 AM, pravin pravinka...@gmail.com wrote: Hi, How to use DTO(data transfer object) in lift. e.g In Java ,i have user defined object i.e Employee with name ,address,emp Id, salary,department attribute. i want to display employee details on UI. for that i will make query for Db for particular employee. Will retrieve all attribute and create new employee object above details. So in scala, can we define such employee class(DTO) with getter setter method? is there any other way for this in scala? Thanks in advance --~--~-~--~~~---~--~~ 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: Lift and interoperability
Sounds good. Don't hesitate to ask questions if you run into issues or if there's something not clear in the API. Derek On Tue, May 19, 2009 at 3:08 AM, rintcius rintc...@gmail.com wrote: I have decided to develop a little example project that looks at using scala from the perspective of java enterprise developers. My first objective is to just translate all the java into scala, but the very next thing i would like to explore is how to plug in Lift components. I would guess that will give some more insight in how Lift can interoperate with other JVM enterprise components. I'll come back to this list when I have got something. Regards, Rintcius --~--~-~--~~~---~--~~ 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: problems logging
If you want the exception handling in all modes, just change your code to case (_, Req(path, , GetRequest), exception) The _ acts as a wildcard for the mode. Derek On Tue, May 19, 2009 at 5:12 AM, Channing Walton channingwal...@mac.comwrote: On May 18, 11:52 pm, sailormoo...@gmail.com sailormoo...@gmail.com wrote: I think in your exception handler only Production is defined. Are you running on Production Mode? Aha, I don't think I am. I just use RunWebApp. I'll look into that thanks. --~--~-~--~~~---~--~~ 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: Scala Sass Compiler
I'm new to the list - just learning Scala through David's book and hopefully Lift soon since I really like some of the design choices. I am a former Java developer who has been doing Rails development for the past 2 years. I came upon Sass about a year ago and really like the way it helps to dry up my CSS - so much easier to maintain. I would have used Sass in any Lift project no matter what, but if it was there out of the box that would be even cooler. Mark Lynn On May 19, 2009, at 7:45 AM, marius d. wrote: I'm not quite a SASS fan but this looks pretty cool. If there is a lot of buy in for SASS out there maybe in time it will make sense for Lift to provide SASS support out of the box Br's, Marius On May 19, 6:35 am, David Pollak feeder.of.the.be...@gmail.com wrote: Very nifty stuff. On Mon, May 18, 2009 at 8:09 PM, Derek Williams de...@nebvin.ca wrote: Hi I discovered Scala and Lift about a month ago and have since been porting my webpage over to it from Ruby's Merb framework. Moving from Haml to HTML wasn't much of a problem as my HTML is usually quite simple, but keeping CSS organized is a pain. I liked the nested approach of Sass (which is the CSS side oh Haml) but didn't want to depend on Ruby to compile it to CSS, so as an introduction to parser combinators I bashed together a basic Sass compiler. It is nowhere near 100% compatible, but it compiles my scripts with no problem. To use it in Lift I am currently compiling my Sass files in Boot and storing them in a Map, which is accessed by a custom dispatch function. It is probably not the best solution but I don't know Maven well enough yet to have it compile the Sass files for me. I need to clean up the code quite a bit and document it, but I thought I'd make what I have available if anyone else would rather work with Sass instead of CSS. http://github.com/nebbie/scala-sass-compiler Derek Williams -- Lift, the simply functional web frameworkhttp://liftweb.net Beginning Scalahttp://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] Which lift version should I be using
I was using lift 1.1-SNAPSHOT,which I had in my local repository. There is a version 1.1-M1 on http://scala-tools.org/repo-releases. Should I be using that, or is there another repository that I should use in my POM? Glenn... --~--~-~--~~~---~--~~ 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: Redirect after login
David, I'm sorry too, because I was already using loginReferer.is. The problem is the loginReferer.remove line has to be removed for the redirect to work. Don't know why. You would think the ret var would stay put, but it doesn't. Glenn... On May 18, 3:57 pm, David Pollak feeder.of.the.be...@gmail.com wrote: Glenn, Sorry... my mistake... the following code works: object loginReferer extends SessionVar(/) override def homePage = { var ret = loginReferer.*is* loginReferer.remove() ret } override def login = { for (r - S.referer if loginReferer.is == /) loginReferer.set(r) super.login } Note the is which extracts the contents from the SessionVar before it's reset. On Sun, May 17, 2009 at 10:30 AM, glenn gl...@exmbly.com wrote: David, I was a little puzzled by the line, in the override of def homePage, of loginReferer.remove(). This actually resets the homePage to /. Removing the line has the intended result. But, then I need a way to reset the loginReferer session variable. Yeah... the reset happened before the old value was removed from the SessionVar. The above code fixes the problem. Better still, it would be nice to be able to create additional stateful parameter maps, something like Seam's conversation state, which would make creation of wizards a breeze. There's some of that we StatefulSnippets... seehttp://demo.liftweb.net/arc I'm hoping that we'll get full wizard support in Lift for 1.1 (seehttps://www.lostlake.org/wizard.wmvexcept using a DSL like SiteMap rather than XML). This brings up another point. The only way I trust to trace the code to determine what's going on is the old-fashioned way, of putting in a bunch of println statements in my code. With lift's flow back-and- forth between templates, which are really client-side, and snippets, which are on the server, normal java debugging tools just doesn't work. That's strange. There's nothing rendered to the client until all the template stuff is fully rendered (the templates are processed by the server and the snippets are invoked as the lift:xxx/ tags are encountered during the first re-write phase of template process.) People have had success setting breakpoints in Eclipse, NetBeans and IntelliJ in Lift apps. I use println personally. Thanks, David This makes developing a slow process and can even offset the gains lift brings to coding efficiency. What do you, and other's use for debugging that might help. Thanks in advance for your assistance. Glenn... On May 15, 3:35 pm, David Pollak feeder.of.the.be...@gmail.com wrote: In your User object, do the following: object loginReferer extends SessionVar(/) override def homePage = { var ret = loginReferer loginReferer.remove() ret } override def login = { for (r - S.referer if loginReferer.is == /) loginReferer.set(r) super.login } So, we're setting up a session variable the keeps track of the referer to the login page. We define the homePage method to return this page, but reset after use. And we override the login method to record the referer. On Fri, May 15, 2009 at 3:11 PM, glenn gl...@exmbly.com wrote: I'm using ProtoUser. But even so, I thought that I might have to create a bunch of separate login pages, each using the loginXhtml form so that action={S.uri} would generate the links to match with the cases. In that way I could do the redirection. But that seems convoluted, to me. This goes back to using EarlyAccess on a menu item, redirecting to the appropriate login page, and then once the user logs in, he is immediately taken to a new page rather than back to /index. Really, what I'm trying to do is create a wizard widget or sorts, to perform a sequence of tasks with a finish button on the last page. Glenn... On May 15, 2:43 pm, David Pollak feeder.of.the.be...@gmail.com wrote: On your login page, you can capture the referer and then redirect to the refering page on successful login. Are you using ProtoUser or are you rolling your own login page? On Fri, May 15, 2009 at 1:27 PM, glenn gl...@exmbly.com wrote: If I wanted to redirect the user to a different page, depending on what page they were on when they initiated a login, does anyone know of a good solution? I'm thinking I need to use a DispatchLocSnippets and define different dispatch case functions. But I'm not clear how best to go about it? Would I need different login pages for each case, or is there a cleaner way in which I can use a single login page for job? Glenn... -- Lift, the simply functional web frameworkhttp://liftweb.net Beginning Scalahttp://www.apress.com/book/view/1430219890 Follow me:http://twitter.com/dpp Git some:http://github.com/dpp --
[Lift] Re: Redirect after login
David, Just a quick followup, this code actually does what I want, although I still have yet to reset the loginReferer SessionVar back to the default. override def homePage = { var ret = loginReferer.is loginReferer.substring(loginReferer.toString.lastIndexOf('/') + 1) match { case group = ret = Company.createPathString case _ = ret = loginReferer.is } ret } On May 19, 9:08 am, glenn gl...@exmbly.com wrote: David, I'm sorry too, because I was already using loginReferer.is. The problem is the loginReferer.remove line has to be removed for the redirect to work. Don't know why. You would think the ret var would stay put, but it doesn't. Glenn... On May 18, 3:57 pm, David Pollak feeder.of.the.be...@gmail.com wrote: Glenn, Sorry... my mistake... the following code works: object loginReferer extends SessionVar(/) override def homePage = { var ret = loginReferer.*is* loginReferer.remove() ret } override def login = { for (r - S.referer if loginReferer.is == /) loginReferer.set(r) super.login } Note the is which extracts the contents from the SessionVar before it's reset. On Sun, May 17, 2009 at 10:30 AM, glenn gl...@exmbly.com wrote: David, I was a little puzzled by the line, in the override of def homePage, of loginReferer.remove(). This actually resets the homePage to /. Removing the line has the intended result. But, then I need a way to reset the loginReferer session variable. Yeah... the reset happened before the old value was removed from the SessionVar. The above code fixes the problem. Better still, it would be nice to be able to create additional stateful parameter maps, something like Seam's conversation state, which would make creation of wizards a breeze. There's some of that we StatefulSnippets... seehttp://demo.liftweb.net/arc I'm hoping that we'll get full wizard support in Lift for 1.1 (seehttps://www.lostlake.org/wizard.wmvexceptusing a DSL like SiteMap rather than XML). This brings up another point. The only way I trust to trace the code to determine what's going on is the old-fashioned way, of putting in a bunch of println statements in my code. With lift's flow back-and- forth between templates, which are really client-side, and snippets, which are on the server, normal java debugging tools just doesn't work. That's strange. There's nothing rendered to the client until all the template stuff is fully rendered (the templates are processed by the server and the snippets are invoked as the lift:xxx/ tags are encountered during the first re-write phase of template process.) People have had success setting breakpoints in Eclipse, NetBeans and IntelliJ in Lift apps. I use println personally. Thanks, David This makes developing a slow process and can even offset the gains lift brings to coding efficiency. What do you, and other's use for debugging that might help. Thanks in advance for your assistance. Glenn... On May 15, 3:35 pm, David Pollak feeder.of.the.be...@gmail.com wrote: In your User object, do the following: object loginReferer extends SessionVar(/) override def homePage = { var ret = loginReferer loginReferer.remove() ret } override def login = { for (r - S.referer if loginReferer.is == /) loginReferer.set(r) super.login } So, we're setting up a session variable the keeps track of the referer to the login page. We define the homePage method to return this page, but reset after use. And we override the login method to record the referer. On Fri, May 15, 2009 at 3:11 PM, glenn gl...@exmbly.com wrote: I'm using ProtoUser. But even so, I thought that I might have to create a bunch of separate login pages, each using the loginXhtml form so that action={S.uri} would generate the links to match with the cases. In that way I could do the redirection. But that seems convoluted, to me. This goes back to using EarlyAccess on a menu item, redirecting to the appropriate login page, and then once the user logs in, he is immediately taken to a new page rather than back to /index. Really, what I'm trying to do is create a wizard widget or sorts, to perform a sequence of tasks with a finish button on the last page. Glenn... On May 15, 2:43 pm, David Pollak feeder.of.the.be...@gmail.com wrote: On your login page, you can capture the referer and then redirect to the refering page on successful login. Are you using ProtoUser or are you rolling your own login page? On Fri, May 15, 2009 at 1:27 PM, glenn gl...@exmbly.com wrote: If I wanted to redirect the user to a different page, depending on what page they were on when they initiated a
[Lift] Re: Which lift version should I be using
I asked something similar some days ago (Subject: Schedule for 1.1).I am using 1.1-SNAPSHOT and that's doing fine ... Heiko 2009/5/19 glenn gl...@exmbly.com I was using lift 1.1-SNAPSHOT,which I had in my local repository. There is a version 1.1-M1 on http://scala-tools.org/repo-releases. Should I be using that, or is there another repository that I should use in my POM? Glenn... -- My blog: heikoseeberger.name Follow me: twitter.com/hseeberger OSGi on Scala: www.scalamodules.org Lift, the simply functional web framework: liftweb.net --~--~-~--~~~---~--~~ 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] Lift vulnerable to HPP?
Hello, just out of curiosity is Lift vulnerable to http parameter pollution? It was demoed at OWASP by two italian researchers. http://blog.mindedsecurity.com/2009/05/http-parameter-pollution-new-web-attack.html Cheers, Tom --~--~-~--~~~---~--~~ 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: Lift vulnerable to HPP?
On Tue, May 19, 2009 at 10:18 AM, Tom Arnold t0m4rn...@gmail.com wrote: Hello, just out of curiosity is Lift vulnerable to http parameter pollution? Lift is built on Scala, so by default, it's strongly typed, thus half the HPP attacks (causing an Array to be sent to a method expecting a String) disappear. Lift's rules for decoding parameters are stable and well defined. If you do an S.param(name) and there were multiple name parameters passed in, you'll get the head of the List which is the first parameter decoded from the URL-encoded POST or GET. The place where things might be strange is in the processing of form elements. If you do something like: SHtml.text(, funcToBeCalledOnFormSubmission _), the function will be called twice if there are two copies of the parameter in the request. I can change this behavior... I should probably change this behavior. In general, however, Lift apps are more resistant to this kind of attack because (1) Lift encorages keeping state on the server and refering to it with opaque identifiers (2) Lift's opaque identifiers are unique for each request making it difficult to build a bot that will spoof them and (3) Lift is built on top of Scala, which is strongly typed, so you always know what the type of the parameter is. It was demoed at OWASP by two italian researchers. http://blog.mindedsecurity.com/2009/05/http-parameter-pollution-new-web-attack.html Cheers, Tom -- 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: problems logging
On May 17, 10:33 pm, Timothy Perrett timo...@getintheloop.eu wrote: Can you verify the log4j.xml file is being read? On Mon, May 18, 2009 at 9:38 PM, Channing Walton channingwal...@mac.com wrote: Not sure how I can tell. Specifying -Dlog4j.debug on the command line should prompt log4j to tell you what it's doing. Martin --~--~-~--~~~---~--~~ 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: Trouble with lift, GAE, JPA, adding child records
Sorry for the delay in responding. My question was not about transaction API, my question was a practical one: If form processing is split into a bunch of little anonymous functions, how can you put them in a try/finally? On May 15, 1:59 pm, Derek Chen-Becker dchenbec...@gmail.com wrote: EntityManager has a getTransaction method that you can use along with the constructor I mentioned previously to explicitly begin and end transactions in your code. derek On Fri, May 15, 2009 at 11:45 AM, ngug naftoli...@gmail.com wrote: One entity group per transaction is a GAE requirement. But my question about handling transactions was more specific - because form processing is specified piecemeal in separate closures, you can't use the normal try/finally. It seems a little too much effort to create a hidden field before and after every form/subform. Thanks. P.S. Sorry about the triple post. Opera Mobile (well, Google) didn't tell me the post was successful like it usually does, so I thought it didn't go through. (I thought the list is moderated and you would filter the extras just in case.) --~--~-~--~~~---~--~~ 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] dsl archetype moved to my github
Lifted, i've refactored things so that the DSL-archetype is now on github (git clone git://github.com/leithaus/stockholm.git) and the rlambda project is on google code. i've been attempting to remove the BNFC dependency from rlambda, and it would be done by now, but the commit for the changes to the pom.xml is failing. The idea is that rlambda should just work as a project -- without any dependencies on BNFC, which drags in a dependency on Haskell, Happy and Alex. For a little while the DSL-archetype will suffer these dependencies until i've got a functioning meta-compiler-compiler. Best wishes, --greg -- L.G. Meredith Managing Partner Biosimilarity LLC 1219 NW 83rd St Seattle, WA 98117 +1 206.650.3740 http://biosimilarity.blogspot.com --~--~-~--~~~---~--~~ 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: Trouble with lift, GAE, JPA, adding child records
Well, typically the form callbacks are just setting values. If they're more complex than that then you would need a try/catch in each function. I don't think that the current form processing code has any facility for a per-form exception handler, although that might be a useful feature. Derek On Tue, May 19, 2009 at 1:09 PM, ngug naftoli...@gmail.com wrote: Sorry for the delay in responding. My question was not about transaction API, my question was a practical one: If form processing is split into a bunch of little anonymous functions, how can you put them in a try/finally? On May 15, 1:59 pm, Derek Chen-Becker dchenbec...@gmail.com wrote: EntityManager has a getTransaction method that you can use along with the constructor I mentioned previously to explicitly begin and end transactions in your code. derek On Fri, May 15, 2009 at 11:45 AM, ngug naftoli...@gmail.com wrote: One entity group per transaction is a GAE requirement. But my question about handling transactions was more specific - because form processing is specified piecemeal in separate closures, you can't use the normal try/finally. It seems a little too much effort to create a hidden field before and after every form/subform. Thanks. P.S. Sorry about the triple post. Opera Mobile (well, Google) didn't tell me the post was successful like it usually does, so I thought it didn't go through. (I thought the list is moderated and you would filter the extras just in case.) --~--~-~--~~~---~--~~ 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: Trouble with lift, GAE, JPA, adding child records
Thanks for the fast response! Okay, a couple of things: 1. Well, typically the form callbacks are just setting values. If they're more ... (I take that to mean that setting entity properties does not require a transaction? I thought that in JPA entities are generally monitored for modifications? Is that a mistake?) Look at my code for setting the location. def bindLocation(loc: NatureLocationType) = { var l = loc bind(location, chooseTemplate(each, location, xhtml), id - SHtml.hidden(()= l = NatureLocationType.lookup (loc.id)), name - SHtml.text(l.name, l.name = _), allowStreet - SHtml.checkbox(l.allowStreet, l.allowStreet = _), allowHospital - SHtml.checkbox(l.allowHospital, l.allowHospital = _), allowDoctor - SHtml.checkbox(l.allowDoctor, l.allowDoctor = _), allowEquipment - SHtml.checkbox(l.allowEquipment, l.allowEquipment = _), removeBtn - SHtml.submit(?(Remove), ()=removeLocation(l)) ) } Because the entity manager is closed after each request, the location has to be reloaded in order to be modified. So loading it has to be done in a transaction, but can I end the transaction before I set the properties? 2. In the mean time I made my own whole-form processor. Unfortunately it's a little verbose to use. Here's the code (currently only supports text boxed and check boxes, and string values and boolean values, but it's very easy to extend): import scala.xml.{Group, Elem, NodeSeq} import scala.collection.mutable.{Map = mMap} import net.liftweb.http.SHtml import net.liftweb.util.{Helpers, Full, Empty} import Helpers._ abstract class FormProcessor(prefix: String) { def text(attrs: (String, String)*)(init: String, action: String=Unit) = SHtml.text(init, action, attrs:_*) def text: (String,String=Unit)=NodeSeq = text()_ def checkbox(attrs: (String, String)*)(init: Boolean, action: Boolean=Unit) = SHtml.checkbox(init, action, attrs:_*) def checkbox: (Boolean, Boolean=Unit)=NodeSeq = checkbox()_ val stringValues: mMap[String, String] = mMap.empty[String, String] val strings = mMap.empty[String, (String,String=Unit)=NodeSeq] val booleanValues = mMap.empty[String, Boolean] val booleans = mMap.empty[String, (Boolean,Boolean=Unit)=NodeSeq] def bind(xhtml: NodeSeq) = { def transform(node: NodeSeq): NodeSeq = { put node match { case Elem(`prefix`, label, _, _, _*) if strings.keys contains label = strings(label)(stringValues(label), stringValues(label) = _) case Elem(`prefix`, label, _, _, _*) if booleans.keys contains label = booleans(label)(booleanValues(label), booleanValues(label) = _) case other = other } } Helpers.bind(prefix, Full(transform _), Empty, xhtml) ++ Seq(SHtml.hidden(()=get)) } def put: Unit def get: Unit } And here's some usage: def bindLocation(loc: NatureLocationType) = { var l = loc val form = new lrbcol.FormProcessor(location) { strings += (name - text) booleans ++= Map(allowStreet-checkbox, allowHospital-checkbox, allowDoctor-checkbox, allowEquipment-checkbox) def put { stringValues(name) = l.name booleanValues ++= Map(allowStreet - l.allowStreet, allowHospital - l.allowHospital, allowDoctor - l.allowDoctor, allowEquipment - l.allowEquipment) } def get = transaction { val l = NatureLocationType.lookup(loc.id) l.name = stringValues(name) l.allowStreet = booleanValues(allowStreet) l.allowHospital = booleanValues(allowHospital) l.allowDoctor = booleanValues(allowDoctor) l.allowEquipment = booleanValues(allowEquipment) } } bind(location, form.bind(chooseTemplate(each, location, xhtml)), removeBtn - SHtml.submit(?(Remove), ()=removeLocation (NatureLocationType.lookup(loc.id))) ) } If you have a better way of implementing it, let me know. Feel free to include it in lift, unmodified or modified. 3. I'll put it in the next post because it's somewhat separate. On May 19, 3:20 pm, Derek Chen-Becker dchenbec...@gmail.com wrote: Well, typically the form callbacks are just setting values. If they're more complex than that then you would need a try/catch in each function. I don't think that the current form processing code has any facility for a per-form exception handler, although that might be a useful feature. Derek On Tue, May 19, 2009 at 1:09 PM, ngug naftoli...@gmail.com wrote: Sorry for the delay in responding. My question was not about transaction API, my question was a practical one: If form processing is split into a bunch of little anonymous functions, how can you put them in a try/finally? On May 15, 1:59 pm, Derek Chen-Becker
[Lift] Re: Trouble with lift, GAE, JPA, adding child records
בה using the FormProcessor, all my exceptions seem to have disappeared. Now I have a problem, that although seems to be a separate problem is very much intertwined with everything else and I think it's really one issue. The page basically looks like this: Nature Name: [text field] Locations: Name Allow St. Addr Allow Hosp. Addr Allow Doc. Allow Eqpmt Loc [text field] [X] [X] [ ] [ ][[Remove button]] [[Insert Row button]] [[Save button]] And you can add/remove locations, e.g. for nature Hospital Visitation you would have one location, called Location or Hospital which is only allowed to be a hospital (when you enter the request you'll get drop-downs). A Food delivery might have a From and a To, which can be street addresses, hospital rooms, or even a doctor's office, but it wouldn't let you select an equipment location. Now, this app is being rewritten, after I started it in PHP. In the PHP version (I didn't know how to use multiple submit buttons then) adding and removing rows was done via a link, so it discarded any modifications you made to locations. (I'm trying to stay away from relying on Javascript). Now, with Lift, they are buttons, and so any modifications you make to locations are saved to the datastore immediately upon pressing them, because the page needs to reload with these locations. But neither of these behaviors is optimal. Really, it should keep track of your changes but only send them to the datastore when you explicitly press Save. But the page can get reloaded via Remove/Insert Row in between. Okay, so I made another RequestVar to hold pending new rows and rows pending removal, and it shows the page as if they were added and removed. But what happens if you modify the properties of a location and then insert a row? Modifying the location that that field was mapped to is pointless, because we don't want to merge it yet, but we're going to have to reload it from the datastore in a future request cycle, before we are able to merge it, because it doesn't seem to be able to merge an entity that was detached the last time the entity manager was closed. What am I supposed to do? Store everything in a fake (never persisted) nature/locations and then copy all the differences to the managed entity when processing the Save submit button? I hope you understand my question, let me know what needs clarification. Thanks a ton! --~--~-~--~~~---~--~~ 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: Trouble with lift, GAE, JPA, adding child records
P.S. I wrote a method to handle the boilerplate of opening/closing/ checking whether to rollback transactions. Shouldn't ScalaJPA have such a method? Or does it? Thanks. --~--~-~--~~~---~--~~ 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: Trouble with lift, GAE, JPA, adding child records
It should already. The closeEM method on both LocalEM and JndiEM checks to see if the transaction has been marked rollback only and should handle committing/rollback there. If it doesn't then it's a bug. Also, for your first question: (I take that to mean that setting entity properties does not require a transaction? I thought that in JPA entities are generally monitored for modifications? Is that a mistake?) In the context of a form processing function, the JPA entity is in a detached state at the point that its members are being updated because the session that it was loaded in (when the form rendered) is now closed. The transaction is only required when you perform the merge of the detached object into a new session to save the entity data. Whether or not the entity is actually monitored is an implementation detail, since the spec only says that when the entity is merged it should save data back to the database, but it doesn't specify how that is done. Any exceptions related to JPA should only occur during the flush, or possibly the merge if the JPA provider does an eager flush to the database. This is why I added the mergeAndFlush, persistAndFlush, and removeAndFlush methods, so that you would have a definite place to wrap in a try/catch. If you're doing multiple ops then you'll need to merge your entire block of merge,persist,remove and flush methods in a try/catch. Does that make sense? I know that sometimes the lifecycle of these things can take a few tries to wrap your head around, so if this isn't clear let me know and I'll try to rephrase. Derek On Tue, May 19, 2009 at 2:07 PM, ngug naftoli...@gmail.com wrote: P.S. I wrote a method to handle the boilerplate of opening/closing/ checking whether to rollback transactions. Shouldn't ScalaJPA have such a method? Or does it? Thanks. --~--~-~--~~~---~--~~ 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: Odd Jetty failure during ToDo tutorial
Thanks for the promp responses. I think it is probably exactly what Tyler said, and shall update my Maven forthwith. Paul. --~--~-~--~~~---~--~~ 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: Trouble with lift, GAE, JPA, adding child records
On May 19, 4:31 pm, Derek Chen-Becker dchenbec...@gmail.com wrote: It should already. The closeEM method on both LocalEM and JndiEM checks to see if the transaction has been marked rollback only and should handle committing/rollback there. If it doesn't then it's a bug. But we're talking about userTx==true. I mean this: private def transaction(prog: =Unit) { val tx = EntityManager.getTransaction try { tx.begin prog tx.commit } finally { if(tx.isActive) tx.rollback } } ... def get = transaction { val l = NatureLocationType.lookup(loc.id) l.name = stringValues(name) l.allowStreet = booleanValues(allowStreet) l.allowHospital = booleanValues(allowHospital) l.allowDoctor = booleanValues(allowDoctor) l.allowEquipment = booleanValues(allowEquipment) } (continued below) Also, for your first question: (I take that to mean that setting entity properties does not require a transaction? I thought that in JPA entities are generally monitored for modifications? Is that a mistake?) In the context of a form processing function, the JPA entity is in a detached state at the point that its members are being updated because the session that it was loaded in (when the form rendered) is now closed. The transaction is only required when you perform the merge of the detached object into a new session to save the entity data. Whether or not the entity is actually monitored is an implementation detail, since the spec only says that when the entity is merged it should save data back to the database, but it doesn't specify how that is done. Any exceptions related to JPA should only occur during the flush, or possibly the merge if the JPA provider does an eager flush to the database. This is why I added the mergeAndFlush, persistAndFlush, and removeAndFlush methods, so that you would have a definite place to wrap in a try/catch. If you're doing multiple ops then you'll need to merge your entire block of merge,persist,remove and flush methods in a try/catch. Does that make sense? I know that sometimes the lifecycle of these things can take a few tries to wrap your head around, so if this isn't clear let me know and I'll try to rephrase. I understand you, and that's what I thought too, but I got an exception when I tried to merge a detached entity! If I could get an entity in one request, close the EM, and in the next request just modify it and merge it it would be great, but so far I haven't managed to. If you can't think of any explanation offhand I'll try to reproduce it in an isolated snippet. Thanks! Derek On Tue, May 19, 2009 at 2:07 PM, ngug naftoli...@gmail.com wrote: P.S. I wrote a method to handle the boilerplate of opening/closing/ checking whether to rollback transactions. Shouldn't ScalaJPA have such a method? Or does it? Thanks. --~--~-~--~~~---~--~~ 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: Trouble with lift, GAE, JPA, adding child records
On the first part, I could add a withTx method to LocalEM that would handle wrapping the tx for you, if that's OK. Something like: def withTx[T] (f : = T) Then you could do MyEM.withTx { prog } And it would handle the rollback. How does that sound? As for the second, if you're getting an exception on the merge I'd really like to see the Exception (and code, if possible). Off the top of my head the only time that should happen is if you have a constraint violation or something similar that would throw and exception even if you were operating on a non-detached entity. Take a look at the JPA Demo Library app. It does detached object merge all of the time for editing authors and books. Derek On Tue, May 19, 2009 at 2:42 PM, ngug naftoli...@gmail.com wrote: On May 19, 4:31 pm, Derek Chen-Becker dchenbec...@gmail.com wrote: It should already. The closeEM method on both LocalEM and JndiEM checks to see if the transaction has been marked rollback only and should handle committing/rollback there. If it doesn't then it's a bug. But we're talking about userTx==true. I mean this: private def transaction(prog: =Unit) { val tx = EntityManager.getTransaction try { tx.begin prog tx.commit } finally { if(tx.isActive) tx.rollback } } ... def get = transaction { val l = NatureLocationType.lookup(loc.id) l.name = stringValues(name) l.allowStreet = booleanValues(allowStreet) l.allowHospital = booleanValues(allowHospital) l.allowDoctor = booleanValues(allowDoctor) l.allowEquipment = booleanValues(allowEquipment) } (continued below) Also, for your first question: (I take that to mean that setting entity properties does not require a transaction? I thought that in JPA entities are generally monitored for modifications? Is that a mistake?) In the context of a form processing function, the JPA entity is in a detached state at the point that its members are being updated because the session that it was loaded in (when the form rendered) is now closed. The transaction is only required when you perform the merge of the detached object into a new session to save the entity data. Whether or not the entity is actually monitored is an implementation detail, since the spec only says that when the entity is merged it should save data back to the database, but it doesn't specify how that is done. Any exceptions related to JPA should only occur during the flush, or possibly the merge if the JPA provider does an eager flush to the database. This is why I added the mergeAndFlush, persistAndFlush, and removeAndFlush methods, so that you would have a definite place to wrap in a try/catch. If you're doing multiple ops then you'll need to merge your entire block of merge,persist,remove and flush methods in a try/catch. Does that make sense? I know that sometimes the lifecycle of these things can take a few tries to wrap your head around, so if this isn't clear let me know and I'll try to rephrase. I understand you, and that's what I thought too, but I got an exception when I tried to merge a detached entity! If I could get an entity in one request, close the EM, and in the next request just modify it and merge it it would be great, but so far I haven't managed to. If you can't think of any explanation offhand I'll try to reproduce it in an isolated snippet. Thanks! Derek On Tue, May 19, 2009 at 2:07 PM, ngug naftoli...@gmail.com wrote: P.S. I wrote a method to handle the boilerplate of opening/closing/ checking whether to rollback transactions. Shouldn't ScalaJPA have such a method? Or does it? Thanks. --~--~-~--~~~---~--~~ 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: Trouble with lift, GAE, JPA, adding child records
I actually started my code by editing the AuthorOps snippet from ymnk's GAE version of it. He does reload the nature before editing it: // Hold a val here so that the id closure holds it when we re-enter this method bind(author, xhtml, id - SHtml.hidden(() = findAuthor(author) match { case Some(a) = authorVar(a) case None =}), name - SHtml.text(author.name, author.name=_), submit - SHtml.submit(?(Save), doAdd)) findAuthor looks up the the author based on the id in the authorVar RequestVar, and then sets that back into the authorVar. I wondered why he did that, and then thought I understood... Thanks! On May 19, 5:01 pm, Derek Chen-Becker dchenbec...@gmail.com wrote: On the first part, I could add a withTx method to LocalEM that would handle wrapping the tx for you, if that's OK. Something like: def withTx[T] (f : = T) Then you could do MyEM.withTx { prog } And it would handle the rollback. How does that sound? As for the second, if you're getting an exception on the merge I'd really like to see the Exception (and code, if possible). Off the top of my head the only time that should happen is if you have a constraint violation or something similar that would throw and exception even if you were operating on a non-detached entity. Take a look at the JPA Demo Library app. It does detached object merge all of the time for editing authors and books. Derek On Tue, May 19, 2009 at 2:42 PM, ngug naftoli...@gmail.com wrote: On May 19, 4:31 pm, Derek Chen-Becker dchenbec...@gmail.com wrote: It should already. The closeEM method on both LocalEM and JndiEM checks to see if the transaction has been marked rollback only and should handle committing/rollback there. If it doesn't then it's a bug. But we're talking about userTx==true. I mean this: private def transaction(prog: =Unit) { val tx = EntityManager.getTransaction try { tx.begin prog tx.commit } finally { if(tx.isActive) tx.rollback } } ... def get = transaction { val l = NatureLocationType.lookup(loc.id) l.name = stringValues(name) l.allowStreet = booleanValues(allowStreet) l.allowHospital = booleanValues(allowHospital) l.allowDoctor = booleanValues(allowDoctor) l.allowEquipment = booleanValues(allowEquipment) } (continued below) Also, for your first question: (I take that to mean that setting entity properties does not require a transaction? I thought that in JPA entities are generally monitored for modifications? Is that a mistake?) In the context of a form processing function, the JPA entity is in a detached state at the point that its members are being updated because the session that it was loaded in (when the form rendered) is now closed. The transaction is only required when you perform the merge of the detached object into a new session to save the entity data. Whether or not the entity is actually monitored is an implementation detail, since the spec only says that when the entity is merged it should save data back to the database, but it doesn't specify how that is done. Any exceptions related to JPA should only occur during the flush, or possibly the merge if the JPA provider does an eager flush to the database. This is why I added the mergeAndFlush, persistAndFlush, and removeAndFlush methods, so that you would have a definite place to wrap in a try/catch. If you're doing multiple ops then you'll need to merge your entire block of merge,persist,remove and flush methods in a try/catch. Does that make sense? I know that sometimes the lifecycle of these things can take a few tries to wrap your head around, so if this isn't clear let me know and I'll try to rephrase. I understand you, and that's what I thought too, but I got an exception when I tried to merge a detached entity! If I could get an entity in one request, close the EM, and in the next request just modify it and merge it it would be great, but so far I haven't managed to. If you can't think of any explanation offhand I'll try to reproduce it in an isolated snippet. Thanks! Derek On Tue, May 19, 2009 at 2:07 PM, ngug naftoli...@gmail.com wrote: P.S. I wrote a method to handle the boilerplate of opening/closing/ checking whether to rollback transactions. Shouldn't ScalaJPA have such a method? Or does it? Thanks. --~--~-~--~~~---~--~~ 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: More Actor garbage (collection)
David, Bravo! That sounds to be some gnarly sleuthing-n-hacking. BTW, have you run into any deadlock issues when you replace the scheduler? Best wishes, --greg On Mon, May 18, 2009 at 2:43 PM, David Pollak feeder.of.the.be...@gmail.com wrote: Folks, As you all may or may not know, I've been battling memory retention issues with the Scala Actor libraries for 6 or so months now. I believe that I've finally nailed the complete issues. They are as follows: - There is an object called ActorGC that keeps track of all the actors in the system. Due to the implementation as some other bugs in the Actor library, the ActorGC code retains references to all Actors that have been created until there is significant pressure on the garbage collector, then the references may or may not be released. In order to combat this, I wrote code that uses reflection to look through the ActorGC retained references and I unretain the references for all Actors that have exited. - The Actor library sits on top of a modified version of Doug Lea's ForkJoin library. Due to bugs in the library or bugs in the enhancements, the library retains references to a substantial number of messages that have ever been sent from one Actor to another. I've replaced the default scheduler with a scheduler based on the java.util.concurrent library with a default of 10 worker threads. If you want to use the standard Scala Actor scheduler, in Boot, set ActorSchedulerFixer.performFix = false I've been running a stress test against the new code that in the past would result in retaining 32MB of memory over a 30 minute period. Over the last 30 minutes it has not retained any memory. I've started a thread on the Scala internals list and I hope that we'll be able to get the Actors fixed up for the 2.8 release. The above fixes will only impact you if you rely on particular facits of the existing Actor scheduling or ActorGC classes. Thanks, David -- 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 -- L.G. Meredith Managing Partner Biosimilarity LLC 1219 NW 83rd St Seattle, WA 98117 +1 206.650.3740 http://biosimilarity.blogspot.com --~--~-~--~~~---~--~~ 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: Lift and interoperability
Glenn, It's easy for emails communications to go south. i'd be more than happy to help you out, but being a pretty slow guy, i need a specific code context before i can really grok what it is you want to do. If you're worried about IP or disclosure, can you cook up a simplified version with the names changed to protect the innocent? Really, if you can just sketch out a scenario, with some specifics regarding what it is you want to do, i'd be more than happy to help. Goodness knows people have really helped me out on this list. Best wishes, --greg On Sun, May 17, 2009 at 9:16 PM, glenn gl...@exmbly.com wrote: Yeah, that's the ticket. You've got a new technology or framework you want to promulgate, insult the one's who don't get it out of the box. A bit mean-spirited, don't you think. Frankly, lift raises more questions then it answers. That's not a complaint.. I don't get it. I don't get that I have to slog through pages of source code to figure out where to hang my hooks. And my boss ain't going to pay me to do that either. To be kind, until you've got a well-documented API, all you have is a work-in-progress. You want followers, I'm exactly the kind of guy you need to talk down to. regards, Glenn... On May 17, 2:22 pm, David Pollak feeder.of.the.be...@gmail.com wrote: On Sun, May 17, 2009 at 2:33 AM, rintcius rintc...@gmail.com wrote: Interesting discussion! I think I see a bit where Glenn is coming from. I'm all for interoperability... I like baseball and apple pie, too. If there is a problem with Lift interoperating with another system or another piece of J(2)EE infrastructure, be specific about it and we'll work on. To date, Glenn has complained a lot and made very little sense and has not been specific. He's complained that you can't create a form to be submitted to an external server that won't somehow magically execute functions defined on your server. He's complained that Lift doesn't have its own implementation of some JavaScript functions which are available in existing JavaScript libraries. To date, Glenn has demonstrated little in terms of understanding if code is executing on the server, in the browser or on some other server. This makes it very difficult to have a coherent conversation... and every time we've asked him for specifics, he's ignored us or give examples that are very far off the mark. To me it's about *ease* of interoperability. For enterprise architectures the most important question is: to what extent is Lift helping me to build a **composable** software system. A composable software system will offer gradual change from one architecture to another and it will make this migration easy. So suppose I am having a Spring based architecture with Hibernate and struts and want to migrate this to Lift. Okay... so there's a ton of documentation on the use of JPA within Lift-based apps. Derek has written a lot of this and does a lot of support on this list of people using JPA within Lift and Scala. Further, if you've already got Java/JPA code, *IT JUST WORKS* inside Lift and Scala. There's nothing to document beyond just use it. I think it would be a good exercise to check how such an architecture can be gradually migrated to a lift based architecture. So what to do if I just want to replace struts or hibernate. I personally recommend starting with building your REST APIs with Lift. It's an easy way to get your hands dirty with Lift, you get to preserve your existing models and it's very easy to do REST and XML/JSON within Lift and Scala. Or what if I want to start with migrating my POJO's to POSO's. Lift is not primarily focused on persistence. Lift is primarily focused on the servicing of HTTP requests. We will help people on this list with JPA-related stuff, but it's not the primary focus of Lift as a web framework. My guess is that this is all possible in Lift but I haven't seen anything in the code or docs that facilitates this. That's because it's not a Lift thing, it's a persistence thing. Please look at Exploring Lift, there are a ton of JPA-related examples. Maybe I have overlooked something but what I have seen so far is based on an all or nothing approach (also nothing wrong with that, e.g. Grails doesn't facilitate this either and this is a very productive framework as well). I disagree with this. Glenn was complaining that Lift didn't do everything for him and that's how he seems to define interoperability. Lift in fact interoperates with all things in JVM-land. If there's something you want to do on the JVM and Lift is getting in your way, please let us know. We'll work on it. Lift is simply a ServletFilter and can intercept as many or as few HTTP requests as defined by your web.xml file. If you simply want to use Lift to service a single
[Lift] Re: More Actor garbage (collection)
On Tue, May 19, 2009 at 2:34 PM, Meredith Gregory lgreg.mered...@gmail.comwrote: David, Bravo! That sounds to be some gnarly sleuthing-n-hacking. BTW, have you run into any deadlock issues when you replace the scheduler? No... the scheduler is a replacement for Doug Lea's FJ library which was superior for JDK 1.4, but is neutral or worse than the JDK 1.5 thread pooling libraries. Best wishes, --greg On Mon, May 18, 2009 at 2:43 PM, David Pollak feeder.of.the.be...@gmail.com wrote: Folks, As you all may or may not know, I've been battling memory retention issues with the Scala Actor libraries for 6 or so months now. I believe that I've finally nailed the complete issues. They are as follows: - There is an object called ActorGC that keeps track of all the actors in the system. Due to the implementation as some other bugs in the Actor library, the ActorGC code retains references to all Actors that have been created until there is significant pressure on the garbage collector, then the references may or may not be released. In order to combat this, I wrote code that uses reflection to look through the ActorGC retained references and I unretain the references for all Actors that have exited. - The Actor library sits on top of a modified version of Doug Lea's ForkJoin library. Due to bugs in the library or bugs in the enhancements, the library retains references to a substantial number of messages that have ever been sent from one Actor to another. I've replaced the default scheduler with a scheduler based on the java.util.concurrent library with a default of 10 worker threads. If you want to use the standard Scala Actor scheduler, in Boot, set ActorSchedulerFixer.performFix = false I've been running a stress test against the new code that in the past would result in retaining 32MB of memory over a 30 minute period. Over the last 30 minutes it has not retained any memory. I've started a thread on the Scala internals list and I hope that we'll be able to get the Actors fixed up for the 2.8 release. The above fixes will only impact you if you rely on particular facits of the existing Actor scheduling or ActorGC classes. Thanks, David -- 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 -- L.G. Meredith Managing Partner Biosimilarity LLC 1219 NW 83rd St Seattle, WA 98117 +1 206.650.3740 http://biosimilarity.blogspot.com -- 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] Why XML tags, not attributes, for lift markup?
Hi, I was wondering why lift markup uses XML elements to reference snippets, rather than using namespaced attributes in the way that (I think) Wicket and Tapestry do? Or like Plone's TAL, which is the first place I saw such a thing. The reason I ask is this: I'm sure I've read somewhere that David P has used these frameworks before (the Java ones, at least)... so it seems most unlikely that such a design was never considered. Perhaps it was just an arbitrary choice? Or was there something more to it than that? I hope this question doesn't sound like criticism - I'm just curious. :o) Martin --~--~-~--~~~---~--~~ 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: Some DispatchSnippet Qs
David, Thanks for your reply. I agree with your points about dispatch snippets: they're a good idea, and I see that it's possible to avoid having to rewrite the method name several times. But Lift does provide a reflection-based dispatch mechanism which could work with stateful snippets but for the fact that StatefulSnippet extends DispatchSnippet. It seems like an arbitrary restriction that would be easy to lift (sorry, couldn't resist). My summary argument is: If it's very important that developers use DispatchSnippet, then all snippets should be DispatchSnippets. But if it's okay to invoke snippets through reflection, then it should be okay for StatefulSnippets too. I'll use the framework either way and do appreciate all the work you've put into it! W On May 19, 8:52 am, David Pollak feeder.of.the.be...@gmail.com wrote: Willis, I appreciate your point of view. Getting stuff done more quickly is good. Having a maintainable, flexible code base is good. Sometimes these things are at odds. I've found that over my various projects, using DispatchSnippets is better. They tend to lead to fewer bugs. That's why I think it's a better practice to use them. Let's look at a couple of examples: class MySnippet { def doIt(in: NodeSeq): NodeSeq = bind(s, in, a - b) } class MyDispSnip extends DispatchSnippet { def dispatch = Map(doIt - doIt _) def doIt(in: NodeSeq): NodeSeq = bind(s, in, a - b) } Or, if I'm feeling DRY: object MyDS extends DispatchSnippet { def dispatch = { case doIt = bind(s, _, a - b) } } Ooo... in the last example, we didn't even have to define our parameter name or type or the return type... so technically, it's the most DRY of all. :-) In all seriousness, I appreciate your comments and perspective. It's good to hear from newbies. And I really do appreciate the balance between convention and configuration. I am gently pushing toward configuration because it's been my experience that in this case, it works better. Thanks, David On Tue, May 19, 2009 at 3:32 AM, Willis Blackburn willis.blackb...@gmail.com wrote: David, Aren't I declaring the methods my snippet supports by including them as public methods of the snippet itself? I think that requiring every StatefulSnippet to also be a DispatchSnippet is at odds with the code-by-convention and don't- repeat-yourself principles. If all my dispatch PF does is map each method name to the corresponding method (as in my example), then all I've done is re-implement the default behavior in order to satisfy the compiler. I would prefer that DispatchSnippet and StatefulSnippet were unrelated, allowing the application developer to make the dispatch vs. reflection and stateless vs. stateful choices independently. Is there a technical reason why this would be impossible? I appreciate that you might think it presumptuous of me to show up in this group, having only a few days' experience with Lift and Scala, and opine about the design of the framework. Nevertheless I hope you'll consider my point of view. I like Lift precisely because it isn't rigid and structured. It's powerful but doesn't prescribe a particular web application architecture like every URL invokes a controller or everything is a component. Even the view-first principle is simply the default strategy and can be changed. That's why the StatefulSnippets-DispatchSnippet coupling stands out for me. W On May 18, 10:36 pm, David Pollak feeder.of.the.be...@gmail.com wrote: It's better practice to use DispatchSnippets. Snippets by convention are the easy toe in the water, but once you're dealing with state, etc., you should be graduating to declaring the methods that your snippets support, thus enforcing the DispatchSnippet being the base class of StatefulSnippet. On Mon, May 18, 2009 at 6:04 PM, Willis Blackburn willis.blackb...@gmail.com wrote: I'm back with another question. I see that StatefulSnippet extends DispatchSnippet. I understand what DispatchSnippet is about. But what is the reason that a StatefulSnippet must also be a DispatchSnippet? Aren't these concepts (stateful vs. stateless, dispatch vs. reflection) unrelated? Most of the StatefulSnippet examples that I've seen look like this: class MySnippet extends StatefulSnippet { def dispatch = { case add = add _ case edit = edit _ case foo = foo _ } def add(xhtml : NodeSeq) : ... ... } The dispatch definition doesn't seem to provide much value here. W -- Lift, the simply functional web frameworkhttp://liftweb.net Beginning Scalahttp://www.apress.com/book/view/1430219890 Follow me:http://twitter.com/dpp Git some:http://github.com/dpp -- Lift, the simply functional web frameworkhttp://liftweb.net Beginning
[Lift] Re: More Actor garbage (collection)
Greg, It's not exactly deadlock, but you may find this interesting: https://lampsvn.epfl.ch/trac/scala/ticket/1999 -Erik On Tue, May 19, 2009 at 5:34 PM, Meredith Gregory lgreg.mered...@gmail.comwrote: David, Bravo! That sounds to be some gnarly sleuthing-n-hacking. BTW, have you run into any deadlock issues when you replace the scheduler? Best wishes, --greg On Mon, May 18, 2009 at 2:43 PM, David Pollak feeder.of.the.be...@gmail.com wrote: Folks, As you all may or may not know, I've been battling memory retention issues with the Scala Actor libraries for 6 or so months now. I believe that I've finally nailed the complete issues. They are as follows: - There is an object called ActorGC that keeps track of all the actors in the system. Due to the implementation as some other bugs in the Actor library, the ActorGC code retains references to all Actors that have been created until there is significant pressure on the garbage collector, then the references may or may not be released. In order to combat this, I wrote code that uses reflection to look through the ActorGC retained references and I unretain the references for all Actors that have exited. - The Actor library sits on top of a modified version of Doug Lea's ForkJoin library. Due to bugs in the library or bugs in the enhancements, the library retains references to a substantial number of messages that have ever been sent from one Actor to another. I've replaced the default scheduler with a scheduler based on the java.util.concurrent library with a default of 10 worker threads. If you want to use the standard Scala Actor scheduler, in Boot, set ActorSchedulerFixer.performFix = false I've been running a stress test against the new code that in the past would result in retaining 32MB of memory over a 30 minute period. Over the last 30 minutes it has not retained any memory. I've started a thread on the Scala internals list and I hope that we'll be able to get the Actors fixed up for the 2.8 release. The above fixes will only impact you if you rely on particular facits of the existing Actor scheduling or ActorGC classes. Thanks, David -- 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 -- L.G. Meredith Managing Partner Biosimilarity LLC 1219 NW 83rd St Seattle, WA 98117 +1 206.650.3740 http://biosimilarity.blogspot.com -- http://erikengbrecht.blogspot.com/ --~--~-~--~~~---~--~~ 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] Snippet name clashes
Hi, As far as I understand it is not possible to specify the FQCN of a snippet class in a snippet tag. Is this true? If so, there might be name clashes: Just imagine popular names like user, customer, item, etc. This will be particularly important in the OSGi space where you can create extensible applications: You do not know in advance, which modules are added. Hence on the long run I think we need something like namespacing. What do you think? Cheers Heiko -- My blog: heikoseeberger.name Follow me: twitter.com/hseeberger OSGi on Scala: www.scalamodules.org Lift, the simply functional web framework: liftweb.net --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---