[Lift] Re: Newbee question Datamapper
I think my simple solution does not work... and the implementation of MappedPassword is not really easy to understand. I thought such classes would be nice for datatypes as Currency, Timespan etc... that appear everwhere in the application but where own tables are not useful. The solution of Naftoli, I tried... but maybe I did something wrong: trait MyMappedTimeSpan[T :Mapper[T]]{ import net.liftweb.util._ import net.liftweb.http.S import xml.NodeSeq object from extends MappedTime[T](this.asInstanceOf[T]) object to extends MappedTime[T](this.asInstanceOf[T]) } class Bericht extends LongKeyedMapper[Bericht] with IdPK with OneToMany [Long, Bericht]{ override def getSingleton = Bericht object mittag extends MyMappedTimeSpan[Bericht] ... If someone found a simple solution, please tell me so :) hyperion On 16 Okt., 22:01, David Pollak feeder.of.the.be...@gmail.com wrote: On Fri, Oct 16, 2009 at 9:42 AM, Naftoli Gugenheim naftoli...@gmail.comwrote: I think there is support somewhere in the MappedField hierarchy for a MappedField that represents to database columns. Take a look at MappedPassword. Having a field represent two columns (as MappedPassword does) is a huge piece of pain. I've made a ton of mistakes with Mapper, but the biggest, nastiest shining hairball of a mistake was compound columns. Have I scared anyone off using them yet? - harryhhar...@gmail.com wrote: Make MyMappedTimeSpan a trait: trait MyMappedTimeSpan[T :Mapper[T]](val owner: T) { object from extends MappedTime[MapperType](this.asIntanceOf [MatterType]) object to extends MappedTime[MapperType](this.asIntanceOf [MatterType]) } And then use it like so: class DBObject extends LongKeyedMapper[Bericht] with IdPK with MyMappedTimeSpan[DBObject] { } -harryh On Oct 16, 8:08 am, hyperion hyperion1...@googlemail.com wrote: Hello, I tried this: class MyMappedTimeSpan[T :Mapper[T]](val owner: T){ import net.liftweb.util._ import net.liftweb.http.S import xml.NodeSeq val from = new MappedTime(owner) val to = new MappedTime(owner) } class DBObject extends LongKeyedMapper[Bericht] with IdPK { def getSingleton = Bericht ... object test extends MyMappedTimeSpan(this) } and bound this class with: from - bt.test.from.toForm, to - bt.test.to.toForm, In html: tr tdbt:von//td tdbt:nach//td /tr Everything worked fine... except that my timespan is completely ignored in the database ;). I think the reason is you use reflection on class DBObject to find all values that should be stored in the dabase?... but I have not inspected the source code jet... I am new to lift and also to scala My Question: Is it possible to build such Datatypes based on two or more DB-Fields of the single table...?... I think even they are mapped to the master-DB-table, such types could be helpful... Greetz -- Lift, the simply functional web frameworkhttp://liftweb.net Beginning Scalahttp://www.apress.com/book/view/1430219890 Follow me:http://twitter.com/dpp Surf the harmonics --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Scala and Eclipse
On Sat, Oct 17, 2009 at 11:07 AM, johncch john...@gmail.com wrote: I manage to import lift and lift-mapper projects fine, but earlier today when I tried importing in lift-hello lift I'm getting editor shutdowns and what nots. Let's look at a few. From the stacktrace my hunch is that you're trying to create projects outside of the Eclipse workspace. That's not fully supported in 2.7.x (it will be in 2.8). Cheers, Miles -- Miles Sabin tel: +44 (0)7813 944 528 skype: milessabin http://www.chuusai.com/ http://twitter.com/milessabin --~--~-~--~~~---~--~~ 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 and Eclipse
I'm not supporting the mvn eclipse:eclipse plugin route right now. If anyone desires to support that, please contribute patches ;) On Sat, Oct 17, 2009 at 8:58 AM, Miles Sabin mi...@milessabin.com wrote: On Sat, Oct 17, 2009 at 11:07 AM, johncch john...@gmail.com wrote: I manage to import lift and lift-mapper projects fine, but earlier today when I tried importing in lift-hello lift I'm getting editor shutdowns and what nots. Let's look at a few. From the stacktrace my hunch is that you're trying to create projects outside of the Eclipse workspace. That's not fully supported in 2.7.x (it will be in 2.8). Cheers, Miles -- Miles Sabin tel: +44 (0)7813 944 528 skype: milessabin http://www.chuusai.com/ http://twitter.com/milessabin --~--~-~--~~~---~--~~ 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 and Eclipse
On Sat, Oct 17, 2009 at 2:31 PM, Josh Suereth joshua.suer...@gmail.com wrote: I'm not supporting the mvn eclipse:eclipse plugin route right now. If anyone desires to support that, please contribute patches ;) So, for the archives, could you say what the currently recommended Maven+Eclipse configuration is? Cheers, Miles -- Miles Sabin tel: +44 (0)7813 944 528 skype: milessabin http://www.chuusai.com/ http://twitter.com/milessabin --~--~-~--~~~---~--~~ 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 and Eclipse
It's gotten to the point where I can only support the configuration we're using at work (as it's critical to our success). At one point I thought I had written how on this wiki: http://lampsvn.epfl.ch/trac/scala/wiki/ScalaEclipseMaven, but it seems like I've missed that. Also, it seems some of the information on this wiki is confusing. Here's the original wiki I was putting together http://code.google.com/p/esmi/wiki/CreatingScalaMavenProjectsInEclipse. If I can grab enough time, I'll combine the two works. But in the meantime, here's the configuration I can guarantee support for: Maven 2.0.10 - 2.2 Eclipse 3.4 Eclipse IAM Plugin 0.10 Scala IDE For Eclipse 2.7.5/2.7.4 Remember to *NOT* use a different version of the Scala IDE for Eclipse from the version of Scala you're using on your projects. And remember to set up your projects in the following order: 1) Import your POMs with IAM's Maven Import Wizards 2) Right click on scala projects and select Add Scala Nature 3) Sometimes, when you change your pom classpath, you need to poke the resident scala compiler. Usually closing/opening the project fixes this. This happens rarely (~1/week) We have a large multi-module project that includes scala in a few key artifacts and things are going somewhat smoothly. However, I think most of the devs are bailing out of eclipse for intellij. Hope that helps! - Josh On Sat, Oct 17, 2009 at 9:36 AM, Miles Sabin mi...@milessabin.com wrote: On Sat, Oct 17, 2009 at 2:31 PM, Josh Suereth joshua.suer...@gmail.com wrote: I'm not supporting the mvn eclipse:eclipse plugin route right now. If anyone desires to support that, please contribute patches ;) So, for the archives, could you say what the currently recommended Maven+Eclipse configuration is? Cheers, Miles -- Miles Sabin tel: +44 (0)7813 944 528 skype: milessabin http://www.chuusai.com/ http://twitter.com/milessabin --~--~-~--~~~---~--~~ 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 the class name in the JSON field
Perhaps supporting optional alias registration for types (case classes) could be a way to reduce domain coupling. It could be used to provide a level of abstraction. Granted it's more work to initialize so there are drawbacks. On Oct 17, 4:40 am, Marius marius.dan...@gmail.com wrote: Hmmm ... I wonder if heterogeneous lists should be supported. I also wonder if type knowledge in JSON is a good thing to do as it seems to me that we're bringing knowledge from another domain creating couplings. I'm not sure if there is a different way to solve this ... it just doesn't feel completely right to me ... but this doesn't necessarily mean it is not right :) 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: Including the class name in the JSON field
I've been thinking this feature today a bit too. Marius raises an important point. Adding type information and more complex serialization scheme will introduce couplings, making it for instance more difficult to deserialize JSON using a different language or toolkit. On a positive side, we might get support for other parameterized types too (tuples for instance). I pushed an experimental branch (joni_issue_108) which contains serialization part of this feature (the easy part really). It adds 'jsonClass' field to objects. case class Animals(animals: List[Animal]) trait Animal case class Dog(name: String) extends Animal case class Fish(weight: Double) extends Animal scala write(Animals(Dog(pluto) :: Fish(1.2) :: Dog(devil) :: Nil)) res0: String = {jsonClass:Animals,animals: [{jsonClass:Dog,name:pluto},{jsonClass:Fish,weight:1.2}, {jsonClass:Dog,name:devil}]} Possible actions: * Do not support parameterized types (status quo) + Simple scheme, easy to serialize in language agnostic way - Limited * Add full type information when serializing/deserializing + Opens possibility to deserialize polymorphic types + Deserialization can be done without any explicit type information (read(...) vs. read[ExpectedType](...)) - Introduces couplings - This is still not a generic serialization solution, there's still a lot of Scala classes which can't be deserialized * Support both schemes + Moar choice - Choice it not necessarily a good thing (adds complexity etc.) Cheers Joni On 17 loka, 11:40, Marius marius.dan...@gmail.com wrote: Hmmm ... I wonder if heterogeneous lists should be supported. I also wonder if type knowledge in JSON is a good thing to do as it seems to me that we're bringing knowledge from another domain creating couplings. I'm not sure if there is a different way to solve this ... it just doesn't feel completely right to me ... but this doesn't necessarily mean it is not right :) Br's, Marius On Oct 15, 1:47 am, David Pollak feeder.of.the.be...@gmail.com wrote: Folks, What are thoughts on including (perhaps optionally) the name of the case class in an additional JSON field so that one can reconstruct a list that contains many different types? Thanks, David -- Lift, the simply functional web frameworkhttp://liftweb.net Beginning Scalahttp://www.apress.com/book/view/1430219890 Follow me:http://twitter.com/dpp Surf the harmonics --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to 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] Google wave for scala / lift
Sorry for cross-posting here, I think I have a valid reason... :) I've spotted that the BASE crowd have a scala wave going, has anyone yet thought to do the same for scala globally? Same question goes to lift users. --~--~-~--~~~---~--~~ 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: Newbee question Datamapper
On Sat, Oct 17, 2009 at 2:42 AM, hyperion hyperion1...@googlemail.comwrote: I think my simple solution does not work... and the implementation of MappedPassword is not really easy to understand. I thought such classes would be nice for datatypes as Currency, Timespan etc... that appear everwhere in the application but where own tables are not useful. As I said, MappedPassword was a mistake. Supporting multiple columns mapping to a single field was a mistake. It's hard stuff to get right. The solution of Naftoli, I tried... but maybe I did something wrong: trait MyMappedTimeSpan[T :Mapper[T]]{ import net.liftweb.util._ import net.liftweb.http.S import xml.NodeSeq object from extends MappedTime[T](this.asInstanceOf[T]) object to extends MappedTime[T](this.asInstanceOf[T]) } class Bericht extends LongKeyedMapper[Bericht] with IdPK with OneToMany [Long, Bericht]{ override def getSingleton = Bericht object mittag extends MyMappedTimeSpan[Bericht] ... If someone found a simple solution, please tell me so :) Your class should look like: class Bericht extends LongKeyedMapper[Bericht] with IdPK with OneToMany [Long, Bericht] with MyMappedTimeSpan[Bericht] { ... } hyperion On 16 Okt., 22:01, David Pollak feeder.of.the.be...@gmail.com wrote: On Fri, Oct 16, 2009 at 9:42 AM, Naftoli Gugenheim naftoli...@gmail.com wrote: I think there is support somewhere in the MappedField hierarchy for a MappedField that represents to database columns. Take a look at MappedPassword. Having a field represent two columns (as MappedPassword does) is a huge piece of pain. I've made a ton of mistakes with Mapper, but the biggest, nastiest shining hairball of a mistake was compound columns. Have I scared anyone off using them yet? - harryhhar...@gmail.com wrote: Make MyMappedTimeSpan a trait: trait MyMappedTimeSpan[T :Mapper[T]](val owner: T) { object from extends MappedTime[MapperType](this.asIntanceOf [MatterType]) object to extends MappedTime[MapperType](this.asIntanceOf [MatterType]) } And then use it like so: class DBObject extends LongKeyedMapper[Bericht] with IdPK with MyMappedTimeSpan[DBObject] { } -harryh On Oct 16, 8:08 am, hyperion hyperion1...@googlemail.com wrote: Hello, I tried this: class MyMappedTimeSpan[T :Mapper[T]](val owner: T){ import net.liftweb.util._ import net.liftweb.http.S import xml.NodeSeq val from = new MappedTime(owner) val to = new MappedTime(owner) } class DBObject extends LongKeyedMapper[Bericht] with IdPK { def getSingleton = Bericht ... object test extends MyMappedTimeSpan(this) } and bound this class with: from - bt.test.from.toForm, to - bt.test.to.toForm, In html: tr tdbt:von//td tdbt:nach//td /tr Everything worked fine... except that my timespan is completely ignored in the database ;). I think the reason is you use reflection on class DBObject to find all values that should be stored in the dabase?... but I have not inspected the source code jet... I am new to lift and also to scala My Question: Is it possible to build such Datatypes based on two or more DB-Fields of the single table...?... I think even they are mapped to the master-DB-table, such types could be helpful... Greetz -- Lift, the simply functional web frameworkhttp://liftweb.net Beginning Scalahttp://www.apress.com/book/view/1430219890 Follow me:http://twitter.com/dpp Surf the harmonics -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp Surf the harmonics --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Including the class name in the JSON field
On Sat, Oct 17, 2009 at 7:54 AM, Joni Freeman freeman.j...@gmail.comwrote: I've been thinking this feature today a bit too. Marius raises an important point. Adding type information and more complex serialization scheme will introduce couplings, making it for instance more difficult to deserialize JSON using a different language or toolkit. On a positive side, we might get support for other parameterized types too (tuples for instance). I pushed an experimental branch (joni_issue_108) which contains serialization part of this feature (the easy part really). It adds 'jsonClass' field to objects. case class Animals(animals: List[Animal]) trait Animal case class Dog(name: String) extends Animal case class Fish(weight: Double) extends Animal scala write(Animals(Dog(pluto) :: Fish(1.2) :: Dog(devil) :: Nil)) res0: String = {jsonClass:Animals,animals: [{jsonClass:Dog,name:pluto},{jsonClass:Fish,weight:1.2}, {jsonClass:Dog,name:devil}]} Possible actions: * Do not support parameterized types (status quo) + Simple scheme, easy to serialize in language agnostic way - Limited I like this option. I'm not looking for a full Java serialization style solution. But having hints as to the type of the particular JSON object would be helpful. Being able to register a jsonClass - Scala class deserializer makes sense. Being able to specify a Scala class - class name is a good thing (with the default being the actual class name without the package). * Add full type information when serializing/deserializing + Opens possibility to deserialize polymorphic types + Deserialization can be done without any explicit type information (read(...) vs. read[ExpectedType](...)) - Introduces couplings - This is still not a generic serialization solution, there's still a lot of Scala classes which can't be deserialized * Support both schemes + Moar choice - Choice it not necessarily a good thing (adds complexity etc.) Cheers Joni On 17 loka, 11:40, Marius marius.dan...@gmail.com wrote: Hmmm ... I wonder if heterogeneous lists should be supported. I also wonder if type knowledge in JSON is a good thing to do as it seems to me that we're bringing knowledge from another domain creating couplings. I'm not sure if there is a different way to solve this ... it just doesn't feel completely right to me ... but this doesn't necessarily mean it is not right :) Br's, Marius On Oct 15, 1:47 am, David Pollak feeder.of.the.be...@gmail.com wrote: Folks, What are thoughts on including (perhaps optionally) the name of the case class in an additional JSON field so that one can reconstruct a list that contains many different types? Thanks, David -- Lift, the simply functional web frameworkhttp://liftweb.net Beginning Scalahttp://www.apress.com/book/view/1430219890 Follow me:http://twitter.com/dpp Surf the harmonics -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp Surf the harmonics --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Newbee question Datamapper
That was not my solution but harryh's, I believe. Of course the downside of it is that there's a limit of 1 timespan per record. - hyperionhyperion1...@googlemail.com wrote: I think my simple solution does not work... and the implementation of MappedPassword is not really easy to understand. I thought such classes would be nice for datatypes as Currency, Timespan etc... that appear everwhere in the application but where own tables are not useful. The solution of Naftoli, I tried... but maybe I did something wrong: trait MyMappedTimeSpan[T :Mapper[T]]{ import net.liftweb.util._ import net.liftweb.http.S import xml.NodeSeq object from extends MappedTime[T](this.asInstanceOf[T]) object to extends MappedTime[T](this.asInstanceOf[T]) } class Bericht extends LongKeyedMapper[Bericht] with IdPK with OneToMany [Long, Bericht]{ override def getSingleton = Bericht object mittag extends MyMappedTimeSpan[Bericht] ... If someone found a simple solution, please tell me so :) hyperion On 16 Okt., 22:01, David Pollak feeder.of.the.be...@gmail.com wrote: On Fri, Oct 16, 2009 at 9:42 AM, Naftoli Gugenheim naftoli...@gmail.comwrote: I think there is support somewhere in the MappedField hierarchy for a MappedField that represents to database columns. Take a look at MappedPassword. Having a field represent two columns (as MappedPassword does) is a huge piece of pain. I've made a ton of mistakes with Mapper, but the biggest, nastiest shining hairball of a mistake was compound columns. Have I scared anyone off using them yet? - harryhhar...@gmail.com wrote: Make MyMappedTimeSpan a trait: trait MyMappedTimeSpan[T :Mapper[T]](val owner: T) { object from extends MappedTime[MapperType](this.asIntanceOf [MatterType]) object to extends MappedTime[MapperType](this.asIntanceOf [MatterType]) } And then use it like so: class DBObject extends LongKeyedMapper[Bericht] with IdPK with MyMappedTimeSpan[DBObject] { } -harryh On Oct 16, 8:08 am, hyperion hyperion1...@googlemail.com wrote: Hello, I tried this: class MyMappedTimeSpan[T :Mapper[T]](val owner: T){ import net.liftweb.util._ import net.liftweb.http.S import xml.NodeSeq val from = new MappedTime(owner) val to = new MappedTime(owner) } class DBObject extends LongKeyedMapper[Bericht] with IdPK { def getSingleton = Bericht ... object test extends MyMappedTimeSpan(this) } and bound this class with: from - bt.test.from.toForm, to - bt.test.to.toForm, In html: tr tdbt:von//td tdbt:nach//td /tr Everything worked fine... except that my timespan is completely ignored in the database ;). I think the reason is you use reflection on class DBObject to find all values that should be stored in the dabase?... but I have not inspected the source code jet... I am new to lift and also to scala My Question: Is it possible to build such Datatypes based on two or more DB-Fields of the single table...?... I think even they are mapped to the master-DB-table, such types could be helpful... Greetz -- Lift, the simply functional web frameworkhttp://liftweb.net Beginning Scalahttp://www.apress.com/book/view/1430219890 Follow me:http://twitter.com/dpp Surf the harmonics --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] [request] update lift-openid 's dependency of openid4java to a newer version
Currently lift-openid is using openid4java 0.9.3, which is a little old and is difficult to find a maven repository to download. I think changing lift-openid's pom with a newer one, like openid4java-0.9.5 will be better. (works fine on my machine) --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---