Re: [Lift] email validation configuration
Where can I find mailer code examples? On Mar 5, 2010, at 5:53 PM, David Pollak wrote: > If you set the Mailer.authenticator in Boot, that will do authentication for > mail sending. > > On Fri, Mar 5, 2010 at 5:33 AM, Jeppe Nejsum Madsen wrote: > On Fri, Mar 5, 2010 at 2:21 PM, GA wrote: > > Hello guys, > > > > could you please let me know where I can find information about how to > > configure the email validation for the MegaProtoUser? > > > > I do not know how to tell Lift about our SMTP server, Authentication data, > > etc. I was searching in the wiki and this list but I could not find > > anything. > > Have a look at the Mailer object. Specifically, it reads either jndi > or the property mail.smtp.host for the hostname. Not sure if handles > authentication. > > /Jeppe > > -- > You received this message because you are subscribed to the Google Groups > "Lift" group. > To post to this group, send email to lift...@googlegroups.com. > To unsubscribe from this group, send email to > liftweb+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/liftweb?hl=en. > > > > > -- > Lift, 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 lift...@googlegroups.com. > To unsubscribe from this group, send email to > liftweb+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/liftweb?hl=en. -- You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
[Lift] email validation configuration
Hello guys, could you please let me know where I can find information about how to configure the email validation for the MegaProtoUser? I do not know how to tell Lift about our SMTP server, Authentication data, etc. I was searching in the wiki and this list but I could not find anything. Thanks in advance, GA -- You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
Re: [Lift] Re: Parsed JSON values do not match with class constructor
Thanks I am gonna try and test it. When is 2.0-M2 going to be released? Cheers, GA On Feb 11, 2010, at 6:00 PM, Joni Freeman wrote: > Yes, it is fixed in 2.0-M2. > > Cheers Joni > > On Feb 11, 6:54 pm, GA wrote: >> That's exactly what I've just found out. :-) >> >> As a workaround I am forcing the client app to send 0.0. >> >> are you saying that the bug is fixed in Lift 2.0-M2? >> >> Thanks for the answer, >> >> cheers, >> >> GA >> >> On Feb 11, 2010, at 5:42 PM, Joni Freeman wrote: >> >>> Hi, >> >>> I believe this bug is already fixed in trunk. If I'm right, the >>> problem was missing conversion from JInt to float. You could fix it by >>> changing these values "passMarkApplied":0,"thresholdApplied":0 to >>> "passMarkApplied":0.0,"thresholdApplied":0.0 >> >>> But it would be great if you have time to test with latest snapshot. >>> It worked for me at least. >> >>> Cheers Joni >> >>> On Feb 11, 6:11 pm, GA wrote: >>>> Hello guys, >> >>>> I am having a very strange error parsing JSON messages. Everything was >>>> working perfect until I introduce a new array in the message. It supposed >>>> to be a very small change, but the system seems to be parsing java data >>>> types instead of scala data types. >> >>>> This is the error message: >> >>>> net.liftweb.json.MappingException: Parsed JSON values do not match with >>>> class constructor >>>> args=129567,248,1,1,0,0, String >>>> arg >>>> types=java.lang.Long,java.lang.Long,java.lang.Long,java.lang.Long,scala.BigInt,scala.BigInt,java.lang.String >>>> constructor=public >>>> com.tribes.ga.api.FeedAPI$FilterLogging$2(long,long,long,long,float,float,java.lang.String) >> >>>> I do not know how to solve this. There is another array in the same >>>> structure that works just fine. >> >>>> This is the JSON message coming into the API: >> >>>> {"lastSync":"Thursday, February11,2010", >>>> "tribeId":1, >>>> "filterLogging":[{"passMarkApplied":0,"thresholdApplied":0,"entryId":129567,"evaluationDescription":"String","objectFiltered":1,"filterApplied":1,"sourceId":248}], >>>> "history":7, >>>> "deviceId":1036, >>>> "source":248, >>>> "showNews":true, >>>> "userId":1049, >>>> "syncFlag":false, >>>> "showNewsChanged":false, >>>> "updatedFeeds":[]} >> >>>> The error is with the array "filter". I am parsing it with the following >>>> code (this is an extraction of the entire definition): >> >>>> case class FilterLogging(entryId: Long, >>>> sourceId: Long, >>>> objectFiltered: Long, >>>> filterApplied: Long, >>>> passMarkApplied: Float, >>>> thresholdApplied: Float, >>>> evaluationDescription: String >>>> ) >> >>>> case class UpdatedSource(userId: Long, >>>> deviceId: Long, >>>> tribeId: Long, >>>> syncFlag: Boolean, >>>> lastSync: String, >>>> history: Int, >>>> source: Long, >>>> updatedFeeds: List[UpdatedFeeds], >>>> filterLogging: List[FilterLogging] >>>> ) >> >>>> val json = parse(req.body.map(bytes => new String(bytes, >>>> "UTF-8")) openOr "") >>>> val request: UpdatedSource = json.extract[UpdatedSource] >> >>>> Any ideas? >> >>>> Thanks in advance, >> >>>> GA >> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "Lift" group. >>> To post to this group, send email to lift...@googlegroups.com. >>> To unsubscribe from this group, send email to >>> liftweb+unsubscr...@googlegroups.com. >>> For more options, visit this group >>> athttp://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 lift...@googlegroups.com. > To unsubscribe from this group, send email to > liftweb+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/liftweb?hl=en. > -- You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
Re: [Lift] Re: Parsed JSON values do not match with class constructor
That's exactly what I've just found out. :-) As a workaround I am forcing the client app to send 0.0. are you saying that the bug is fixed in Lift 2.0-M2? Thanks for the answer, cheers, GA On Feb 11, 2010, at 5:42 PM, Joni Freeman wrote: > Hi, > > I believe this bug is already fixed in trunk. If I'm right, the > problem was missing conversion from JInt to float. You could fix it by > changing these values "passMarkApplied":0,"thresholdApplied":0 to > "passMarkApplied":0.0,"thresholdApplied":0.0 > > But it would be great if you have time to test with latest snapshot. > It worked for me at least. > > Cheers Joni > > On Feb 11, 6:11 pm, GA wrote: >> Hello guys, >> >> I am having a very strange error parsing JSON messages. Everything was >> working perfect until I introduce a new array in the message. It supposed to >> be a very small change, but the system seems to be parsing java data types >> instead of scala data types. >> >> This is the error message: >> >> net.liftweb.json.MappingException: Parsed JSON values do not match with >> class constructor >> args=129567,248,1,1,0,0, String >> arg >> types=java.lang.Long,java.lang.Long,java.lang.Long,java.lang.Long,scala.BigInt,scala.BigInt,java.lang.String >> constructor=public >> com.tribes.ga.api.FeedAPI$FilterLogging$2(long,long,long,long,float,float,java.lang.String) >> >> I do not know how to solve this. There is another array in the same >> structure that works just fine. >> >> This is the JSON message coming into the API: >> >> {"lastSync":"Thursday, February11,2010", >> "tribeId":1, >> "filterLogging":[{"passMarkApplied":0,"thresholdApplied":0,"entryId":129567,"evaluationDescription":"String","objectFiltered":1,"filterApplied":1,"sourceId":248}], >> "history":7, >> "deviceId":1036, >> "source":248, >> "showNews":true, >> "userId":1049, >> "syncFlag":false, >> "showNewsChanged":false, >> "updatedFeeds":[]} >> >> The error is with the array "filter". I am parsing it with the following >> code (this is an extraction of the entire definition): >> >> case class FilterLogging(entryId: Long, >> sourceId: Long, >> objectFiltered: Long, >> filterApplied: Long, >> passMarkApplied: Float, >> thresholdApplied: Float, >> evaluationDescription: String >> ) >> >> case class UpdatedSource(userId: Long, >> deviceId: Long, >> tribeId: Long, >> syncFlag: Boolean, >> lastSync: String, >> history: Int, >> source: Long, >> updatedFeeds: List[UpdatedFeeds], >> filterLogging: List[FilterLogging] >> ) >> >> val json = parse(req.body.map(bytes => new String(bytes, >> "UTF-8")) openOr "") >> val request: UpdatedSource = json.extract[UpdatedSource] >> >> Any ideas? >> >> Thanks in advance, >> >> GA > > -- > You received this message because you are subscribed to the Google Groups > "Lift" group. > To post to this group, send email to lift...@googlegroups.com. > To unsubscribe from this group, send email to > liftweb+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/liftweb?hl=en. > -- You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
[Lift] Parsed JSON values do not match with class constructor
Hello guys, I am having a very strange error parsing JSON messages. Everything was working perfect until I introduce a new array in the message. It supposed to be a very small change, but the system seems to be parsing java data types instead of scala data types. This is the error message: net.liftweb.json.MappingException: Parsed JSON values do not match with class constructor args=129567,248,1,1,0,0, String arg types=java.lang.Long,java.lang.Long,java.lang.Long,java.lang.Long,scala.BigInt,scala.BigInt,java.lang.String constructor=public com.tribes.ga.api.FeedAPI$FilterLogging$2(long,long,long,long,float,float,java.lang.String) I do not know how to solve this. There is another array in the same structure that works just fine. This is the JSON message coming into the API: {"lastSync":"Thursday, February11,2010", "tribeId":1, "filterLogging":[{"passMarkApplied":0,"thresholdApplied":0,"entryId":129567,"evaluationDescription":"String","objectFiltered":1,"filterApplied":1,"sourceId":248}], "history":7, "deviceId":1036, "source":248, "showNews":true, "userId":1049, "syncFlag":false, "showNewsChanged":false, "updatedFeeds":[]} The error is with the array "filter". I am parsing it with the following code (this is an extraction of the entire definition): case class FilterLogging(entryId: Long, sourceId: Long, objectFiltered: Long, filterApplied: Long, passMarkApplied: Float, thresholdApplied: Float, evaluationDescription: String ) case class UpdatedSource(userId: Long, deviceId: Long, tribeId: Long, syncFlag: Boolean, lastSync: String, history: Int, source: Long, updatedFeeds: List[UpdatedFeeds], filterLogging: List[FilterLogging] ) val json = parse(req.body.map(bytes => new String(bytes, "UTF-8")) openOr "") val request: UpdatedSource = json.extract[UpdatedSource] Any ideas? Thanks in advance, GA -- You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
Re: [Lift] Helpers.bind question
Thanks guys. It works. On Feb 9, 2010, at 10:26 PM, David Pollak wrote: > > > On Tue, Feb 9, 2010 at 12:04 PM, GA wrote: > What we have here is a iphone native application that has the help screens in > HTML. The help screens are in multiple languages and are stored in the > database. > > When the application starts, it checks in the server for updates in the help > pages calling a particular URL but with different context parameters. The > downloaded HTML is stored locally in the app to be able to work when the > phone is offline. The downloaded content has a common template for each > language and it loads the content from the database. > > The help content has been written as HTML in MS Word. It has been already > formatted there. That is why it is stored altogether in the database. It is > not a typical lift web site. > > If it is not possible to pass the characters unescaped, then we will have to > create the pages individually loading just the text from the database. It is > not a big deal and I know it would be cleaner, but I wanted to know if we can > avoid this change. > > As Naftoli mentioned, scala.xml.Unparsed(string) will pass string to the > output. If the string is not valid XML, the client browser may complain. > > > Thanks in advance, > > GA > > On Feb 9, 2010, at 8:31 PM, David Pollak wrote: > >> >> >> On Tue, Feb 9, 2010 at 10:00 AM, GA wrote: >> Hello guys, >> >> I have a very silly question. I have a snippet that reads a string field >> from the database and it inserts it within a html page. >> >> So far so good. The text that the snippet reads from the database is a piece >> of html code. The problem is that the bind method replaces the "<" and ">" >> within the string with "<" and ">". The snippet looks like that: >> >> if (context != "") { >> ContextHelp.findByKey(context.toLong) match { >> case Full(help) => { >> val message = help.contextHelp >> Helpers.bind("b", in, "text" -> message.toString) >> } >> case _ => Helpers.bind("b", in, "text" -> "Context not >> found") >> } >> } else Helpers.bind("b", in, "text" -> "The URL is invalid. ") >> >> >> The HTML that calls the snippet looks like this: >> >> >> >> >> >> What should I do to get the html content without changes in the tags? >> >> It is not Helpers.bind() that's transforming the text. It's the XML >> libraries that properly XML escape Text() elements when they are converted >> from XML representation to a byte stream. >> >> In almost every context, this is what you want... you want Strings to be >> properly escaped. If that was not the case, there would be tons of cross >> site scripting issues. >> >> So, what is the type of "message" in the code above? Do you really, really, >> really mean for the String representation of message to be not XML escaped? >> >> >> Thanks in advance, >> >> GA >> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Lift" group. >> To post to this group, send email to lift...@googlegroups.com. >> To unsubscribe from this group, send email to >> liftweb+unsubscr...@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/liftweb?hl=en. >> >> >> >> -- >> Lift, 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 lift...@googlegroups.com. >> To unsubscribe from this group, send email to >> liftweb+unsubscr...@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/liftweb?hl=en. > > > -- > You received this message because you are subscribed to the Google Groups > "Lift" group. > To post to this group, send email to lift...@googlegroups.com. > To unsubscribe from this group, send email to > liftweb+unsubscr...@googlegroups.com. > For more options, visit this g
Re: [Lift] Helpers.bind question
What we have here is a iphone native application that has the help screens in HTML. The help screens are in multiple languages and are stored in the database. When the application starts, it checks in the server for updates in the help pages calling a particular URL but with different context parameters. The downloaded HTML is stored locally in the app to be able to work when the phone is offline. The downloaded content has a common template for each language and it loads the content from the database. The help content has been written as HTML in MS Word. It has been already formatted there. That is why it is stored altogether in the database. It is not a typical lift web site. If it is not possible to pass the characters unescaped, then we will have to create the pages individually loading just the text from the database. It is not a big deal and I know it would be cleaner, but I wanted to know if we can avoid this change. Thanks in advance, GA On Feb 9, 2010, at 8:31 PM, David Pollak wrote: > > > On Tue, Feb 9, 2010 at 10:00 AM, GA wrote: > Hello guys, > > I have a very silly question. I have a snippet that reads a string field from > the database and it inserts it within a html page. > > So far so good. The text that the snippet reads from the database is a piece > of html code. The problem is that the bind method replaces the "<" and ">" > within the string with "<" and ">". The snippet looks like that: > > if (context != "") { > ContextHelp.findByKey(context.toLong) match { > case Full(help) => { > val message = help.contextHelp > Helpers.bind("b", in, "text" -> message.toString) > } > case _ => Helpers.bind("b", in, "text" -> "Context not found") > } > } else Helpers.bind("b", in, "text" -> "The URL is invalid. ") > > > The HTML that calls the snippet looks like this: > > > > > > What should I do to get the html content without changes in the tags? > > It is not Helpers.bind() that's transforming the text. It's the XML > libraries that properly XML escape Text() elements when they are converted > from XML representation to a byte stream. > > In almost every context, this is what you want... you want Strings to be > properly escaped. If that was not the case, there would be tons of cross > site scripting issues. > > So, what is the type of "message" in the code above? Do you really, really, > really mean for the String representation of message to be not XML escaped? > > > Thanks in advance, > > GA > > > -- > You received this message because you are subscribed to the Google Groups > "Lift" group. > To post to this group, send email to lift...@googlegroups.com. > To unsubscribe from this group, send email to > liftweb+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/liftweb?hl=en. > > > > -- > Lift, 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 lift...@googlegroups.com. > To unsubscribe from this group, send email to > liftweb+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/liftweb?hl=en. -- You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
[Lift] Helpers.bind question
Hello guys, I have a very silly question. I have a snippet that reads a string field from the database and it inserts it within a html page. So far so good. The text that the snippet reads from the database is a piece of html code. The problem is that the bind method replaces the "<" and ">" within the string with "<" and ">". The snippet looks like that: if (context != "") { ContextHelp.findByKey(context.toLong) match { case Full(help) => { val message = help.contextHelp Helpers.bind("b", in, "text" -> message.toString) } case _ => Helpers.bind("b", in, "text" -> "Context not found") } } else Helpers.bind("b", in, "text" -> "The URL is invalid. ") The HTML that calls the snippet looks like this: What should I do to get the html content without changes in the tags? Thanks in advance, GA -- You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
Re: [Lift] Re: Show the deprecated messages
It worked! Thanks, GA On Jan 13, 2010, at 11:37 AM, Timothy Perrett wrote: > Something like: > > > >org.scala-tools >maven-scala-plugin >2.12.2 > > >-Xmx1024m > > >-unchecked >-deprecation >-Xno-varargs-conversion > > > > > > On Jan 13, 10:01 am, GA wrote: >> Hello guys, >> >> I have a very silly question. >> >> when I run the mvn command to compile the classes, I receive the following >> message: >> >> warning: there were deprecation warnings; re-run with -deprecation for >> details >> one warning found >> >> How can I do to see the messages? I tried to add -deprecation to the mvn >> command but it does not recognize it. >> >> Thanks in advance, >> >> GA > -- > You received this message because you are subscribed to the Google Groups > "Lift" group. > To post to this group, send email to lift...@googlegroups.com. > To unsubscribe from this group, send email to > liftweb+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/liftweb?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
[Lift] Show the deprecated messages
Hello guys, I have a very silly question. when I run the mvn command to compile the classes, I receive the following message: warning: there were deprecation warnings; re-run with -deprecation for details one warning found How can I do to see the messages? I tried to add -deprecation to the mvn command but it does not recognize it. Thanks in advance, GA -- You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
[Lift] "asJs" method with OneToMany relationships
Hello guys, I have a Mapper class with a OneToMany relationship. It works fine in the database and forms, but we need also to send the structure as a JSON message in an API. I am trying to use the method "asJs" in the parent class, but the JSON message is generated without including the children. Is this functionality supported by the method? Thanks, GA -- You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
Re: [Lift] How to remove manyTomany children?
I would like to remove them from the database, not only the relationship. How should I do that? Thanks, On Jan 5, 2010, at 9:42 PM, Naftoli Gugenheim wrote: > Are they not getting removed from the collection when you call clear, or are > they not getting deleted in the database when you call save? > Also, are you trying to delete the actual entity? Clear and remove just > delete the relationship. > > ----- > GA wrote: > > It does not work either with the LongKeyedMapper. > > Am I doing something wrong? > > > On Jan 5, 2010, at 7:25 PM, Guillermo Acilu wrote: > >> It was the first thing I tried. But it does not work. >> >> I have run out of options now. I am going to try to add a LongKeyMapper to >> see if the problem gets solved. >> >> >> >> On Jan 5, 2010, at 7:12 PM, Naftoli Gugenheim wrote: >> >>> Can you try >>> entry.childEntries.clear >>> entry.save >>> ? >>> >>> - >>> GA wrote: >>> >>> Hello guys, >>> >>> I have a table that has a many-to-many relationship with itself. >>> >>> I manage to add new entries to the relationship table using the >>> MapperManyToMany, but I cannot remove entries. >>> >>> This is the code I am using to remove: >>> >>> for (entryToRemove <- entry.childEntries) { >>> val indexOf = entry.childEntries.indexOf(entryToRemove) >>> entry.childEntries.remove(indexOf) >>> } >>> entry.save >>> >>> This code is supposed to remove all the entries in the relationship table, >>> but it does nothing. >>> >>> The class I am using to define the ManyToMany table is an extension of >>> Mapper, not LongKeyedMapper. This is because I do not really need an extra >>> field just for the primary key. Could this be the problem? >>> >>> Any suggestions? >>> >>> Thanks in advance, >>> >>> GA >>> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "Lift" group. >>> To post to this group, send email to lift...@googlegroups.com. >>> To unsubscribe from this group, send email to >>> liftweb+unsubscr...@googlegroups.com. >>> For more options, visit this group at >>> http://groups.google.com/group/liftweb?hl=en. >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "Lift" group. >>> To post to this group, send email to lift...@googlegroups.com. >>> To unsubscribe from this group, send email to >>> liftweb+unsubscr...@googlegroups.com. >>> For more options, visit this group at >>> http://groups.google.com/group/liftweb?hl=en. >>> >>> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Lift" group. >> To post to this group, send email to lift...@googlegroups.com. >> To unsubscribe from this group, send email to >> liftweb+unsubscr...@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/liftweb?hl=en. >> >> > > -- > You received this message because you are subscribed to the Google Groups > "Lift" group. > To post to this group, send email to lift...@googlegroups.com. > To unsubscribe from this group, send email to > liftweb+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/liftweb?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
Re: [Lift] How to remove manyTomany children?
It does not work either with the LongKeyedMapper. Am I doing something wrong? On Jan 5, 2010, at 7:25 PM, Guillermo Acilu wrote: > It was the first thing I tried. But it does not work. > > I have run out of options now. I am going to try to add a LongKeyMapper to > see if the problem gets solved. > > > > On Jan 5, 2010, at 7:12 PM, Naftoli Gugenheim wrote: > >> Can you try >> entry.childEntries.clear >> entry.save >> ? >> >> - >> GA wrote: >> >> Hello guys, >> >> I have a table that has a many-to-many relationship with itself. >> >> I manage to add new entries to the relationship table using the >> MapperManyToMany, but I cannot remove entries. >> >> This is the code I am using to remove: >> >> for (entryToRemove <- entry.childEntries) { >> val indexOf = entry.childEntries.indexOf(entryToRemove) >> entry.childEntries.remove(indexOf) >> } >> entry.save >> >> This code is supposed to remove all the entries in the relationship table, >> but it does nothing. >> >> The class I am using to define the ManyToMany table is an extension of >> Mapper, not LongKeyedMapper. This is because I do not really need an extra >> field just for the primary key. Could this be the problem? >> >> Any suggestions? >> >> Thanks in advance, >> >> GA >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Lift" group. >> To post to this group, send email to lift...@googlegroups.com. >> To unsubscribe from this group, send email to >> liftweb+unsubscr...@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/liftweb?hl=en. >> -- >> You received this message because you are subscribed to the Google Groups >> "Lift" group. >> To post to this group, send email to lift...@googlegroups.com. >> To unsubscribe from this group, send email to >> liftweb+unsubscr...@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/liftweb?hl=en. >> >> > > -- > You received this message because you are subscribed to the Google Groups > "Lift" group. > To post to this group, send email to lift...@googlegroups.com. > To unsubscribe from this group, send email to > liftweb+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/liftweb?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
[Lift] How to remove manyTomany children?
Hello guys, I have a table that has a many-to-many relationship with itself. I manage to add new entries to the relationship table using the MapperManyToMany, but I cannot remove entries. This is the code I am using to remove: for (entryToRemove <- entry.childEntries) { val indexOf = entry.childEntries.indexOf(entryToRemove) entry.childEntries.remove(indexOf) } entry.save This code is supposed to remove all the entries in the relationship table, but it does nothing. The class I am using to define the ManyToMany table is an extension of Mapper, not LongKeyedMapper. This is because I do not really need an extra field just for the primary key. Could this be the problem? Any suggestions? Thanks in advance, GA -- You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
Re: [Lift] Indentation problem with Eclipse plugin
Thanks for the answers. Good to know that it has been fixed already on trunk. Any idea when the new release of the plugin will be available? Cheers, GA On Dec 31, 2009, at 1:12 PM, Miles Sabin wrote: > On Thu, Dec 31, 2009 at 11:11 AM, Timothy Perrett > wrote: >> As this is a problem with the eclipse plugin, you'll get a better / right >> response on either scala-user or logging an issue with epfl trac so miles >> can pick it up and address it. > > No need ... this is fixed on trunk. > > 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 lift...@googlegroups.com. > To unsubscribe from this group, send email to > liftweb+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/liftweb?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
[Lift] Indentation problem with Eclipse plugin
Hello guys, I am having a very strange indentation problem with the Eclipse plugin. To appreciate please maximize your email window. You can see how the second line starts after the last " [ ". It does it whenever you have "[ ]" in the code. object entries extends MappedOneToMany(FeedEntry, FeedEntry.entrySource) with Owned[FeedEntry] with Cascade[FeedEntry] object tribes extends MappedManyToMany(ContentTribes, ContentTribes.sourceId, ContentTribes.tribeId, Tribe) I was trying to live with it, but it is kind of annoying in long chunks of code. Any ideas on how to solve it? Thanks in advance and happy 2010 to everybody. Cheers, GA -- You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
[Lift] Netbeans 6.8 issues with Lift
Hello guys, I have upgraded my Netbeans from 6.7 to 6.8 and the very same Lift code started to report some errors. The code compiles correctly from the command line, but it reports error in the GUI. One of the errors is the following: This method: def dispatch: LiftRules.DispatchPF = { case r...@req("api" :: "feed":: "getNewSources" :: Nil, "", PutRequest) => () => getNewSources(r) case r...@req("api" :: "feed":: "getNewFeedsPerSource" :: Nil, "", PutRequest) => () => getNewFeedsPerSource(r) case r...@req("api" :: "feed" :: "setNewSource" :: Nil, "", PutRequest) => () => setNewSource(r) case r...@req("api" :: "feed" :: "setNewFeedEntries" :: Nil, "", PutRequest) => () => setNewFeedEntries(r) } Reports: missing parameter type for expanded function As I say, the code complies and run perfectly from Maven in the command line. Does anybody have similar issues with Netbeans 6.8? Thanks in advance, GA -- You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
[Lift] Re: "Content is not allowed in prolog" Parsing an XML
Sorry I've sent this email to the wrong list. On Nov 12, 2009, at 12:24 PM, GA wrote: > > Hello guys, > > I have the following scala code line: > > XML.load(new java.io.InputStreamReader(conn.getInputStream, "UTF-8")) > > I am downloading and parsing RSS feeds. This line parses most of the sites > without problems but some sites give the following error: > > Content is not allowed in prolog > > Any ideas on how to solve this problem? > > Thanks in advance, > > GA > > > > --~--~-~--~~~---~--~~ 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] "Content is not allowed in prolog" Parsing an XML
Hello guys, I have the following scala code line: XML.load(new java.io.InputStreamReader(conn.getInputStream, "UTF-8")) I am downloading and parsing RSS feeds. This line parses most of the sites without problems but some sites give the following error: Content is not allowed in prolog Any ideas on how to solve this problem? Thanks in advance, GA --~--~-~--~~~---~--~~ 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] Concatenate JsObj objects
Hello guys, is it possible to concatenate JsObj objects? Right now I have several JsonResponse calls depending on some conditions. I am building the responses including some error codes and different components. I would like to build the answer part by part and concatenate the pieces at the end of the method in only one call to JsonResponse. Here an example: JsonResponse(JsObj("a" -> 1, "b"->2)) Would it be possible to have something like: val response = JsObj("a" -> 1) val response1=JsObj("b" -> 2) then JsonResponse(JsObj(reponse ,response1)) A line exactly like this one gives a compilation error. I know I need to write it differently but I do not know how. Any suggestions? Thanks in advance, GA --~--~-~--~~~---~--~~ 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: JsonResponse with non string values
Thanks for the answer. This line does the trick: newUser.id.asJsExp . It returns a type net.liftweb.http.js.JE.numToJsExp. GA On Nov 9, 2009, at 6:31 PM, Ross Mellgren wrote: > > Bring the numToJsExp implicit into scope -- import > net.liftweb.http.js.JE.numToJsExp > > -Ross > > On Nov 9, 2009, at 12:22 PM, GA wrote: > >> >> Hello guys, >> >> I have the following code working ok: >> >>JsonResponse(JsObj("Op" -> 0,"e" -> 0,"id" -> >> newUser.id.toString)) >> >> The returned JSON message looks like the following: >> >> {"Op": 5, "e": 0, "id":"123455"} >> >> I would like the message to be like this: >> >> {"Op": 5, "e": 0, "id": 123455} >> >> If I write the line like this: >> >>JsonResponse(JsObj("Op" -> 0,"e" -> 0,"id" -> >> newUser.id) >> >> I receive a compilation error saying: >> >> found : Long >> required: net.liftweb.http.js.JsExp with net.liftweb.util.Bindable >> >> How can I return the long value without converting it to string? >> >> Thanks in advance, >> >> GA >> >> >>> > > > > --~--~-~--~~~---~--~~ 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] JsonResponse with non string values
Hello guys, I have the following code working ok: JsonResponse(JsObj("Op" -> 0,"e" -> 0,"id" -> newUser.id.toString)) The returned JSON message looks like the following: {"Op": 5, "e": 0, "id":"123455"} I would like the message to be like this: {"Op": 5, "e": 0, "id": 123455} If I write the line like this: JsonResponse(JsObj("Op" -> 0,"e" -> 0,"id" -> newUser.id) I receive a compilation error saying: found : Long required: net.liftweb.http.js.JsExp with net.liftweb.util.Bindable How can I return the long value without converting it to string? Thanks in advance, GA --~--~-~--~~~---~--~~ 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: Working with database views
Yes, it just did the trick. It compiles now. Why is it working now? Isn't it Mapper also a MetaMapper? On Nov 8, 2009, at 12:27 PM, Jeppe Nejsum Madsen wrote: > > GA writes: > >> Hello guys, >> >> I need to create a database view to create a very specific query from >> an API. I am planning the following steps: >> >> 1. Create the view in the database directly >> 2. Create a model without a primary key extending Mapper instead of >> Keymapper >> 3. I am not going to add the view to Schemifier since I am managing >> the creation and maintenance of the object manually >> >> My problem is that I am having problems to compile the Mapper class. >> This is the code I am trying to create: >> >> class SyncVW extends Mapper[SyncVW] { >> def getSingleton = SyncVW >> >> object field1 extends MappedLong(this, ContentSource) >> object field2 extends MappedString(this, 999) >> object field3 extends MappedString(this,255) >> object field4 extends MappedString(this,30) >> } >> object SyncVW extends SyncVW with Mapper[SyncVW] > > I think this last line should read > > object SyncVW extends SyncVW with MetaMapper[SyncVW] > > /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] Working with database views
Hello guys, I need to create a database view to create a very specific query from an API. I am planning the following steps: 1. Create the view in the database directly 2. Create a model without a primary key extending Mapper instead of Keymapper 3. I am not going to add the view to Schemifier since I am managing the creation and maintenance of the object manually My problem is that I am having problems to compile the Mapper class. This is the code I am trying to create: class SyncVW extends Mapper[SyncVW] { def getSingleton = SyncVW object field1 extends MappedLong(this, ContentSource) object field2 extends MappedString(this, 999) object field3 extends MappedString(this,255) object field4 extends MappedString(this,30) } object SyncVW extends SyncVW with Mapper[SyncVW] The compilation error is in the "def getSingleton" line. The compiler is expecting a Mapper[SyncVW] object and it is receiving SyncVW. What am I doing wrong? Thanks, GA --~--~-~--~~~---~--~~ 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] RSS Library
Hello guys, is there any standard RSS Library to parse RSS and Atom feeds from a scala client? Thanks in advance, GA --~--~-~--~~~---~--~~ 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] A better way to create a JSON Response
Hello guys, I have build a small test API to learn how to receive and respond with JSON formatted documents. I have managed to make it work but I do not think I am using the most appropriate classes in my example. This is the example: def jsonTest(req: Req): LiftResponse = { import net.liftweb.json.JsonAST._ import net.liftweb.json.Printer.pretty implicit val formats = net.liftweb.json.DefaultFormats // Brings in default date formats etc. case class Person(name: String, password: String) val json = parse(req.body.map(bytes => new String(bytes, "UTF-8")) openOr "") val person = json.extract[Person] Log.info(person.name) PlainTextResponse(pretty(render(json))) } I am receiving a JSON document. I parse it and I place it inside of a json object. Then I print one field in the log to check that the extraction was ok, and I respond with the very same document as plain text. The client receives the document again without problems. My question is about the response. Is it ok to respond as plain text? Or is it a more direct way to do it? Thanks in advance, GA --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: How to receive content-type application/json in a Lift API
Thanks David. It works with a little change. I cannot do parse(new String(req.body, "UTF-8")) directly, because the type of req.body is net.liftweb.util.Box[Array[Byte]]. So I did this: var message = "" for (i <- req.body) { message = new String(i, "UTF-8") } val json = parse(message) Is there an easier way to write this? I am quite new in scala yet. Thanks, GA On Oct 27, 2009, at 5:09 PM, David Pollak wrote: > > > On Tue, Oct 27, 2009 at 9:05 AM, GA wrote: > > Hello guys, > > I have a small Lift API that has to receive JSON content. The content- > type is specified as "application/json". The API method is written as > follows: > > def jsonTest(req: Req): LiftResponse = { > > implicit val formats = net.liftweb.json.DefaultFormats // > Brings in default date formats etc. > case class Person(name: String, password: String) > val json = parse(req.body.toString) /* Line that fails */ > val person = json.extract[Person] > CreatedResponse(wrapXmlBody( success="true"> ), "application/json") > } > > > I want to parse the content using the net.liftweb.jsonParser but the > server returns HTTP 500 error. > > req.body is an Array[Byte]. calling .toString on it will not yield > a String representing the Array[Byte]. > > Try parse(new String(req.body, "UTF-8")) > > If this doesn't work, please include the stack trace. > > > If the content-type is text/xml, the message comes inside of req.xml, > where does it come when it is application/json? > > Thanks in advance, > > GA > > > > > > > -- > 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] How to receive content-type application/json in a Lift API
Hello guys, I have a small Lift API that has to receive JSON content. The content- type is specified as "application/json". The API method is written as follows: def jsonTest(req: Req): LiftResponse = { implicit val formats = net.liftweb.json.DefaultFormats // Brings in default date formats etc. case class Person(name: String, password: String) val json = parse(req.body.toString) /* Line that fails */ val person = json.extract[Person] CreatedResponse(wrapXmlBody( ), "application/json") } I want to parse the content using the net.liftweb.jsonParser but the server returns HTTP 500 error. If the content-type is text/xml, the message comes inside of req.xml, where does it come when it is application/json? Thanks in advance, GA --~--~-~--~~~---~--~~ 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: I am not able to save a many-to-many relationship from an API
Thanks for the answer. I understand now. But I have a follow up question. This is the code for my relationship table, which I've done following some examples and previous discussions about this subject: class UserDevice extends LongKeyedMapper[UserDevice] with IdPK { def getSingleton = UserDevice object userId extends MappedLongForeignKey(this, User) object deviceId extends MappedLongForeignKey(this, Device) } object UserDevice extends UserDevice with LongKeyedMetaMapper [UserDevice] The question is: Shouldn't be both fields (userID and deviceID) be the primary key of this table? Why am I using IdPK? Couldn't I just remove it? Thanks, GA On Oct 26, 2009, at 7:49 PM, Jim Barrows wrote: > On Mon, Oct 26, 2009 at 11:43 AM, GA wrote: > I have made a test that worked. I have modified my code like this: > > newUser.save > newUser.devices += newDevice > newUser.save > > The newDevice was already saved. It looks like both parents must be > saved before I save the relationship. Am I right? or I am doing > something wrong? > > No, you always have to save the parents before the relationship. > Well.. as long as the relationship table has the parents PK as it's > PK's anyway. > If you remove that restriction, then nah.. it doesn't matter. Of > course that way lies madness > > > Thanks, > > GA > > > > > On Oct 26, 2009, at 6:55 PM, GA wrote: > >> Hello guys, >> >> I have a many-to-many relationship between two mappers called, >> Users and Devices. >> >> There is also an API that receives and XML message that contains >> one user and one device. >> >> The API could create the Device and User with the relationship or >> it could create only the relationship in case the users and/or >> device already exists. >> >> The problem I have is that the API creates the User and the Device, >> but the not the relationship. This is the code that saves the >> records (just a test for a now): >> >> def addUser(req: Req): LiftResponse = { >> >> var tempUserName = "" >> var tempDeviceName = "" >> var deviceAlreadyExists = false >> >> val newUser = new User >> val newDevice = new Device >> req.xml match { >> case Full({parameters @_*}) => { >> for(parameter <- parameters){ parameter match { >> case {userName} => >> tempUserName = userName.text >> case {firstName} >> => newUser.firstName(firstName.text) >> case {lastName} => >> newUser.lastName(lastName.text) >> case {password} => >> newUser.password(password.text) >> case {email} => >> newUser.email(email.text) >> case {createdOn} >> => newUser.createdOn(new java.util.Date(createdOn.text)) >> case {updatedOn} >> => newUser.updatedOn(new java.util.Date(updatedOn.text)) >> case {deviceName} => >> tempDeviceName = deviceName.text >> case _ => >> } >> } >> try { >> Device.find(By >> (Device.deviceName,tempDeviceName)) match { >> case Full(deviceRequested) => >> deviceAlreadyExists = true >> case _ => { >> newDevice.deviceName >> (tempDeviceName) >> newDevice.createdBy(tempUserName) >> newDevice.createdOn >> (newUser.createdOn) >> newDevice.updatedBy(tempUserName) >> newDevice.updatedOn >> (newUser.updatedOn) >> newDevice.save >> } >> } >> User.find(By(User.userName, tempUserName)) >> match { >> case Full(userRequested) => >> CreatedResponse(wrapXmlBody >> (), "text/xml
[Lift] Re: I am not able to save a many-to-many relationship from an API
I have made a test that worked. I have modified my code like this: newUser.save newUser.devices += newDevice newUser.save The newDevice was already saved. It looks like both parents must be saved before I save the relationship. Am I right? or I am doing something wrong? Thanks, GA On Oct 26, 2009, at 6:55 PM, GA wrote: > Hello guys, > > I have a many-to-many relationship between two mappers called, Users > and Devices. > > There is also an API that receives and XML message that contains one > user and one device. > > The API could create the Device and User with the relationship or it > could create only the relationship in case the users and/or device > already exists. > > The problem I have is that the API creates the User and the Device, > but the not the relationship. This is the code that saves the > records (just a test for a now): > > def addUser(req: Req): LiftResponse = { > > var tempUserName = "" > var tempDeviceName = "" > var deviceAlreadyExists = false > > val newUser = new User > val newDevice = new Device > req.xml match { > case Full({parameters @_*}) => { > for(parameter <- parameters){ parameter match { > case {userName} => > tempUserName = userName.text > case {firstName} > => newUser.firstName(firstName.text) > case {lastName} => > newUser.lastName(lastName.text) > case {password} => > newUser.password(password.text) > case {email} => > newUser.email(email.text) > case {createdOn} > => newUser.createdOn(new java.util.Date(createdOn.text)) > case {updatedOn} > => newUser.updatedOn(new java.util.Date(updatedOn.text)) > case {deviceName} => > tempDeviceName = deviceName.text > case _ => > } > } > try { > Device.find(By > (Device.deviceName,tempDeviceName)) match { > case Full(deviceRequested) => > deviceAlreadyExists = true > case _ => { > newDevice.deviceName > (tempDeviceName) > newDevice.createdBy(tempUserName) > newDevice.createdOn > (newUser.createdOn) > newDevice.updatedBy(tempUserName) > newDevice.updatedOn > (newUser.updatedOn) > newDevice.save > } > } > User.find(By(User.userName, tempUserName)) > match { > case Full(userRequested) => > CreatedResponse(wrapXmlBody > (), "text/xml") > case _ => { > newUser.userName(tempUserName) > newUser.createdBy(tempUserName) > newUser.updatedBy(tempUserName) > newUser.devices.clear > newUser.validated(true) > newUser.devices += newDevice > newUser.save > CreatedResponse(wrapXmlBody > (), "text/xml") > } > } > } > catch { > case e => Log.error("Could not add person/ > device", e); BadResponse() > } > } > case _ => Log.error("Request was malformed "+req.view); > BadResponse() > } > } > > The field "devices" is the MappedManyToMany field within the User > mapper. > > What am I doing wrong? > > Thanks in advance, > > GA > > > > --~--~-~--~~~---~--~~ 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] I am not able to save a many-to-many relationship from an API
Hello guys, I have a many-to-many relationship between two mappers called, Users and Devices. There is also an API that receives and XML message that contains one user and one device. The API could create the Device and User with the relationship or it could create only the relationship in case the users and/or device already exists. The problem I have is that the API creates the User and the Device, but the not the relationship. This is the code that saves the records (just a test for a now): def addUser(req: Req): LiftResponse = { var tempUserName = "" var tempDeviceName = "" var deviceAlreadyExists = false val newUser = new User val newDevice = new Device req.xml match { case Full({parameters @_*}) => { for(parameter <- parameters){ parameter match { case {userName} => tempUserName = userName.text case {firstName} => newUser.firstName(firstName.text) case {lastName} => newUser.lastName(lastName.text) case {password} => newUser.password(password.text) case {email} => newUser.email(email.text) case {createdOn} => newUser.createdOn(new java.util.Date(createdOn.text)) case {updatedOn} => newUser.updatedOn(new java.util.Date(updatedOn.text)) case {deviceName} => tempDeviceName = deviceName.text case _ => } } try { Device.find(By (Device.deviceName,tempDeviceName)) match { case Full(deviceRequested) => deviceAlreadyExists = true case _ => { newDevice.deviceName (tempDeviceName) newDevice.createdBy(tempUserName) newDevice.createdOn (newUser.createdOn) newDevice.updatedBy(tempUserName) newDevice.updatedOn (newUser.updatedOn) newDevice.save } } User.find(By(User.userName, tempUserName)) match { case Full(userRequested) => CreatedResponse(wrapXmlBody (), "text/xml") case _ => { newUser.userName(tempUserName) newUser.createdBy(tempUserName) newUser.updatedBy(tempUserName) newUser.devices.clear newUser.validated(true) newUser.devices += newDevice newUser.save CreatedResponse(wrapXmlBody (), "text/xml") } } } catch { case e => Log.error("Could not add person/ device", e); BadResponse() } } case _ => Log.error("Request was malformed "+req.view); BadResponse() } } The field "devices" is the MappedManyToMany field within the User mapper. What am I doing wrong? Thanks in advance, GA --~--~-~--~~~---~--~~ 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: Problem to process a PUT request in a lift API
Thanks David. You were right. I added this line: conn.addRequestProperty("content-type", "text/xml") and it works perfectly. Thanks again. GA On Oct 23, 2009, at 7:36 PM, David Pollak wrote: > In order to trigger XML parsing, you have to set the Content-Type to > text/xml > > On Fri, Oct 23, 2009 at 10:30 AM, GA wrote: > > I have printed Req in the log and it looks like the XML is really > empty: > > Req(List(), Map(), ParsePath(List(api, person),,true,false), , > PutRequest, Empty) > > This is how I send the XML: > > def post(url:URL):String = { > > val message = > > John > John > Smith > a > a...@.com > 10/12/2009 > John > 10/12/2009 > John > > > url.openConnection match { case conn: HttpURLConnection => { > conn.setRequestMethod("PUT") > conn.setDoOutput(true) > //conn.connect > conn.getOutputStream.write > (message.mkString.getBytes) > scala.io.Source.fromInputStream > (conn.getInputStream).getLines.mkString > } > } > } > > Any suggestions? > > Cheers, > > GA > > > > > On Oct 23, 2009, at 5:15 PM, GA wrote: > > > > > Hello guys, > > > > I have created an API to process a PUT request and a GET request. > The > > GET works perfectly fine, but with the PUT the XML seems to be > lost in > > its way. I have the following code: > > > > def dispatch: LiftRules.DispatchPF = { > > case Req("api" :: "person" :: userName :: Nil, "", > > GetRequest) => > > () => showPerson(userName) > > > > case r @ Req(List("api", "person"), "", PutRequest) => > > () => addPerson(r) > > } > > > > In the addPerson method I have the following code: > > > > req.xml match { > > case Full({parameters @_*}) => { > > for(parameter <- parameters){ parameter match { > > > > All the XML parsing > > > > } > > } > > > > try { > > person.validate match { > > case Nil => > > person.save > > CreatedResponse(wrapXmlBody > > (), "text/xml") > > case _ => > > CreatedResponse(wrapXmlBody > > (), "text/ > xml") > > } > > } > > catch { > > case e => Log.error("Could not add person", > > e); BadResponse() > > } > > } > > case _ => Log.error("Request was malformed "+req.view); > > BadResponse() > > } > > > > The method always goes through the last case: "Request was > malformed". > > > > I was checking the values to req.view and req.xml.toString and the > > results are "person" and empty, respectively. > > > > Any ideas about what it could be happening? > > > > Thanks in advance, > > > > GA > > > > > > > > > > > > > > -- > 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: Problem to process a PUT request in a lift API
I have printed Req in the log and it looks like the XML is really empty: Req(List(), Map(), ParsePath(List(api, person),,true,false), , PutRequest, Empty) This is how I send the XML: def post(url:URL):String = { val message = John John Smith a a...@.com 10/12/2009 John 10/12/2009 John url.openConnection match { case conn: HttpURLConnection => { conn.setRequestMethod("PUT") conn.setDoOutput(true) //conn.connect conn.getOutputStream.write (message.mkString.getBytes) scala.io.Source.fromInputStream (conn.getInputStream).getLines.mkString } } } Any suggestions? Cheers, GA On Oct 23, 2009, at 5:15 PM, GA wrote: > > Hello guys, > > I have created an API to process a PUT request and a GET request. The > GET works perfectly fine, but with the PUT the XML seems to be lost in > its way. I have the following code: > > def dispatch: LiftRules.DispatchPF = { > case Req("api" :: "person" :: userName :: Nil, "", > GetRequest) => > () => showPerson(userName) > > case r @ Req(List("api", "person"), "", PutRequest) => > () => addPerson(r) > } > > In the addPerson method I have the following code: > > req.xml match { > case Full({parameters @_*}) => { > for(parameter <- parameters){ parameter match { > > All the XML parsing > > } > } > > try { > person.validate match { > case Nil => > person.save > CreatedResponse(wrapXmlBody > (), "text/xml") > case _ => > CreatedResponse(wrapXmlBody > (), "text/xml") > } > } > catch { > case e => Log.error("Could not add person", > e); BadResponse() > } > } > case _ => Log.error("Request was malformed "+req.view); > BadResponse() > } > > The method always goes through the last case: "Request was malformed". > > I was checking the values to req.view and req.xml.toString and the > results are "person" and empty, respectively. > > Any ideas about what it could be happening? > > Thanks in advance, > > GA > > > > --~--~-~--~~~---~--~~ 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] Problem to process a PUT request in a lift API
Hello guys, I have created an API to process a PUT request and a GET request. The GET works perfectly fine, but with the PUT the XML seems to be lost in its way. I have the following code: def dispatch: LiftRules.DispatchPF = { case Req("api" :: "person" :: userName :: Nil, "", GetRequest) => () => showPerson(userName) case r @ Req(List("api", "person"), "", PutRequest) => () => addPerson(r) } In the addPerson method I have the following code: req.xml match { case Full({parameters @_*}) => { for(parameter <- parameters){ parameter match { All the XML parsing } } try { person.validate match { case Nil => person.save CreatedResponse(wrapXmlBody (), "text/xml") case _ => CreatedResponse(wrapXmlBody (), "text/xml") } } catch { case e => Log.error("Could not add person", e); BadResponse() } } case _ => Log.error("Request was malformed "+req.view); BadResponse() } The method always goes through the last case: "Request was malformed". I was checking the values to req.view and req.xml.toString and the results are "person" and empty, respectively. Any ideas about what it could be happening? Thanks in advance, GA --~--~-~--~~~---~--~~ 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 is the default.props in the lift1.1-M6 and the Full method ?
Hello Neil, the file must be located in src/main/resources/props/default.props Here you have an example that it is working for us: db.driver=org.postgresql.Driver db.url=jdbc:postgresql://localhost/dbname db.user=userName db.password=Password You should create the props directory and the file. I do not know about the Full method. I also should ask the silly question. :-) I hope this helps. Cheers, GA On Oct 21, 2009, at 10:24 AM, Neil.Lv wrote: > > Hi all, > > Where is the default.props in the lift1.1-M6 whether the file name > is defualt.props ? > > I see this code in the Boot.scala > > ### >Props.get("db.driver") > ### > > If it uses the default Props, and where is it ? > > And i have a silly question about the helper method Full(). What > can it do for us? > > ### > Full(user), Full(pwd)) => DriverManager.getConnection(dbUrl, > user, pwd) > ### > > Thanks for any information! > > Cheers, > Neil > > > --~--~-~--~~~---~--~~ 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: Why the liftweb doesn't use mysql as the default database ?
I absolutely agree with the last statement. We changed from MySQL to PostgreSQL. Most of us here are Oracle DBAs, and we feel at home with PostgreSQL. We have made tests in the three platforms and we have chosen PostgreSQL. PostgreSQL gives us most of the main features of Oracle in an open source platform. Cheers, On Oct 19, 2009, at 6:18 PM, David Pollak wrote: > > > On Mon, Oct 19, 2009 at 1:10 AM, Neil.Lv wrote: > > Hi all, > > Why the liftweb doesn't use MySQL as the default database ? > > In addition to the reasons listed in this thread (most importantly, > Lift default apps "just work" with just Java and Maven installed), I > recommend against using MySQL. > > Both PostgreSQL and H2 are higher performance and PostgreSQL has far > more features. > > I have a personal bond with the MySQL folks and really wish that I > could say different, but I've also been involved with some of the > highest volume MySQL-based sites around and seen the benchmarks of > MySQL vs. PostgreSQL. It's pretty simple, if you have a choice > between the two, use PostgeSQL. > > > Thanks very much ! > > Cheers, > Neil > > > > > > -- > 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: error: not found: type IdPK in Lift 1.1
You were right. I was making things complicated. the mvn command I was writing was wrong... I stopped and started all over. I retyped it from scratch and I found the errors. Thanks for your help guys. My project works in 1.1-M6 just fine. Cheers, GA On Oct 16, 2009, at 5:04 PM, David Pollak wrote: > > > On Fri, Oct 16, 2009 at 7:28 AM, GA wrote: > Why is it getting the 2.7.1 version in first place? The pom.xml is > created by maven from the archetype and repository right? > > It seems that you created your project against the Lift 1.0 > archetype and are try to upgrade it to 1.1-X. Lift 1.0 used Scala > 2.7.1. > > > Is it perhaps some environment setup that I have or I should have? > > No. You are making this much more complex than it needs to be. You > can either: > Create a new basic project against the 1.1-SNAPSHOT > Update the pom.xml file for your existing project to set the Scala > version to 2.7.5 and the Lift version to 1.1-SNAPSHOT (or 1.1-M6 if > you do not want to include the snapshots repository in your > tag) > > > > > On Oct 16, 2009, at 4:24 PM, David Pollak wrote: > >> You have to make sure that the version of Scala in your pom.xml >> file is 2.7.5. >> >> On Fri, Oct 16, 2009 at 4:40 AM, GA wrote: >> Ok, now we have an improvement. I did the following: >> >> I replaced the following part of my pom.xml: >> >>>> >>>> >>>> scala-tools.org >>>> Scala-Tools Maven2 Repository >>>> http://scala-tools.org/repo-releases >>>> >>>> >> >> >> with: >> >> >> >> scala-tools >> http://scala-tools.org/repo-snapshots >> >> >> scala-tools-releases >> http://scala-tools.org/repo-releases >> >> >> >> I run mvn jetty:run and there were no changes. Then added what >> David suggested yesterday: >> >> >> net.liftweb >> lift-mapper >> 1.1-SNAPSHOT >> >> >> I run mvn jetty:run again and it started downloading jars like >> crazy. So now I have a lift-mapper-1.1-SNAPSHOT.jar, but I receive >> a warning when the server starts: >> >> 2009-10-16 13:31:32.768::INFO: jetty-6.1.21 >> 2009-10-16 13:31:32.908::INFO: No Transaction manager found - if >> your webapp requires one, please configure one. >> 2009-10-16 13:31:33.154::WARN: failed LiftFilter: >> java.lang.VerifyError: (class: net/liftweb/util/EmptyBox, method: >> open_$bang signature: ()Ljava/lang/Object;) Can only throw >> Throwable objects >> 2009-10-16 13:31:33.155::WARN: failed >> org.mortbay.jetty.plugin.jetty6pluginwebappcont...@3549494e{/,/ >> Users/gacilu/NetBeansProjects/gaTribesServer/src/main/webapp}: >> java.lang.VerifyError: (class: net/liftweb/util/EmptyBox, method: >> open_$bang signature: ()Ljava/lang/Object;) Can only throw >> Throwable objects >> 2009-10-16 13:31:33.155::WARN: failed >> contexthandlercollect...@6f1a7e7f: java.lang.VerifyError: (class: >> net/liftweb/util/EmptyBox, method: open_$bang signature: ()Ljava/ >> lang/Object;) Can only throw Throwable objects >> 2009-10-16 13:31:33.155::WARN: failed handlercollect...@3466fcd5: >> java.lang.VerifyError: (class: net/liftweb/util/EmptyBox, method: >> open_$bang signature: ()Ljava/lang/Object;) Can only throw >> Throwable objects >> 2009-10-16 13:31:33.155::WARN: Error starting handlers >> java.lang.VerifyError: (class: net/liftweb/util/EmptyBox, method: >> open_$bang signature: ()Ljava/lang/Object;) Can only throw >> Throwable objects >> at net.liftweb.http.LiftRules$.(LiftRules.scala:231) >> >> >> Is this warning important? >> >> Thanks for your help guys. I really appreciate it. >> >> GA >> >> >> >> >> On Oct 16, 2009, at 1:17 PM, Timothy Perrett wrote: >> >>> >>> No - 1.1-SNAPSHOT is (surprisingly) in the snapshot repository. >>> Make your repositories node look like the one I pasted and you >>> should find your project working ones more. >>> >>> Cheers, Tim >>> >>> On 16 Oct 2009, at 11:59, GA wrote: >>> >>>> This is what it comes with my pom.xml >>>> >>>> >>>> >>>> scala-tools.org >>>> Scala-Tools Maven2 Repository >>>> http://scala-tools.org/repo-releases >>>> >>>> >&
[Lift] Re: error: not found: type IdPK in Lift 1.1
Could you please send me a pom.xml example for lift 1.1? Cheers, GA On Oct 16, 2009, at 4:28 PM, GA wrote: > Why is it getting the 2.7.1 version in first place? The pom.xml is > created by maven from the archetype and repository right? > > Is it perhaps some environment setup that I have or I should have? > > > > On Oct 16, 2009, at 4:24 PM, David Pollak wrote: > >> You have to make sure that the version of Scala in your pom.xml >> file is 2.7.5. >> >> On Fri, Oct 16, 2009 at 4:40 AM, GA wrote: >> Ok, now we have an improvement. I did the following: >> >> I replaced the following part of my pom.xml: >> >>>> >>>> >>>> scala-tools.org >>>> Scala-Tools Maven2 Repository >>>> http://scala-tools.org/repo-releases >>>> >>>> >> >> >> with: >> >> >> >> scala-tools >> http://scala-tools.org/repo-snapshots >> >> >> scala-tools-releases >> http://scala-tools.org/repo-releases >> >> >> >> I run mvn jetty:run and there were no changes. Then added what >> David suggested yesterday: >> >> >> net.liftweb >> lift-mapper >> 1.1-SNAPSHOT >> >> >> I run mvn jetty:run again and it started downloading jars like >> crazy. So now I have a lift-mapper-1.1-SNAPSHOT.jar, but I receive >> a warning when the server starts: >> >> 2009-10-16 13:31:32.768::INFO: jetty-6.1.21 >> 2009-10-16 13:31:32.908::INFO: No Transaction manager found - if >> your webapp requires one, please configure one. >> 2009-10-16 13:31:33.154::WARN: failed LiftFilter: >> java.lang.VerifyError: (class: net/liftweb/util/EmptyBox, method: >> open_$bang signature: ()Ljava/lang/Object;) Can only throw >> Throwable objects >> 2009-10-16 13:31:33.155::WARN: failed >> org.mortbay.jetty.plugin.jetty6pluginwebappcont...@3549494e{/,/ >> Users/gacilu/NetBeansProjects/gaTribesServer/src/main/webapp}: >> java.lang.VerifyError: (class: net/liftweb/util/EmptyBox, method: >> open_$bang signature: ()Ljava/lang/Object;) Can only throw >> Throwable objects >> 2009-10-16 13:31:33.155::WARN: failed >> contexthandlercollect...@6f1a7e7f: java.lang.VerifyError: (class: >> net/liftweb/util/EmptyBox, method: open_$bang signature: ()Ljava/ >> lang/Object;) Can only throw Throwable objects >> 2009-10-16 13:31:33.155::WARN: failed handlercollect...@3466fcd5: >> java.lang.VerifyError: (class: net/liftweb/util/EmptyBox, method: >> open_$bang signature: ()Ljava/lang/Object;) Can only throw >> Throwable objects >> 2009-10-16 13:31:33.155::WARN: Error starting handlers >> java.lang.VerifyError: (class: net/liftweb/util/EmptyBox, method: >> open_$bang signature: ()Ljava/lang/Object;) Can only throw >> Throwable objects >> at net.liftweb.http.LiftRules$.(LiftRules.scala:231) >> >> >> Is this warning important? >> >> Thanks for your help guys. I really appreciate it. >> >> GA >> >> >> >> >> On Oct 16, 2009, at 1:17 PM, Timothy Perrett wrote: >> >>> >>> No - 1.1-SNAPSHOT is (surprisingly) in the snapshot repository. >>> Make your repositories node look like the one I pasted and you >>> should find your project working ones more. >>> >>> Cheers, Tim >>> >>> On 16 Oct 2009, at 11:59, GA wrote: >>> >>>> This is what it comes with my pom.xml >>>> >>>> >>>> >>>> scala-tools.org >>>> Scala-Tools Maven2 Repository >>>> http://scala-tools.org/repo-releases >>>> >>>> >>>> >>>> >>>> >>>> scala-tools.org >>>> Scala-Tools Maven2 Repository >>>> http://scala-tools.org/repo-releases >>>> >>>> >>>> >>>> >>>> It is ok? >>>> >>>> Cheers, >>>> >>>> GA >>>> >>>> >>>> On Oct 16, 2009, at 12:33 PM, Timothy Perrett wrote: >>>> >>>>> >>>>> You must be missing the correct repository tag. Check that you >>>>> have: >>>>> >>>>> >>>>> >>>>> s
[Lift] Re: error: not found: type IdPK in Lift 1.1
Why is it getting the 2.7.1 version in first place? The pom.xml is created by maven from the archetype and repository right? Is it perhaps some environment setup that I have or I should have? On Oct 16, 2009, at 4:24 PM, David Pollak wrote: > You have to make sure that the version of Scala in your pom.xml file > is 2.7.5. > > On Fri, Oct 16, 2009 at 4:40 AM, GA wrote: > Ok, now we have an improvement. I did the following: > > I replaced the following part of my pom.xml: > >>> >>> >>> scala-tools.org >>> Scala-Tools Maven2 Repository >>> http://scala-tools.org/repo-releases >>> >>> > > > with: > > > > scala-tools > http://scala-tools.org/repo-snapshots > > > scala-tools-releases > http://scala-tools.org/repo-releases > > > > I run mvn jetty:run and there were no changes. Then added what David > suggested yesterday: > > > net.liftweb > lift-mapper > 1.1-SNAPSHOT > > > I run mvn jetty:run again and it started downloading jars like > crazy. So now I have a lift-mapper-1.1-SNAPSHOT.jar, but I receive a > warning when the server starts: > > 2009-10-16 13:31:32.768::INFO: jetty-6.1.21 > 2009-10-16 13:31:32.908::INFO: No Transaction manager found - if > your webapp requires one, please configure one. > 2009-10-16 13:31:33.154::WARN: failed LiftFilter: > java.lang.VerifyError: (class: net/liftweb/util/EmptyBox, method: > open_$bang signature: ()Ljava/lang/Object;) Can only throw Throwable > objects > 2009-10-16 13:31:33.155::WARN: failed > org.mortbay.jetty.plugin.jetty6pluginwebappcont...@3549494e{/,/Users/ > gacilu/NetBeansProjects/gaTribesServer/src/main/webapp}: > java.lang.VerifyError: (class: net/liftweb/util/EmptyBox, method: > open_$bang signature: ()Ljava/lang/Object;) Can only throw Throwable > objects > 2009-10-16 13:31:33.155::WARN: failed > contexthandlercollect...@6f1a7e7f: java.lang.VerifyError: (class: > net/liftweb/util/EmptyBox, method: open_$bang signature: ()Ljava/ > lang/Object;) Can only throw Throwable objects > 2009-10-16 13:31:33.155::WARN: failed handlercollect...@3466fcd5: > java.lang.VerifyError: (class: net/liftweb/util/EmptyBox, method: > open_$bang signature: ()Ljava/lang/Object;) Can only throw Throwable > objects > 2009-10-16 13:31:33.155::WARN: Error starting handlers > java.lang.VerifyError: (class: net/liftweb/util/EmptyBox, method: > open_$bang signature: ()Ljava/lang/Object;) Can only throw Throwable > objects > at net.liftweb.http.LiftRules$.(LiftRules.scala:231) > > > Is this warning important? > > Thanks for your help guys. I really appreciate it. > > GA > > > > > On Oct 16, 2009, at 1:17 PM, Timothy Perrett wrote: > >> >> No - 1.1-SNAPSHOT is (surprisingly) in the snapshot repository. >> Make your repositories node look like the one I pasted and you >> should find your project working ones more. >> >> Cheers, Tim >> >> On 16 Oct 2009, at 11:59, GA wrote: >> >>> This is what it comes with my pom.xml >>> >>> >>> >>> scala-tools.org >>> Scala-Tools Maven2 Repository >>> http://scala-tools.org/repo-releases >>> >>> >>> >>> >>> >>> scala-tools.org >>> Scala-Tools Maven2 Repository >>> http://scala-tools.org/repo-releases >>> >>> >>> >>> >>> It is ok? >>> >>> Cheers, >>> >>> GA >>> >>> >>> On Oct 16, 2009, at 12:33 PM, Timothy Perrett wrote: >>> >>>> >>>> You must be missing the correct repository tag. Check that you >>>> have: >>>> >>>> >>>> >>>> scala-tools >>>> http://scala-tools.org/repo-snapshots >>>> >>>> >>>> scala-tools-releases >>>> http://scala-tools.org/repo-releases >>>> >>>> >>>> >>>> Cheers, Tim >>>> >>>> On 16 Oct 2009, at 10:58, GA wrote: >>>> >>>>> Thanks for the info. I downloaded all the jars again, but it did >>>>> not solved my problem. Now for some reason, if I initiate >>>>> everything from scratch even with version 1.0 it does not work >>>>> anymore. >>>>> >>>>>
[Lift] Re: error: not found: type IdPK in Lift 1.1
I did it. This is the first par of my pom.xml 4.0.0 com.server Server 1.1-SNAPSHOT war Server 2007 2.7.1 scala-tools.org Scala-Tools Maven2 Repository http://scala-tools.org/repo-releases scala-tools.org Scala-Tools Maven2 Repository http://scala-tools.org/repo-releases I find something strange. Do you see the scala version 2.7.1? This is the scala version in my command line: Scala code runner version 2.7.5.final -- Copyright 2002-2009, LAMP/EPFL Cheers, GA On Oct 16, 2009, at 2:57 PM, Timothy Perrett wrote: > Try creating a blank project, not a basic one... Lets see what > happens then. > > Cheers, Tim > > On 16 Oct 2009, at 13:39, GA wrote: > >> More errors. Shouldn't this be working right after the creation? I >> am talking about brand new projects. It is absolutely empty. It has >> only the delivered User model. >> >> >> [WARNING] Multiple versions of scala libraries detected! >> [INFO] includes = [**/*.scala,] >> [INFO] excludes = [] >> [INFO] Compiling 3 source files to /Users/gacilu/NetBeansProjects/ >> gaTribesServer/target/classes >> /Users/gacilu/NetBeansProjects/gaTribesServer/src/main/scala/com/ >> tribes/ga/model/User.scala:9: error: wrong number of type arguments >> for net.liftweb.mapper.MetaMegaProtoUser, should be 1 >> object User extends User with MetaMegaProtoUser[User, User with >> KeyedMetaMapper[Long, User]] { >> ^ >> /Users/gacilu/NetBeansProjects/gaTribesServer/src/main/scala/com/ >> tribes/ga/model/User.scala:26: error: type mismatch; >> found : com.tribes.ga.model.User.type (with underlying type >> object com.tribes.ga.model.User) >> required: net.liftweb.mapper.KeyedMetaMapper >> [Long,com.tribes.ga.model.User] >> def getSingleton = User // what's the "meta" server >> ^ >> /Users/gacilu/NetBeansProjects/gaTribesServer/src/main/scala/ >> bootstrap/liftweb/Boot.scala:21: error: overloaded method value >> schemify with alternatives (Boolean,(=> AnyRef) => >> Unit >> ,net.liftweb.mapper.ConnectionIdentifier >> ,net.liftweb.mapper.BaseMetaMapper*)List[String] (Boolean,(=> >> AnyRef) => Unit,net.liftweb.mapper.BaseMetaMapper*)List[String] >> cannot be applied to (Boolean,(=> AnyRef) => >> Unit,com.tribes.ga.model.User.type) >> Schemifier.schemify(true, Log.infoF _, User) >>^ >> /Users/gacilu/NetBeansProjects/gaTribesServer/src/main/scala/ >> bootstrap/liftweb/Boot.scala:23: error: value addTemplateBefore is >> not a member of object net.liftweb.http.LiftRules >> LiftRules.addTemplateBefore(User.templates) >> ^ >> /Users/gacilu/NetBeansProjects/gaTribesServer/src/main/scala/ >> bootstrap/liftweb/Boot.scala:26: error: type mismatch; >> found : java.lang.String("/") >> required: net.liftweb.sitemap.Loc.Link >> [net.liftweb.sitemap.NullLocParams] >> val entries = Menu(Loc("Home", "/", "Home")) :: User.sitemap >>^ >> /Users/gacilu/NetBeansProjects/gaTribesServer/src/main/scala/ >> bootstrap/liftweb/Boot.scala:26: error: value sitemap is not a >> member of object com.tribes.ga.model.User >> val entries = Menu(Loc("Home", "/", "Home")) :: User.sitemap >> ^ >> /Users/gacilu/NetBeansProjects/gaTribesServer/src/main/scala/ >> bootstrap/liftweb/Boot.scala:28: error: value requestLoans is not a >> member of object com.tribes.ga.model.User >> S.addAround(User.requestLoans) >> ^ >> /Users/gacilu/NetBeansProjects/gaTribesServer/src/main/scala/ >> bootstrap/liftweb/Boot.scala:34: error: not found: type Can >> def newConnection(name: ConnectionIdentifier): Can[Connection] = { >> ^ >> 8 errors found >> >> Cheers, >> >> GA >> >> >> >> On Oct 16, 2009, at 2:23 PM, Timothy Perrett wrote: >> >>> Yes, the error is important. >>> >>> Can you try a: >>> >>> mvn clean jetty:run >>> >>> Cheers, Tim >>> >>> On 16 Oct 2009, at 12:40, GA wrote: >>> >>>> Ok, now we have an improvement. I did the following: >>>> >>>> I replaced the following part of my pom.xml: >>>> >>>>>>
[Lift] Re: error: not found: type IdPK in Lift 1.1
More errors. Shouldn't this be working right after the creation? I am talking about brand new projects. It is absolutely empty. It has only the delivered User model. [WARNING] Multiple versions of scala libraries detected! [INFO] includes = [**/*.scala,] [INFO] excludes = [] [INFO] Compiling 3 source files to /Users/gacilu/NetBeansProjects/ gaTribesServer/target/classes /Users/gacilu/NetBeansProjects/gaTribesServer/src/main/scala/com/ tribes/ga/model/User.scala:9: error: wrong number of type arguments for net.liftweb.mapper.MetaMegaProtoUser, should be 1 object User extends User with MetaMegaProtoUser[User, User with KeyedMetaMapper[Long, User]] { ^ /Users/gacilu/NetBeansProjects/gaTribesServer/src/main/scala/com/ tribes/ga/model/User.scala:26: error: type mismatch; found : com.tribes.ga.model.User.type (with underlying type object com.tribes.ga.model.User) required: net.liftweb.mapper.KeyedMetaMapper [Long,com.tribes.ga.model.User] def getSingleton = User // what's the "meta" server ^ /Users/gacilu/NetBeansProjects/gaTribesServer/src/main/scala/bootstrap/ liftweb/Boot.scala:21: error: overloaded method value schemify with alternatives (Boolean,(=> AnyRef) => Unit ,net.liftweb.mapper.ConnectionIdentifier ,net.liftweb.mapper.BaseMetaMapper*)List[String] (Boolean,(=> AnyRef) => Unit,net.liftweb.mapper.BaseMetaMapper*)List[String] cannot be applied to (Boolean,(=> AnyRef) => Unit,com.tribes.ga.model.User.type) Schemifier.schemify(true, Log.infoF _, User) ^ /Users/gacilu/NetBeansProjects/gaTribesServer/src/main/scala/bootstrap/ liftweb/Boot.scala:23: error: value addTemplateBefore is not a member of object net.liftweb.http.LiftRules LiftRules.addTemplateBefore(User.templates) ^ /Users/gacilu/NetBeansProjects/gaTribesServer/src/main/scala/bootstrap/ liftweb/Boot.scala:26: error: type mismatch; found : java.lang.String("/") required: net.liftweb.sitemap.Loc.Link [net.liftweb.sitemap.NullLocParams] val entries = Menu(Loc("Home", "/", "Home")) :: User.sitemap ^ /Users/gacilu/NetBeansProjects/gaTribesServer/src/main/scala/bootstrap/ liftweb/Boot.scala:26: error: value sitemap is not a member of object com.tribes.ga.model.User val entries = Menu(Loc("Home", "/", "Home")) :: User.sitemap ^ /Users/gacilu/NetBeansProjects/gaTribesServer/src/main/scala/bootstrap/ liftweb/Boot.scala:28: error: value requestLoans is not a member of object com.tribes.ga.model.User S.addAround(User.requestLoans) ^ /Users/gacilu/NetBeansProjects/gaTribesServer/src/main/scala/bootstrap/ liftweb/Boot.scala:34: error: not found: type Can def newConnection(name: ConnectionIdentifier): Can[Connection] = { ^ 8 errors found Cheers, GA On Oct 16, 2009, at 2:23 PM, Timothy Perrett wrote: > Yes, the error is important. > > Can you try a: > > mvn clean jetty:run > > Cheers, Tim > > On 16 Oct 2009, at 12:40, GA wrote: > >> Ok, now we have an improvement. I did the following: >> >> I replaced the following part of my pom.xml: >> >>>> >>>> >>>> scala-tools.org >>>> Scala-Tools Maven2 Repository >>>> http://scala-tools.org/repo-releases >>>> >>>> >> >> >> with: >> >> >> >> scala-tools >> http://scala-tools.org/repo-snapshots >> >> >> scala-tools-releases >> http://scala-tools.org/repo-releases >> >> >> >> I run mvn jetty:run and there were no changes. Then added what >> David suggested yesterday: >> >> >> net.liftweb >> lift-mapper >> 1.1-SNAPSHOT >> >> >> I run mvn jetty:run again and it started downloading jars like >> crazy. So now I have a lift-mapper-1.1-SNAPSHOT.jar, but I receive >> a warning when the server starts: >> >> 2009-10-16 13:31:32.768::INFO: jetty-6.1.21 >> 2009-10-16 13:31:32.908::INFO: No Transaction manager found - if >> your webapp requires one, please configure one. >> 2009-10-16 13:31:33.154::WARN: failed LiftFilter: >> java.lang.VerifyError: (class: net/liftweb/util/EmptyBox, method: >> open_$bang signature: ()Ljava/lang/Object;) Can only throw >> Throwable objects >> 2009-10-16 13:31:33.155::WARN: failed >> org.mortbay.jetty.plugin.jetty6pluginwebappcont...@3549494e{/,/ >> Users/gacilu/NetBeansPr
[Lift] Re: error: not found: type IdPK in Lift 1.1
Ok, now we have an improvement. I did the following: I replaced the following part of my pom.xml: >> >> >> scala-tools.org >> Scala-Tools Maven2 Repository >> http://scala-tools.org/repo-releases >> >> with: scala-tools http://scala-tools.org/repo-snapshots scala-tools-releases http://scala-tools.org/repo-releases I run mvn jetty:run and there were no changes. Then added what David suggested yesterday: net.liftweb lift-mapper 1.1-SNAPSHOT I run mvn jetty:run again and it started downloading jars like crazy. So now I have a lift-mapper-1.1-SNAPSHOT.jar, but I receive a warning when the server starts: 2009-10-16 13:31:32.768::INFO: jetty-6.1.21 2009-10-16 13:31:32.908::INFO: No Transaction manager found - if your webapp requires one, please configure one. 2009-10-16 13:31:33.154::WARN: failed LiftFilter: java.lang.VerifyError: (class: net/liftweb/util/EmptyBox, method: open_ $bang signature: ()Ljava/lang/Object;) Can only throw Throwable objects 2009-10-16 13:31:33.155::WARN: failed org.mortbay.jetty.plugin.jetty6pluginwebappcont...@3549494e{/,/Users/ gacilu/NetBeansProjects/gaTribesServer/src/main/webapp}: java.lang.VerifyError: (class: net/liftweb/util/EmptyBox, method: open_ $bang signature: ()Ljava/lang/Object;) Can only throw Throwable objects 2009-10-16 13:31:33.155::WARN: failed contexthandlercollect...@6f1a7e7f: java.lang.VerifyError: (class: net/ liftweb/util/EmptyBox, method: open_$bang signature: ()Ljava/lang/ Object;) Can only throw Throwable objects 2009-10-16 13:31:33.155::WARN: failed handlercollect...@3466fcd5: java.lang.VerifyError: (class: net/liftweb/util/EmptyBox, method: open_ $bang signature: ()Ljava/lang/Object;) Can only throw Throwable objects 2009-10-16 13:31:33.155::WARN: Error starting handlers java.lang.VerifyError: (class: net/liftweb/util/EmptyBox, method: open_ $bang signature: ()Ljava/lang/Object;) Can only throw Throwable objects at net.liftweb.http.LiftRules$.(LiftRules.scala:231) Is this warning important? Thanks for your help guys. I really appreciate it. GA On Oct 16, 2009, at 1:17 PM, Timothy Perrett wrote: > > No - 1.1-SNAPSHOT is (surprisingly) in the snapshot repository. Make > your repositories node look like the one I pasted and you should > find your project working ones more. > > Cheers, Tim > > On 16 Oct 2009, at 11:59, GA wrote: > >> This is what it comes with my pom.xml >> >> >> >> scala-tools.org >> Scala-Tools Maven2 Repository >> http://scala-tools.org/repo-releases >> >> >> >> >> >> scala-tools.org >> Scala-Tools Maven2 Repository >> http://scala-tools.org/repo-releases >> >> >> >> >> It is ok? >> >> Cheers, >> >> GA >> >> >> On Oct 16, 2009, at 12:33 PM, Timothy Perrett wrote: >> >>> >>> You must be missing the correct repository tag. Check that you have: >>> >>> >>> >>> scala-tools >>> http://scala-tools.org/repo-snapshots >>> >>> >>> scala-tools-releases >>> http://scala-tools.org/repo-releases >>> >>> >>> >>> Cheers, Tim >>> >>> On 16 Oct 2009, at 10:58, GA wrote: >>> >>>> Thanks for the info. I downloaded all the jars again, but it did >>>> not solved my problem. Now for some reason, if I initiate >>>> everything from scratch even with version 1.0 it does not work >>>> anymore. >>>> >>>> If I add the entry: >>>> >>>>>>>> >>>>>>>> net.liftweb >>>>>>>> lift-mapper >>>>>>>> 1.1-SNAPSHOT >>>>>>>> >>>> >>>> to the pom.xml manually, I receive the following error when I run >>>> the command mvn jetty:run: >>>> >>>> INFO] Unable to find resource 'net.liftweb:lift-mapper:jar:1.1- >>>> SNAPSHOT' in repository scala-tools.org >>>> (http://scala-tools.org/repo-releases >>>> ) >>>> [INFO] >>>> >>>> [ERROR] BUILD ERROR >>>> [INFO] >>>> >>>> [INFO] Failed to resolve artifact. >>>> >>>>
[Lift] Re: error: not found: type IdPK in Lift 1.1
This is what it comes with my pom.xml scala-tools.org Scala-Tools Maven2 Repository http://scala-tools.org/repo-releases scala-tools.org Scala-Tools Maven2 Repository http://scala-tools.org/repo-releases It is ok? Cheers, GA On Oct 16, 2009, at 12:33 PM, Timothy Perrett wrote: > > You must be missing the correct repository tag. Check that you have: > > > > scala-tools > http://scala-tools.org/repo-snapshots > > > scala-tools-releases > http://scala-tools.org/repo-releases > > > > Cheers, Tim > > On 16 Oct 2009, at 10:58, GA wrote: > >> Thanks for the info. I downloaded all the jars again, but it did >> not solved my problem. Now for some reason, if I initiate >> everything from scratch even with version 1.0 it does not work >> anymore. >> >> If I add the entry: >> >>>>>> >>>>>> net.liftweb >>>>>> lift-mapper >>>>>> 1.1-SNAPSHOT >>>>>> >> >> to the pom.xml manually, I receive the following error when I run >> the command mvn jetty:run: >> >> INFO] Unable to find resource 'net.liftweb:lift-mapper:jar:1.1- >> SNAPSHOT' in repository scala-tools.org >> (http://scala-tools.org/repo-releases >> ) >> [INFO] >> >> [ERROR] BUILD ERROR >> [INFO] >> >> [INFO] Failed to resolve artifact. >> >> Missing: >> -- >> 1) net.liftweb:lift-mapper:jar:1.1-SNAPSHOT >> >> Try downloading the file manually from the project website. >> >> Then, install it using the command: >> mvn install:install-file -DgroupId=net.liftweb - >> DartifactId=lift-mapper -Dversion=1.1-SNAPSHOT -Dpackaging=jar - >> Dfile=/path/to/file >> >> Alternatively, if you host your own repository you can deploy the >> file there: >> mvn deploy:deploy-file -DgroupId=net.liftweb - >> DartifactId=lift-mapper -Dversion=1.1-SNAPSHOT -Dpackaging=jar - >> Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id] >> >> Path to dependency: >> 1) com.tribes.ga:gaTribesServer1:war:1.1-SNAPSHOT >> 2) net.liftweb:lift-mapper:jar:1.1-SNAPSHOT >> >> -- >> 1 required artifact is missing. >> >> >> It is very strange. It was working before without problems. Any >> ideas? >> >> Thanks, >> >> GA >> >> >> >> On Oct 16, 2009, at 11:09 AM, Timothy Perrett wrote: >> >>> Just remove ~/.m2 >>> >>> The next time you make a maven call it'll then download all the >>> new JAR files. >>> >>> Cheers, Tim >>> >>> On 16 Oct 2009, at 09:35, GA wrote: >>> >>>> Is there any way to reset maven's repository? I think there is >>>> something corrupt because the behavior is really strange. I think >>>> this is the cause of my error. >>>> >>>> Thanks, >>>> >>>> >>>> On Oct 15, 2009, at 5:52 PM, GA wrote: >>>> >>>>> It is strange. I do not have the entries that you are saying in >>>>> the pom.xml file, but I do not have them in the 1.0 neither. I >>>>> have also created a project with archetype-basic and I have >>>>> having the same error. This is the command I am using to create >>>>> the project. Is it ok? >>>>> >>>>> mvn archetype:generate -U -DarchetypeGroupId=net.liftweb - >>>>> DarchetypeArtifactId=lift-archetype-basic -Dversion=1.1-SNAPSHOT >>>>> -DremoteRepositories=http://scala-tools.org/repo-snapshots - >>>>> DgroupId=com.tribes.ga -DartifactId=gaTribesServer-d0.1.1 >>>>> >>>>> Thanks, >>>>> >>>>> GA >>>>> >>>>> >>>>> On Oct 15, 2009, at 5:35 PM, David Pollak wrote: >>>>> >>>>>> I'm not sure what's going on. This code worked for me in a >>>>>> brand new archetype-basic 1.1-SNAPSHOT project. >>>>>> >>>>>> Please make sure the following entry is in your pom.xml file: >>>>>> >>>>>> >>>>>> >>>>>>
[Lift] Re: error: not found: type IdPK in Lift 1.1
Thanks for the info. I downloaded all the jars again, but it did not solved my problem. Now for some reason, if I initiate everything from scratch even with version 1.0 it does not work anymore. If I add the entry: >>>> >>>> net.liftweb >>>> lift-mapper >>>> 1.1-SNAPSHOT >>>> to the pom.xml manually, I receive the following error when I run the command mvn jetty:run: INFO] Unable to find resource 'net.liftweb:lift-mapper:jar:1.1- SNAPSHOT' in repository scala-tools.org (http://scala-tools.org/repo-releases ) [INFO] [ERROR] BUILD ERROR [INFO] [INFO] Failed to resolve artifact. Missing: -- 1) net.liftweb:lift-mapper:jar:1.1-SNAPSHOT Try downloading the file manually from the project website. Then, install it using the command: mvn install:install-file -DgroupId=net.liftweb - DartifactId=lift-mapper -Dversion=1.1-SNAPSHOT -Dpackaging=jar -Dfile=/ path/to/file Alternatively, if you host your own repository you can deploy the file there: mvn deploy:deploy-file -DgroupId=net.liftweb -DartifactId=lift- mapper -Dversion=1.1-SNAPSHOT -Dpackaging=jar -Dfile=/path/to/file - Durl=[url] -DrepositoryId=[id] Path to dependency: 1) com.tribes.ga:gaTribesServer1:war:1.1-SNAPSHOT 2) net.liftweb:lift-mapper:jar:1.1-SNAPSHOT -- 1 required artifact is missing. It is very strange. It was working before without problems. Any ideas? Thanks, GA On Oct 16, 2009, at 11:09 AM, Timothy Perrett wrote: > Just remove ~/.m2 > > The next time you make a maven call it'll then download all the new > JAR files. > > Cheers, Tim > > On 16 Oct 2009, at 09:35, GA wrote: > >> Is there any way to reset maven's repository? I think there is >> something corrupt because the behavior is really strange. I think >> this is the cause of my error. >> >> Thanks, >> >> >> On Oct 15, 2009, at 5:52 PM, GA wrote: >> >>> It is strange. I do not have the entries that you are saying in >>> the pom.xml file, but I do not have them in the 1.0 neither. I >>> have also created a project with archetype-basic and I have having >>> the same error. This is the command I am using to create the >>> project. Is it ok? >>> >>> mvn archetype:generate -U -DarchetypeGroupId=net.liftweb - >>> DarchetypeArtifactId=lift-archetype-basic -Dversion=1.1-SNAPSHOT - >>> DremoteRepositories=http://scala-tools.org/repo-snapshots - >>> DgroupId=com.tribes.ga -DartifactId=gaTribesServer-d0.1.1 >>> >>> Thanks, >>> >>> GA >>> >>> >>> On Oct 15, 2009, at 5:35 PM, David Pollak wrote: >>> >>>> I'm not sure what's going on. This code worked for me in a brand >>>> new archetype-basic 1.1-SNAPSHOT project. >>>> >>>> Please make sure the following entry is in your pom.xml file: >>>> >>>> >>>> >>>> net.liftweb >>>> lift-mapper >>>> 1.1-SNAPSHOT >>>> >>>> >>>> >>>> Thanks, >>>> >>>> David >>>> >>>> On Thu, Oct 15, 2009 at 8:27 AM, GA wrote: >>>> Here you have the complete model file. >>>> >>>> It is just a test class. The error I have is "Not found: Type >>>> IdPK". I get it when I try to compile the file. Also NetBeans is >>>> showing the error. The same file was working fine in Lift 1.0. >>>> >>>> I have created a new project based on the Lift snapshot 1.1 >>>> "archetype-blank" and then copied all my files from the previous >>>> project. The original 1.0 project was created with the "archetype- >>>> basic", could this be the source of the error? >>>> >>>> Thanks, >>>> >>>> >>>> package com.tribes.ga.model >>>> >>>> import net.liftweb._ >>>> import mapper._ >>>> import util._ >>>> import scala.xml.{NodeSeq,Text} >>>> import _root_.java.text.{DateFormat,SimpleDateFormat} >>>> >>>> class Person extends LongKeyedMapper[Person] with IdPK { >>>> def getSingleton = Person >>>> >>>> object userName extends MappedString(this, 30) >>>> object password extends MappedString(this, 30) >>&
[Lift] Re: error: not found: type IdPK in Lift 1.1
Is there any way to reset maven's repository? I think there is something corrupt because the behavior is really strange. I think this is the cause of my error. Thanks, On Oct 15, 2009, at 5:52 PM, GA wrote: > It is strange. I do not have the entries that you are saying in the > pom.xml file, but I do not have them in the 1.0 neither. I have also > created a project with archetype-basic and I have having the same > error. This is the command I am using to create the project. Is it ok? > > mvn archetype:generate -U -DarchetypeGroupId=net.liftweb - > DarchetypeArtifactId=lift-archetype-basic -Dversion=1.1-SNAPSHOT - > DremoteRepositories=http://scala-tools.org/repo-snapshots - > DgroupId=com.tribes.ga -DartifactId=gaTribesServer-d0.1.1 > > Thanks, > > GA > > > On Oct 15, 2009, at 5:35 PM, David Pollak wrote: > >> I'm not sure what's going on. This code worked for me in a brand >> new archetype-basic 1.1-SNAPSHOT project. >> >> Please make sure the following entry is in your pom.xml file: >> >> >> >> net.liftweb >> lift-mapper >> 1.1-SNAPSHOT >> >> >> >> Thanks, >> >> David >> >> On Thu, Oct 15, 2009 at 8:27 AM, GA wrote: >> Here you have the complete model file. >> >> It is just a test class. The error I have is "Not found: Type >> IdPK". I get it when I try to compile the file. Also NetBeans is >> showing the error. The same file was working fine in Lift 1.0. >> >> I have created a new project based on the Lift snapshot 1.1 >> "archetype-blank" and then copied all my files from the previous >> project. The original 1.0 project was created with the "archetype- >> basic", could this be the source of the error? >> >> Thanks, >> >> >> package com.tribes.ga.model >> >> import net.liftweb._ >> import mapper._ >> import util._ >> import scala.xml.{NodeSeq,Text} >> import _root_.java.text.{DateFormat,SimpleDateFormat} >> >> class Person extends LongKeyedMapper[Person] with IdPK { >> def getSingleton = Person >> >> object userName extends MappedString(this, 30) >> object password extends MappedString(this, 30) >> object firstName extends MappedString(this, 30) >> object lastName extends MappedString(this, 30) >> object email extends MappedString(this, 255) >> object deviceName extends MappedString(this, 30) >> object createdOn extends MappedDateTime(this) >> object updatedOn extends MappedDateTime(this) >> object createdBy extends MappedString(this, 25) >> object updatedBy extends MappedString(this, 25) >> >> def toXML: NodeSeq = { >> val id = "http://www.gatribes.com/api/expense/"; + this.id >> val formatter = new SimpleDateFormat("-MM- >> dd'T'HH:mm:ss'Z'") >> >> >> {id} >> {getUserName(userName.is)} >> {firstName.is} >> {lastName.is} >> >> } >> >> private def getUserName(userName: String): String = { >> Person.find(By(Person.userName, userName)) match { >> case Full(a) => a.userName >> case _ => "No Account Name" >> } >> } >> >> >> } >> >> object Person extends Person with LongKeyedMetaMapper[Person] >> >> >> >> On Oct 15, 2009, at 5:04 PM, David Pollak wrote: >> >>> Can you post an example (complete file) of something's not working? >>> >>> On Thu, Oct 15, 2009 at 3:21 AM, GA wrote: >>> >>> Hello guys, >>> >>> I have a Lift project working perfectly in version 1.0, but when I >>> moved it to Lift 1.1 I am having errors with the Modeler with the >>> type >>> IdPK. Any ideas? >>> >>> Thanks, >>> >>> GA >>> >>> >>> >>> >>> >>> >>> -- >>> 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 >>> >>> >> >> >> >> >> >> >> -- >> 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: error: not found: type IdPK in Lift 1.1
It is strange. I do not have the entries that you are saying in the pom.xml file, but I do not have them in the 1.0 neither. I have also created a project with archetype-basic and I have having the same error. This is the command I am using to create the project. Is it ok? mvn archetype:generate -U -DarchetypeGroupId=net.liftweb - DarchetypeArtifactId=lift-archetype-basic -Dversion=1.1-SNAPSHOT - DremoteRepositories=http://scala-tools.org/repo-snapshots - DgroupId=com.tribes.ga -DartifactId=gaTribesServer-d0.1.1 Thanks, GA On Oct 15, 2009, at 5:35 PM, David Pollak wrote: > I'm not sure what's going on. This code worked for me in a brand > new archetype-basic 1.1-SNAPSHOT project. > > Please make sure the following entry is in your pom.xml file: > > > > net.liftweb > lift-mapper > 1.1-SNAPSHOT > > > > Thanks, > > David > > On Thu, Oct 15, 2009 at 8:27 AM, GA wrote: > Here you have the complete model file. > > It is just a test class. The error I have is "Not found: Type IdPK". > I get it when I try to compile the file. Also NetBeans is showing > the error. The same file was working fine in Lift 1.0. > > I have created a new project based on the Lift snapshot 1.1 > "archetype-blank" and then copied all my files from the previous > project. The original 1.0 project was created with the "archetype- > basic", could this be the source of the error? > > Thanks, > > > package com.tribes.ga.model > > import net.liftweb._ > import mapper._ > import util._ > import scala.xml.{NodeSeq,Text} > import _root_.java.text.{DateFormat,SimpleDateFormat} > > class Person extends LongKeyedMapper[Person] with IdPK { > def getSingleton = Person > > object userName extends MappedString(this, 30) > object password extends MappedString(this, 30) > object firstName extends MappedString(this, 30) > object lastName extends MappedString(this, 30) > object email extends MappedString(this, 255) > object deviceName extends MappedString(this, 30) > object createdOn extends MappedDateTime(this) > object updatedOn extends MappedDateTime(this) > object createdBy extends MappedString(this, 25) > object updatedBy extends MappedString(this, 25) > > def toXML: NodeSeq = { > val id = "http://www.gatribes.com/api/expense/"; + this.id > val formatter = new SimpleDateFormat("-MM- > dd'T'HH:mm:ss'Z'") > > > {id} > {getUserName(userName.is)} > {firstName.is} > {lastName.is} > > } > > private def getUserName(userName: String): String = { > Person.find(By(Person.userName, userName)) match { > case Full(a) => a.userName > case _ => "No Account Name" > } > } > > > } > > object Person extends Person with LongKeyedMetaMapper[Person] > > > > On Oct 15, 2009, at 5:04 PM, David Pollak wrote: > >> Can you post an example (complete file) of something's not working? >> >> On Thu, Oct 15, 2009 at 3:21 AM, GA wrote: >> >> Hello guys, >> >> I have a Lift project working perfectly in version 1.0, but when I >> moved it to Lift 1.1 I am having errors with the Modeler with the >> type >> IdPK. Any ideas? >> >> Thanks, >> >> GA >> >> >> >> >> >> >> -- >> 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 >> >> > > > > > > > -- > 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: error: not found: type IdPK in Lift 1.1
Here you have the complete model file. It is just a test class. The error I have is "Not found: Type IdPK". I get it when I try to compile the file. Also NetBeans is showing the error. The same file was working fine in Lift 1.0. I have created a new project based on the Lift snapshot 1.1 "archetype- blank" and then copied all my files from the previous project. The original 1.0 project was created with the "archetype-basic", could this be the source of the error? Thanks, package com.tribes.ga.model import net.liftweb._ import mapper._ import util._ import scala.xml.{NodeSeq,Text} import _root_.java.text.{DateFormat,SimpleDateFormat} class Person extends LongKeyedMapper[Person] with IdPK { def getSingleton = Person object userName extends MappedString(this, 30) object password extends MappedString(this, 30) object firstName extends MappedString(this, 30) object lastName extends MappedString(this, 30) object email extends MappedString(this, 255) object deviceName extends MappedString(this, 30) object createdOn extends MappedDateTime(this) object updatedOn extends MappedDateTime(this) object createdBy extends MappedString(this, 25) object updatedBy extends MappedString(this, 25) def toXML: NodeSeq = { val id = "http://www.gatribes.com/api/expense/"; + this.id val formatter = new SimpleDateFormat("-MM- dd'T'HH:mm:ss'Z'") {id} {getUserName(userName.is)} {firstName.is} {lastName.is} } private def getUserName(userName: String): String = { Person.find(By(Person.userName, userName)) match { case Full(a) => a.userName case _ => "No Account Name" } } } object Person extends Person with LongKeyedMetaMapper[Person] On Oct 15, 2009, at 5:04 PM, David Pollak wrote: > Can you post an example (complete file) of something's not working? > > On Thu, Oct 15, 2009 at 3:21 AM, GA wrote: > > Hello guys, > > I have a Lift project working perfectly in version 1.0, but when I > moved it to Lift 1.1 I am having errors with the Modeler with the type > IdPK. Any ideas? > > Thanks, > > GA > > > > > > > -- > 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] error: not found: type IdPK in Lift 1.1
Hello guys, I have a Lift project working perfectly in version 1.0, but when I moved it to Lift 1.1 I am having errors with the Modeler with the type IdPK. Any ideas? Thanks, GA --~--~-~--~~~---~--~~ 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: Sending a XML message to a Lift server
Hello Jon, your code is giving me two errors in the last two lines. (fragment of Main.scala):52: error: ambiguous reference to overloaded definition, both method fromInputStream in object Source of type (java.io.InputStream)scala.io.Source and method fromInputStream in object Source of type (java.io.InputStream,String)scala.io.Source match expected type ? scala.io.Source.fromInputStream ^ (fragment of Main.scala):53: error: value getLines is not a member of java.io.InputStream (conn.getInputStream).getLines.mkString ^ two errors found !!! discarding
[Lift] Re: Sending a XML message to a Lift server
The dispatch library looks very interesting, but I am having problems to make it work. I have the following script: import dispatch._ import Http._ class ServerTest { def read { val http = new Http http("http://localhost:8080/api/getPerson/test/"; >>> System.out) } } val msg = new ServerTest msg.read I am getting the following error message when I run it with scala from the command line: java.lang.NoClassDefFoundError: dispatch/Handlers It seems to be a simple classpath error, but it is not. If I try to compile it with scalac it compiles correctly and also NetBeans compiles it without complains. The dispatch jars are all in place. Any ideas? Thanks in advance, GA On Oct 15, 2009, at 1:55 AM, Timothy Perrett wrote: > > Checkout this: http://databinder.net/dispatch/About > > Easily the most rocking HTTP library in scala-land. > > Cheers, Tim > > On 14 Oct 2009, at 19:35, jon wrote: > >> >> oh, if you want to parse directly into xml replace >> >> Source.fromInputStream(conn.getInputStream).getLines.mkString >> with >> XML.load(conn.getInputStream) >> >> On Oct 14, 2:32 pm, jon wrote: >>> this should work: >>> >>> def post(url:URL, toPost:String):String = url.openConnection match { >>> case conn: HttpURLConnection => { >>>conn.setRequestMethod("POST") >>>conn.setDoOutput(true) >>>conn.connect >>>conn.getOutputStream.write(toPost.getBytes()) >>>scala.io.Source.fromInputStream >>> (conn.getInputStream).getLines.mkString >>> } >>> >>> } >>> >>> On Oct 14, 2:22 pm, GA wrote: >>> >>> >>> >>>> Hello guys, >>> >>>> I have created a small web service in Lift. It has two services: >>>> One >>>> reads a row from a table in a database and the other writes one. To >>>> test the API I am writing a small client application in scala to >>>> read >>>> and write from the Lift API. >>>> Since I am new to scala and lift, I am thinking the code in Java >>>> and >>>> writing in scala, and of course I am having some problems because >>>> of >>>> that. >>> >>>> When I read from the Lift service, the service answers correctly, >>>> but >>>> my client method reads one line and ends the loop. I believe that >>>> the >>>> syntax of my "for comprehension" is not correct. This is my reader >>>> code: >>> >>>> import java.net._ >>>> import java.io._ >>> >>>> def read { >>> >>>> val url = new URL("http://localhost:8080/api/getPerson/ >>>> myrow >>>> ") >>> >>>> var connection = url.openConnection >>>> connection.setDoOutput(true); >>> >>>> var in = new BufferedReader(new InputStreamReader >>>> (connection.getInputStream())); >>> >>>> var incomingMsg = "" >>> >>>> **Loop with the problem*** >>>> for (decodedString <- in.readLine) { >>>> incomingMsg = incomingMsg + decodedString >>>> } >>> >>>> in.close(); >>> >>>> println(incomingMsg) >>>> } >>> >>>> My second problem is when i try to send a message to the API i >>>> receive >>>> the following java error: >>> >>>> java.io.FileNotFoundException:http://localhost:8080/api/getPerson >>> >>>> The error happens when the method tries to read the answers from >>>> the >>>> API. This is the code: >>> >>>> def send { >>>> val message = >>>> >>>> >>>> >>>> Jose >>>> Jose >>>> Perez >>>> a >>>> a...@.com >>>> 10/12/2009 >>>> Jose >>>> 10/12/2009 >>>> Jose >>>> >>>> >>> >>>> val url = new URL("http://localhost:8080/api/getPerson";) >>> >>>> var connection = url.openConnection >>>> connection.setDoOutput(true); >>> >>>> var outgoingMsg = message.toString >>> >>>> var out = new OutputStreamWriter >>>> (connection.getOutputStream()); >>>> out.write("string=" + outgoingMsg); >>>> out.close(); >>> >>>>***The error happens in the next line** >>>> var in = new BufferedReader(new InputStreamReader >>>> (connection.getInputStream())); >>> >>>> //var decodedString = "" >>> >>>> for (decodedString <- in.readLine) >>>> println(decodedString) >>>> in.close(); >>>> } >>> >>>> Any ideas? and, by the way, are there scala packages to replace >>>> java.net and java.io? >>> >>>> Thanks in advance, >>> >>>> GA >>> >> > > > > --~--~-~--~~~---~--~~ 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] Sending a XML message to a Lift server
Hello guys, I have created a small web service in Lift. It has two services: One reads a row from a table in a database and the other writes one. To test the API I am writing a small client application in scala to read and write from the Lift API. Since I am new to scala and lift, I am thinking the code in Java and writing in scala, and of course I am having some problems because of that. When I read from the Lift service, the service answers correctly, but my client method reads one line and ends the loop. I believe that the syntax of my "for comprehension" is not correct. This is my reader code: import java.net._ import java.io._ def read { val url = new URL("http://localhost:8080/api/getPerson/myrow";) var connection = url.openConnection connection.setDoOutput(true); var in = new BufferedReader(new InputStreamReader (connection.getInputStream())); var incomingMsg = "" **Loop with the problem*** for (decodedString <- in.readLine) { incomingMsg = incomingMsg + decodedString } in.close(); println(incomingMsg) } My second problem is when i try to send a message to the API i receive the following java error: java.io.FileNotFoundException: http://localhost:8080/api/getPerson The error happens when the method tries to read the answers from the API. This is the code: def send { val message = Jose Jose Perez a a...@.com 10/12/2009 Jose 10/12/2009 Jose val url = new URL("http://localhost:8080/api/getPerson";) var connection = url.openConnection connection.setDoOutput(true); var outgoingMsg = message.toString var out = new OutputStreamWriter(connection.getOutputStream()); out.write("string=" + outgoingMsg); out.close(); ***The error happens in the next line** var in = new BufferedReader(new InputStreamReader (connection.getInputStream())); //var decodedString = "" for (decodedString <- in.readLine) println(decodedString) in.close(); } Any ideas? and, by the way, are there scala packages to replace java.net and java.io? Thanks in advance, GA --~--~-~--~~~---~--~~ 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: Complex primary key
It is only available in Lift 1.1 right? GA On Oct 14, 2009, at 11:47 AM, Peter Robinett wrote: > > http://scala-tools.org/mvnsites-snapshots/liftweb/lift-mapper/scaladocs/net/liftweb/mapper/ManyToMany.html > > If you look back in the group there is a thread announcing the > addition of the trait and how to use it. > > Peter Robinett > > On Oct 14, 10:57 am, GA wrote: >> I need a many-to-many intermediary table and i need to add some more >> fields to it as well. >> >> In the question I meant compound primary key because I am creating >> the >> intermediary table manually in the mapper model. Is there any way to >> do many-to-many relationships automatically in the mapper? >> >> Thanks, >> >> On Oct 13, 2009, at 6:37 PM, David Pollak wrote: >> >>> I'm sorry, are you trying to do a compound primary key or create a >>> many-to-many intermediary table? >> >>> On Tue, Oct 13, 2009 at 8:06 AM, David Pollak >>> >>> wrote: >>> I don't think that's possible with mapper. Sorry. >> >>> You might want to see if JPA supports such a beast. >> >>> On Mon, Oct 12, 2009 at 7:30 AM, wrote: >> >>> Hello guys, >> >>> How can I create a mapper with two or more fields as primary key? >> >>> For instance if we have a table of "people" with a Long primary key >>> called ID generated by "IdPK", and also we have a table of addresses >>> also with a Long primary key called ID generated by "IdPK". The idea >>> is to create an association table with both IDs to represent people >>> with many addresses and addresses with multiple people. So both IDs >>> will be primary key of the new table. >> >>> Thanks in advance, >> >>> GA >> >>> -- >>> 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 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: Silly question about Lift project navigation in Netbeans
Problem solved. The issue was that I did not have installed the J2EE plugins. I added them and after I restarted the folder Web Pages appeared. GA On Oct 14, 2009, at 10:44 AM, GA wrote: > > Hello guys, > > I am working with Netbeans and I like it, but there is a small thing I > am not able to do. > > I create the project with maven in the command line (I am in Mac OS > 10.6) and then I open the project in Netbeans. Everything is visible > except the html pages and the templates. I can of course open them > manually (File-Open File) and edit them, but I would like to see them > in the project navigation in the side bar. Any ideas on how to do it? > > Thanks in advance, > > GA > > > > --~--~-~--~~~---~--~~ 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: Complex primary key
I need a many-to-many intermediary table and i need to add some more fields to it as well. In the question I meant compound primary key because I am creating the intermediary table manually in the mapper model. Is there any way to do many-to-many relationships automatically in the mapper? Thanks, On Oct 13, 2009, at 6:37 PM, David Pollak wrote: > I'm sorry, are you trying to do a compound primary key or create a > many-to-many intermediary table? > > On Tue, Oct 13, 2009 at 8:06 AM, David Pollak > wrote: > I don't think that's possible with mapper. Sorry. > > You might want to see if JPA supports such a beast. > > > On Mon, Oct 12, 2009 at 7:30 AM, wrote: > > Hello guys, > > How can I create a mapper with two or more fields as primary key? > > For instance if we have a table of "people" with a Long primary key > called ID generated by "IdPK", and also we have a table of addresses > also with a Long primary key called ID generated by "IdPK". The idea > is to create an association table with both IDs to represent people > with many addresses and addresses with multiple people. So both IDs > will be primary key of the new table. > > Thanks in advance, > > GA > > > > > > > -- > 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 > > > > -- > 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] Silly question about Lift project navigation in Netbeans
Hello guys, I am working with Netbeans and I like it, but there is a small thing I am not able to do. I create the project with maven in the command line (I am in Mac OS 10.6) and then I open the project in Netbeans. Everything is visible except the html pages and the templates. I can of course open them manually (File-Open File) and edit them, but I would like to see them in the project navigation in the side bar. Any ideas on how to do it? Thanks in advance, GA --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---