[Lift] broken app
Hi Over the last couple of days I have been getting the following error on Lift 1.0 using scala 2.7.3 when I try to deploy an application to a Glassfish (or Tomcat) server (Jetty works ok) : Exception starting filter LiftFilter java.lang.IncompatibleClassChangeError: Class scala.List$$anon$1 does not implement the requested interface scala.Seq$Projection at net.liftweb.util.ListHelpers$class.first(ListHelpers.scala:50) at net.liftweb.util.Helpers$.first(Helpers.scala:29) at net.liftweb.util.Props$.init(Props.scala:151) at net.liftweb.util.Props$.clinit(Props.scala) at net.liftweb.util.LogBoot$.findTheFile$1(Log.scala:115) at net.liftweb.util.LogBoot$._log4JSetup(Log.scala:118) at net.liftweb.util.LogBoot$$anonfun$2.apply(Log.scala:96) at net.liftweb.util.LogBoot$$anonfun$2.apply(Log.scala:96) at net.liftweb.util.LogBoot$.checkConfig(Log.scala:94) at net.liftweb.util.LogBoot$.net$liftweb$util$LogBoot$$_logger(Log.scala:140) at net.liftweb.util.LogBoot$$anonfun$3.apply(Log.scala:142) at net.liftweb.util.LogBoot$$anonfun$3.apply(Log.scala:142) at net.liftweb.http.LiftRules$.init(LiftRules.scala:559) at net.liftweb.http.LiftRules$.clinit(LiftRules.scala) at net.liftweb.http.LiftFilter.init(LiftServlet.scala:546) ... I think the application was deploying OK earlier in the week. Any ideas??? cheers Oliver --~--~-~--~~~---~--~~ 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 job
Hi all, The company I work for, Paycorp, is based in Sydney Australia and has a job with a significant Lift / Scala component. The job description is posted on http://www.scalacareers.com/ cheers Oliver --~--~-~--~~~---~--~~ 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: You are not banned from this group!!
My son was born a week ago, with a heart defect that has just been operated on - I've been biting my nails for months and haven't felt like communicating or working. Things are starting to look good for him so maybe Im back. cheers Oliver On Thu, Sep 24, 2009 at 12:08 PM, Charles F. Munat c...@munat.com wrote: Funny, I was just wondering what happened to you maybe two days ago. Are you back, or just checking in? Chas. Oliver Lambert wrote: On Tue, Sep 22, 2009 at 7:21 AM, David Pollak feeder.of.the.be...@gmail.com mailto:feeder.of.the.be...@gmail.com wrote: I will gladly buy beer/coffee/food for anyone who gets such a notice. I sincerely apologize for any problems this is causing. Can you send me such a notice, I'd like a beer! Oh, and I've been away for a while, its nice to see the lift mailing list is going so strong. Oliver --~--~-~--~~~---~--~~ 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: You are not banned from this group!!
On Tue, Sep 22, 2009 at 7:21 AM, David Pollak feeder.of.the.be...@gmail.com wrote: I will gladly buy beer/coffee/food for anyone who gets such a notice. I sincerely apologize for any problems this is causing. Can you send me such a notice, I'd like a beer! Oh, and I've been away for a while, its nice to see the lift mailing list is going so strong. Oliver --~--~-~--~~~---~--~~ 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: Including jars into a liftweb project
If I have an application thats not in a Maven repository, I usually put it in my local (or company) repository - for instance adding functionaljava.jar mvn install:install-file -DgroupId=org.other -DartifactId=functionaljava -Dversion=2.17 -Dpackaging=jar -Dfile=functionaljava.jar -DgeneratePom=true But, before you do this, as suggested below, you might want to google for the application (eg ibiblio functionaljava) to make sure its not in a maven repository. On Fri, Jun 26, 2009 at 6:16 PM, Timothy Perrett timo...@getintheloop.euwrote: To clarify - you only need that system path if its a JAR not in a maven repository anywhere. What JAR are you trying to add? Cheers, Tim On Jun 26, 9:01 am, Caoyuan dcaoy...@gmail.com wrote: On Fri, Jun 26, 2009 at 3:51 PM, Jeppe Nejsum Madsenje...@ingolfs.dk wrote: On 26 Jun 2009, fbettag wrote: Hey guys, i was wondering how (and where) i have to put jars in my liftweb project to get them included. i know it's a beginners question, but i've been playing around all night and i couldn't get it to work. Normally, you would put jars in the WEB-INF/lib folder and they will be picked up by the servlet container They need to be available at compile time too... /Jeppe Usually, jar files should be put under maven's dependency management, but you can try to add them by adding something like the following to pom.xml !-- local dependency -- dependency groupIdcom.xxx/groupId artifactIdcom.xxx.xxx/artifactId version4.7.1/version scopesystem/scope systemPath${basedir}/src/main/webapp/WEB-INF/lib/x-4.7.1.jar/systemP ath /dependency --~--~-~--~~~---~--~~ 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: New mapper class: MappedEnumString
On Thu, Jun 25, 2009 at 10:49 PM, Jeppe Nejsum Madsen je...@ingolfs.dkwrote: On Thu, Jun 25, 2009 at 1:12 AM, Oliver Lambert olambo...@gmail.com wrote: Looks very nice. One thing I'm wondering, what if I wanted the displayed value outside of the mapper, such as TestTypes.Item1.displayValue. Would you use an implicit conversion to provide this or is the display value conceptually always part of a mapper object. Good question :-) I'm still using CRUDify generated views while prototyping, but will probably need some more sophisticated layouts at some point. Don't yet know if the display value will come from the mapper object or the underlying enum. I have a rough implementation called EnumWithDescription, that wraps (not extends) an Enumeration and provides a description method on the enumeration value without using an implicit. I'm wondering if it might be useful to combine your approach and mine? Sure. It might also be possible to make the original MappedEnum a bit more flexible instead (as Derek suggested earlier). My class is basically just a copy with very few modifications to handle the db value. I just haven't got the Scala knowledge yet to easily see how the interface should be and I needed to nail the db schema :-) No this isn't what I'm suggesting, I don't think MappedEnum should be made flexible. I was thinking perhaps your class could work with EnumWithDescription as shown below, which extends Enumeration#Values to include a description. /* A wrapper arround a Scala Enumeration Value that has a name, description for each object */ trait ValueWithDescription { def description: String def name: String } abstract class EnumWithDescription { type Value = enum.Value with ValueWithDescription private var _values: List[Value] = Nil def values = _values // possibly not a good idea using this directly val enum = new Enumeration { def Value(inName: String, inDescription: String): Value with ValueWithDescription = { new Val(nextId, inName) with ValueWithDescription { def description = inDescription def name = inName } } } def Value(name: String, description: String): Value = { val value = enum.Value(name, description) _values = _values ::: List(value) // build in order value } def Value(name: String): Value = Value(name, name) def valueOf(name: String) = values find (_.name == name) def nameDescriptionList = values map(x = (x.name, x.description) ) } /Jeppe --~--~-~--~~~---~--~~ 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: New mapper class: MappedEnumString
Looks very nice. One thing I'm wondering, what if I wanted the displayed value outside of the mapper, such as TestTypes.Item1.displayValue. Would you use an implicit conversion to provide this or is the display value conceptually always part of a mapper object. I have a rough implementation called EnumWithDescription, that wraps (not extends) an Enumeration and provides a description method on the enumeration value without using an implicit. I'm wondering if it might be useful to combine your approach and mine? cheers Oliver On Thu, Jun 25, 2009 at 6:39 AM, Jeppe Nejsum Madsen je...@ingolfs.dkwrote: Hi, A while ago, I asked if it was possible to use something like MappedEnum and have some sensible values inserted into the database instead of integers. I got the feeling this was not the case, so I've created MappedEnumString (attached) which maps Enumerations into string values. Example: object TestTypes extends Enumeration { val Unknown = new Val(0,??) val Item1 = new Val(XX) val Item2 = new Val(YY) } object test extends MappedEnumString(this, TestTypes, 2) This will store the values, ??, XX or YY in the db. For display purposes, it will by default lookup the resource values TestTypes.??, TestTypes.XX, TestTypes.YY You can also calculate the displayed values: object test2 extends MappedEnumString(this, TestTypes, 2) { override def _valueToDisplayString(v:Enumeration#Value) = v match { case TestTypes.Item1 = Item1Display case TestTypes.Item2 = Item2Display case _ = Unknown x ItemDisplay } } I'm by no means a Scala/Lift expert so I may have overlooked stuff, so feel free to comment :-) /Jeppe --~--~-~--~~~---~--~~ 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] JPA question
I don't understand from the code sample why AbstractContainer has to be an entity or have a table or id annotation. I'd be looking at just using the @MappedSuperclass annotation. On Wed, Jun 24, 2009 at 9:27 AM, Meredith Gregory lgreg.mered...@gmail.comwrote: Kris, Thanks for this code sample. i will study and see if it offers a way around the conundrum. In the meantime, here's a code samplehttp://svn.biosimilarity.com/src/open/codesamples/trunk/hibernate/hbex/illustrating exactly what i'm talking about. Best wishes, --greg On Tue, Jun 23, 2009 at 2:21 PM, Kris Nuttycombe kris.nuttyco...@gmail.com wrote: Oops, forgot a member of the hierarchy, inline below: On Tue, Jun 23, 2009 at 3:19 PM, Kris Nuttycombekris.nuttyco...@gmail.com wrote: I'm just so puzzled by this thread because I have the following entity hierarchy in my app: @Entity @Inheritance(strategy = InheritanceType.JOINED) @Table(name = payment_source_transaction) public abstract class PaymentSourceTransactionT extends PaymentSourceT extends SubscriptionTransaction implements MonetaryTransactionT, Serializable { @ManyToOne(cascade = {CascadeType.MERGE, CascadeType.PERSIST}, optional = false, targetEntity = PaymentSource.class) private T paymentSource; ... } @Entity public abstract class CreditCardTransaction extends PaymentSourceTransactionCreditCard { ... } @MappedSuperclass public abstract class VoidableCCTransaction extends CreditCardTransaction implements Serializable { ... } @OneToOne(cascade = {CascadeType.MERGE, CascadeType.PERSIST}, mappedBy=voidedTransaction) private CCVoidTransaction voidTransaction; @Entity public class CCAuthTransaction extends VoidableCCTransaction implements AuthTransactionCreditCard, Divisional, Serializable { .. } @Entity @Inheritance(strategy = InheritanceType.SINGLE_TABLE) public abstract class CCCaptureTransaction extends VoidableCCTransaction implements Serializable, CaptureTransactionCreditCard { private static final long serialVersionUID = 1L; @OneToOne(cascade = {CascadeType.PERSIST, CascadeType.MERGE}) private CCAuthTransaction authTransaction; ... } @Entity public class EcometryCaptureTransaction extends CCCaptureTransaction implements EcometryOrder, Serializable { ... } @Entity @Inheritance(strategy = InheritanceType.JOINED) public abstract class PaymentSourceT extends PaymentSourceT extends UUEntity implements MutationControlledT, Serializable { ... } @Entity public class CreditCard extends PaymentSourceCreditCard implements Addressable, Serializable { ... } @Entity public class CheckingAccount extends PaymentSourceCheckingAccount implements Serializable { ... } This works for me without difficulty. What am I missing that is different about this scheme than the one that you describe? Kris On Tue, Jun 23, 2009 at 11:29 AM, Meredith Gregorylgreg.mered...@gmail.com wrote: Derek, i completely concur. i wanted to give it a serious go, however, before i abandoned it. The issue is that so much of the incumbent technology goes across this object-relational boundary, i needed a simple case to justify walking away from this technology. This example provides it. To see just how non-complex it is, let me state it in common sense terms. Suppose we are building an app for a manufacturing firm, and the firm ships out its goods in different kinds of containers: plastic-coated cardboard boxes, metal boxes, etc. Suppose that different kinds of materials go into different kinds of boxes, and sometimes medicinal or toxic substances go into these containers; but, every container gets a manifest. When the container contains these materials that need to be handled with care or attention, the manifest is a special kind of certified manifest. We might imagine that this firm has already constructed an object model that looks like abstract class Container { ...; Manifest getManifest(); void setManifest( Manifest manifest ); ... } class CardboardContainer extends Container { ... } class MetalContainer extends Container { ... } abstract class Manifest { ... } class StdManifest extends Manifest { ... } class CertifiedManifest extends Manifest { ... } We need to work with their existing infrastructure. However, this situation/model breaks Hibernate's implementation of JPA. That such a simple situation would cause problems indicates to me that these technologies have never been used in any significant way in production -- otherwise they would have bumped into such a common case. If i'm wrong about something, here, i'd love to be disabused of my misunderstanding(s). Currently, i feel i have enough justification to go to a different kind of solution, such as a LINQ-based solution. Best wishes, --greg On Mon, Jun 22, 2009 at 5:46 PM, Derek
[Lift] Re: [scala] JPA question
Actually, I don't think I would be looking at @MappedSuperclass either. Whats your database schema? Is it always a Legacy database or are you creating it new? Are the java entities you are trying to create, read only? Why aren't you using Scala's JPA? If you are creating a complex parent-child relationships, cant you use one-many relationships in hibernate rather than bothering with Hibernates object-superclass implementation? I have seen Hibernate used to map complex relationships in production, but when I see an OR-mapping problem I always try KISS principles on it first. Sometimes this involves creating views, sometimes it involves just completely lying to Hibernate about the underling data structure and creating a Read only entity. For example I have a the following entity that maps to a select (not a table or view) class RoEntity { @Id var entityId: Long = _ ... } EM.createNativeQuery[RoEntity](nativeQueryStr, classOf[RoEntity]) If I want to save it, I populate an entity that really has an underlying table. cheers Oliver On Wed, Jun 24, 2009 at 9:55 AM, Oliver Lambert olambo...@gmail.com wrote: I don't understand from the code sample why AbstractContainer has to be an entity or have a table or id annotation. I'd be looking at just using the @MappedSuperclass annotation. On Wed, Jun 24, 2009 at 9:27 AM, Meredith Gregory lgreg.mered...@gmail.com wrote: Kris, Thanks for this code sample. i will study and see if it offers a way around the conundrum. In the meantime, here's a code samplehttp://svn.biosimilarity.com/src/open/codesamples/trunk/hibernate/hbex/illustrating exactly what i'm talking about. Best wishes, --greg On Tue, Jun 23, 2009 at 2:21 PM, Kris Nuttycombe kris.nuttyco...@gmail.com wrote: Oops, forgot a member of the hierarchy, inline below: On Tue, Jun 23, 2009 at 3:19 PM, Kris Nuttycombekris.nuttyco...@gmail.com wrote: I'm just so puzzled by this thread because I have the following entity hierarchy in my app: @Entity @Inheritance(strategy = InheritanceType.JOINED) @Table(name = payment_source_transaction) public abstract class PaymentSourceTransactionT extends PaymentSourceT extends SubscriptionTransaction implements MonetaryTransactionT, Serializable { @ManyToOne(cascade = {CascadeType.MERGE, CascadeType.PERSIST}, optional = false, targetEntity = PaymentSource.class) private T paymentSource; ... } @Entity public abstract class CreditCardTransaction extends PaymentSourceTransactionCreditCard { ... } @MappedSuperclass public abstract class VoidableCCTransaction extends CreditCardTransaction implements Serializable { ... } @OneToOne(cascade = {CascadeType.MERGE, CascadeType.PERSIST}, mappedBy=voidedTransaction) private CCVoidTransaction voidTransaction; @Entity public class CCAuthTransaction extends VoidableCCTransaction implements AuthTransactionCreditCard, Divisional, Serializable { .. } @Entity @Inheritance(strategy = InheritanceType.SINGLE_TABLE) public abstract class CCCaptureTransaction extends VoidableCCTransaction implements Serializable, CaptureTransactionCreditCard { private static final long serialVersionUID = 1L; @OneToOne(cascade = {CascadeType.PERSIST, CascadeType.MERGE}) private CCAuthTransaction authTransaction; ... } @Entity public class EcometryCaptureTransaction extends CCCaptureTransaction implements EcometryOrder, Serializable { ... } @Entity @Inheritance(strategy = InheritanceType.JOINED) public abstract class PaymentSourceT extends PaymentSourceT extends UUEntity implements MutationControlledT, Serializable { ... } @Entity public class CreditCard extends PaymentSourceCreditCard implements Addressable, Serializable { ... } @Entity public class CheckingAccount extends PaymentSourceCheckingAccount implements Serializable { ... } This works for me without difficulty. What am I missing that is different about this scheme than the one that you describe? Kris On Tue, Jun 23, 2009 at 11:29 AM, Meredith Gregorylgreg.mered...@gmail.com wrote: Derek, i completely concur. i wanted to give it a serious go, however, before i abandoned it. The issue is that so much of the incumbent technology goes across this object-relational boundary, i needed a simple case to justify walking away from this technology. This example provides it. To see just how non-complex it is, let me state it in common sense terms. Suppose we are building an app for a manufacturing firm, and the firm ships out its goods in different kinds of containers: plastic-coated cardboard boxes, metal boxes, etc. Suppose that different kinds of materials go into different kinds of boxes, and sometimes medicinal or toxic substances go into these containers; but, every container gets a manifest. When the container contains these materials that need to be handled with care
[Lift] Re: JPA and auto generation of id
What sort of database are you trying to use Hibernate against (look at the property hibernate.dialect in the file persistence.xml)? I think the error may mean that your trying to use GenerationType.AUTO against a database that doesn't support it. On Mon, Jun 22, 2009 at 7:08 PM, David Persons dhwpers...@gmail.com wrote: Hello guys, I get a org.hibernate.exception.SQLGrammarException: could not get or update next value error everytime I try to save the following Entity: @Entity class Scene { @Id @GeneratedValue(){val strategy = GenerationType.AUTO} var id : Long = _ @Column{val unique = true, val nullable = false} var ordering : Int = _ @Column{val unique = true, val nullable = false} var name : String = @ManyToOne{val optional = false} var storyBoard : StoryBoard = _ } What am I doing wrong?? grtz, David Persons --~--~-~--~~~---~--~~ 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: prep for offline work
Check you can work offline before you go with the command Tim details (mvn -o clean install). If you are running against a snapshot of Lift consider changing to a release instead, otherwise Maven will want to download a new snapshot every day (you could freeze at a snapshot version, but thats more complicated). On Tue, Jun 23, 2009 at 1:30 AM, Timothy Perrett timo...@getintheloop.euwrote: Grab yourself a copy of the lift book, download the lift source code so you can build locally if need be and dont forget you prefix all your maven commands: mvn -o Cheers, Tim On Jun 22, 4:01 pm, Mojo mojo...@gmail.com wrote: Hi all, I've enjoyed following the list for a few weeks, and studying Scala casually for a few months. I'm a Java developer currently working with Spring and Hibernate to build web apps, and spent a few months professionally in the Ruby on Rails world as well. I'm about to depart on a ten-day cruise (San Francisco to Alaska) and kind of looking forward to the disconnected time to spend working with Scala and Lift. Being disconnected makes for good concentration time, but it also makes it difficult to deal with things like missing Maven dependencies. I'm trying to be as prepared as I can before departure. I've done things like install the helloworld lift app from Maven, and done a complete build to jetty:run, and even mvn site to try and make sure all the plugins and dependencies are in my local repository. I have Netbeans on the machine, 6.5, and the latest RC for 6.7, but haven't yet installed the Scala plugin. I'd probably better have a DB on hand. Mysql or HSQLDB. Can anyone think of any other good ways to prepare for doing some study and development while being off the grid, so to speak? Cheers, Mojo -- Morris Jones Monrovia, CA m...@whiteoaks.comhttp://mojo.whiteoaks.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: Thoughts on separation of display from logic
I modified the BindHelper in the branch, I am working on some time back to allow automatic mixin binding by name. If you have in your html input name=favourite:yourName size=20 maxlength=40/, then it will accept in the snippet bind(favourite, xhtml, yourName - SHtml.text(show string, s = setBio(s)) and output something like input name=38833747474# size=20 maxlength=40 value=show string/ if you include attributes in the snippets bind, that are already in the html, it will substitute them Is this something like what you are trying to achieve? On Thu, Jun 18, 2009 at 6:51 AM, David Pollak feeder.of.the.be...@gmail.com wrote: I can see a set of methods that look like: textarea(f: String = Unit)(n: NodeSeq) that will slurp the values and attributes out of the NodeSeq... so you'd bind like: biography - textarea(s = setBio(s)) _ On Wed, Jun 17, 2009 at 10:22 AM, Matt Williams m...@makeable.co.ukwrote: I wholeheartedly agree with the philosophy of separating the display from the program logic, and am currently getting to grips with the generators, but am finding that now I end up with a degree of markup within my code. Can you think of any caveats to infering the node type passed, and dynamically using the relevant generators to construct the returned node. I am thinking something along the lines of: person:biography textarea style=myStyle cols=20 rows=5 This is a sample of some biography text /textarea /person:biography Where it would automatically infer that it is a textarea, pass through the relevant attributes, and insert whatever function, values, etc I have specified in my snippet. What are your thoughts on this? Brgds, Matt -- 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: scalajpa - while accessing two distincts databases, the second access is made with a connection to the first database
Hi Greg, Thank you, I enjoyed reading that. Perhaps the Greedy Empire, should indeed, be worried. cheers Oliver 2009/6/18 Meredith Gregory lgreg.mered...@gmail.com Oliver, You wrote: we would have taken over Google by now. My not-so-secret plan for taking over Google is contained in the deck i posted in response to Viktorhttp://svn.biosimilarity.com/src/open/talks/MonadicDesignPatternsForTheWeb.pdf. Part of the reason i was excited that Jonas took on to make the JTA wrapper monadic is that it composes perfectly with the ideas explained in the deck. These ideas dovetail perfectly with the DSL stuff i've been working on. My feeling is that we are at a point where things could really start to happen. The ideas are 'in the air' so to speak. Best wishes, --greg 2009/6/17 Oliver Lambert olambo...@gmail.com 2009/6/18 Meredith Gregory lgreg.mered...@gmail.com Oliver, The short answer is no. The longer answer is - i worked this all out on my own; so, you guys -- who can program lift on top of scala on top of JVM and are therefore about 20X smarter than i am -- can too. I think if we were all 20X (or 2X) smarter than you, we would have taken over Google by now. - - And also, help is always available, if there is something specific you don't understand, let me know and i will do my best to convey it to you. As suggested by another kind person, I may have to start by going back to (an American?) school. Heres a question, why should I care about Monad's when they are already in OO, just not called Monads? - Best wishes, --greg P.S. Here is a version of the paragraph with links to useful bits of lore from the literature. For myself, i was unhappy with the notion of name. The π-calculihttp://en.wikipedia.org/wiki/Pi-calculusand lambda calculi http://en.wikipedia.org/wiki/Lambda_calculus suffer a dependence on a notion of name. Both families of calculi require at least countably infinitely http://en.wikipedia.org/wiki/Countable many nameshttp://www.cs.nps.navy.mil/research/languages/statements/gordon.html, and a notion of equality on names. If names have no internal structure then these theories *cannot be effectivehttp://en.wikipedia.org/wiki/Computable_function *. The reasons is that the notion of equality must then be realized as an infinitary table which cannot fit in any computer we have access to. Therefore, in effective theories, names must have internal structure. Since they have internal structure and are at least countably infinite, one is in danger of undermining the foundational character of these proposals for computing. Therefore, the only possible solution is that the notion of structured name must come from the notion of program proposed by the model. This argument is airtight. If you want a foundational model of computing with nominal structure, the nominal structure must derive from the notion of computation being put forward, i.e. it must *reflect* the notion of computationhttp://svn.biosimilarity.com/src/open/papers/trunk/concurrency/rho/ex_nihilo_entcs/ex_nihilo_finco.pdf. This gives rise to all kinds of new an beautiful phenomena. One measure of your way into compositional thinking is whether this is happening. Is your approach to compositional thinking beginning to yield whole new aspects of computing, and new 'wholes' of computation, new forms of organization. 2009/6/16 Oliver Lambert olambo...@gmail.com 2009/6/17 Meredith Gregory lgreg.mered...@gmail.com Jeremy, Most excellent question award to you, sir! How to bootstrap thinking compositionally... this is what i did - learn some compositional idioms by heart - do you know the shape of the paradoxical combinator by heart - do you know the data making up a monad - do you know the data making up a distributive law between monads - use them in real world applications and see where they fail - when is calculating the least/greatest fixpoint of a recursive spec for a problem the suboptimal solution - when is a monad not the answer - when is an indexed form of composition inadequate - improve them - is it a situational improvement or - a fundamental improvement - see where the very programming model itself fails - is functional composition the only sort of composition - how is parallel composition like functional composition - is parallel composition easily represented in categorical composition - improve it - what is the view of the world in your notion of composition - play with new programming models - does your new notion of composition give rise to a whole generation of different models - invent new idioms in these models - what are the things these models naturally express - and teach them to someone who wishes to bootstrap thinking
[Lift] Re: scalajpa - while accessing two distincts databases, the second access is made with a connection to the first database
You made an assumption and programmed a solution based on the knowledge you had at the time. Thats fine and there is nothing wrong with it - start with the simplest solution that fits. If it need to be changed due to changing requirements, thats fine too. There is a tradeoff in creating a overly complex solution that fits problems that you think might exist in the future and simplicity. Also, there is nothing that makes composition an idea that is only understood and relevant to functional programming as almost seems to be suggested here. On Wed, Jun 17, 2009 at 4:14 PM, Derek Chen-Becker dchenbec...@gmail.comwrote: I agree that it's an issue. In my own defense, what I meant was not that I didn't think people would use more than one DB. I actually have several apps (not yet converted to Lift) that use 4 or more persistence units that represent various legacy databases. Rather, I failed to realize the problem that would arise from defining the EM factory as a singleton because when I wrote that code I didn't fully understand how member objects on classes worked. Other than that, I agree with your post :) Derek On Tue, Jun 16, 2009 at 5:38 PM, Meredith Gregory lgreg.mered...@gmail.com wrote: Derek, soapbox You have just demonstrated a process that i have been talking about for the last 15 years. People have a blind spot when it comes to thinking compositionally. They think -- almost to a person -- about god's eye view solutions where there's only one of some key solution component. They don't think about solutions that are composed of ... (wait for it)... solutions! It takes some serious training to think compositionally. Compositional solutions, however, are the only realistic way to scale. When solutions are compositional, you can *de*compose. The db example is a case in point. One of the most natural ways to scale data access is sharding and partitioning -- which requires upfront machinery to support decomposition of the store. Lest you feel bad, note that some of the best scientific minds of all time have fallen prey to this blind spot. Newtonian physics as well as Einstein's update to Newton's proposal is a non-compositional solution. Quantum mechanics also exhibits compositional failures. This is why physics is failing to find proposals that link theories of gravitation (essentially large scale) to quantum mechanical theories of the other forces (essentially very small scale) -- the physical theories are non-compositional -- they don't scale! One of the real things functional programming has going for it is that the basic model of computation underlying the means of structuring and manipulating programs is compositional. That's why it is important to have a technology like Scala resting atop the incumbent execution model (JVM) being deployed on web-scale problems. Compositionality is the only way to tackle applications at global scale. /soapbox Thanks for getting the fix to this problem in so quickly. Best wishes, --greg On Tue, Jun 16, 2009 at 11:53 AM, Derek Chen-Becker dchenbec...@gmail.com wrote: Using multiple EMs was not something I had considered when I wrote this. I think that I can modify the code to provide a __nameSalt def to differentiate instances. Let me work on it and I'll have something soon. Derek On 6/16/09, Jean-Luc jlcane...@gmail.com wrote: For your information, here is an extract of source code of RequestVarEM : Trait RequestVarEM extends ScalaEntityManager with ScalaEMFactory { object emVar extends RequestVar[EntityManager](openEM()) { ... } } EntityManager is stored in the singleton emVar; so, all db access of Model objects are made using the singleton emVar. = trait RequestVarEM allow only one connection to a database within the same HttpRequest context. Jean-Luc 2009/6/15 Jean-Luc jlcane...@gmail.com Hello, I have two databases, db1 (a.k.a. Motorbike) and db2 (a.k.a. Motorway) defined with RequestVarEM : - object ModelDb1 extends LocalEMF(db1) with RequestVarEM // Motorbike database - object ModelDb2 extends LocalEMF(db2) with RequestVarEM // Motorway database I thought one could access to any databases independently from any snippet as long as the correct Model object were used (ModelDb1 or ModelDb2 for exemple) ; but when I access both databases from the same page, the second database access issues a Named query not found exception. I have two snippets, one to display a list of motorbike, another to display a list of motorway : - page1 : ModelDb1.createNamedQuery[Motorbike](Motorbike.findAll).getResultList() = ok - page2 : ModelDb2.createNamedQuery[Motorway](Motorway.findAll).getResultList() = ok - page3 : calling from page 3 motorbike motorway snippets : Named query not found: Motorway.findAll - page4 : calling from page 4 motorway motorbike snippets : Named query not found: Motorbike.findAll - page3 changing the query of *Motorway* snippet : -
[Lift] QA, before merging code
Hi, Seems theres been a little bit of discussion about methodologies of coding and development processes in the latest threads which is cool and makes me think about my current coding efforts. I created a branch a while ago where I put in my take on a slightly alternative (or complementary?) binding process (the particular code adds a bind by name to BindHelpers). I was hoping for some feedback from a few of you (David, Marius, and anyone else) before merging it back with the main site, as I feel what I have done might be contentious and I don't want to cause any problems. Whats the normal process of committing changes. Is the code QA'ed in some way or do I just do it,and wait for people to say #!. cheers Oliver --~--~-~--~~~---~--~~ 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: scalajpa - while accessing two distincts databases, the second access is made with a connection to the first database
2009/6/18 Meredith Gregory lgreg.mered...@gmail.com Oliver, The short answer is no. The longer answer is - i worked this all out on my own; so, you guys -- who can program lift on top of scala on top of JVM and are therefore about 20X smarter than i am -- can too. I think if we were all 20X (or 2X) smarter than you, we would have taken over Google by now. - - And also, help is always available, if there is something specific you don't understand, let me know and i will do my best to convey it to you. As suggested by another kind person, I may have to start by going back to (an American?) school. Heres a question, why should I care about Monad's when they are already in OO, just not called Monads? - Best wishes, --greg P.S. Here is a version of the paragraph with links to useful bits of lore from the literature. For myself, i was unhappy with the notion of name. The π-calculihttp://en.wikipedia.org/wiki/Pi-calculusand lambda calculi http://en.wikipedia.org/wiki/Lambda_calculus suffer a dependence on a notion of name. Both families of calculi require at least countably infinitely http://en.wikipedia.org/wiki/Countable many nameshttp://www.cs.nps.navy.mil/research/languages/statements/gordon.html, and a notion of equality on names. If names have no internal structure then these theories *cannot be effectivehttp://en.wikipedia.org/wiki/Computable_function *. The reasons is that the notion of equality must then be realized as an infinitary table which cannot fit in any computer we have access to. Therefore, in effective theories, names must have internal structure. Since they have internal structure and are at least countably infinite, one is in danger of undermining the foundational character of these proposals for computing. Therefore, the only possible solution is that the notion of structured name must come from the notion of program proposed by the model. This argument is airtight. If you want a foundational model of computing with nominal structure, the nominal structure must derive from the notion of computation being put forward, i.e. it must *reflect* the notion of computationhttp://svn.biosimilarity.com/src/open/papers/trunk/concurrency/rho/ex_nihilo_entcs/ex_nihilo_finco.pdf. This gives rise to all kinds of new an beautiful phenomena. One measure of your way into compositional thinking is whether this is happening. Is your approach to compositional thinking beginning to yield whole new aspects of computing, and new 'wholes' of computation, new forms of organization. 2009/6/16 Oliver Lambert olambo...@gmail.com 2009/6/17 Meredith Gregory lgreg.mered...@gmail.com Jeremy, Most excellent question award to you, sir! How to bootstrap thinking compositionally... this is what i did - learn some compositional idioms by heart - do you know the shape of the paradoxical combinator by heart - do you know the data making up a monad - do you know the data making up a distributive law between monads - use them in real world applications and see where they fail - when is calculating the least/greatest fixpoint of a recursive spec for a problem the suboptimal solution - when is a monad not the answer - when is an indexed form of composition inadequate - improve them - is it a situational improvement or - a fundamental improvement - see where the very programming model itself fails - is functional composition the only sort of composition - how is parallel composition like functional composition - is parallel composition easily represented in categorical composition - improve it - what is the view of the world in your notion of composition - play with new programming models - does your new notion of composition give rise to a whole generation of different models - invent new idioms in these models - what are the things these models naturally express - and teach them to someone who wishes to bootstrap thinking compositionally For myself, i was unhappy with the notion of name. The π-calculi and lambda calculi suffer a dependence on a notion of name. Both families of calculi require at least countably infinitely many names, and a notion of equality on names. If names have no internal structure then these theories *cannot be effective*. Do we need to do some sort of course to understand this language? The reasons is that the notion of equality must then be realized as an infinitary table which cannot fit in any computer we have access to. Therefore, in effective theories, names must have internal structure. Since they have internal structure and are at least countably infinite, one is in danger of undermining the foundational character of these proposals for computing. Therefore, the only possible solution is that the notion of structured
[Lift] Re: Develop / Production System
Sometimes (is this, folk-tale or truth?) the maven repository around the application you'reworking on may get slightly out of sync. Then you might need to delete the part of the repository that your application is installed into. On Tue, Jun 16, 2009 at 7:25 PM, Tobias Daub hannes.flo...@gmx.li wrote: Ok, thanks. Well, with the pom.xml file it was a little bit strange. I had to change the Lift version to do the mvn clean install and then change it back. I've no idea why, but it was the only things that helped. Maven stores project dependencies in a repository (by default, its called .m2). When you move a Lift application from one system to another, the repository on the new system may need to be updated, hence your requirement to do a mvn clean install. Don't know what you changed on the pom.xml (if you have any hard coded paths, you might have to change them). On Tue, Jun 16, 2009 at 2:41 AM, Tobias Daub hannes.flo...@gmx.li mailto:hannes.flo...@gmx.li wrote: Hi There, I would like to know whats the best way to move an existing Lift installation from one system to another. I ask this, because I had some problems after I just copied the whole directory (I had to edit the pom.xml file and do mvn clean install). 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: scalajpa - while accessing two distincts databases, the second access is made with a connection to the first database
I think you have just volunteered to help refactor this code to make it more composition friendly :) On Wed, Jun 17, 2009 at 9:38 AM, Meredith Gregory lgreg.mered...@gmail.comwrote: Derek, soapbox You have just demonstrated a process that i have been talking about for the last 15 years. People have a blind spot when it comes to thinking compositionally. They think -- almost to a person -- about god's eye view solutions where there's only one of some key solution component. They don't think about solutions that are composed of ... (wait for it)... solutions! It takes some serious training to think compositionally. Compositional solutions, however, are the only realistic way to scale. When solutions are compositional, you can *de*compose. The db example is a case in point. One of the most natural ways to scale data access is sharding and partitioning -- which requires upfront machinery to support decomposition of the store. Lest you feel bad, note that some of the best scientific minds of all time have fallen prey to this blind spot. Newtonian physics as well as Einstein's update to Newton's proposal is a non-compositional solution. Quantum mechanics also exhibits compositional failures. This is why physics is failing to find proposals that link theories of gravitation (essentially large scale) to quantum mechanical theories of the other forces (essentially very small scale) -- the physical theories are non-compositional -- they don't scale! One of the real things functional programming has going for it is that the basic model of computation underlying the means of structuring and manipulating programs is compositional. That's why it is important to have a technology like Scala resting atop the incumbent execution model (JVM) being deployed on web-scale problems. Compositionality is the only way to tackle applications at global scale. /soapbox Thanks for getting the fix to this problem in so quickly. Best wishes, --greg On Tue, Jun 16, 2009 at 11:53 AM, Derek Chen-Becker dchenbec...@gmail.com wrote: Using multiple EMs was not something I had considered when I wrote this. I think that I can modify the code to provide a __nameSalt def to differentiate instances. Let me work on it and I'll have something soon. Derek On 6/16/09, Jean-Luc jlcane...@gmail.com wrote: For your information, here is an extract of source code of RequestVarEM : Trait RequestVarEM extends ScalaEntityManager with ScalaEMFactory { object emVar extends RequestVar[EntityManager](openEM()) { ... } } EntityManager is stored in the singleton emVar; so, all db access of Model objects are made using the singleton emVar. = trait RequestVarEM allow only one connection to a database within the same HttpRequest context. Jean-Luc 2009/6/15 Jean-Luc jlcane...@gmail.com Hello, I have two databases, db1 (a.k.a. Motorbike) and db2 (a.k.a. Motorway) defined with RequestVarEM : - object ModelDb1 extends LocalEMF(db1) with RequestVarEM // Motorbike database - object ModelDb2 extends LocalEMF(db2) with RequestVarEM // Motorway database I thought one could access to any databases independently from any snippet as long as the correct Model object were used (ModelDb1 or ModelDb2 for exemple) ; but when I access both databases from the same page, the second database access issues a Named query not found exception. I have two snippets, one to display a list of motorbike, another to display a list of motorway : - page1 : ModelDb1.createNamedQuery[Motorbike](Motorbike.findAll).getResultList() = ok - page2 : ModelDb2.createNamedQuery[Motorway](Motorway.findAll).getResultList() = ok - page3 : calling from page 3 motorbike motorway snippets : Named query not found: Motorway.findAll - page4 : calling from page 4 motorway motorbike snippets : Named query not found: Motorbike.findAll - page3 changing the query of *Motorway* snippet : - ModelDb2.createNamedQuery[*Motorbike*](*Motorbike*.findAll).getResultList() = it's ok and I do NOT have an exception ! I joined a sample application, ... any idea about this issue ? (bad use of LocalEMF in the application code ? issue with LocalEMF or RequestVarEM ?) Jean-Luc PS : I don't know if it's related but I have this in the log : [INFO] Checking for multiple versions of scala [WARNING] Multiple versions of scala libraries detected! -- Jean-Luc Canela jlcane...@gmail.com -- Jean-Luc Canela jlcane...@gmail.com -- 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
[Lift] directory structure
In Boot.scala can I call LiftRules.addToPackages multiple times to add multiple directories with snippets in them? Do I have to have a directory structure ending with snippet, for snippets? Do I need the directories comet, model and view, when they are just empty? cheers Oliver --~--~-~--~~~---~--~~ 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: scalajpa - while accessing two distincts databases, the second access is made with a connection to the first database
2009/6/17 Meredith Gregory lgreg.mered...@gmail.com Jeremy, Most excellent question award to you, sir! How to bootstrap thinking compositionally... this is what i did - learn some compositional idioms by heart - do you know the shape of the paradoxical combinator by heart - do you know the data making up a monad - do you know the data making up a distributive law between monads - use them in real world applications and see where they fail - when is calculating the least/greatest fixpoint of a recursive spec for a problem the suboptimal solution - when is a monad not the answer - when is an indexed form of composition inadequate - improve them - is it a situational improvement or - a fundamental improvement - see where the very programming model itself fails - is functional composition the only sort of composition - how is parallel composition like functional composition - is parallel composition easily represented in categorical composition - improve it - what is the view of the world in your notion of composition - play with new programming models - does your new notion of composition give rise to a whole generation of different models - invent new idioms in these models - what are the things these models naturally express - and teach them to someone who wishes to bootstrap thinking compositionally For myself, i was unhappy with the notion of name. The π-calculi and lambda calculi suffer a dependence on a notion of name. Both families of calculi require at least countably infinitely many names, and a notion of equality on names. If names have no internal structure then these theories *cannot be effective*. Do we need to do some sort of course to understand this language? The reasons is that the notion of equality must then be realized as an infinitary table which cannot fit in any computer we have access to. Therefore, in effective theories, names must have internal structure. Since they have internal structure and are at least countably infinite, one is in danger of undermining the foundational character of these proposals for computing. Therefore, the only possible solution is that the notion of structured name must come from the notion of program proposed by the model. This argument is airtight. If you want a foundational model of computing with nominal structure, the nominal structure must derive from the notion of computation being put forward, i.e. it must *reflect* the notion of computation. This gives rise to all kinds of new an beautiful phenomena. One measure of your way into compositional thinking is whether this is happening. Is your approach to compositional thinking beginning to yield whole new aspects of computing, and new 'wholes' of computation, new forms of organization. Best wishes, --greg On Tue, Jun 16, 2009 at 7:31 PM, Jeremy Day jeremy@gmail.com wrote: Greg, On Tue, Jun 16, 2009 at 6:38 PM, Meredith Gregory lgreg.mered...@gmail.com wrote: It takes some serious training to think compositionally. No doubt it is extremely tough to think compositionally, and it's all too easy to fall back on non-compositional ways of thinking. In a similar vein it's all too easy to fall into procedural patterns when learning or working with functional programming in a multi-paradigm language. But what are good ways for programmers to learn to think compositionally and, more importantly, practice? Do you know of any books or online references that might help make the transition for anyone who is interested? Jeremy -- 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: Cheap Hosting
Thats good value - might use it too sometime. On Mon, Jun 15, 2009 at 1:56 PM, David Pollak feeder.of.the.be...@gmail.com wrote: Mark, You should be able to host a moderately trafficked site (400 unique visitors an hour) with a $20 slicehost.com account. Thanks, David On Sun, Jun 14, 2009 at 4:40 PM, Mark Lynn m...@sabado.com wrote: I have a web app that I am doing free for a charitable organization that is sensitive to hosting costs. I would like to make it my first Lift app since it is pretty straight-forward - simple database and will probably just use Mapper. Most of my previous experience is with Rails projects or projects that were hosted internally so I don't have much experience with java hosting services. Does anyone have a recommendation for an inexpensive hosting option where I can use scala/ lift? With Rails or PHP I can find stuff for as little as $5/mth. Mark Lynn -- 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: a href... optional query params
I don't think any of the Liftweb's binding is going to survive a server restart, but, why are you worried about a server restart? On Tue, Jun 16, 2009 at 8:59 AM, Ewan ehar...@gmail.com wrote: Hi all I have bind that renders a link and at the moment I want the link to include a couple of query params ie. a href=/search?q1=v1q2=v2 Click me/a I figured I'd be able to do something like the following except the additional key/id is added which messes it up. value - SHtml.link(/search?q1=v1, () = doSearch, SText(Click me)) Looking at the src I can't see how this would work. I guess using a requestVar would be the recommended solution but how does that work for bookmarked urls between server restarts? --~--~-~--~~~---~--~~ 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: Hiring Lift Developers
As probably is Sydney, Australia. It might be useful knowing where people are who are looking for jobs - the company I work for is small, but, might be interested in hiring sometime in the future. On Tue, Jun 16, 2009 at 8:51 AM, KWright kev.lee.wri...@googlemail.comwrote: I suspect that London UK would probably be an exception too far! On 15 June, 23:45, David LaPalomento dlapalome...@novell.com wrote: Good point, sorry! Most of the team is located in the Boston area, but we'd probably be willing to make exceptions. On Jun 15, 4:14 pm, KWright kev.lee.wri...@googlemail.com wrote: You forgot to mention where you are in the world, it might be useful to know... :P On 15 June, 18:32, David LaPalomento dlapalome...@novell.com wrote: Hi all, My team has recently started a project based around Lift and we're looking at bringing on some passionate, full-time developers to make that happen. It's a pretty ambitious effort and we expect to be pushing the technology envelope in real-time communication (CometActors have already been a huge help here) and user experience for web applications. If you think you might be interested, drop me an email and I'd be glad to go into greater detail about the project. Also, apologies in advance if I shouldn't be posting this sort of thing to the list. Regards, David --~--~-~--~~~---~--~~ 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: Develop / Production System
Maven stores project dependencies in a repository (by default, its called .m2). When you move a Lift application from one system to another, the repository on the new system may need to be updated, hence your requirement to do a mvn clean install. Don't know what you changed on the pom.xml (if you have any hard coded paths, you might have to change them). On Tue, Jun 16, 2009 at 2:41 AM, Tobias Daub hannes.flo...@gmx.li wrote: Hi There, I would like to know whats the best way to move an existing Lift installation from one system to another. I ask this, because I had some problems after I just copied the whole directory (I had to edit the pom.xml file and do mvn clean install). 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: file upload
Whats serious uploading? I uploaded 15,000 records using it today - seemedto handle it OK. On Fri, Jun 12, 2009 at 9:48 AM, Timothy Perrett timo...@getintheloop.euwrote: FYI - its not a streaming upload at the moment, so its great for smallish files, but you wouldnt want to do much serious uploading with it right now. We've had several discussions about making it streaming, and its certainly on the todo list. Cheers, Tim On Jun 11, 9:24 pm, DavidV david.v.villa...@gmail.com wrote: I would like to upload a .csv file onto the web server so I can then parse it in my webapp, and put certain fields into my database. I would like a Browse... button, much like the one shown on this Lift example page:http://demo.liftweb.net/file_upload Can anyone point me in the right direction as to how to get started doing this, or tell me where I can find the example code for the link I provided? I can't seem to locate it in liftweb in github thanks, David --~--~-~--~~~---~--~~ 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: security
On Wed, Jun 10, 2009 at 11:58 PM, David Pollak feeder.of.the.be...@gmail.com wrote: On Tue, Jun 9, 2009 at 11:39 PM, marius d. marius.dan...@gmail.comwrote: Hi, For most apps cannonicalization is not really necessary as the character stream for form-url-encoded is UTF-8 by default as Lift uses UTF-8 by default. Oh and the conversion from URL encoding to plain UTF-8 content is really done by container and when we get the params from the request object they are already well formed. Now if we're talking about a higher level of validation that's a different story and IMO this is an application aspect and not much a framework one. And Lift does URL Decoding of the paths before presenting them as the Req() object. More broadly, Lift should provide all the features of ESAPI out of the box. If there are particular things that ESAPI offers that Lift doesn't, please flag them and we'll add them. I did a bunch of years as VPE and CTO at a web app security company. In general, I've worked to make sure that Lift has security baked in and that the developer has to work to make the app insecure, rather than vice versa. If I missed a spot, Lift will be enhanced to make sure it does have security baked in. From my perspective Lift is secure, much more so than other frameworks I've used. The current set of Lift apps, that I've helped develop, have survived outsourced penetration testing without requiring any modifications at all. Great! I'm not a security expert, but I am being asked to consider ESAPI features. From my limited understanding, the UTF-8 encoding is fine and Lift protects the response from displaying any scripts or html that might have inadvertently been added to the database. The problem is more what is being validated and how its being validated. I don't buy Marius's claim that this is somehow a higer order validation that is an application concern rather than a framework one. The internet has all the insecurities it has, because security has been left to the application developer. As far a I can see, one problem lies when a string is obtained from the web page and instanciated into a String object. For instance, if it comes in as scriptalert('XSS')/script, then its probably not what you want. Why does it matter if something like this gets stored in your database - perhaps because it's one part of your security. In addition if it comes in doubly encoded as %253Cscript%253Ealert('XSS')%253C%252Fscript%253E then its probably also not what you want. 1) To stop double encoding, ESAPI suggests that you use cannonicalization to convert the strings to a similar format before validation. 2) After, the input has been cannonicalized, ESAPI suggests that the input should be validated against a whitelist of allowed charaters. Now, I can't see that 1 or 2 is necessary if you are creating a number from the input, but perhaps it should be, if you are creating a ordinary String object. I also am not sure how much work would be involved in using a whitelist in a location aware multilingual way, but perhaps it could be done as a default. Br's, Marius On Jun 10, 5:43 am, Oliver Lambert olambo...@gmail.com wrote: Looks like I might have a requirement for implementing OWASP secure coding practices, as described by One thing that I definitively don't do and I believe Lift doesn't do out of the box is Canonicalize input before validation/filtering. I was looking into using OWASP ESAPIhttp://www.owasp.org/index.php/ESAPIbut I'm put off by it's use of property files and system resources. Do any of you Canonicalize input, if so, do you use a Library? Does Lift need this feature, or any of the others described in the above document? cheers Oliver -- 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: Record and Field
Im not at the machine right now, but I believe it was a version of 1.6 on Ubuntu, I was running against the snapshot of liftweb that I cloned a couple of days ago. I've rerun On my mac, build 1.6.0_07-b06-153 but the exception with build 1.0 is different, java.lang.IllegalArgumentException: wrong number of arguments On Mon, Jun 1, 2009 at 10:05 PM, marius d. marius.dan...@gmail.com wrote: what Java version are you using? On Jun 1, 1:58 pm, Oliver Lambert olambo...@gmail.com wrote: When I try to run createRecord on a net.liftweb.record.Record, I get a java.lang.ExceptionInInitializerError. Any ideas what I might be doing wrong? cheers Oliver --~--~-~--~~~---~--~~ 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: Record with the new bind-immutable
On Sat, May 30, 2009 at 2:05 AM, marius d. marius.dan...@gmail.com wrote: On May 29, 4:32 pm, Oliver Lambert olambo...@gmail.com wrote: Hi Marius, To try and answer your question, I had to go and look at the Record code in more detail. I hadn't recently written the Binder Validator, so it wasn't designed to be complementary to anything else (however, some of the naming and methodology is very similar in both sets of code). What I found. 1) MetaRecord.validate === Binder.validate 2) Field.validators === BoundObj.validations 3) Field.validationFunction === Validator.validate 4) List[FieldError] === List[ValidationError] Can I get rid of Binder Validation and just use Record/Field validation? It certainly looks like I should try. However, I might have to add/change some of the original Lift code. For instance, I might want to add an errorType (with a default, so no code is broken) to FieldError. I might also want to move/change Field.validationFunction so its a little more like my Validator,with an errorType and toString (When I print my validators, the errorType give a little information on what they do, rather than just telling me I have a function - I also filter using the errorType) I think we should unify the models. What I particularly like about the existent validators is that it rlies on function type hence the flexibility to use anonymous functions or existent ones. SO IMHO it would be really neat to keep the existent validators per Field and if you would edd the errorType support would just great. I think Ive managed to unify the models. There is a new Validator object, net.liftweb.record.Validator that has an implicit conversion that accepts a function (anonymous or otherwise) and wraps it in a Validator class with an errorType. Thus validators can be written as functions or classes, and as they are wrapped in a class it should be easy enough to add support for javascript validation. I can't really test it on the existing Record code, as I can't even manage to instanciate a simple record. I have however, refactored the immutable binding code. Oh FWIW I'm not a fan of function names starting with capital letters such as: def Range(lower: Int, upper: Int, errStr: String) .. but that's just me. Me neither. Don't know why I did this. Other things of interest that I found. Could a Binder be a MetaRecord? There are definitely some similarities. Binder holds a set of immutable objects which can be an advantage, but MetaRecord can talk to databases which is kind of useful at times. I think we should keep the Meta Record and Record. Please keep in mind that MetaRecord and Record have NOTHING to do with database, they are completely separated per design so that Records can be also used outside of a RDBMS scope. For DB we have DBMetaRecord and DBRecord which are not fully implemented yet. Could a BoundObj be a Field. Same distinction as above. A BoundObj[T] may hold a reference to a string value that is completely invalid. I'm not sure I see this in Field. IMHO I would just add the features that your code has and current code does not (such as error type) and put them in the MetaRecord/Record (or wherever they belong) and have a single coherent model. Please also take a deeper look on the existent code, in MetaRecord, Record, Fields implementations Not DB Fields) and see what goodies can be added from your new code. And integrating client side validations (as Dave suggested) in the same model would be really cool. cheers Oliver On Fri, May 29, 2009 at 6:22 PM, marius d. marius.dan...@gmail.com wrote: I see ... still the question remains. What are we going to do with two validators? I'd like to understand the principles of your addition (... I know I should have dig into the code but I don't have much time now). I'd like to understand as I said previously if we have redundant validators or complementary functionality so that people to not get confused. I'm not trying at all to be negative or anything, just trying to understand the value added. Br's, Marius On May 29, 11:01 am, Oliver Lambert olambo...@gmail.com wrote: I'm aware of S.error and my ValidationError uses it when I'm ready to show errors. I've briefly looked at the ValidationFunction and the thing I might stumble on is the errorType which I rely on. I may be able to refactor the code to use List[FieldError] as I don't think I rely on errorType at this point. I'll have a go at modifying the Binder code. cheers Oliver On Fri, May 29, 2009 at 5:05 PM, Marius marius.dan...@gmail.com wrote: Oliver, I very briefly looked on your code and I saw that you have your own validator there. How would that play with the existent validattors that Record has where each field has
[Lift] Re: git ouch
I got that list of commands wrong, what I typed, was git clone g...@github.com:dpp/liftweb.git git branch wip-ol-immu git checkout wip-ol-immu git push origin wip-ol-immu When I do a git branch -a, I get two wip-ol-immu master * wip-ol-immu origin/1.0_maint origin/HEAD origin/master origin/new_actor origin/wip-boolean-can origin/wip-dcb-derby-binary origin/wip-dcb-jpa-jta origin/wip-dcb-jpa-validation origin/wip-dcb-lift-jpa origin/wip-dpp-record origin/wip-marius-dom-optimizations origin/wip-ol-immu origin/wip-prettify origin/wip-record2-dpp On Fri, May 29, 2009 at 3:50 PM, Oliver Lambert olambo...@gmail.com wrote: When I look at the liftweb network graph, it looks like I'm working on the main liftweb master line and have renamed it. On Fri, May 29, 2009 at 3:38 PM, Derek Chen-Becker dchenbec...@gmail.comwrote: I just looked at Git and I show a proper branch there (wip-ol-immu) committed about 30 minutes ago. Are you seeing some error on your end? Derek On Thu, May 28, 2009 at 11:19 PM, Oliver Lambert olambo...@gmail.comwrote: Git wouldn't let me create a branch of liftweb until I deleted and recreated my ssh keys - I believed all was good. I thought I was following the documentation, to create my own branch, which appeared to be correct on my machine. But, when I just pushed what I thought was my branch, I appear to have done something wrong. Any help (without curses) is greatly appreciated at this moment. cheers Oliver --~--~-~--~~~---~--~~ 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: git ouch
I have a problem with breaking a build on my first attempt of working with git. I'm happy if I haven't, but what was concerning me was in the included image (the network line looks like wip-ol-immu is directly next to master, rather than on a separate branch - if this is normal, Im happy) On Fri, May 29, 2009 at 4:22 PM, Heiko Seeberger heiko.seeber...@googlemail.com wrote: Oliver, But that's perfect! What's your problem? There is one LOCAL wip-ol-immu branch and one REMOTE. That's how it is expected to be for a branch you pushed. Heiko 2009/5/29 Oliver Lambert olambo...@gmail.com I got that list of commands wrong, what I typed, was git clone g...@github.com:dpp/liftweb.git git branch wip-ol-immu git checkout wip-ol-immu git push origin wip-ol-immu When I do a git branch -a, I get two wip-ol-immu master * wip-ol-immu origin/1.0_maint origin/HEAD origin/master origin/new_actor origin/wip-boolean-can origin/wip-dcb-derby-binary origin/wip-dcb-jpa-jta origin/wip-dcb-jpa-validation origin/wip-dcb-lift-jpa origin/wip-dpp-record origin/wip-marius-dom-optimizations origin/wip-ol-immu origin/wip-prettify origin/wip-record2-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 -~--~~~~--~~--~--~--- attachment: wip-ol.jpg
[Lift] Re: Record with the new bind-immutable
I'm aware of S.error and my ValidationError uses it when I'm ready to show errors. I've briefly looked at the ValidationFunction and the thing I might stumble on is the errorType which I rely on. I may be able to refactor the code to use List[FieldError] as I don't think I rely on errorType at this point. I'll have a go at modifying the Binder code. cheers Oliver On Fri, May 29, 2009 at 5:05 PM, Marius marius.dan...@gmail.com wrote: Oliver, I very briefly looked on your code and I saw that you have your own validator there. How would that play with the existent validattors that Record has where each field has a list of : type ValidationFunction = MyType = Box[Node] Note that current MetaRecord's validator after evaluating the validators for each field it yields a List[FieldError] which can be easily naturally used with S.error function to show the error messages etc. Is there a redundancy or complementary functionality? Br's, Marius --~--~-~--~~~---~--~~ 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: Record with the new bind-immutable
Hi Marius, To try and answer your question, I had to go and look at the Record code in more detail. I hadn't recently written the Binder Validator, so it wasn't designed to be complementary to anything else (however, some of the naming and methodology is very similar in both sets of code). What I found. 1) MetaRecord.validate === Binder.validate 2) Field.validators === BoundObj.validations 3) Field.validationFunction === Validator.validate 4) List[FieldError] === List[ValidationError] Can I get rid of Binder Validation and just use Record/Field validation? It certainly looks like I should try. However, I might have to add/change some of the original Lift code. For instance, I might want to add an errorType (with a default, so no code is broken) to FieldError. I might also want to move/change Field.validationFunction so its a little more like my Validator,with an errorType and toString (When I print my validators, the errorType give a little information on what they do, rather than just telling me I have a function - I also filter using the errorType) Other things of interest that I found. Could a Binder be a MetaRecord? There are definitely some similarities. Binder holds a set of immutable objects which can be an advantage, but MetaRecord can talk to databases which is kind of useful at times. Could a BoundObj be a Field. Same distinction as above. A BoundObj[T] may hold a reference to a string value that is completely invalid. I'm not sure I see this in Field. cheers Oliver On Fri, May 29, 2009 at 6:22 PM, marius d. marius.dan...@gmail.com wrote: I see ... still the question remains. What are we going to do with two validators? I'd like to understand the principles of your addition (... I know I should have dig into the code but I don't have much time now). I'd like to understand as I said previously if we have redundant validators or complementary functionality so that people to not get confused. I'm not trying at all to be negative or anything, just trying to understand the value added. Br's, Marius On May 29, 11:01 am, Oliver Lambert olambo...@gmail.com wrote: I'm aware of S.error and my ValidationError uses it when I'm ready to show errors. I've briefly looked at the ValidationFunction and the thing I might stumble on is the errorType which I rely on. I may be able to refactor the code to use List[FieldError] as I don't think I rely on errorType at this point. I'll have a go at modifying the Binder code. cheers Oliver On Fri, May 29, 2009 at 5:05 PM, Marius marius.dan...@gmail.com wrote: Oliver, I very briefly looked on your code and I saw that you have your own validator there. How would that play with the existent validattors that Record has where each field has a list of : type ValidationFunction = MyType = Box[Node] Note that current MetaRecord's validator after evaluating the validators for each field it yields a List[FieldError] which can be easily naturally used with S.error function to show the error messages etc. Is there a redundancy or complementary functionality? Br's, Marius --~--~-~--~~~---~--~~ 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: Record with the new bind-immutable
That would be very cool On Fri, May 29, 2009 at 11:37 PM, David Pollak feeder.of.the.be...@gmail.com wrote: One thing I've been thinking about is optionally extending the Validator Functions to also emit JavaScript that would perform the validation in the browser... that would provide a seamless way to do client-side validation for validators (e.g., min len, max len, regex) that only rely on client-side data. On Fri, May 29, 2009 at 6:32 AM, Oliver Lambert olambo...@gmail.comwrote: Hi Marius, To try and answer your question, I had to go and look at the Record code in more detail. I hadn't recently written the Binder Validator, so it wasn't designed to be complementary to anything else (however, some of the naming and methodology is very similar in both sets of code). What I found. 1) MetaRecord.validate === Binder.validate 2) Field.validators === BoundObj.validations 3) Field.validationFunction === Validator.validate 4) List[FieldError] === List[ValidationError] Can I get rid of Binder Validation and just use Record/Field validation? It certainly looks like I should try. However, I might have to add/change some of the original Lift code. For instance, I might want to add an errorType (with a default, so no code is broken) to FieldError. I might also want to move/change Field.validationFunction so its a little more like my Validator,with an errorType and toString (When I print my validators, the errorType give a little information on what they do, rather than just telling me I have a function - I also filter using the errorType) Other things of interest that I found. Could a Binder be a MetaRecord? There are definitely some similarities. Binder holds a set of immutable objects which can be an advantage, but MetaRecord can talk to databases which is kind of useful at times. Could a BoundObj be a Field. Same distinction as above. A BoundObj[T] may hold a reference to a string value that is completely invalid. I'm not sure I see this in Field. cheers Oliver On Fri, May 29, 2009 at 6:22 PM, marius d. marius.dan...@gmail.comwrote: I see ... still the question remains. What are we going to do with two validators? I'd like to understand the principles of your addition (... I know I should have dig into the code but I don't have much time now). I'd like to understand as I said previously if we have redundant validators or complementary functionality so that people to not get confused. I'm not trying at all to be negative or anything, just trying to understand the value added. Br's, Marius On May 29, 11:01 am, Oliver Lambert olambo...@gmail.com wrote: I'm aware of S.error and my ValidationError uses it when I'm ready to show errors. I've briefly looked at the ValidationFunction and the thing I might stumble on is the errorType which I rely on. I may be able to refactor the code to use List[FieldError] as I don't think I rely on errorType at this point. I'll have a go at modifying the Binder code. cheers Oliver On Fri, May 29, 2009 at 5:05 PM, Marius marius.dan...@gmail.com wrote: Oliver, I very briefly looked on your code and I saw that you have your own validator there. How would that play with the existent validattors that Record has where each field has a list of : type ValidationFunction = MyType = Box[Node] Note that current MetaRecord's validator after evaluating the validators for each field it yields a List[FieldError] which can be easily naturally used with S.error function to show the error messages etc. Is there a redundancy or complementary functionality? Br's, Marius -- 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] git ouch
Git wouldn't let me create a branch of liftweb until I deleted and recreated my ssh keys - I believed all was good. I thought I was following the documentation, to create my own branch, which appeared to be correct on my machine. But, when I just pushed what I thought was my branch, I appear to have done something wrong. Any help (without curses) is greatly appreciated at this moment. cheers Oliver --~--~-~--~~~---~--~~ 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: git ouch
The following sequence, without various commits git clone g...@github.com:dpp/liftweb.git git branch wip-ol-immugit checkout wip-ol-immu git checkout wip-ol-immu git push origin wip-ol-immu The git network now looks wrong. Where did I stuff up? On Fri, May 29, 2009 at 3:29 PM, Heiko Seeberger heiko.seeber...@googlemail.com wrote: Some more details, please: What git commands did you enter? 2009/5/29 Oliver Lambert olambo...@gmail.com Git wouldn't let me create a branch of liftweb until I deleted and recreated my ssh keys - I believed all was good. I thought I was following the documentation, to create my own branch, which appeared to be correct on my machine. But, when I just pushed what I thought was my branch, I appear to have done something wrong. Any help (without curses) is greatly appreciated at this moment. cheers Oliver -- 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: git ouch
When I look at the liftweb network graph, it looks like I'm working on the main liftweb master line and have renamed it. On Fri, May 29, 2009 at 3:38 PM, Derek Chen-Becker dchenbec...@gmail.comwrote: I just looked at Git and I show a proper branch there (wip-ol-immu) committed about 30 minutes ago. Are you seeing some error on your end? Derek On Thu, May 28, 2009 at 11:19 PM, Oliver Lambert olambo...@gmail.comwrote: Git wouldn't let me create a branch of liftweb until I deleted and recreated my ssh keys - I believed all was good. I thought I was following the documentation, to create my own branch, which appeared to be correct on my machine. But, when I just pushed what I thought was my branch, I appear to have done something wrong. Any help (without curses) is greatly appreciated at this moment. cheers Oliver --~--~-~--~~~---~--~~ 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: immutable bindings
I've pushed my changes and additions back to my branch, hopefully for all to see (still learning git). I'll write an example app based on the changes soon. cheers Oliver On Tue, May 19, 2009 at 9:14 AM, David Pollak feeder.of.the.be...@gmail.com wrote: Oliver, Good stuff... please make sure that your branch is available on the GitHub repository for all to see and use. Thanks, David On Sat, May 16, 2009 at 1:36 AM, Oliver Lambert olambo...@gmail.comwrote: On Sat, May 16, 2009 at 4:32 AM, David Pollak feeder.of.the.be...@gmail.com wrote: On Thu, May 14, 2009 at 7:43 PM, Oliver Lambert olambo...@gmail.comwrote: I've started integrating my immutable bindings, but have some questions On my build, I've placed the main immutable binding classes in module lift webkit under package net.liftweb.http.immu. Is that location/name OK? If there's stuff that does not reference other stuff in the http classes, please put it in net.liftweb.util. How many classes do you have? Can we put it in net.liftweb.record instead? I'm thinking your work might form the basis for some of the record stuff. I'll put what I can in net.liftweb.util. I guess there are about 10 classes, but I'll probably put these in a few files. I like the idea of using net.liftweb.record - I'll start to study the record methodology, also. I would like to introduce a new set of currency classes, roughly based on Martin et al's Currency Zone example in their book. Derek, is using an earlier version of it in his JPA example, Ive simplified it a little and extended it to include a few different currencies. Is this OK? - I know there is a simple currency class already. Sure. I'm pretty sure the existing currency class in net.liftweb.util is unused, so if you want to break that class, that might be a good place to put your code. cool, will do I'm not sure what to do about the mixin binding that I use for html, that extends/modifies BindHelpers. Put it in BindHelpers... as long as it doesn't break any of the existing APIs. ok, I might go slowly on this bit. Potentially I could modify BindHelpers, but, should I leave it out for now or include it as an optional and separate class in net.liftweb.html.immu? cheers Oliver -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp Git some: http://github.com/dpp -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp 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 -~--~~~~--~~--~--~---
Fwd: [Lift] Re: immutable bindings
Added immutable binding example application to sites module, in my branch (didn't take long, must have done something right). -- Forwarded message -- From: Oliver Lambert olambo...@gmail.com Date: Wed, May 27, 2009 at 4:16 PM Subject: Re: [Lift] Re: immutable bindings To: liftweb@googlegroups.com I've pushed my changes and additions back to my branch, hopefully for all to see (still learning git). I'll write an example app based on the changes soon. cheers Oliver On Tue, May 19, 2009 at 9:14 AM, David Pollak feeder.of.the.be...@gmail.com wrote: Oliver, Good stuff... please make sure that your branch is available on the GitHub repository for all to see and use. Thanks, David On Sat, May 16, 2009 at 1:36 AM, Oliver Lambert olambo...@gmail.comwrote: On Sat, May 16, 2009 at 4:32 AM, David Pollak feeder.of.the.be...@gmail.com wrote: On Thu, May 14, 2009 at 7:43 PM, Oliver Lambert olambo...@gmail.comwrote: I've started integrating my immutable bindings, but have some questions On my build, I've placed the main immutable binding classes in module lift webkit under package net.liftweb.http.immu. Is that location/name OK? If there's stuff that does not reference other stuff in the http classes, please put it in net.liftweb.util. How many classes do you have? Can we put it in net.liftweb.record instead? I'm thinking your work might form the basis for some of the record stuff. I'll put what I can in net.liftweb.util. I guess there are about 10 classes, but I'll probably put these in a few files. I like the idea of using net.liftweb.record - I'll start to study the record methodology, also. I would like to introduce a new set of currency classes, roughly based on Martin et al's Currency Zone example in their book. Derek, is using an earlier version of it in his JPA example, Ive simplified it a little and extended it to include a few different currencies. Is this OK? - I know there is a simple currency class already. Sure. I'm pretty sure the existing currency class in net.liftweb.util is unused, so if you want to break that class, that might be a good place to put your code. cool, will do I'm not sure what to do about the mixin binding that I use for html, that extends/modifies BindHelpers. Put it in BindHelpers... as long as it doesn't break any of the existing APIs. ok, I might go slowly on this bit. Potentially I could modify BindHelpers, but, should I leave it out for now or include it as an optional and separate class in net.liftweb.html.immu? cheers Oliver -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp Git some: http://github.com/dpp -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp 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: Robust and clear ways to do performant JDBC?
Yes, I helped with the code! On Sat, May 23, 2009 at 9:28 PM, Timothy Perrett timo...@getintheloop.euwrote: To what degree are you wanting to re-invent the wheel? Derek has done amazing work with JPA and Scala - the resulting output being scala-jpa and the jpa archetypes for lift. Are you familiar with them? Cheers, Tim On 23/05/2009 11:56, Oliver Lambert olambo...@gmail.com wrote: JPA is a ORM tool. I think it would be great if someone would create a Scala solution using JPA as the starting point - any takers? --~--~-~--~~~---~--~~ 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: Robust and clear ways to do performant JDBC?
When I want to have user defined types, I have to write them as a Hibernate hack to JPA - Id rather not be wedded to Hibernate.When I get a collection out of a returned entity, I have to use JCL to wrap it. I'd rather, have everything in Scala collections. When I have a read only entity, I'd like it to be immutable. In fact, maybe all entities should be, but thats probably too hard. I'm just taking about the lower layer of JPA that Derek's stuff hooks into - its OK for Java, it kind of sucks for Scala. Just my thoughts, don't expect anyone to agree. cheers Oliver On Sat, May 23, 2009 at 9:41 PM, Timothy Perrett timo...@getintheloop.euwrote: Lol! Sorry oliver... I remember now :) What did you have in mind for “scala solution using JPA”? Is this not what we have already? Cheers, Tim On 23/05/2009 12:33, Oliver Lambert olambo...@gmail.com wrote: Yes, I helped with the code! On Sat, May 23, 2009 at 9:28 PM, Timothy Perrett timo...@getintheloop.eu wrote: To what degree are you wanting to re-invent the wheel? Derek has done amazing work with JPA and Scala - the resulting output being scala-jpa and the jpa archetypes for lift. Are you familiar with them? Cheers, Tim On 23/05/2009 11:56, Oliver Lambert olambo...@gmail.com wrote: JPA is a ORM tool. I think it would be great if someone would create a Scala solution using JPA as the starting point - any takers? --~--~-~--~~~---~--~~ 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: immutable bindings
On Sat, May 16, 2009 at 4:32 AM, David Pollak feeder.of.the.be...@gmail.com wrote: On Thu, May 14, 2009 at 7:43 PM, Oliver Lambert olambo...@gmail.comwrote: I've started integrating my immutable bindings, but have some questions On my build, I've placed the main immutable binding classes in module lift webkit under package net.liftweb.http.immu. Is that location/name OK? If there's stuff that does not reference other stuff in the http classes, please put it in net.liftweb.util. How many classes do you have? Can we put it in net.liftweb.record instead? I'm thinking your work might form the basis for some of the record stuff. I'll put what I can in net.liftweb.util. I guess there are about 10 classes, but I'll probably put these in a few files. I like the idea of using net.liftweb.record - I'll start to study the record methodology, also. I would like to introduce a new set of currency classes, roughly based on Martin et al's Currency Zone example in their book. Derek, is using an earlier version of it in his JPA example, Ive simplified it a little and extended it to include a few different currencies. Is this OK? - I know there is a simple currency class already. Sure. I'm pretty sure the existing currency class in net.liftweb.util is unused, so if you want to break that class, that might be a good place to put your code. cool, will do I'm not sure what to do about the mixin binding that I use for html, that extends/modifies BindHelpers. Put it in BindHelpers... as long as it doesn't break any of the existing APIs. ok, I might go slowly on this bit. Potentially I could modify BindHelpers, but, should I leave it out for now or include it as an optional and separate class in net.liftweb.html.immu? cheers Oliver -- 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: immutable bindings
I've created a git branch, cloned it on my machine and built lift - built in 9 minutes with no errors (1 more tick for maven). Will go wild soon. On Tue, May 12, 2009 at 9:26 AM, David Pollak feeder.of.the.be...@gmail.com wrote: Oliver, Please create a git branch and go wild on the branch... once you're comfortable with it, please roll the changes into the main branch. Thanks, David --~--~-~--~~~---~--~~ 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: garbage collection
On Fri, May 8, 2009 at 6:51 AM, marius d. marius.dan...@gmail.com wrote: Personally I'd be very reluctant exposing that to applications as this is Lift implementation specific and exposing an API tight to that leads to unnecessary coupling. While I don't like unnecessary coupling, either, I do like simple profiling. But why do you really need this? ... just for statistical purposes? ... I'm not sure about the relevance of such number. I want to get an idea about the growth of functions stored in the session. I have a idea that might cut the number of functions, under certain circumstances. Br's, Marius On May 7, 10:22 pm, Oliver Lambert olambo...@gmail.com wrote: Any chance of exposing a getter on messageCallback that would return some statistics (the number of functions being stored would be a good starting point)? On Thu, May 7, 2009 at 11:21 PM, marius d. marius.dan...@gmail.com wrote: Just FYI ... Things in this area are may change a bit once JQuery fixes the bug related with namespaces.This was the main reason why we had to deviate from Dave's original idea of using lift:gc attributes. Br's, Marius On May 7, 3:47 pm, Oliver Lambert olambo...@gmail.com wrote: Ah, you mean messageCallback - The joys of private variables. thanks again Ol On Thu, May 7, 2009 at 9:55 PM, marius d. marius.dan...@gmail.com wrote: Please see LiftSession. On May 7, 1:41 pm, Oliver Lambert olambo...@gmail.com wrote: Thanks for this. I would like to look at the code that actually holds the storage container and profile it. Any pointers on which class to look at s a starting point? Ol On Thu, May 7, 2009 at 7:17 PM, marius d. marius.dan...@gmail.com wrote: In short the current Lift GC is: 1. Each page has an ID 2. Each mapped function is associated with the page ID 3. There are periodical Ajax request sent from the page that are refreshing the timestamps on the mapped functions 4. Mapped functions that exceeded the expiration time are de- referenced hence become eligible for garbage collector. Br's, Marius On May 7, 10:15 am, Oliver Lambert olambo...@gmail.com wrote: I'm trying to get an understanding how garbage collection is implemented in Lift. Any pointers on what scala classes do the actual work? While I'm at it, S.functionMap appears to only return functions that were recently bound. Does S._functionMap, contain the functions being garbage collected? cheers Oliver --~--~-~--~~~---~--~~ 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] garbage collection
I'm trying to get an understanding how garbage collection is implemented in Lift. Any pointers on what scala classes do the actual work? While I'm at it, S.functionMap appears to only return functions that were recently bound. Does S._functionMap, contain the functions being garbage collected? cheers Oliver --~--~-~--~~~---~--~~ 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: garbage collection
Thanks for this. I would like to look at the code that actually holds the storage container and profile it. Any pointers on which class to look at s a starting point? Ol On Thu, May 7, 2009 at 7:17 PM, marius d. marius.dan...@gmail.com wrote: In short the current Lift GC is: 1. Each page has an ID 2. Each mapped function is associated with the page ID 3. There are periodical Ajax request sent from the page that are refreshing the timestamps on the mapped functions 4. Mapped functions that exceeded the expiration time are de- referenced hence become eligible for garbage collector. Br's, Marius On May 7, 10:15 am, Oliver Lambert olambo...@gmail.com wrote: I'm trying to get an understanding how garbage collection is implemented in Lift. Any pointers on what scala classes do the actual work? While I'm at it, S.functionMap appears to only return functions that were recently bound. Does S._functionMap, contain the functions being garbage collected? cheers Oliver --~--~-~--~~~---~--~~ 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: garbage collection
Ah, you mean messageCallback - The joys of private variables. thanks again Ol On Thu, May 7, 2009 at 9:55 PM, marius d. marius.dan...@gmail.com wrote: Please see LiftSession. On May 7, 1:41 pm, Oliver Lambert olambo...@gmail.com wrote: Thanks for this. I would like to look at the code that actually holds the storage container and profile it. Any pointers on which class to look at s a starting point? Ol On Thu, May 7, 2009 at 7:17 PM, marius d. marius.dan...@gmail.com wrote: In short the current Lift GC is: 1. Each page has an ID 2. Each mapped function is associated with the page ID 3. There are periodical Ajax request sent from the page that are refreshing the timestamps on the mapped functions 4. Mapped functions that exceeded the expiration time are de- referenced hence become eligible for garbage collector. Br's, Marius On May 7, 10:15 am, Oliver Lambert olambo...@gmail.com wrote: I'm trying to get an understanding how garbage collection is implemented in Lift. Any pointers on what scala classes do the actual work? While I'm at it, S.functionMap appears to only return functions that were recently bound. Does S._functionMap, contain the functions being garbage collected? cheers Oliver --~--~-~--~~~---~--~~ 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: Where to add demos/examples
Oh dear, sorry didn't realize I was butting in on committers talk. On Sat, May 2, 2009 at 11:20 PM, David Pollak feeder.of.the.be...@gmail.com wrote: On Sat, May 2, 2009 at 5:09 AM, Timothy Perrett timo...@getintheloop.euwrote: Heiko, Please see here: http://is.gd/w5SB +1 We've talked before on the committers list about renaming sites to examples or such, so I see no reason why putting any working example you want in there. POC would probably be a different matter... If its not working code, host it on your own github account then when its working potentially move it into examples if appropriate. Cheers, Tim On 02/05/2009 12:53, Oliver Lambert olambo...@gmail.com wrote: Interesting idea, perhaps you could get the examples hosted on the lift demo website too. Oliver On Sat, May 2, 2009 at 7:48 PM, Heiko Seeberger heiko.seeber...@googlemail.com wrote: Hi, I would like to add demo/example (well, also POC) projects to the repository. Where would be the right place? 1. Into the repository root 2. Into a lift-examples module 3. Other alternatives? I think I would like to go for lift-examples and maybe have nested modules there, e.g. lift-examples lift-examples-osgi lift-examples-osgi-hello ... What do you think? Heiko -- 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: immutable bindings
I just realized, I removed the header comments to the classes under the package scalame and had removed credit to Lift for SBind (modifying Bind). My apologies, and I understand my code is nowhere near as well written as the original. Oliver --~--~-~--~~~---~--~~ 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: scalar queries in Lift/JPA
Sorry, I didn't get back sooner - too much work! No one told me I couldn't do this so I just did it. Create a dummy entity to a table/view that doesn't exist - then write a query that uses column aliases and any arbitrary sql to populate that entity. I guess JPA/Hibernate is just creating an instance of a class and then calling a bunch of setters. Other times, I've dumped all the hard work on Oracle programmers, getting them to create a set of read only views and created entities on them, but I guess thats less weird. I've also done a similar thing in using formal constructors via hibernate's report queries, but thats more work and I'm lazy. cheers Oliver On Fri, Apr 24, 2009 at 6:11 AM, Derek Chen-Becker dchenbec...@gmail.comwrote: Oliver, I've never done anything like that in JPA or Hibernate. Is that actually possible? Can you create a class instance within a query? Derek On Thu, Apr 23, 2009 at 2:47 PM, Charles F. Munat c...@munat.com wrote: I'm not really sure how I would go about this, but I'll think about it when I have time to get back to that code. Thanks, Oliver. Chas. Oliver Lambert wrote: Is there anything to stop you defining an class/entity {answer: String, countAnswer: Int} and to directly create it from JPA (of course, it's read only). On Wed, Apr 22, 2009 at 9:36 AM, Charles F. Munat c...@munat.com mailto:c...@munat.com wrote: I was thinking tuples, but that didn't work. I'll try your suggestion. BTW, for anyone reading along, I forgot the group by clause in the query below. Chas. Derek Chen-Becker wrote: I think that the type would be Array[Any] and you'll get one String and Int for each row. Derek On Tue, Apr 21, 2009 at 3:37 PM, Charles F. Munat c...@munat.com mailto:c...@munat.com mailto:c...@munat.com mailto:c...@munat.com wrote: Anyone have a quick example of how to run a scalar query in JPA? I can't find anything in the JPA demo. I have this query: select t.answer, count(distinct answer) from Vote t where t.poll = :poll order by t.answer but how do I call it? I normally do: Model.createNamedQuery[...](findVoteCountAnswersByPoll, poll - poll).findAll But what is the type? And how do I get the results back out? I know I did this once before somewhere, but I can't remember where and I can't find it. Thanks! Chas. --~--~-~--~~~---~--~~ 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: scalar queries in Lift/JPA
Is there anything to stop you defining an class/entity {answer: String, countAnswer: Int} and to directly create it from JPA (of course, it's read only). On Wed, Apr 22, 2009 at 9:36 AM, Charles F. Munat c...@munat.com wrote: I was thinking tuples, but that didn't work. I'll try your suggestion. BTW, for anyone reading along, I forgot the group by clause in the query below. Chas. Derek Chen-Becker wrote: I think that the type would be Array[Any] and you'll get one String and Int for each row. Derek On Tue, Apr 21, 2009 at 3:37 PM, Charles F. Munat c...@munat.com mailto:c...@munat.com wrote: Anyone have a quick example of how to run a scalar query in JPA? I can't find anything in the JPA demo. I have this query: select t.answer, count(distinct answer) from Vote t where t.poll = :poll order by t.answer but how do I call it? I normally do: Model.createNamedQuery[...](findVoteCountAnswersByPoll, poll - poll).findAll But what is the type? And how do I get the results back out? I know I did this once before somewhere, but I can't remember where and I can't find it. Thanks! Chas. --~--~-~--~~~---~--~~ 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: stateful vs stateless snippet
On Mon, Apr 13, 2009 at 4:35 AM, David Pollak feeder.of.the.be...@gmail.com wrote: On Sun, Apr 12, 2009 at 7:30 AM, Oliver Lambert olambo...@gmail.comwrote: On Sun, Apr 12, 2009 at 11:04 PM, David Pollak feeder.of.the.be...@gmail.com wrote: On Sun, Apr 12, 2009 at 5:29 AM, Oliver Lambert olambo...@gmail.comwrote: On Sun, Apr 12, 2009 at 3:49 PM, marius d. marius.dan...@gmail.comwrote: As I said you CAN use it to span the same snippet instance for multiple pages. Please see the two fundamental functions offered by StatefulSnippet: link and redirect. Lift book provided correct information. It can be used, but doesn't always give the same instance when the back button is used? Therefore, all my fields are reset to null. Is this the expected functionality, or a bug (my code or Lift's)? I am using Stateful link and redirect and the application works fine, apart from the back button. If you're using the back button and you're presenting forms to the user, what you're seeing is the expected (perhaps not desired) behavior. In order to figure out which stateful snippet is being used, Lift either inserts a hidden field on the form or adds a parameter to the link URL. In both cases, these hidden items refer to a function that binds the instance of the stateful snippet to the name of the snippet so that the same instance will be used. If you press the back button and a URL does not have the query parameter, there's no way for Lift to know which instance of the stateful snippet to attach to the particular snippet name and Lift creates a new one. More broadly, I opted to not have ugly URLs in Lift. Seaside and other frameworks that are more stateful than Lift have to put a token in the URL indicating the state of the application for that particular URL. This allows you to have multiple instances of a given multi-page form going at the same time, all with back-button support. The cost is ugly URLs and the inability to send a given URL to a friend (because the state information is part of the URL.) In Seaside, you have to specify that a particular URL is durable and it's not uglified. In Lift, by default, the URLs are pretty and stateless. So, you've found a corner case of the downside of this choice. I'm hoping to add wizard functionality to Lift for 1.1 (although it's not on the official schedule) and that would give you better statefulness, ugly URLs, and better back-button support. Thanks, David Thanks, for explaining the functionality. I was just asked by my boss to ask a question, I'm not criticizing Lift for having the occasional corner case I don't expect. The fix for the application I'm currently working on is to use sessionVars, the occasional requestVar and to remove statefulSnippets - probably several hours work. Cool. In fact, I think I appreciate the design of lift for its flexibility. While I use the function binding of Lift, I've abstracted part of it away, so much of my code is automatically dealing with immutable objects. Maybe my one criticism of Lift is - it almost offers too much choice. Yeah. Rails and Mac are both great and having one true way. Windows gives you the choose what you like. In general, Mac apps feel more uniform and better than Windows apps. Mac apps often look more professional too - which is kind of funny considering their market. More broadly, I'd like to see how you do more immutable stuff within the context of Lift. I'm still uncomfortable about the the amount of mutability floating around in Lift. Great, I'll create an example project using the methodology I'm using this week. Thanks, David cheers Oliver On Apr 12, 5:44 am, Oliver Lambert olambo...@gmail.com wrote: On Sun, Apr 12, 2009 at 7:14 AM, marius d. marius.dan...@gmail.com wrote: The StatefulSnippet is not a snippet instance that is always used in the context of your session. Yikes! in that case, I wrote a whole application based on false assumption. It says in the lift book a StatefulSnippet is ideal for small, conversational state, such as a form that spans multiple pages If it spans multiple pages, doesn't this kind of imply the same instance in the session? Anyway thanks for this info. Any reason why a StatefulSnippet always has a dispatch function and a Stateless one, by default, has not? The reason that I see ... Stateless snippets are the most used artifacts to attach business logic to your view. Because it is so common besides DispatchSnippet trait, Lift loads and invoke Snippets functions using reflection. Since discriminating at runtime between a stateless and a stateful requires a trait (forget about annotations for now) well that trait is StatefulSnippet. to avoid RequestVar-s but keep state for current rendering pipeline in the snippet. 2. You can indicate that you want to reuse the same instance across multiple pages
[Lift] Re: stateful vs stateless snippet
On Sun, Apr 12, 2009 at 3:49 PM, marius d. marius.dan...@gmail.com wrote: As I said you CAN use it to span the same snippet instance for multiple pages. Please see the two fundamental functions offered by StatefulSnippet: link and redirect. Lift book provided correct information. It can be used, but doesn't always give the same instance when the back button is used? Therefore, all my fields are reset to null. Is this the expected functionality, or a bug (my code or Lift's)? I am using Stateful link and redirect and the application works fine, apart from the back button. On Apr 12, 5:44 am, Oliver Lambert olambo...@gmail.com wrote: On Sun, Apr 12, 2009 at 7:14 AM, marius d. marius.dan...@gmail.com wrote: The StatefulSnippet is not a snippet instance that is always used in the context of your session. Yikes! in that case, I wrote a whole application based on false assumption. It says in the lift book a StatefulSnippet is ideal for small, conversational state, such as a form that spans multiple pages If it spans multiple pages, doesn't this kind of imply the same instance in the session? Anyway thanks for this info. Any reason why a StatefulSnippet always has a dispatch function and a Stateless one, by default, has not? The reason that I see ... Stateless snippets are the most used artifacts to attach business logic to your view. Because it is so common besides DispatchSnippet trait, Lift loads and invoke Snippets functions using reflection. Since discriminating at runtime between a stateless and a stateful requires a trait (forget about annotations for now) well that trait is StatefulSnippet. to avoid RequestVar-s but keep state for current rendering pipeline in the snippet. 2. You can indicate that you want to reuse the same instance across multiple pages using link or redirectTo functions from the StatefulSnippet So depending what you want to doyou can use the statefull or stateless nature of snippets. For stateless snippets you can just declare the class and the method and just use it. Such as: class Foo { def bar(xml: NodeSeq) :NodeSeq = ... } .. and in your markup lift:Foo.bar/ you can also say class Foo extends DispatchSniuppet { def dispatch = ... } which is also a stateless snippet. Br's, Marius On Apr 11, 7:21 am, Oliver Lambert olambo...@gmail.com wrote: I have a stateful snippet that doesn't always appear to work with the back button. Sometimes, when the back button is used, a new stateful snippet instance appears to be created. Has this happened to anyone else? Anyway, I've converted what I had to use a SessionVar to store the state. Should I replace the stateful snippet with a stateless one - does a stateful snippet that isn't storing any state have any extra overhead over a stateless one? If I do use a stateless snipet can I still have a dispatch method? cheers Oliver --~--~-~--~~~---~--~~ 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: stateful vs stateless snippet
On Sun, Apr 12, 2009 at 7:14 AM, marius d. marius.dan...@gmail.com wrote: The StatefulSnippet is not a snippet instance that is always used in the context of your session. Yikes! in that case, I wrote a whole application based on false assumption. It says in the lift book a StatefulSnippet is ideal for small, conversational state, such as a form that spans multiple pages If it spans multiple pages, doesn't this kind of imply the same instance in the session? Anyway thanks for this info. Any reason why a StatefulSnippet always has a dispatch function and a Stateless one, by default, has not? to avoid RequestVar-s but keep state for current rendering pipeline in the snippet. 2. You can indicate that you want to reuse the same instance across multiple pages using link or redirectTo functions from the StatefulSnippet So depending what you want to doyou can use the statefull or stateless nature of snippets. For stateless snippets you can just declare the class and the method and just use it. Such as: class Foo { def bar(xml: NodeSeq) :NodeSeq = ... } .. and in your markup lift:Foo.bar/ you can also say class Foo extends DispatchSniuppet { def dispatch = ... } which is also a stateless snippet. Br's, Marius On Apr 11, 7:21 am, Oliver Lambert olambo...@gmail.com wrote: I have a stateful snippet that doesn't always appear to work with the back button. Sometimes, when the back button is used, a new stateful snippet instance appears to be created. Has this happened to anyone else? Anyway, I've converted what I had to use a SessionVar to store the state. Should I replace the stateful snippet with a stateless one - does a stateful snippet that isn't storing any state have any extra overhead over a stateless one? If I do use a stateless snipet can I still have a dispatch method? cheers Oliver --~--~-~--~~~---~--~~ 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: JPA or JDO best for us on Google App Engine?
On Sun, Apr 12, 2009 at 2:54 PM, David Pollak feeder.of.the.be...@gmail.com wrote: On Sat, Apr 11, 2009 at 8:36 PM, mal3 malcolm.gor...@gmail.com wrote: We are going to use the Google App Engine (GAE) for our app using GWT with the new Google GWT Eclipse plugin support. Our Scala and Lift skills are not up to the task of doing it in Lift right now. Once we have Exploring Lift and Beginning Scala books in our hot little hands in May, we will begin to port the app over to Lift. We need to choose between JPA and JDO. Which is the best choice in anticipation of using Lift on GAE in a couple of months time? So far as I can see, Lift supports JPA but not JDO. Lift supports either. Lift is persistence agnostic. Lift has a module, mapper, that has JDBC support. Derek and Co. have built some nice JPA archetypes, but you can use JDO to your heart's content with Lift. But there are no JDO examples while there are JPA and mapper ones. Mal. -- 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] stateful vs stateless snippet
I have a stateful snippet that doesn't always appear to work with the back button. Sometimes, when the back button is used, a new stateful snippet instance appears to be created. Has this happened to anyone else? Anyway, I've converted what I had to use a SessionVar to store the state. Should I replace the stateful snippet with a stateless one - does a stateful snippet that isn't storing any state have any extra overhead over a stateless one? If I do use a stateless snipet can I still have a dispatch method? cheers Oliver --~--~-~--~~~---~--~~ 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 AJAX and IE6
On Thu, Apr 9, 2009 at 11:03 PM, David Pollak feeder.of.the.be...@gmail.com wrote: On Thu, Apr 9, 2009 at 4:35 AM, olambo olambo...@gmail.com wrote: Also, is the Lift AJAX script necessary for anything other than Comet? If I have a site that's using no AJAX or Comet, can I just turn this off? If so, how? No... it's also used for Garbage Collection. :-( I've also noticed this running. Is this Garbage Collection of javascript or a call to the JVM? Lift stores a mapping between GUIDs it assigns to HTML elements on the client to functions to execute when those elements are processed by the server. For example: SHtml.text(, s = println(The text box was +s)) The function (s = println(The text box was +s)) is stored on the server. The input type=text .../ tag has a GUID that binds the HTML element to the function. If the HTML element is not on the client any more, the reference to the function should be dropped so it's not using resources. This is garbage collection. It is not JVM garbage collection, but it is removal of unused references. I can see that it needs to remove unused references, but why in an ajax call, why not as part of the lift request lifecycle? If the client has closed the browser the ajax call isn't going to be called anyway. Why would a single HTML element in a single client response have disappeared (heavy use of ajax and javascript?). Now why is lift saving references - obviously to support the next request from the current page, which might involve the back button (and subsequently, the forward button). So in my mind, I should be able to specify I want the last N back button calls supported and any functions older than that get dropped from the reference map. But obviously this isn't whats happening, because an ajax call to do it, makes no sense (assuming I have no javascript and no ajax calls). So what references are being removed and why ajax to remove them? -- 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] maven scala plugin
Hi, I know its not exactly a lift specific problem, but I create a lift project using mvn archetype:generate -U -DarchetypeGroupId=net.liftweb -DarchetypeArtifactId=lift-archetype-blank -DarchetypeVersion=0.10 -DremoteRepositories=http://scala-tools.org/repo-releases -DgroupId=demo.helloworld -DartifactId=helloworld -Dversion=1.0-SNAPSHOT This creates a pom.xml with 2.7.3 as the version of Scala - Everything appears fine. I add a variable that uses an Enumeration and use the new valueOf method. When I open the project in netbeans, it says the valueOf method doesnt exist, but when I do a mvn clean build, everything is happy When I extend an Enumeration and define a valueOf method (without overriding it) maven fails at the test stage, saying I need to override When I override the valueOf method, maven fails at the compilation stage, saying valueOf is not defined in the parent Any ideas what the maven scala plugin is doing? cheers Oliver --~--~-~--~~~---~--~~ 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] thanks
Thanks for all the help and support over the last few months. During that time, I've developed several Lift applications that are now successfully running in production at the company I work for. One of the things that has impressed me is the community spirit of the group. I've had pretty much all my questions answered and problems fixed very quickly. This gave me confidence to push the adoption of the framework. I haven't always agreed with some of the design decisions in Lift, but that's true of any framework. I bet even a framework founder doesn't like everything about it. Anyway sometimes programmers have to agree to disagree. I now find myself in the position of having to consider Slinky as an alternative to Lift. This brings up questions in my mind about community, support and maturity. I'm not willing to let go of Lift's xhtml templating paradigm, so I can see some interesting discussions ahead. cheers Oliver --~--~-~--~~~---~--~~ 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: thanks
If you could that would be great! On Fri, Feb 13, 2009 at 10:55 AM, Jorge Ortiz jorge.or...@gmail.com wrote: One of the projects I keep putting off is to extract Lift's templating system into a component that could be used as a stand-alone library. If this is something you'd be interested in, let me know and I'll try to prioritize it. cheers Oliver --~--~-~--~~~---~--~~ 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: *** BREAKING CHANGES ***
Doesn't look right and If I do this I get the following error - constructor cannot be instantiated to the expected type On Tue, Feb 10, 2009 at 8:57 PM, Jorge Ortiz jorge.or...@gmail.com wrote: Try (without the = sign): LiftRules.exceptionHandler.prepend { case (mode, state, ex) = RedirectResponse(/error) } --j On Mon, Feb 9, 2009 at 10:47 PM, Oliver ola...@gmail.com wrote: If I try to use the following, I get a reassignment to Val error - any ideas? LiftRules.exceptionHandler.prepend = { case (mode, state, ex) = RedirectResponse(/error) } On Wed, Dec 24, 2008 at 5:41 AM, Marius marius.dan...@gmail.com wrote: Folks, I just committed a couple of changes that may impact your application. 1. LiftRules.logAndReturnExceptionToBrowser and LiftRules.browserResponseToException have been removed. These were two different variables that did pretty much the same thing in fact the first ultimately called the former. These have been replaced with: var exceptionHandler = RulesSeq[ExceptionHandlerPF] having type ExceptionHandlerPF = PartialFunction[(Props.RunModes.Value, Req, Throwable), LiftResponse] By default a partial function is appended and it is the same code that used to be for LiftRules.browserResponseToException. So up until now probably your application was using something like: LiftRules.logAndReturnExceptionToBrowser = { case (state, ex) = RedirectResponse(/error) } now this turns into: LiftRules.exceptionHandler.prepend = { case (mode, state, ex) = RedirectResponse(/error) } 2. More unification of Ajax notices with static notices. So far to apply styling information (css classes etc) to Ajax notices we used three LiftRules variables: var ajaxNoticeMeta: Can[AjaxMessageMeta] var ajaxWarningMeta: Can[AjaxMessageMeta] var ajaxErrorMeta: Can[AjaxMessageMeta] the motivation was that in order for Lift to send down the correct style information for Ajax/Comet notices it needed to maintain this information. Now I finally found time to do it. The above variables are gone. Instead the same styling information that you use for lift:msgs and lift:msg snippets will be applied for AJax and Comet notices. The styling information is captured when these snippets are executed and used whenever you're using notices for AJax response or from a Comet actor. Br's, Marius --~--~-~--~~~---~--~~ 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: *** BREAKING CHANGES ***
I've just updated my code to rely on the stable version of lift 0.10 rather than an earlier snapshot. Unfortunately the removal of LiftRules.logAndReturnExceptionToBrowser and non working status of LiftRules.exceptionHandler.prepend means my choices now are 1) To back out my reliance on the stable version of lift 0.10 2) To look at the source code for lift and try to figure out the problem 3) To remove my applications reliance on this code I am going to be glad when Lift gets to version 1.0, because presumably there will be less breaking changes (I hope) On Wed, Feb 11, 2009 at 9:58 AM, Oliver ola...@gmail.com wrote: Doesn't look right and If I do this I get the following error - constructor cannot be instantiated to the expected type On Tue, Feb 10, 2009 at 8:57 PM, Jorge Ortiz jorge.or...@gmail.com wrote: Try (without the = sign): LiftRules.exceptionHandler.prepend { case (mode, state, ex) = RedirectResponse(/error) } --j On Mon, Feb 9, 2009 at 10:47 PM, Oliver ola...@gmail.com wrote: If I try to use the following, I get a reassignment to Val error - any ideas? LiftRules.exceptionHandler.prepend = { case (mode, state, ex) = RedirectResponse(/error) } On Wed, Dec 24, 2008 at 5:41 AM, Marius marius.dan...@gmail.com wrote: Folks, I just committed a couple of changes that may impact your application. 1. LiftRules.logAndReturnExceptionToBrowser and LiftRules.browserResponseToException have been removed. These were two different variables that did pretty much the same thing in fact the first ultimately called the former. These have been replaced with: var exceptionHandler = RulesSeq[ExceptionHandlerPF] having type ExceptionHandlerPF = PartialFunction[(Props.RunModes.Value, Req, Throwable), LiftResponse] By default a partial function is appended and it is the same code that used to be for LiftRules.browserResponseToException. So up until now probably your application was using something like: LiftRules.logAndReturnExceptionToBrowser = { case (state, ex) = RedirectResponse(/error) } now this turns into: LiftRules.exceptionHandler.prepend = { case (mode, state, ex) = RedirectResponse(/error) } 2. More unification of Ajax notices with static notices. So far to apply styling information (css classes etc) to Ajax notices we used three LiftRules variables: var ajaxNoticeMeta: Can[AjaxMessageMeta] var ajaxWarningMeta: Can[AjaxMessageMeta] var ajaxErrorMeta: Can[AjaxMessageMeta] the motivation was that in order for Lift to send down the correct style information for Ajax/Comet notices it needed to maintain this information. Now I finally found time to do it. The above variables are gone. Instead the same styling information that you use for lift:msgs and lift:msg snippets will be applied for AJax and Comet notices. The styling information is captured when these snippets are executed and used whenever you're using notices for AJax response or from a Comet actor. Br's, Marius --~--~-~--~~~---~--~~ 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: *** BREAKING CHANGES ***
My apologies, it works as shown by your code and in the way Jorge described. I had changed simply cut and pasted Marius's example and deleted it when it didn't work. Then I changed my own code without modifying the case statement correctly. Sometimes I can't add 1 + 1 On Wed, Feb 11, 2009 at 10:26 AM, David Pollak feeder.of.the.be...@gmail.com wrote: On Tue, Feb 10, 2009 at 3:13 PM, Oliver ola...@gmail.com wrote: I've just updated my code to rely on the stable version of lift 0.10 rather than an earlier snapshot. Unfortunately the removal of LiftRules.logAndReturnExceptionToBrowser and non working status of LiftRules.exceptionHandler.prepend means my choices now are 1) To back out my reliance on the stable version of lift 0.10 2) To look at the source code for lift and try to figure out the problem 3) To remove my applications reliance on this code I just inserted: LiftRules.exceptionHandler.prepend { case (mode, state, ex) = RedirectResponse(/error) } Into Boot.scala in a newly created Lift 0.10 app. It worked without complaint. Please try doing an mvn -U clean install and see if that works. I'm also happy to look at your source off-list to see if I can puzzle through the problem. And, yes the API changes are going to be minimal from here on out. I am going to be glad when Lift gets to version 1.0, because presumably there will be less breaking changes (I hope) On Wed, Feb 11, 2009 at 9:58 AM, Oliver ola...@gmail.com wrote: Doesn't look right and If I do this I get the following error - constructor cannot be instantiated to the expected type On Tue, Feb 10, 2009 at 8:57 PM, Jorge Ortiz jorge.or...@gmail.com wrote: Try (without the = sign): LiftRules.exceptionHandler.prepend { case (mode, state, ex) = RedirectResponse(/error) } --j On Mon, Feb 9, 2009 at 10:47 PM, Oliver ola...@gmail.com wrote: If I try to use the following, I get a reassignment to Val error - any ideas? LiftRules.exceptionHandler.prepend = { case (mode, state, ex) = RedirectResponse(/error) } On Wed, Dec 24, 2008 at 5:41 AM, Marius marius.dan...@gmail.com wrote: Folks, I just committed a couple of changes that may impact your application. 1. LiftRules.logAndReturnExceptionToBrowser and LiftRules.browserResponseToException have been removed. These were two different variables that did pretty much the same thing in fact the first ultimately called the former. These have been replaced with: var exceptionHandler = RulesSeq[ExceptionHandlerPF] having type ExceptionHandlerPF = PartialFunction[(Props.RunModes.Value, Req, Throwable), LiftResponse] By default a partial function is appended and it is the same code that used to be for LiftRules.browserResponseToException. So up until now probably your application was using something like: LiftRules.logAndReturnExceptionToBrowser = { case (state, ex) = RedirectResponse(/error) } now this turns into: LiftRules.exceptionHandler.prepend = { case (mode, state, ex) = RedirectResponse(/error) } 2. More unification of Ajax notices with static notices. So far to apply styling information (css classes etc) to Ajax notices we used three LiftRules variables: var ajaxNoticeMeta: Can[AjaxMessageMeta] var ajaxWarningMeta: Can[AjaxMessageMeta] var ajaxErrorMeta: Can[AjaxMessageMeta] the motivation was that in order for Lift to send down the correct style information for Ajax/Comet notices it needed to maintain this information. Now I finally found time to do it. The above variables are gone. Instead the same styling information that you use for lift:msgs and lift:msg snippets will be applied for AJax and Comet notices. The styling information is captured when these snippets are executed and used whenever you're using notices for AJax response or from a Comet actor. Br's, Marius -- 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] JTA showSQL
Hi Derek and interested parties I know there is a showSQL option that can be enabled with JTA/Hibernate but I find the output verbose and uninformative about parameter replacement. So, I have my own ScalaQuery that allows simple debugging - the main differences are - var queryParams: List[Pair[String,Any]] = Nil /* the following method needs to be called by the various SetParameter methods */ def addParam(one: String,two: Any) = { query.setParameter(one, two) queryParams = (one, two) :: queryParams } /* output the query with parameters substitued, for debugging ... */ def getQueryWithParams() = { var q = queryStr try { queryParams.foreach{v = var rep = v._2 match { case d: Date = '+SUtil.formatDate(d, dd/MM/)+' case s: String = '+s+' case x = if (x==null) else x.toString } rep = rep.replaceAll(\\$, ddDollardd) // stupid bug q = q.replaceAll(:+v._1, rep) } q.replaceAll(ddDollardd, \\$) } catch { case e: Exception = q+ PARAMS +queryParams+ EXCEPTION +e } } With this I can log the query via Log.info(emailQuery.getQueryWithParams()) Better still, (assuming execOnce exists in a utility object) when I only need to see the query once in the log /* execulte execFn, just once for the jvm. */ val execOnceSet = scala.collection.mutable.Set() def execOnce(key: String, execFn: = Unit) = { if (!execOnceSet.contains(key)) { execOnceSet += key execFn } } execOnce(findByEmail, Log.info(emailQuery.getQueryWithParams()) ) You can add the functionality if you find it useful cheers Oliver --~--~-~--~~~---~--~~ 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: *** BREAKING CHANGES ***
If I try to use the following, I get a reassignment to Val error - any ideas? LiftRules.exceptionHandler.prepend = { case (mode, state, ex) = RedirectResponse(/error) } On Wed, Dec 24, 2008 at 5:41 AM, Marius marius.dan...@gmail.com wrote: Folks, I just committed a couple of changes that may impact your application. 1. LiftRules.logAndReturnExceptionToBrowser and LiftRules.browserResponseToException have been removed. These were two different variables that did pretty much the same thing in fact the first ultimately called the former. These have been replaced with: var exceptionHandler = RulesSeq[ExceptionHandlerPF] having type ExceptionHandlerPF = PartialFunction[(Props.RunModes.Value, Req, Throwable), LiftResponse] By default a partial function is appended and it is the same code that used to be for LiftRules.browserResponseToException. So up until now probably your application was using something like: LiftRules.logAndReturnExceptionToBrowser = { case (state, ex) = RedirectResponse(/error) } now this turns into: LiftRules.exceptionHandler.prepend = { case (mode, state, ex) = RedirectResponse(/error) } 2. More unification of Ajax notices with static notices. So far to apply styling information (css classes etc) to Ajax notices we used three LiftRules variables: var ajaxNoticeMeta: Can[AjaxMessageMeta] var ajaxWarningMeta: Can[AjaxMessageMeta] var ajaxErrorMeta: Can[AjaxMessageMeta] the motivation was that in order for Lift to send down the correct style information for Ajax/Comet notices it needed to maintain this information. Now I finally found time to do it. The above variables are gone. Instead the same styling information that you use for lift:msgs and lift:msg snippets will be applied for AJax and Comet notices. The styling information is captured when these snippets are executed and used whenever you're using notices for AJax response or from a Comet actor. Br's, Marius --~--~-~--~~~---~--~~ 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: Can or Box or something else
Ha :), I really think you've let the Can out of the Box by raising this thread. Don't we all get a vote? After reading all the threads - +1 Box On 27/12/2008, at 10:06 AM, David Pollak wrote: 2008/12/26 Alex Boisvert boisv...@intalio.com Just brainstorming here... not sure if we're beating a dead horse... but about Option3 to signify it has 3 states? (i.e. Some3, None3, Error3) It's uglier but could be easier to explain and understand. Personally, it took me a lot to get the concept of Option... mainly because to me, an Option is this or that, not some or none. Optional would have been a better choice as is Maybe. In fact, it wasn't until I was playing around with Haskell and the Maybe monad, that I finally got Options. I would despise the idea of perpetuating what I consider to be one of Scala's weakest naming schemes. It's going to stay Can, but if I had it to do all over, I'd call it Box. Thanks for all your respective thoughts on the subject. David PS -- The code is pretty much frozen for Lift. There'll be a few last minute minor changes between now and Jan 2 (or whenever 2.7.3 goes final) at which time we'll release Lift 0.10 and start on the Lift 1.0-SNAPSHOT version. We're expecting to ship Lift 1.0 on the 2 year anniversary of the project. alex On Fri, Dec 26, 2008 at 3:29 AM, Mateusz Fiołka mateusz.fio...@gmail.co m wrote: If Maybe should be not used because of possible name clash in Scala library then how about considering synonyms: Possible and Perhaps? On Fri, Dec 26, 2008 at 10:31 AM, Caoyuan dcaoy...@gmail.com wrote: and Pack ? On Fri, Dec 26, 2008 at 8:35 AM, Marc Boschma marc +lift...@boschma.cx wrote: I know David has resigned to keeping 'Can', but wouldn't 'Jar' be an alternative? That way Empty and Full still make sense... Initially I thought 'Tin' sounded better but I recognise that term wouldn't be as universal. Marc On 26/12/2008, at 4:14 AM, Michael Campbell wrote: David Pollak wrote: Folks, Over the year that Lift has had Can[T] as a replacement for Scala's Option[T], the name Can has required a lot of explaining. I've never liked Can as a name; always thinking that the opposite of one should be a Can't. I'm sure it's my own issue to solve, but it's cognitively dissonant to me. Any other container name works better for me, although of the ones you listed, I like Box. -- Twitter: http://twitter.com/campbellmichael -- Lift, the simply functional web framework http://liftweb.net Collaborative Task Management http://much4.us 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: LiftRules.logAndReturnExceptionToBrowser doesnt alway work
Cool, Thanks On 21/12/2008, at 6:20 PM, Marius wrote: You already got good advices to your particular problem still an exception thrown from LoanWrapper-s should be caught by and your function called. I'll look into it tomorrow. Br's, Marius On 18 Dec, 23:58, Oliver ola...@gmail.com wrote: I was redirecting to an error page using LiftRules.logAndReturnExceptionToBrowser, but when I use a LoanWrapper to close a EntityManager and an error occurs when closing the entity manager, LiftRules.logAndReturnExceptionToBrowser doesn't appear to redirect to my error page. Can anyone think of a work around? // Output a simple error to the user. Link the error message to the screen via the current datetime LiftRules.logAndReturnExceptionToBrowser = { RedirectResponse(/error); } // Set up a LoanWrapper to automatically close a EntityManager if its open S.addAround(List( new LoanWrapper { def apply[T] (f : = T): T = { try { f } finally { EM.closeEM // close if open } } })) } --~--~-~--~~~---~--~~ 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: url handling
Im using a net.liftweb.http.S.redirectTo within a stateful snippet. On 20/12/2008, at 9:40 PM, Marius wrote: Looks like a function will be executed when this request is submitted. In what conditions are you seeing this? Are you calling S.redirectTo and pass a function? ... or use RedirectWithState? Br's, Marius On 20 Dec, 05:26, Oliver Lambert ola...@gmail.com wrote: Hi I notice lift sometimes lift rewrites the url a little e.g. - http://localhost:9090/enterbecomeshttp://localhost:9090/enter?fnVT32KHAJRTHI5RNQ2XBY=_ What are the rules for when this happens? Is there anyway to write a lift application where it doesn't happen? cheers Oliver --~--~-~--~~~---~--~~ 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] Can or Box or something else
Is Can a little less like Option and more like scala.Either, where the left side is used to indicate failure? On 21/12/2008, at 1:43 AM, David Pollak wrote: Folks, Over the year that Lift has had Can[T] as a replacement for Scala's Option[T], the name Can has required a lot of explaining. As we make the final push into freezing Lift's APIs, do we want to change the name of Can to something else or should we leave it as Can. Alternatives are: Cup Box Both of which can be Full/Empty. Thanks, David PS -- The Scala collections classes are getting a redo for 2.8. I've been gently pestering Martin to expand Option to have a Failure case. If this happens (it's not really likely for a couple of reasons), Can will be orphaned. -- Lift, the simply functional web framework http://liftweb.net Collaborative Task Management http://much4.us 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: url handling
It sounds like the this version is firing. What should I be using? On 21/12/2008, at 2:36 AM, Derek Chen-Becker wrote: Are you sure you're using S.redirectTo? For one, that's not what you want if you want to keep using the same stateful snippet instance. Second, if you're not calling it explicitly (i.e. using just redirectTo), the this version of redirectTo on StatefulSnippet may be firing. Derek On Sat, Dec 20, 2008 at 5:36 AM, Oliver Lambert ola...@gmail.com wrote: Simple, I would like my url to be called without ?... tacked onto the end. On 20/12/2008, at 10:40 PM, Tim Perrett wrote: Oliver, Lift will only create these types of URL when you pass params when creating a link. There is a very sophisticated rewriting engine in lift, so a better question would be what do you want your URL to look like? Thanks, Tim Sent from my iPhone On 20 Dec 2008, at 03:26, Oliver Lambert ola...@gmail.com wrote: Hi I notice lift sometimes lift rewrites the url a little e.g. - http://localhost:9090/enter becomes http://localhost:9090/enter?fnVT32KHAJRTHI5RNQ2XBY=_ What are the rules for when this happens? Is there anyway to write a lift application where it doesn't happen? cheers Oliver --~--~-~--~~~---~--~~ 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: Can or Box or something else
Yup, when you chose the original name, you did a good job - why second guess yourself now. Can we just leave it the way it is. On 21/12/2008, at 6:25 AM, David Pollak wrote: Because Can is three letters and OptionPlus is 11 and a frequently used construct should be easy on the fingers. On Dec 20, 2008 11:15 AM, Oliver Lambert ola...@gmail.com wrote: Ok so Can is not either an Either or an Option, its a Can. I kind of wondered when I first used Can, and it was described as an enhanced Option, why it wasn't called something like Option+ with None, Some and Failure. On 21/12/2008, at 5:47 AM, David Pollak wrote: Can has map, flatMap, filter etc. So it can be u... You received this message because you are subscribed to the Google Groups Lift group. To post to ... --~--~-~--~~~---~--~~ 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: Can or Box or something else
Perhaps we should rename Can to Option and get the Scala guys to rename theirs, OptionWithoutFailure :) On 21/12/2008, at 6:50 AM, Charles F. Munat wrote: OptionWithFailure --~--~-~--~~~---~--~~ 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: LiftRules.logAndReturnExceptionToBrowser doesnt alway work
Ha, very observant - I am relying on it to commit or rollback or do nothing. I note your recommendation, but I'd rather not have transaction support code littered around. For my application, I want a transaction lazily created and closed after each request, if it was created. If what I am doing is bad design or coding, Im willing to change it. Oliver On 20/12/2008, at 1:12 AM, Derek Chen-Becker wrote: What kind of error are you getting when the EM closes? As long as you're not relying on the EM.close to commit your transaction (something I'd recommend against anyway) then there really shouldn't be any errors at this point. Derek On Thu, Dec 18, 2008 at 10:00 PM, Oliver ola...@gmail.com wrote: I started on that path, and thought I could redirect with something like Full(span some html that redirects to the error page... /span).asInstanceOf[T] It feels like a big hack, even if I could get it working and I was a little worried about creating a redirection loop. I've created a static html error page and call it from web.xml for now - it'll have to do for now. On Fri, Dec 19, 2008 at 11:09 AM, David Pollak feeder.of.the.be...@gmail.com wrote: I'd put a try/finally around the EM.closeEM call so that it does not impact the stuff that's being rendered to the browser. Don't let the exception in the finally block propogate. On Thu, Dec 18, 2008 at 1:58 PM, Oliver ola...@gmail.com wrote: I was redirecting to an error page using LiftRules.logAndReturnExceptionToBrowser, but when I use a LoanWrapper to close a EntityManager and an error occurs when closing the entity manager, LiftRules.logAndReturnExceptionToBrowser doesn't appear to redirect to my error page. Can anyone think of a work around? // Output a simple error to the user. Link the error message to the screen via the current datetime LiftRules.logAndReturnExceptionToBrowser = { RedirectResponse(/error); } // Set up a LoanWrapper to automatically close a EntityManager if its open S.addAround(List( new LoanWrapper { def apply[T] (f : = T): T = { try { f } finally { EM.closeEM // close if open } } })) } -- Lift, the simply functional web framework http://liftweb.net Collaborative Task Management http://much4.us 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] url handling
Hi I notice lift sometimes lift rewrites the url a little e.g. - http://localhost:9090/enter becomes http://localhost:9090/enter?fnVT32KHAJRTHI5RNQ2XBY=_ What are the rules for when this happens? Is there anyway to write a lift application where it doesn't happen? cheers Oliver --~--~-~--~~~---~--~~ 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] LiftRules.logAndReturnExceptionToBrowser doesnt alway work
I was redirecting to an error page using LiftRules.logAndReturnExceptionToBrowser, but when I use a LoanWrapper to close a EntityManager and an error occurs when closing the entity manager, LiftRules.logAndReturnExceptionToBrowser doesn't appear to redirect to my error page. Can anyone think of a work around? // Output a simple error to the user. Link the error message to the screen via the current datetime LiftRules.logAndReturnExceptionToBrowser = { RedirectResponse(/error); } // Set up a LoanWrapper to automatically close a EntityManager if its open S.addAround(List( new LoanWrapper { def apply[T] (f : = T): T = { try { f } finally { EM.closeEM // close if open } } })) } --~--~-~--~~~---~--~~ 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: LiftRules.logAndReturnExceptionToBrowser doesnt alway work
I started on that path, and thought I could redirect with something like Full(span some html that redirects to the error page... /span).asInstanceOf[T] It feels like a big hack, even if I could get it working and I was a little worried about creating a redirection loop. I've created a static html error page and call it from web.xml for now - it'll have to do for now. On Fri, Dec 19, 2008 at 11:09 AM, David Pollak feeder.of.the.be...@gmail.com wrote: I'd put a try/finally around the EM.closeEM call so that it does not impact the stuff that's being rendered to the browser. Don't let the exception in the finally block propogate. On Thu, Dec 18, 2008 at 1:58 PM, Oliver ola...@gmail.com wrote: I was redirecting to an error page using LiftRules.logAndReturnExceptionToBrowser, but when I use a LoanWrapper to close a EntityManager and an error occurs when closing the entity manager, LiftRules.logAndReturnExceptionToBrowser doesn't appear to redirect to my error page. Can anyone think of a work around? // Output a simple error to the user. Link the error message to the screen via the current datetime LiftRules.logAndReturnExceptionToBrowser = { RedirectResponse(/error); } // Set up a LoanWrapper to automatically close a EntityManager if its open S.addAround(List( new LoanWrapper { def apply[T] (f : = T): T = { try { f } finally { EM.closeEM // close if open } } })) } -- Lift, the simply functional web framework http://liftweb.net Collaborative Task Management http://much4.us 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: liftweb xml schema location
Thanks This is the information I need On Wed, Dec 17, 2008 at 11:29 PM, David Bernard david.bernard...@gmail.com wrote: It's not an external link nor a link to a schema but the definition of a namespace : lift On Wed, Dec 17, 2008 at 10:07, Oliver Lambert ola...@gmail.com wrote: Don't I need the xsd or dtd specification? On 17/12/2008, at 7:50 PM, Viktor Klang wrote: Why not just add a hosts entry and redirect that host to an internal machine? On Wed, Dec 17, 2008 at 7:26 AM, Oliver ola...@gmail.com wrote: I have a client doesn't want an external link like xmlns:lift=http://liftweb.net/; Can I store the schema locally? How do I get it? cheers Oliver -- Viktor Klang Senior Systems Analyst --~--~-~--~~~---~--~~ 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: error message tag
On 16/12/2008, at 3:30 PM, Charles F. Munat wrote: I copied and pasted the error message code into my own error message utility and then changed the blank output to Text(). I also wanted to rewrite other parts of it. Im trying to get a html programmer to come up with a css fix before I put in my own fix, but its certainly a option to use, if necessary. It seems there is always a trade-off between convenience and configuration. My coding style is very different from David's (at least where HTML is concerned), so I find myself rewriting (modifying, really) lots of stuff to make it work the way I need it to. But it sure saves time to have a base of code to modify, rather than having to write it all from scratch. I've been guilty of modifying a few things myself, so I certainly understand where you are coming from here. It makes me wonder how many lifters are working with an unadulterated version of the code-base. My own code style is also probably different from others and is likely going to diverge as I have a mentor pushing me to adopt a much more functional/immutable style of programming. Chas. Oliver wrote: I have the following to output an error message against lift:msg id=errMsg type=msgs/ When I have an error its all fine, but when I don't have an error I get the following html span id=errMsg/ Is there any way of getting rid of the empty span? cheers Oliver --~--~-~--~~~---~--~~ 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] liftweb xml schema location
I have a client doesn't want an external link like xmlns:lift=http://liftweb.net/; Can I store the schema locally? How do I get it? cheers Oliver --~--~-~--~~~---~--~~ 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] error message tag
I have the following to output an error message against lift:msg id=errMsg type=msgs/ When I have an error its all fine, but when I don't have an error I get the following html span id=errMsg/ Is there any way of getting rid of the empty span? cheers Oliver --~--~-~--~~~---~--~~ 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] context path
I have a few links within my pages where I don't want lift to prepend the context path to the url. Is there any way to do this? cheers Oliver --~--~-~--~~~---~--~~ 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: Binding Problem - Help
David Thanks for the prompt reply. I'll upgrade to the latest version of lift so I can use the fix when it comes in. Is everything relatively stable at the current snapshot? cheers Oliver On Mon, Dec 15, 2008 at 11:47 AM, David Pollak feeder.of.the.be...@gmail.com wrote: Okay, The problem is that your computer is too fast. :-) Lift assigns function names based on the nano time. It turns out that the methods are getting called so fast, there's no nano tick and the order of the function creation is not reflected in the function name. I've got a fix. I'll roll it into Lift tonight or tomorrow. Thanks, David On Sun, Dec 14, 2008 at 3:44 PM, Oliver ola...@gmail.com wrote: Hi, Its Ubuntu Gutsy running a virtual vsx. The processor is a dual cpu 2.8 Theres 2GB of memory, but Apache tomcat has 500MB. I'm running on a snapshot of lift webkit frozen at 0.10-20080930.234135-129 I'll send the html in a moment. Cheers Oliver On Mon, Dec 15, 2008 at 10:28 AM, David Pollak feeder.of.the.be...@gmail.com wrote: On Sun, Dec 14, 2008 at 3:17 PM, Oliver ola...@gmail.com wrote: Hi, I've got a error on one of our Apache/Tomcat servers with binding, it works in Jetty and another Apache/Tomcat server. It looks like lift is calling some of the function setters after calling a method on a StatefullSnippet. For example, in the example below, v = who(Full(v)) would be getting called after doProcess() is called bind(hello, xhtml, whoField -- text(who.openOr(), v = who(Full(v)) ), submit -- submit(?(Send), ignore = doProcess() ) ) Has anyone got any idea what might be going on? What kind of machine is the problem happening on (OS, processor, speed, number of processors)? Can you send me the static HTML generated by a page that's causing the problem? Thanks, David cheers Oliver -- Lift, the simply functional web framework http://liftweb.net Collaborative Task Management http://much4.us Follow me: http://twitter.com/dpp Git some: http://github.com/dpp -- Lift, the simply functional web framework http://liftweb.net Collaborative Task Management http://much4.us 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: Binding Problem - Help
Thanks for all the help, it appears to all be working now - I had a feeling I was going to be fed to the lions, wolves, tigers and bears if I didn't find a fix, and quick. One question, does the name generation have to be based on a random number generator? I realize, with the length of the number I probably won't see the same error in the life of the universe, but you never know your luck. On Mon, Dec 15, 2008 at 12:36 PM, David Pollak feeder.of.the.be...@gmail.com wrote: On Sun, Dec 14, 2008 at 5:06 PM, Oliver ola...@gmail.com wrote: David Thanks for the prompt reply. I'll upgrade to the latest version of lift so I can use the fix when it comes in. Is everything relatively stable at the current snapshot? I've pushed the change. Give it an hour or so to get built in Maven. The APIs are changing right now, but the code itself is stable (the APIs changes have not introduced defects.) Thanks, David cheers Oliver On Mon, Dec 15, 2008 at 11:47 AM, David Pollak feeder.of.the.be...@gmail.com wrote: Okay, The problem is that your computer is too fast. :-) Lift assigns function names based on the nano time. It turns out that the methods are getting called so fast, there's no nano tick and the order of the function creation is not reflected in the function name. I've got a fix. I'll roll it into Lift tonight or tomorrow. Thanks, David On Sun, Dec 14, 2008 at 3:44 PM, Oliver ola...@gmail.com wrote: Hi, Its Ubuntu Gutsy running a virtual vsx. The processor is a dual cpu 2.8 Theres 2GB of memory, but Apache tomcat has 500MB. I'm running on a snapshot of lift webkit frozen at 0.10-20080930.234135-129 I'll send the html in a moment. Cheers Oliver On Mon, Dec 15, 2008 at 10:28 AM, David Pollak feeder.of.the.be...@gmail.com wrote: On Sun, Dec 14, 2008 at 3:17 PM, Oliver ola...@gmail.com wrote: Hi, I've got a error on one of our Apache/Tomcat servers with binding, it works in Jetty and another Apache/Tomcat server. It looks like lift is calling some of the function setters after calling a method on a StatefullSnippet. For example, in the example below, v = who(Full(v)) would be getting called after doProcess() is called bind(hello, xhtml, whoField -- text(who.openOr(), v = who(Full(v)) ), submit -- submit(?(Send), ignore = doProcess() ) ) Has anyone got any idea what might be going on? What kind of machine is the problem happening on (OS, processor, speed, number of processors)? Can you send me the static HTML generated by a page that's causing the problem? Thanks, David cheers Oliver -- Lift, the simply functional web framework http://liftweb.net Collaborative Task Management http://much4.us Follow me: http://twitter.com/dpp Git some: http://github.com/dpp -- Lift, the simply functional web framework http://liftweb.net Collaborative Task Management http://much4.us Follow me: http://twitter.com/dpp Git some: http://github.com/dpp -- Lift, the simply functional web framework http://liftweb.net Collaborative Task Management http://much4.us 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: JPADemo weird disappearing boot
I'm getting the error too :( rotten boot On Wed, Oct 8, 2008 at 4:47 PM, Charles F. Munat [EMAIL PROTECTED] wrote: I figured this out (sort of). The problem was in the master pom.xml. Not sure what it was, though. Chas. Charles F. Munat wrote: I seem to have lost my boot. I copied the JPADemo out of the liftweb source code and changed the poms and everything else to make it the basis for a new app I'm trying to get online this week. Everything compiles just fine, and the site works (sort of), but the Boot class fails to load. Here is the error: ERROR - Failed to Boot java.lang.ClassNotFoundException: bootstrap.liftweb.Boot at java.net.URLClassLoader$1.run(URLClassLoader.java:200) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:316) ... Here's the stripped down Boot class: package bootstrap.liftweb import java.util.Locale import javax.servlet.http.HttpServletRequest import net.liftweb.util.{Can,Empty,Full,LoanWrapper,LogBoot} import net.liftweb.http._ import net.liftweb.sitemap._ import net.liftweb.sitemap.Loc._ import org.wsbg.model._ import S.? class Boot { def boot { // where to search snippet LiftRules.addToPackages(org.myapp) } } Everything has been changed from com.foo.jpademo to org.myapp appropriately. Where can I look to determine why Boot isn't found? Thanks, Chas. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] error page
I don't want to display the default error page to the user. How do I replace it with my own? cheers Oliver --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: error page
I tried LiftRules.logAndReturnExceptionToBrowser = { case (request, e) = println(what is going on); RedirectResponse(/) case _ = println(whatis going on 2); RedirectResponse(/) } No change in behavior On 02/10/2008, at 6:03 PM, Marius wrote: Or you can use LiftRules.logAndReturnExceptionToBrowser ...actually browserResponseToException is ultimately called by logAndReturnExceptionToBrowser On Oct 2, 10:59 am, Marius [EMAIL PROTECTED] wrote: Hi, Please see LiftRules.browserResponseToException ... this is called when an exception is thrown from the application. Here you can intercept the Throwable and redirect to your own error page using RedirectResponse or RedirectWithState. Br's, Marius On Oct 2, 10:48 am, Oliver [EMAIL PROTECTED] wrote: I don't want to display the default error page to the user. How do I replace it with my own? cheers Oliver --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Todays questions
I'm writing a wizard-like process, where when they have finished the set of forms and press submit I don't want the back button to take them back. Is there any way I can clear out the history? I guess a related question is, Lift is holding references to objects in its history that I would like to be made available to garbage collection. For instance, I have a table of html links - once one is selected, I can set the holding collection to null, but lift is still holding a reference for its history. cheers Oliver --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Todays questions
Thanks for the answers Another related question - Is there any functionality in lift to prevent multiple submits (e.g. the browser is slow for whatever reason and the user presses the submit button multiple times)? cheers Oliver On Fri, Oct 3, 2008 at 10:15 AM, David Pollak [EMAIL PROTECTED] wrote: On Thu, Oct 2, 2008 at 5:13 PM, Oliver [EMAIL PROTECTED] wrote: I'm writing a wizard-like process, where when they have finished the set of forms and press submit I don't want the back button to take them back. Is there any way I can clear out the history? This is JavaScript magic and I'm not sure how to disable it. I guess a related question is, Lift is holding references to objects in its history that I would like to be made available to garbage collection. For instance, I have a table of html links - once one is selected, I can set the holding collection to null, but lift is still holding a reference for its history. I have a number of GC methodologies that I'm working one. Basically, Lift will hold certain references for a period of time (right now that period is the session, but it will get shorter). Thanks, David cheers Oliver -- Lift, the simply functional web framework http://liftweb.net Collaborative Task Management http://much4.us 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: JPA and enumerations
On Thu, Oct 2, 2008 at 11:07 PM, Derek Chen-Becker [EMAIL PROTECTED]wrote: OK, I've run into problems again now that I'm trying to actually use the enumerations. In my book class I have the variable defined as: @Type{val `type` = com.foo.jpaweb.model.GenreType} var genre = Genre.unknown Enumv.Value(name: String, desc: String) should be returning a type of Value (Val is the implementation). I'll fix this, or you can. [WARNING] found : com.foo.jpaweb.model.Genre.Value [WARNING] required: com.foo.jpaweb.model.Genre.Val I tried changing the variable definition to var genre : Genre.Value = Genre.unknown But then I get a runtime error when I run my unit tests: java.lang.NoSuchMethodError: com.foo.jpaweb.model.Book.genre_$eq(Lscala/Enumeration$Val;)V I don't get this error, can you supply me the test code? It appears that setting genre to Genre.unknown makes its type Genre.Val instead of Genre.Value, but I have no idea how to fix it at this point. Thanks, Derek On Wed, Oct 1, 2008 at 11:38 PM, Derek Chen-Becker [EMAIL PROTECTED]wrote: Doh. I missed where you had extended it. It works now that I'm using it correctly (imagine that!) Thanks much, Derek On Wed, Oct 1, 2008 at 5:08 PM, Oliver [EMAIL PROTECTED] wrote: You have to extend it - I did it at the top of the model, but it probably makes sense to create a separate file(s). So Gender would have a corresponding type class GenderType extends EnumvType(Gender) {} and then you can use @Type{val `type`=com.foo.jpaweb.model.GenderType} I hadn't coded a user type in Scala before either and I couldn't find a way to generically do all enumerations as one user type - Scala is just too strict. hope that helps Oliver On Thu, Oct 2, 2008 at 6:58 AM, Derek Chen-Becker [EMAIL PROTECTED] wrote: Hmmm. Oliver, I'm working on using the UserType you wrote now, but when I try to test it, I'm getting this error: org.hibernate.MappingException: Cannot instantiate custom type: com.foo.jpaweb.model.EnumvType At first I thought this was because EnumvType was abstract, but changing that didn't do anything. I've set the property on the Book class as: @Type{val `type` = com.foo.jpaweb.model.EnumvType} var genre = Genre.unknown Is the not correct? Any ideas? I've only ever used Hibernate Types that were written in Java, so I wasn't sure if that might also be an issue... Derek On Mon, Sep 22, 2008 at 8:29 AM, Derek Chen-Becker [EMAIL PROTECTED] wrote: Looks good. In keeping with the theme of a Library catalog I'm going to rework Gender as Genre and add things like Mystery, Horror, Comedy, Childrens' , etc. I think I can just put the Money on as a purchase price. Thanks, Derek On Sun, Sep 21, 2008 at 1:19 AM, Oliver Lambert [EMAIL PROTECTED]wrote: Hi, I've extended the JPA Demo project to include hibernate mappings for Money and Enumerations. The example money is Australian, but its simple enough to add other currencies. The example enumeration is for Gender - I've mapped the name of the enumeration rather than the ordinal value and extended it to include a description field, valueOf method and list of name value pairs. Hope its of use Oliver On 21/09/2008, at 1:40 PM, Jorge Ortiz wrote: On Sat, Sep 20, 2008 at 9:14 AM, Oliver Lambert [EMAIL PROTECTED] wrote: I need this too so I might have a go at implementing it. Does lift persist enumerations (cant see a mapper it) There's a MappedEnum class in MappedInt.scala Thanks for this - I should have looked more --j --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED][EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~--- --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: JPA and enumerations
You have to extend it - I did it at the top of the model, but it probably makes sense to create a separate file(s). So Gender would have a corresponding type class GenderType extends EnumvType(Gender) {} and then you can use @Type{val `type`=com.foo.jpaweb.model.GenderType} I hadn't coded a user type in Scala before either and I couldn't find a way to generically do all enumerations as one user type - Scala is just too strict. hope that helps Oliver On Thu, Oct 2, 2008 at 6:58 AM, Derek Chen-Becker [EMAIL PROTECTED]wrote: Hmmm. Oliver, I'm working on using the UserType you wrote now, but when I try to test it, I'm getting this error: org.hibernate.MappingException: Cannot instantiate custom type: com.foo.jpaweb.model.EnumvType At first I thought this was because EnumvType was abstract, but changing that didn't do anything. I've set the property on the Book class as: @Type{val `type` = com.foo.jpaweb.model.EnumvType} var genre = Genre.unknown Is the not correct? Any ideas? I've only ever used Hibernate Types that were written in Java, so I wasn't sure if that might also be an issue... Derek On Mon, Sep 22, 2008 at 8:29 AM, Derek Chen-Becker [EMAIL PROTECTED]wrote: Looks good. In keeping with the theme of a Library catalog I'm going to rework Gender as Genre and add things like Mystery, Horror, Comedy, Childrens' , etc. I think I can just put the Money on as a purchase price. Thanks, Derek On Sun, Sep 21, 2008 at 1:19 AM, Oliver Lambert [EMAIL PROTECTED] wrote: Hi, I've extended the JPA Demo project to include hibernate mappings for Money and Enumerations. The example money is Australian, but its simple enough to add other currencies. The example enumeration is for Gender - I've mapped the name of the enumeration rather than the ordinal value and extended it to include a description field, valueOf method and list of name value pairs. Hope its of use Oliver On 21/09/2008, at 1:40 PM, Jorge Ortiz wrote: On Sat, Sep 20, 2008 at 9:14 AM, Oliver Lambert [EMAIL PROTECTED] wrote: I need this too so I might have a go at implementing it. Does lift persist enumerations (cant see a mapper it) There's a MappedEnum class in MappedInt.scala Thanks for this - I should have looked more --j --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED][EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~--- --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Making Record a reality [was: Validations, Server side controls etc]
Hey Chas, No worries, I re-read too and understood the tone of your reply. I'm playing devils advocate on validation to try to get a flexible framework for everyone to use. Ol On 24/09/2008, at 4:07 PM, Charles F. Munat wrote: Charles F. Munat wrote: Running Ajax calls between fields for validation is pretty ugly, javascript validation would be better That's what I said. Sorry, Oliver. On re-reading, that sounds a little snippy, but I didn't mean it that way. I just meant that we agree -- after mentioning it as a possibility, I said it would be unnecessary since JavaScript would have to be working anyway. Chas. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: bind and enumerations
Ha that's it - I was hoping they would magically work like java enum's :) thanks Ol On Thu, Sep 18, 2008 at 2:33 PM, David Pollak [EMAIL PROTECTED] wrote: It's because you have to create each of the Enumeration's String representations manually: scala object Gender extends Enumeration { | val Unknown = Value(0, Unknown) | val Male = Value(1, Male) | val Female = Value(2, Female) | } defined module Gender scala Gender.elements.toList res3: List[Gender.Value] = List(Unknown, Male, Female) scala Gender.elements.toList.map(v = (v, v.toString)) res4: List[(Gender.Value, java.lang.String)] = List((Unknown,Unknown), (Male,Male), (Female,Female)) Oliver wrote: When I saw this answer, I was really hoping it would work. Unfortunately, Gender.elements.toList.map(v = (v, v.toString)) gives me List((a.Gender(0),a.Gender(0)), (a.Gender(1),a.Gender(1))) On Thu, Sep 18, 2008 at 12:56 PM, David Pollak [EMAIL PROTECTED] wrote: var g: Can[Gender] = Empty SHtml.selectObj(Gender.elements.toList.map(v = (v, v.toString)), g, v = g = Full(v)) On Wed, Sep 17, 2008 at 7:33 PM, Charles F. Munat [EMAIL PROTECTED] wrote: I'm using an enumeration for Gender: @serializable object Gender extends Enumeration { type Gender = Value val Male, Female = Value } import Gender._ How do I use this in bind? And is there an easy way to create a drop down list with blank, Male, and Female options? Thanks! Chas. -- Lift, the simply functional web framework http://liftweb.net Collaborative Task Management http://much4.us 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: RBAC in Lift
I'm also interested in authorization and authentication. If your going to use a application server like Glassfish, JAAS is possibility. However, I'm trying to decide whether to use Acegi (without Spring) or look at something like JSecurity. Any thoughts as to which would be a better fit with Lift? Oliver On 08/09/2008, at 9:24 AM, Charles F. Munat wrote: I'm building a website for a group that wants to have different levels of access to the site. Essentially, there will be five roles, from Admin down to Guest, with each role having access to different parts of the site. Some pages will only be accessible to users with a specific role. For example, the CRUD pages controlling users will only be accessible to those in the Admin role. On other pages, most of the page will be public, but parts of the page will only become visible if the user is a) logged in, and b) in the proper role. Blocking entire pages can obviously be done in the SiteMap with some sort of conditional statement. I'm guessing that the best way to handle the partial pages is with snippets, with the snippet displaying a blank or particular content depending on the user's role. But there are also other considerations. Users will have their own pages, so views of those pages may be limited to the particular user (such as a page to update one's profile), or, optionally, made public by that user (such as a bio). Does anyone have any suggestions for the best practice for going about this, or an example they can show me? Thanks for any and all help. I'm slowly figuring out the SiteMap and menu functions and hope to put together a tutorial on that shortly. Chas. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: JPA w/Scala
Hi Derek, this is looking good On Wed, Sep 10, 2008 at 2:55 AM, Derek Chen-Becker [EMAIL PROTECTED]wrote: OK, the code is merged in and the latest version is attached. I made a few minor modifications to the JPA code that Oliver sent: 1. I made the openEM and closeEM methods abstract and protected. The idea is that the JPA class shouldn't be tied to the way the user wants to access JPA. Rather, when they implement the JPA class they can provide their own hooks to do direct access, IoC, or JNDI, etc. 2. I added a convenience method for createNamedQuery so that you can pass parameters in when you create the query. A very minor change but it saves a little typing when you use it a lot. I like this, it saves typing and reads a lot better I've also changed the module naming per Oliver's suggestion. I'll test against the other DBs this afternoon, but so far I've had no issues with HSQLDB. I've also tested it against SQL Server 2000 and it runs without any problems (unfortunately, I don't have SQL Server 2005 or later, to test against) Derek On Tue, Sep 9, 2008 at 8:35 AM, Derek Chen-Becker [EMAIL PROTECTED]wrote: Looks like I missed a lot in the two days I was gone :). I'm going to look at Oliver's code and merge it. As for Tim's problem with the insertions, the AUTO ID generation should usually just work. I don't have a SQL Server instance to try it out on, but after I merge the code I'll test it again with HSQL, PostgreSQL and MySQL to make sure that it works there. If so, it may be something specific to the SQL Server dialect. Derek On Tue, Sep 9, 2008 at 5:09 AM, Oliver Lambert [EMAIL PROTECTED] wrote: On 09/09/2008, at 7:47 PM, Tim Perrett wrote: I agree - its strange and not what we would expect. What version of SQL server are you running? Im using 2005 Enterprise here... I think thats what they are using at my company Its just a really strange thing, the 100 is always ignored... I think it just needs a 2nd parameter there, even if its going to ignore it. Thats certainly what it looks like from the SQL thats being run anyway. I would have thought the GenerationType.IDENTITY would mean that it knows not to use it in SQL inserts/updates, but obviously not. I assume that you have run a simple unit test to do an insert with persist e.g. def testOK = { val na = new Author() na.name = HELLO THERE! Model.persist(na) val authors = Model.createNamedQuery[Author] (findAllAuthors).getResultList() authors.foreach(author = { println(name: +author.name) author.books.foreach(book = println( title: +book.title)) }) } If you are still having problems, mvn clean your project, zip it up and mail it to me - I'll run it tomorrow morning, when I get to work Oliver Cheers Tim --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: JPA w/Scala
On 09/09/2008, at 7:47 PM, Tim Perrett wrote: I agree - its strange and not what we would expect. What version of SQL server are you running? Im using 2005 Enterprise here... I think thats what they are using at my company Its just a really strange thing, the 100 is always ignored... I think it just needs a 2nd parameter there, even if its going to ignore it. Thats certainly what it looks like from the SQL thats being run anyway. I would have thought the GenerationType.IDENTITY would mean that it knows not to use it in SQL inserts/updates, but obviously not. I assume that you have run a simple unit test to do an insert with persist e.g. def testOK = { val na = new Author() na.name = HELLO THERE! Model.persist(na) val authors = Model.createNamedQuery[Author] (findAllAuthors).getResultList() authors.foreach(author = { println(name: +author.name) author.books.foreach(book = println( title: +book.title)) }) } If you are still having problems, mvn clean your project, zip it up and mail it to me - I'll run it tomorrow morning, when I get to work Oliver Cheers Tim --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: One further: JPA + JTA + Lift
Now, now lets not get testi ;-) On 09/09/2008, at 9:34 PM, Viktor Klang wrote: On Tue, Sep 9, 2008 at 10:09 AM, Oliver [EMAIL PROTECTED] wrote: Actually, is this the essence of the cookie. Why has the object been detached in the example Kris gives - is there something wrong with RequestVar lifecycle? Actually, just add a simple debug-print when the session is created and when it's closed. And if it prints that it is closed _before_ the execption is raised then there certainly is a problem with the requestvar lifecycle. Ideally the entitymanager should be managed outside the scope of request-vars, since the order of request-var destruction isn't given, which means that if the cleanup is done in the wrong order, the Session is closed before referenced objects are cleaned up, which introduces the possibility for weirdness. Cheers, Viktor On Tue, Sep 9, 2008 at 5:27 PM, Viktor Klang [EMAIL PROTECTED] wrote: Hello Kris, this is a quite common problem in the world of JPA and object references. I'm not going to bore people out by talking about object lifecycles, but here's the essence of the cookie: When a JPA Session is created, it is bound to some context (wether it be the currently running thread, a session-bean, an HTTPSession or a RequestVar) Any PEs ( Persistent Entities) loaded through it will be associated with that particular Session instance, however, JPA tries to proxy alot of objects and collections to avoid having to load whole object graphs into memory when they haven't been requested. Your problem arises when you try to access a proxy outside the scope of the Session ( Google for Detached + JPA for more info on when an object is outside the scope of a Session) What I usually do if I want to hang onto references (Detached) to JPA-managed objects is that I create my own proxy around it that does something like the following: if(!currentSession.contains(myObject)) currentSession.refresh(myObject); //Reattaches the object to the session return myObject; However, this is also a pretty dangerous strategy, so you'll have to know what you're doing here. (First-commit-wins, Last-commit-wins, partial overwrites, lost updates... the list goes on) Hope someone finds this informative. Cheers, Viktor On Mon, Sep 8, 2008 at 11:31 PM, Kris Nuttycombe [EMAIL PROTECTED] wrote: I've been following the advancement of the JPA/Lift tutorial with great interest, and have managed to get my app working, but I'm now struggling with a problem that occurs whenever I try to retrieve a collection that is mapped as a lazy association: Exception occured while processing /orders/list Message: org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: com.gaiam.gcsi.entities.subscription.Order.subscriptions, no session or session was closed org .hibernate .collection .AbstractPersistentCollection .throwLazyInitializationException(AbstractPersistentCollection.java: 358) org .hibernate .collection .AbstractPersistentCollection .throwLazyInitializationExceptionIfNotConnected (AbstractPersistentCollection.java:350) org .hibernate .collection .AbstractPersistentCollection .readSize(AbstractPersistentCollection.java:97) org.hibernate.collection.PersistentBag.size(PersistentBag.java:225) com.gaiam.gcsi.snippet.Orders$$anonfun$list $1.apply(Orders.scala:21) com.gaiam.gcsi.snippet.Orders$$anonfun$list $1.apply(Orders.scala:18) scala.Seq$class.flatMap(Seq.scala:267) com.gaiam.gcsi.model.EM$$anon$1.flatMap(EM.scala:11) com.gaiam.gcsi.snippet.Orders.list(Orders.scala:18) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ... I took the simplest-possible route of encapsulating the EntityManager in a RequestVar per Derek's suggestion as such: object EM { def entityManager() = (new InitialContext()).lookup(java:comp/env/persistence/ em).asInstanceOf[EntityManager] } class Orders { object em extends RequestVar(entityManager()) def list(xhtml: NodeSeq) : NodeSeq = { val orders = em.createQuery(from Order).getResultList().asInstanceOf[java.util.List[Order]] orders.flatMap(order = bind(order, xhtml, id -- Text(order.getId().toString), count -- Text(order.getSubscriptions().size().toString))) } } The issue appears to be that the transaction that the the query ran in is no longer active by the time of the call to order.getSubscriptions(). Has anyone else been using JTA and encountered this? I'm running the latest stable Glassfish (2.1 UR2) and using Hibernate for the persistence layer. Thanks, Kris -- Viktor Klang Rogue Software Architect -- Viktor Klang Senior Systems Analyst --~--~-~--~~~---~--~~ You received this message
[Lift] Re: JPA w/Scala
You know I always forget those long winded archetype creation commands and thinking about this I guess I would hope for something more. Something like specify a set of tables (and stuff) and have LiftBuilder go and create mappings, validation and default html for me. I haven't looked at it for a long time, but I believe Grails does something like this Oliver On 08/09/2008, at 9:52 AM, Charles F. Munat wrote: Oh, hell yeah. Please! And down the road, when the mapper becomes agnostic, would there be an archetype that used JPA as the back end for the Lift mapper? Chas. Tim Perrett wrote: Ah cool - this is quite nice actually; good work Oliver! Cheers @Derek, what are your thoughts? It certainly strikes me that as time wears on and more people are using the lift/jpa stuff that we should really create an archetype for it would others find that useful? Cheers Tim --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: JPA w/Scala
I think sql server uses @GeneratedValue(strategy=GenerationType.IDENTITY) You could try this instead of GenerationType.AUTO (though this should translate to the above) Oliver On 09/09/2008, at 12:43 AM, Tim Perrett wrote: Hmmm, I've tried: @Id @GeneratedValue(){val strategy = GenerationType.AUTO} @Column(){val insertable = false} var id : Long = _ But yet its still being included in the query, any ideas? Cheers, Tim --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: JPA w/Scala
or, you could try @GeneratedValue(strategy = GenerationType.AUTO, generator = system-guid) @GenericGenerator(name = system-guid, strategy = guid) with or without the Microsoft driver property name=driverClassName valuecom.microsoft.sqlserver.jdbc.SQLServerDriver/value /property and the pom entry !dependency groupIdMSSQLDriver/groupId artifactIdsqljdbc/artifactId version1.1.1501.101/version /dependency On 09/09/2008, at 4:05 AM, Oliver Lambert wrote: I think sql server uses @GeneratedValue(strategy=GenerationType.IDENTITY) You could try this instead of GenerationType.AUTO (though this should translate to the above) Oliver On 09/09/2008, at 12:43 AM, Tim Perrett wrote: Hmmm, I've tried: @Id @GeneratedValue(){val strategy = GenerationType.AUTO} @Column(){val insertable = false} var id : Long = _ But yet its still being included in the query, any ideas? Cheers, Tim --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: One further: JPA + JTA + Lift
It looks a little like the RequestVar has had its lifecycle closing hook called by the time you call getSubscriptions Try touch/get the subscriptions before you pass them into the bind. cheers Oliver On Tue, Sep 9, 2008 at 7:31 AM, Kris Nuttycombe [EMAIL PROTECTED]wrote: I've been following the advancement of the JPA/Lift tutorial with great interest, and have managed to get my app working, but I'm now struggling with a problem that occurs whenever I try to retrieve a collection that is mapped as a lazy association: Exception occured while processing /orders/list Message: org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: com.gaiam.gcsi.entities.subscription.Order.subscriptions, no session or session was closed org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:358) org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:350) org.hibernate.collection.AbstractPersistentCollection.readSize(AbstractPersistentCollection.java:97) org.hibernate.collection.PersistentBag.size(PersistentBag.java:225) com.gaiam.gcsi.snippet.Orders$$anonfun$list$1.apply(Orders.scala:21) com.gaiam.gcsi.snippet.Orders$$anonfun$list$1.apply(Orders.scala:18) scala.Seq$class.flatMap(Seq.scala:267) com.gaiam.gcsi.model.EM$$anon$1.flatMap(EM.scala:11) com.gaiam.gcsi.snippet.Orders.list(Orders.scala:18) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ... I took the simplest-possible route of encapsulating the EntityManager in a RequestVar per Derek's suggestion as such: object EM { def entityManager() = (new InitialContext()).lookup(java:comp/env/persistence/em).asInstanceOf[EntityManager] } class Orders { object em extends RequestVar(entityManager()) def list(xhtml: NodeSeq) : NodeSeq = { val orders = em.createQuery(from Order).getResultList().asInstanceOf[java.util.List[Order]] orders.flatMap(order = bind(order, xhtml, id -- Text(order.getId().toString), count -- Text(order.getSubscriptions().size().toString))) } } The issue appears to be that the transaction that the the query ran in is no longer active by the time of the call to order.getSubscriptions(). Has anyone else been using JTA and encountered this? I'm running the latest stable Glassfish (2.1 UR2) and using Hibernate for the persistence layer. Thanks, Kris --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: JPA w/Scala
Doesn't look right. The id is the primary key - it could now be inserted with a value of 100, always. I can do an insert here with @Id @GeneratedValue(){val strategy = GenerationType.AUTO} Still works without GeneratedValue being present. My pom dependencies are dependency groupIdorg.hibernate/groupId artifactIdhibernate-entitymanager/artifactId version3.3.2.GA/version /dependency dependency groupIdnet.sourceforge.jtds/groupId artifactIdjtds/artifactId version1.2/version /dependency Properties in persistance.xml properties property name=hibernate.dialect value=org.hibernate.dialect.SQLServerDialect/ property name=hibernate.connection.driver_class value=net.sourceforge.jtds.jdbc.Driver/ property name=hibernate.connection.username value=xx/ property name=hibernate.connection.password value=xx/ property name=hibernate.connection.url value=jdbc:jtds:sqlserver://localhost:1433/fred/ property name=hibernate.max_fetch_depth value=3/ property name=hibernate.show_sql value=true/ /properties On Tue, Sep 9, 2008 at 9:37 AM, Tim Perrett [EMAIL PROTECTED] wrote: I managed to fix it in the end by reading some really really old post in the hibernate archive. Effectively, if you define something, a class property that has no initial value (in our case, _ ) then it bones the inserting for some reason. Quite knows what it does that but it does.. and with very little error as well :-( For completeness sake, here is the final Author class: @Entity @Table(){val name=authors, val schema=dbo} class Author { @Id @GeneratedValue(){val strategy = GenerationType.IDENTITY} @Column(){val insertable = false, val unique = true} var id : Long = 100 var name : String = @OneToMany(){val mappedBy = author, val targetEntity = classOf[Book]} var books : java.util.Set[Book] = new java.util.HashSet[Book]() } --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---