[Lift] Re: date management
OK, things are working well with RequestVar, but now I need to know how to kill it! After I create and save my record, if I refresh the browser, I get another record created. I did a temporary hack-fix with: if(! myRecord.saved_?) but I would just like to kill the RequestVar after the first round of record creation-saving. In terms of your example above, how would I do that? On Jun 8, 7:18 am, Derek Chen-Becker dchenbec...@gmail.com wrote: Generally you can either use RequestVars or a StatefulSnippet class to keep the values around on form resubmission. If you're using a Mapper class, you really just need one RequestVar to hold your Mapper instance. For example, if I had a Mapper class for a person with first name, last name and email, I could do something like this in my snippet class: ... // Set the up the RequstVar to initialize a new MyUserClass by default object userVar extends RequestVar[MyUserClass](MyUserClass.create) def editMyUser (xhtml : NodeSeq) : NodeSeq = { // We define a val to capture the current value of the userVar. This will be used to reinject later, as well // as for current access val current = userVar.is ... def saveMyUser () { current.validate match { ... ... current.save } } bind(user, xhtml, // First we re-inject the current MyUserClass instance using a hidden field current - SHtml.hidden(() = userVar(current)) // normal fields follow, e.g. name - SHtml.text(current.name.is, current.name(_)) // alternatively, you could do both steps in the first form field: name - SHtml.text(current.name.is, { in = userVar(current); current.name(in) }) ... ) } ... Let me know if you have any questions on that. Derek On Fri, Jun 5, 2009 at 9:47 PM, g-man gregor...@gmail.com wrote: I now have the due date arriving OK from the jQuery datepicker, and I cobbled together some ugliness to give days left until the ToDo due date, so that is good. My problem now is since we are not using the 'magic' of the _toForm methods for the form elements, I have to set each var value for the model field from the input SHtml data, as was done in the PocketChange app AddEntry.scala file. What is happening is that the initialization for each var is resetting the form if validation fails, so I guess I need to institute some RequestVars to remember the form values for resubmission, right? All my questions will take take the form of 'how to' recipes of foundational webapp elements, as you can see. My plan is to develop them for a 'cookbook' section of the wiki, so that's why I am asking one simple conceptual thing at a time. Therefore, what I have to learn now is all about form binding and recalling form value state if validation fails, so please break that down for me. Thanks as always! On Jun 3, 10:25 pm, Derek Chen-Becker dchenbec...@gmail.com wrote: Box is the base class. What you want is Full(2). Derek On Wed, Jun 3, 2009 at 8:53 PM, g-man gregor...@gmail.com wrote: Very good! I did a little homework, rearranged some things, and am getting some nice results with the 'manual method'... Since I am following the PocketChange app now rather than the ToDo example, there is no 'todo' val in scope to bind, so the todo.priority.toForm method will not work. I have SHtml.select working with a mapping for my choices, and I can use Empty for my default, but how do I get a Box[2] as my default? On Jun 3, 7:21 am, Derek Chen-Becker dchenbec...@gmail.com wrote: The only issue I would mention is that there's currently an open ticket because MappedDateTime won't save the time portion when you use Derby. I haven't had time to triage this yet. Derek On Wed, Jun 3, 2009 at 3:01 AM, Timothy Perrett timo...@getintheloop.eu wrote: Greg, I dont really use toForm; have you explored doing it manually? It seems like that would be able to tell you if there is a problem with toForm on MappedDateTime. I use mapped date time quite a bit and have no problems at all persisting the dates :-) Cheers, Tim On Jun 3, 3:09 am, g-man gregor...@gmail.com wrote: Are there no ideas for my problem? I have many more questions saved up, but would like to clear each out before starting a new one. Thanks again! On May 31, 1:57 pm, g-man gregor...@gmail.com wrote: As I proceed to enhance the ToDo example, I have added a new field to the ToDo.scala model: object dueOn extends MappedDateTime(this) { final val dateFormat = DateFormat.getDateInstance (DateFormat.SHORT) override def asHtml = Text(dateFormat.format(is))} Next, I added a binding in the TD.scala snippet within the add
[Lift] Re: lift presentation
I'm giving today a presentation for Transylvania JUG ... I'll email you my material. Br's, Marius On Jun 25, 8:04 am, Wilson MacGyver wmacgy...@gmail.com wrote: Hi, I'm doing a presentation on lift to my local java user group next month. I'm wondering if any of you have slides on lift that I can borrow/leverage? :) Thanks, Mac -- Omnem crede diem tibi diluxisse supremum. --~--~-~--~~~---~--~~ 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: higher-kinded types
All, The following code works without going through the M-P-O construction. It enjoys approximately the same brevity as a Haskell type class. // smallest expression of monad i can find trait MBrace[C[_] : MBrace[C,A],A] { def nest( a : A ) : C[A] def flatten[T : C[C[A]]]( bsq : T ) : C[A] } // one of the simplest witnesses of monad i can find class MBraceSeq[A]( a_ : A* ) extends Seq[A] with MBrace[MBraceSeq,A] { override def nest( a : A ) = new MBraceSeq[A]( a ) override def flatten[T : MBraceSeq[MBraceSeq[A]]]( bsq : T ) : MBraceSeq[A] = { (new MBraceSeq[A]( ) /: bsq)( { ( acc : MBraceSeq[A], e : MBraceSeq[A] ) = ( acc ++ e ).asInstanceOf[MBraceSeq[A]] } ) } override def length = a_.length override def elements = a_.elements override def apply( n : Int ) = a_.apply( n ) } Best wishes, --greg On Wed, Jun 24, 2009 at 3:49 PM, Meredith Gregory lgreg.mered...@gmail.comwrote: All, Am i correct in concluding that the solution in The Moors-Piessens-Odersky paper only works with collections that have been clever enough to have used type members rather that type parameters? Or, is there a trick to making the vast majority of the collections types that are parametrically typed look as if they have type members? (See example below.) Best wishes, --greg // Paraphrasing the basic Moors-Piessens-Odersky construction trait TypeCtor1 { type E } trait Brace[A] extends TypeCtor1 { type C : TypeCtor1 def nest( a : A ) : C{type E = A} def flatten( bsq : C{type E=C{type E=A}} ) : C{type E=A} } // Now, how to make a version of BraceList since List is parametrically typed? -- L.G. Meredith Managing Partner Biosimilarity LLC 1219 NW 83rd St Seattle, WA 98117 +1 206.650.3740 http://biosimilarity.blogspot.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 http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: lift presentation
You can find all of DPP's preso's here: http://is.gd/1cUi0 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 liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Can't embed a snippet
Wouldn't this work with the Scala XML parser? xml:group h2Welcome/h2 pPut welcome details here./p /xml:group On 25/06/2009, at 1:08 AM, Nolan Darilek wrote: On 06/24/2009 09:40 AM, Derek Chen-Becker wrote: Wait a second. I have plenty of templates that have multiple elements in them. What exactly is the problem you're seeing here? Using 1.1, I have the following in templates-hidden/welcome.html: h2Welcome/h2 pPut welcome details here./p Running mvn test gives me the following failure report: --- Test set: info.thewordnerd.therascribe.AppTest --- Tests run: 2, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 1.8 sec FAILURE! testXml(info.thewordnerd.therascribe.AppTest) Time elapsed: 1.474 sec FAILURE! junit.framework.AssertionFailedError: Malformed XML in 1 file: src/main/webapp/templates-hidden/welcome.html at junit.framework.Assert.fail(Assert.java:47) at info.thewordnerd.therascribe.AppTest.testXml(AppTest.scala:72) .. From the surefire report: system-outMalformed XML in 1 file: src/main/webapp/templates-hidden/welcome.html /system-out system-err:3:70: document must contain exactly one element ^ /system-err Surrounding it in a div fixes that. Must be a new addition in 1.1? --~--~-~--~~~---~--~~ 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: Getting Username and Password from URL of form hxxp://user:passw...@foo.org
Are you using the builtin support for basic authentication in lift? If not, please see my example here: http://is.gd/1cYhR The format you mention is standard HTTP Basic, and in accordance with the RFC's - it should be Base64 encoded. Lift supports both HTTP basic and HTTP digest. Cheers, Tim On Jun 25, 5:10 am, Alan M alan.morten...@gmail.com wrote: I can't seem to find anyway to get to those two values. I've been searching all over the request class/object and no luck. I'm writing a RESTful web service that uses basic auth and for some reason jQuery likes to send things in the above mentioned format (http://user:passw...@foo.org). I've tried to fix that on the Javascript side but I couldn't get anything to work. So instead I decided on the service to recognize either the header style or the URL style of passing the login info. Sounded simple enough, until I couldn't find how to get at that/those strings.. Any help would be greatly appreciated.. Alan Mortensen --~--~-~--~~~---~--~~ 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 presentation
Wilson MacGyver a écrit : Hi, I'm doing a presentation on lift to my local java user group next month. I'm wondering if any of you have slides on lift that I can borrow/leverage? :) I did a presentation some weeks ago, the slides are under a creative common licence, so use them if you want ! http://fanf42.blogspot.com/2009/06/tour-of-scala-ossgtp-paris-oss-user.html -- Francois Armand http://fanf42.blogspot.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: lift presentation
I did a presentation some weeks ago, the slides are under a creative common licence, so use them if you want ! http://fanf42.blogspot.com/2009/06/tour-of-scala-ossgtp-paris-oss-user.html OK, just ignore this message, it was a *Scala* presentation, not a *Lift* one - sorry, I read your post too quickly - and no, the fact that we were in Lift ml didn't make me find that strange :) -- -- Francois Armand http://fanf42.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: Anyone working on the flot widget?
On 25 Jun 2009, Francois Bertrand wrote: Hi Jeppe Great to see you are interested in the flot widget. My current to-do list for the flot widget, is: - create more Lift JsExp and JsCmd to modify a already displayed flot graph. They should be used in AJAX and Comet applications - update to a more recent version of the javascrrit widget I need this as well, especially since there are some patches that provides pie charts - create the test demo app, - make the creation of FlotOptions, FlotLinesOptions, etc, less verbose. I hope that Scala 2.8 Named and Default Arguments will help. Yeah, this would be nice :-) We probably need some working code within the next few weeks so probably can't wait for 2.8 though. - create a high level mechanism to display Lift's Record I appreciate any help. What's the best way to coordinate this? Just fork the code on github or? /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: lift presentation
Thank you very much! On Thu, Jun 25, 2009 at 2:16 AM, marius d. marius.dan...@gmail.com wrote: I'm giving today a presentation for Transylvania JUG ... I'll email you my material. Br's, Marius On Jun 25, 8:04 am, Wilson MacGyver wmacgy...@gmail.com wrote: Hi, I'm doing a presentation on lift to my local java user group next month. I'm wondering if any of you have slides on lift that I can borrow/leverage? :) Thanks, Mac -- Omnem crede diem tibi diluxisse supremum. -- Omnem crede diem tibi diluxisse supremum. --~--~-~--~~~---~--~~ 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 presentation
heheh, no problem. I did the one on Scala back in Feb. :) On Thu, Jun 25, 2009 at 7:31 AM, Francois Armandfan...@gmail.com wrote: I did a presentation some weeks ago, the slides are under a creative common licence, so use them if you want ! http://fanf42.blogspot.com/2009/06/tour-of-scala-ossgtp-paris-oss-user.html OK, just ignore this message, it was a *Scala* presentation, not a *Lift* one - sorry, I read your post too quickly - and no, the fact that we were in Lift ml didn't make me find that strange :) -- -- Francois Armand http://fanf42.blogspot.com/ -- Omnem crede diem tibi diluxisse supremum. --~--~-~--~~~---~--~~ 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 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 :-) /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: lift presentation
Guys, I just want to say that I haven't started using Lift yet but I already love it. This community is very supportive and responsive. Keep up the awesome work! Jeremy On Thu, Jun 25, 2009 at 7:21 AM, Wilson MacGyver wmacgy...@gmail.comwrote: heheh, no problem. I did the one on Scala back in Feb. :) On Thu, Jun 25, 2009 at 7:31 AM, Francois Armandfan...@gmail.com wrote: I did a presentation some weeks ago, the slides are under a creative common licence, so use them if you want ! http://fanf42.blogspot.com/2009/06/tour-of-scala-ossgtp-paris-oss-user.html OK, just ignore this message, it was a *Scala* presentation, not a *Lift* one - sorry, I read your post too quickly - and no, the fact that we were in Lift ml didn't make me find that strange :) -- -- Francois Armand http://fanf42.blogspot.com/ -- Omnem crede diem tibi diluxisse supremum. --~--~-~--~~~---~--~~ 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: date management
The code Derek included: // Set the up the RequstVar to initialize a new MyUserClass by default object userVar extends RequestVar[MyUserClass](MyUserClass.create) By default creates a MyUserClass instance. Maybe you want to init the RequestVar as an Empty Box and then conditionally modify it. object userVar extends RequestVar[Box[MyUserClass]](Empty) Then after you save, you can set the RequestVar to Empty again. Without looking at your code, this is a guess, I could be/probably am wrong. On Jun 25, 12:10 am, g-man gregor...@gmail.com wrote: OK, things are working well with RequestVar, but now I need to know how to kill it! After I create and save my record, if I refresh the browser, I get another record created. I did a temporary hack-fix with: if(! myRecord.saved_?) but I would just like to kill the RequestVar after the first round of record creation-saving. In terms of your example above, how would I do that? On Jun 8, 7:18 am, Derek Chen-Becker dchenbec...@gmail.com wrote: Generally you can either use RequestVars or a StatefulSnippet class to keep the values around on form resubmission. If you're using a Mapper class, you really just need one RequestVar to hold your Mapper instance. For example, if I had a Mapper class for a person with first name, last name and email, I could do something like this in my snippet class: ... // Set the up the RequstVar to initialize a new MyUserClass by default object userVar extends RequestVar[MyUserClass](MyUserClass.create) def editMyUser (xhtml : NodeSeq) : NodeSeq = { // We define a val to capture the current value of the userVar. This will be used to reinject later, as well // as for current access val current = userVar.is ... def saveMyUser () { current.validate match { ... ... current.save } } bind(user, xhtml, // First we re-inject the current MyUserClass instance using a hidden field current - SHtml.hidden(() = userVar(current)) // normal fields follow, e.g. name - SHtml.text(current.name.is, current.name(_)) // alternatively, you could do both steps in the first form field: name - SHtml.text(current.name.is, { in = userVar(current); current.name(in) }) ... ) } ... Let me know if you have any questions on that. Derek On Fri, Jun 5, 2009 at 9:47 PM, g-man gregor...@gmail.com wrote: I now have the due date arriving OK from the jQuery datepicker, and I cobbled together some ugliness to give days left until the ToDo due date, so that is good. My problem now is since we are not using the 'magic' of the _toForm methods for the form elements, I have to set each var value for the model field from the input SHtml data, as was done in the PocketChange app AddEntry.scala file. What is happening is that the initialization for each var is resetting the form if validation fails, so I guess I need to institute some RequestVars to remember the form values for resubmission, right? All my questions will take take the form of 'how to' recipes of foundational webapp elements, as you can see. My plan is to develop them for a 'cookbook' section of the wiki, so that's why I am asking one simple conceptual thing at a time. Therefore, what I have to learn now is all about form binding and recalling form value state if validation fails, so please break that down for me. Thanks as always! On Jun 3, 10:25 pm, Derek Chen-Becker dchenbec...@gmail.com wrote: Box is the base class. What you want is Full(2). Derek On Wed, Jun 3, 2009 at 8:53 PM, g-man gregor...@gmail.com wrote: Very good! I did a little homework, rearranged some things, and am getting some nice results with the 'manual method'... Since I am following the PocketChange app now rather than the ToDo example, there is no 'todo' val in scope to bind, so the todo.priority.toForm method will not work. I have SHtml.select working with a mapping for my choices, and I can use Empty for my default, but how do I get a Box[2] as my default? On Jun 3, 7:21 am, Derek Chen-Becker dchenbec...@gmail.com wrote: The only issue I would mention is that there's currently an open ticket because MappedDateTime won't save the time portion when you use Derby. I haven't had time to triage this yet. Derek On Wed, Jun 3, 2009 at 3:01 AM, Timothy Perrett timo...@getintheloop.eu wrote: Greg, I dont really use toForm; have you explored doing it manually? It seems like that would be able to tell you if there is a problem with toForm on MappedDateTime. I use mapped date time quite a bit and have no problems at all persisting the dates :-) Cheers, Tim On Jun 3, 3:09 am, g-man
[Lift] From JPA question to ScalaQuery to Collection Abstractions
All, Again -- many thanks to the posters and responders on this thread. i've moved on to attempt to use ScalaQueryhttp://github.com/szeiger/scala-query/tree/masteras the target for the SQL persistence. Stefan Szeiger describes his work herehttp://szeiger.de/blog/2008/12/21/a-type-safe-database-query-dsl-for-scala/#more-24 . It seems to be a week of meeting resistance, however. i've been attempting to build the simplest possible collection to use as a toy to test my compilation strategy. This has turned out to be quite a little brain-teaser. For me simpler means: contains less information. In this sense, a Set is simpler than a List. The simplest possible collection i can imagine (that still supports associativity -- and i don't know if i can call something that doesn't support associativity a collection) is a monad. A monad doesn't commit to what the collection contains; only parametrically commits to how to put things into the collection; and only parametrically commits to how to flatten the collection (which is tantamount to supporting associativity). After thinking about it for half a day, and revisiting the Moors-Piessens-Odersky (MPO) paper on higher-kinded types, i realized that the MPO construction doesn't actually apply to Scala in practice (someone please tell me if i'm wrong) because they fundamentally rely on constructions using type *members* and not type *parameters*. Unfortunately, most of the collections libraries are written using type parameters. So, i decided to roll my own and see what i got. Here's what i came up with last night. // smallest expression of monad i can find trait MBrace[C[_] : MBrace[C,A],A] { def nest( a : A ) : C[A] def flatten[T : C[C[A]]]( bsq : T ) : C[A] } // one of the simplest witnesses of monad i can find class MBraceSeq[A]( a_ : A* ) extends Seq[A] with MBrace[MBraceSeq,A] { override def nest( a : A ) = new MBraceSeq[A]( a ) override def flatten[T : MBraceSeq[MBraceSeq[A]]]( bsq : T ) : MBraceSeq[A] = { (new MBraceSeq[A]( ) /: bsq)( { ( acc : MBraceSeq[A], e : MBraceSeq[A] ) = ( acc ++ e ).asInstanceOf[MBraceSeq[A]] } ) } override def length = a_.length override def elements = a_.elements override def apply( n : Int ) = a_.apply( n ) } i was mostly ok with this -- apart from some desiderata/concerns regarding the Seq methods being visible at this level. i woke up this am and realized that this is not even wrong. It requires an instance of MBrace to invoke the nest or flatten methods. Geez, i feel like a first year undergrad. All i want to do is write the simplest possible collection on which i can then test a persistence strategry and i run into roadblocks everywhere. ;-) Best wishes, --greg On Wed, Jun 24, 2009 at 8:00 AM, Derek Chen-Becker dchenbec...@gmail.comwrote: Well, in my real-world experience I've never had very complex models and I've never used TABLE-PER-CLASS either, so I don't really have a feel for what's not possible. Generally I think that JPA (which is a subset of Hibernate) covers a good portion of people's needs for ORM, but it definitely has some big missing functionality (e.g. no ordered collections until JPA 2). I think that in this case Greg is pushing the limits on a relatively unused corner of JPA (I've never seen someone use TABLE-PER-CLASS before) and he's hitting some bugs. I want to make clear that I think that what Greg is attempting is entirely possible. My earlier comment about rolling your own ORM was because I misunderstood what he was doing with abstract classes. In my mind, there would be a couple of places where you might want to roll your own stuff: 1. An existing schema that doesn't map well to an object graph. We have a legacy database at work where the brilliant developers decided that nothing should be normalized and data can exist in one of four tables based on some arcane business logic. You can still build an ORM layer on something like this, but essentially all you're doing is creating a thin wrapper on ResultSets 2. You have very specific data that you need to retrieve with possibly complex joins, and you need it to be as performant as possible. There are some tricks you can do with EJB QL to make it prefetch things, but often you can end up with multiple round trips to the database and/or data that you don't need being fetched. In certain scenarios I could see this being an issue. This list isn't intended to be exhaustive, these are just the top two that come to mind. In terms of Hibernate vs others like JPOX, TopLink, etc, I'd say that Hibernate is a first-class provider and at least equal to the others. Derek On Wed, Jun 24, 2009 at 2:21 AM, TSP tim.pig...@optrak.co.uk wrote: Derek Would you distinguish between what is achievable in a specific ORM such as Hibernate from JPA in this statement or would you think it applies to all. I've got to go with hibernate in any case because of
[Lift] MySQL connection pool
It's not strictly Lift question... Is connection pool a feature of MySQL JDBC driver? It is a feature of MySQL ODBC driver... Looking into this article http://dev.mysql.com/tech-resources/articles/connection_pooling_with_connectorj.html it's not clear to me wheather connection pool is implemented in application server or in driver itself. I'm planning on writing own application server and don't know if I need to worry about implementing connection pooling or not. --~--~-~--~~~---~--~~ 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 website page renders incorrectly in IE
This lift page renders incorrectly in IE: http://liftweb.net/docs/getting_started.html The text is much too far to the right. My coworker pointed this out to me and I reproduced the problem, let me know if you have any problems identifying or reproducing the problem. --~--~-~--~~~---~--~~ 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 website page renders incorrectly in IE
This is a known issue - I'll get round to rebuilding the site soon (it was originally thrown up in a matter of hours so it not the smoothest) so we can eliminate these kinds of bugs. Thanks Tim On 25/06/2009 17:43, samreid samrr...@gmail.com wrote: This lift page renders incorrectly in IE: http://liftweb.net/docs/getting_started.html The text is much too far to the right. My coworker pointed this out to me and I reproduced the problem, let me know if you have any problems identifying or reproducing the problem. --~--~-~--~~~---~--~~ 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 and auto generation of id
I've used JPA with MySQL in the past and I don't recall having to specify a generator to get auto-incremenet IDs working. Does the schema for this particular entity have AUTO_INCREMENT set for the id column? Derek On Wed, Jun 24, 2009 at 5:29 PM, David Persons dhwpers...@gmail.com wrote: Thanks for all the answers guys. I managed to fix the id problem, I needed the Hibernate specific class GenericGenerator to fix it, which of cource is less pretty then using only JPA. Someone has an example of how to make it work with MySql and only JPA annotations? Current version: @Entity class Scene { @Id @GenericGenerator{val name=hibernate-increment, val strategy=increment} @GeneratedValue{val strategy = GenerationType.SEQUENCE, val generator = hibernate-increment} 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 = _ } However, now I get an org.hibernate.PropertyValueException: not-null property references a null or transient value: model.Scene.storyBoard :-s I tried a lot of things already, the corresponding StoryBoard is saved and not null, so I guess it has to be transient. Merging the StoryBoard however still gives the same error.. I tried to get JPA and Lift working together in the same way as in the JPADemo example.. Is it the use of MySql which prevents the example from working for me? regards, David On 23 jun, 00:54, Derek Chen-Becker dchenbec...@gmail.com wrote: Also, what does the schema for the entity's table look like? On Mon, Jun 22, 2009 at 4:54 PM, Derek Chen-Becker dchenbec...@gmail.comwrote: Mind posting the snippet of code where you're saving the instance? A merge should interpret a null ID as a fresh instance, and a persist should just save it. Derek On Mon, Jun 22, 2009 at 1:50 PM, David Persons dhwpers...@gmail.com wrote: I am using MySql (5). After setting the hibernate.dialect to org.hibernate.dialect.MySQLDialect in my persistence.xml file, I get a org.hibernate.AssertionFailure: null id :-s cheers On 22 jun, 19:18, Derek Chen-Becker dchenbec...@gmail.com wrote: That's not accurate, at least with Hibernate. By putting the annotations on vars, the compiler ends up putting them on the internal fields, which then forces Hibernate into a field-based persistence model and not a getter/setter based one. The SQLGrammarException is most likely what the other people have said. If you're in Oracle or PostgreSQL, for instance, you need a sequence set up for the auto identity model. What database are you using? Derek On Mon, Jun 22, 2009 at 8:54 AM, Eric Bowman ebow...@boboco.ie wrote: David Persons 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 = _ } You almost certainly need some scala.reflect.BeanProperty annotations on your fields. cheers, Eric -- Eric Bowman Boboco Ltd ebow...@boboco.ie http://www.boboco.ie/ebowman/pubkey.pgp +35318394189/+353872801532 http://www.boboco.ie/ebowman/pubkey.pgp%0A+35318394189/+353872801532 --~--~-~--~~~---~--~~ 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: MySQL connection pool
The MySQL driver may have facilities for connection pooling, but generally you use a pool provider (dbcp, c3po, etc) or write your own. Derek On Thu, Jun 25, 2009 at 11:31 AM, ph pkirsa...@gmail.com wrote: It's not strictly Lift question... Is connection pool a feature of MySQL JDBC driver? It is a feature of MySQL ODBC driver... Looking into this article http://dev.mysql.com/tech-resources/articles/connection_pooling_with_connectorj.html it's not clear to me wheather connection pool is implemented in application server or in driver itself. I'm planning on writing own application server and don't know if I need to worry about implementing connection pooling or not. --~--~-~--~~~---~--~~ 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't embed a snippet
Sleeping on it the snippet would be as simple as def group(c : scala.xml.NodeSeq) : scala.xml.NodeSeq = scala.xml.Group(c) which would allow for: lift:group h2Welcome/h2 pPut welcome details here/p /lift:group The advantage is that it is in the lift name space... Marc On 25/06/2009, at 8:59 PM, Marc Boschma wrote: Wouldn't this work with the Scala XML parser? xml:group h2Welcome/h2 pPut welcome details here./p /xml:group On 25/06/2009, at 1:08 AM, Nolan Darilek wrote: --~--~-~--~~~---~--~~ 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] form element specific error messages
I have a form such as: lift:Customer.newCustomer form=POST divnewCustomer:firstName/newCustomer:firstName/div divnewCustomer:lastName/newCustomer:lastName/div divnewCustomer:submit //div /lift:Customer.newCustomer and a bind: bind(newCustomer, xhtml, firstName - text(XXX), lastName - text(XXX), submit - submit(XXX) ) If I want to require that both first and last name are required, but the form is submitted with no last name, how anyone suggest that I put the error message *Required in the appropriate div tag next to the text box. --~--~-~--~~~---~--~~ 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: Modify CRUDify XHTML
Naftoli, you would overload the _editTemplate field or the editTemplate method, I imagine. Peter On Jun 24, 11:49 am, Naftoli Gugenheim naftoli...@gmail.com wrote: How would you customize the edit view, say to allow editing all child entities on the same screen? On Wed, Jun 24, 2009 at 2:01 PM, Jeppe Nejsum Madsen je...@ingolfs.dkwrote: On 24 Jun 2009, Peter Robinett wrote: Hi all, I'm using CRUDify on one of my models and I'd like to display some additional data on the view template. I believe that I need to override one of the model definitions with some sort of reference to my own XHTML file. Which one? _viewTemplate? Or perhaps the viewTemplate method? If you look at the source to CRUDify, you'll see def viewTemplate(): NodeSeq = pageWrapper(_viewTemplate) where def pageWrapper(body: NodeSeq): NodeSeq = lift:surround with=default at=content { body } /lift:surround def _viewTemplate = lift:crud.view table id={viewId} class={viewClass} crud:row tr tdcrud:name//td tdcrud:value//td /tr /crud:row /table /lift:crud.view So the simplest thing is to override _viewTemplate with something similar to the above. This should be done on the companion objects where CRUDify is mixed in /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
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 -~--~~~~--~~--~--~---