[Lift] Re: Package building...
No, that's not it... Apache Maven 2.2.0 (r788681; 2009-06-26 14:04:01+0100) Java version: 1.5.0_13 Java home: /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/ Home Default locale: en_GB, platform encoding: MacRoman OS name: mac os x version: 10.5.6 arch: i386 Family: unix Any other ideas? Is there an installer for a previous version? Joe On Aug 9, 11:09 pm, David Pollak feeder.of.the.be...@gmail.com wrote: Please do mvn -v If you're using Maven prior to 2.0.9, you'll see problems. On Sat, Aug 8, 2009 at 9:53 AM, Joe Wass j...@folktunefinder.com wrote: Hi, I just pulled the latest Mac installer and tried to build an existing project to a package and this happened... $ mvn package [INFO] Scanning for projects... [INFO] [INFO] Building XX [INFO]task-segment: [package] [INFO] [INFO] [resources:resources {execution: default-resources}] [WARNING] Using platform encoding (MacRoman actually) to copy filtered resources, i.e. build is platform dependent! [INFO] Copying 0 resource [INFO] [yuicompressor:compress {execution: default}] [INFO] nb warnings: 0, nb errors: 0 [INFO] [compiler:compile {execution: default-compile}] [INFO] Nothing to compile - all classes are up to date [INFO] [scala:compile {execution: default}] [INFO] Checking for multiple versions of scala [INFO] Nothing to compile - all classes are up to date [INFO] [resources:testResources {execution: default-testResources}] [WARNING] Using platform encoding (MacRoman actually) to copy filtered resources, i.e. build is platform dependent! [INFO] skip non existing resourceDirectory /XX/src/test/ resources [INFO] [compiler:testCompile {execution: default-testCompile}] [INFO] No sources to compile [INFO] [scala:testCompile {execution: default}] [INFO] Checking for multiple versions of scala [WARNING] No source files found. [INFO] [surefire:test {execution: default-test}] [INFO] Surefire report directory: /XX/target/surefire-reports --- T E S T S --- There are no tests to run. Results : Tests run: 0, Failures: 0, Errors: 0, Skipped: 0 [INFO] [war:war {execution: default-war}] [INFO] Packaging webapp [INFO] Assembling webapp[XX] in [/XX/target/ XX-1.0-SNAPSHOT] [INFO] [ERROR] FATAL ERROR [INFO] [INFO] null [INFO] [INFO] Trace java.lang.NullPointerException at org.apache.maven.plugin.war.util.WebappStructure.getDependencies (WebappStructure.java:109) at org.apache.maven.plugin.war.util.WebappStructure.analyseDependencies (WebappStructure.java:288) at org.apache.maven.plugin.war.packaging.DependenciesAnalysisPackagingTask.performPackaging (DependenciesAnalysisPackagingTask.java:46) at org.apache.maven.plugin.war.AbstractWarMojo.buildWebapp (AbstractWarMojo.java:439) at org.apache.maven.plugin.war.AbstractWarMojo.buildExplodedWebapp (AbstractWarMojo.java:375) at org.apache.maven.plugin.war.WarMojo.performPackaging(WarMojo.java: 181) at org.apache.maven.plugin.war.WarMojo.execute(WarMojo.java:143) at org.apache.maven.plugin.DefaultPluginManager.executeMojo (DefaultPluginManager.java:483) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals (DefaultLifecycleExecutor.java:678) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle (DefaultLifecycleExecutor.java:540) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal (DefaultLifecycleExecutor.java:519) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures (DefaultLifecycleExecutor.java:371) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments (DefaultLifecycleExecutor.java:332) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute (DefaultLifecycleExecutor.java:181) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:356) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:137) at org.apache.maven.cli.MavenCli.main(MavenCli.java:362) at org.apache.maven.cli.compat.CompatibleMain.main (CompatibleMain.java:41) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke
[Lift] Re: retrieve id's of form elements - set focus to HTML element
thanks for the tip; it's way nicer than what I did: give the element an ID and then use this one for the focus thanks markus On Aug 10, 12:15 am, David Pollak feeder.of.the.be...@gmail.com wrote: On Sat, Aug 8, 2009 at 9:19 AM, fricke 00fri...@googlemail.com wrote: Hi all, currently I have the following simple problem: I want to set the focus to a specific field, using script type=text/javascript document.myform.myfield.focus(); /script The Scenario: a simple bind(user, form, name - SHtml.text(x, x = _) ) Try: import net.liftweb.http.js.JsCmds._ Then: bind(user, form, name - FocusOnLoad(SHtml.text(x, x =_) )) with lift:UserLogin.login form=POST User Name: user:name/ /lift:UserLogin.login Here I come into trouble since (i) I cannot tell lift what the name of the form is (I tried lift:UserLogin.login form=POST name=myform, but this didn't work (I alternatively tried the namespaces lift: and the one used in the binding) (ii) additionally, I couldn't retrieve (or alternatively define) the name of the generated ID - the one used in the input field name (I tried to overwrite it in the HTML - via user:name=myfield - but this wasn't reflected in the backend, so the value never arrived there - I also tried to add attributes in the call of the bind method = same behaviour). In the getting started it's mentioned that you can overwrite the generated form names etc - but I couldnt find a way to do so. I would even be happier with a way to retrieve the internal name of a SFuncHolder (ot keep these nice random values) ah btw. I'm using the latest snapshot thanks and regards Markus -- Lift, the simply functional web frameworkhttp://liftweb.net Beginning Scalahttp://www.apress.com/book/view/1430219890 Follow me:http://twitter.com/dpp Git some:http://github.com/dpp --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Mapper Decimal, PostgreSQL, and foreign keys issues
I can take care of #1 and #3 if you can open issues for them on GitHub. If you could attach a standalone project for #3 that I can test against that would be very helpful. Derby has some other not so fun quirks with types (BINARY support sucks), so I wouldn't be surprised if there's something ridiculous in it's decimal support as well :(. I think that we should probably look at changing to H2 for the archetypes. For #1, is there a particular database that you're aware of that doesn't support SQL DECIMAL types? I only tested against PostgreSQL and MySQL when I wrote it. Derek On Sun, Aug 9, 2009 at 12:48 PM, Kyle Goodwin goodw...@gmail.com wrote: Hello, I'm fairly new to Lift, but I have found what I think are some issues in Mapper. If these have been discussed before or this isn't the proper place to bring them up please let me know: 1. MappedDecimal should use the DriverType framework to determine the type name in fieldCreatorString rather than hardcoding it in the class. 2. The PostgreSQL DriverType should be set up so that it is brokenAutogeneratedKeys but not wickedBrokenAutogeneratedKeys since it does support the RETURNING method of getting keys just not the jdbc3 method. 3. MappedDecimal seems to be truncating the fractional portions of values when using an embedded Derby database (the default archetype- generated setup). Switching to PostgreSQL resulted in normal behavior with no other changes. 4. Should the default for supportsForeignKeys_? really be false? None of the drivers seem to define this as true and most (almost all?) of them do actually support foreign keys. Foreign keys are not generated for PostgreSQL at the moment, for example, but it definitely supports them. Has this been done intentionally because foreign keys are undesired or not working? If they are undesired then it would be nice to have a straightforward way to override that setting...currently I think it would be difficult since the DriverType class for the database is loaded inside the Mapper code without an opportunity to pass in a class that overrides the default for the jdbc driver you're using. Thanks, Kyle Goodwin --~--~-~--~~~---~--~~ 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: Mapper nullability
I don't think that Mapper currently supports NOT NULL in the schema generation, although off the top of my head I think that we should be able to add that (please open an issue). I'm not sure about the H2 issue. What does the output from Schemifier look like when it runs? Derek On Sun, Aug 9, 2009 at 7:15 PM, Naftoli Gugenheim naftoli...@gmail.comwrote: Does Mapper have control over the nullability of a column? Is there a way to specify NOT NULL? Also, what am I doing wrong if my IdPK'd tables aren't having their id columns created as primary keys in H2? Thanks. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] More problems with CRUDify and SessionVars
Hi, I'm using CRUDify, but all domain objects belong to an account, so I need to add the current user's account id to the queries made by CRUDIfy. This works fine for the list Loc: override def findForListParams: List[QueryParam[Vehicle]] = List(OrderBy(primaryKeyField, Ascending), By(account, User.currentUser.open_!.account.is)) But for the edit/delete Locs, this fails: override def findForParam(in: String): Box[Vehicle] = { Log.info(User %s, id=%s.format(User.currentUser, User.currentUserId)) find(List(in,By(account, User.currentUser.open_!.account.is))) } Both currentUser currentUserId is empty at this point in the request cycle, as can be seen from this log output: INFO - User Empty, id=Empty java.lang.NullPointerException: Trying to open an empty Box at net.liftweb.util.EmptyBox.open_$bang(Box.scala:370) at net.liftweb.util.EmptyBox.open_$bang(Box.scala:366) at dk.model.Vehicle$$$M$f617a4a2.findForParam(Vehicle.scala:276) at dk.model.Vehicle$$$A$f617a4a2.findForParam(generated) at dk.model.Vehicle$.findForParam(Vehicle.scala:259) at net.liftweb.mapper.CRUDify$$anon$6$$anonfun$4.gd4$1(CRUDify.scala:174) at net.liftweb.mapper.CRUDify$$anon$6$$anonfun$4.isDefinedAt(CRUDify.scala:170) at net.liftweb.mapper.CRUDify$$anon$6$$anonfun$4.isDefinedAt(CRUDify.scala:170) at net.liftweb.util.NamedPF.isDefinedAt(NamedPartialFunction.scala:29) at net.liftweb.sitemap.Loc$$anonfun$rewritePF$1$$anon$1.isDefinedAt(Loc.scala:77) at net.liftweb.sitemap.Loc$$anonfun$rewritePF$1$$anon$1.isDefinedAt(Loc.scala:70) at net.liftweb.util.NamedPF$$anonfun$find$1.apply(NamedPartialFunction.scala:51) at net.liftweb.util.NamedPF$$anonfun$find$1.apply(NamedPartialFunction.scala:51) at scala.List.find(List.scala:1048) at net.liftweb.util.NamedPF$.find(NamedPartialFunction.scala:51) at net.liftweb.util.NamedPF$.applyBox(NamedPartialFunction.scala:91) at net.liftweb.http.Req$.processRewrite$1(Req.scala:114) at net.liftweb.http.Req$.apply(Req.scala:123) at net.liftweb.http.provider.HTTPProvider$class.service(HTTPProvider.scala:51) at net.liftweb.http.LiftFilter.service(LiftServlet.scala:481) at net.liftweb.http.provider.servlet.ServletFilterProvider$class.protected$service(ServletFilterProvider.scala:41) at net.liftweb.http.LiftFilter.protected$service(LiftServlet.scala:481) at net.liftweb.http.provider.servlet.ServletFilterProvider$$anonfun$doFilter$1.apply(ServletFilterProvider.scala:41) at net.liftweb.http.provider.servlet.ServletFilterProvider$$anonfun$doFilter$1.apply(ServletFilterProvider.scala:36) at net.liftweb.http.RequestVarHandler$$anonfun$apply$5$$anonfun$apply$6$$anonfun$apply$7$$anonfun$apply$8.apply(Vars.scala:212) at net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:65) at net.liftweb.http.RequestVarHandler$$anonfun$apply$5$$anonfun$apply$6$$anonfun$apply$7.apply(Vars.scala:211) at net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:65) at net.liftweb.http.RequestVarHandler$$anonfun$apply$5$$anonfun$apply$6.apply(Vars.scala:210) at net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:65) at net.liftweb.http.RequestVarHandler$$anonfun$apply$5.apply(Vars.scala:209) at net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:65) at net.liftweb.http.RequestVarHandler$.apply(Vars.scala:208) I think I'm seeing something similar to the problem mentioned here http://groups.google.com/group/liftweb/browse_thread/thread/0190091bcdb6d18a/90a33ace15273d3d?lnk=raot except now also the User.currentUserId SesssionVar seems to be uninitialized. So, is this not supported? Is there a workaround? Just back from two weeks of vacation, I might have missed something obvious :-) /Jeppe --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: retrieve id's of form elements - set focus to HTML element
On Mon, Aug 10, 2009 at 4:13 AM, fricke 00fri...@googlemail.com wrote: thanks for the tip; Sure thing. it's way nicer than what I did: give the element an ID and then use this one for the focus But if you've already given the element an id, it used that one. thanks markus On Aug 10, 12:15 am, David Pollak feeder.of.the.be...@gmail.com wrote: On Sat, Aug 8, 2009 at 9:19 AM, fricke 00fri...@googlemail.com wrote: Hi all, currently I have the following simple problem: I want to set the focus to a specific field, using script type=text/javascript document.myform.myfield.focus(); /script The Scenario: a simple bind(user, form, name - SHtml.text(x, x = _) ) Try: import net.liftweb.http.js.JsCmds._ Then: bind(user, form, name - FocusOnLoad(SHtml.text(x, x =_) )) with lift:UserLogin.login form=POST User Name: user:name/ /lift:UserLogin.login Here I come into trouble since (i) I cannot tell lift what the name of the form is (I tried lift:UserLogin.login form=POST name=myform, but this didn't work (I alternatively tried the namespaces lift: and the one used in the binding) (ii) additionally, I couldn't retrieve (or alternatively define) the name of the generated ID - the one used in the input field name (I tried to overwrite it in the HTML - via user:name=myfield - but this wasn't reflected in the backend, so the value never arrived there - I also tried to add attributes in the call of the bind method = same behaviour). In the getting started it's mentioned that you can overwrite the generated form names etc - but I couldnt find a way to do so. I would even be happier with a way to retrieve the internal name of a SFuncHolder (ot keep these nice random values) ah btw. I'm using the latest snapshot thanks and regards Markus -- Lift, the simply functional web frameworkhttp://liftweb.net Beginning Scalahttp://www.apress.com/book/view/1430219890 Follow me:http://twitter.com/dpp Git some:http://github.com/dpp -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp Git some: http://github.com/dpp --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: More problems with CRUDify and SessionVars
(1) Don't use open_! unless you have a very, very, very good reason to do so. It defeats the purpose of Box. (2) If you have a particular question/example of what you want to do (a complete, runnable example), I can work out a pattern for you. On Mon, Aug 10, 2009 at 8:37 AM, Jeppe Nejsum Madsen je...@ingolfs.dkwrote: Hi, I'm using CRUDify, but all domain objects belong to an account, so I need to add the current user's account id to the queries made by CRUDIfy. This works fine for the list Loc: override def findForListParams: List[QueryParam[Vehicle]] = List(OrderBy(primaryKeyField, Ascending), By(account, User.currentUser.open_!.account.is)) But for the edit/delete Locs, this fails: override def findForParam(in: String): Box[Vehicle] = { Log.info(User %s, id=%s.format(User.currentUser, User.currentUserId)) find(List(in,By(account, User.currentUser.open_!.account.is))) } Both currentUser currentUserId is empty at this point in the request cycle, as can be seen from this log output: INFO - User Empty, id=Empty java.lang.NullPointerException: Trying to open an empty Box at net.liftweb.util.EmptyBox.open_$bang(Box.scala:370) at net.liftweb.util.EmptyBox.open_$bang(Box.scala:366) at dk.model.Vehicle$$$M$f617a4a2.findForParam(Vehicle.scala:276) at dk.model.Vehicle$$$A$f617a4a2.findForParam(generated) at dk.model.Vehicle$.findForParam(Vehicle.scala:259) at net.liftweb.mapper.CRUDify$$anon$6$$anonfun$4.gd4$1(CRUDify.scala:174) at net.liftweb.mapper.CRUDify$$anon$6$$anonfun$4.isDefinedAt(CRUDify.scala:170) at net.liftweb.mapper.CRUDify$$anon$6$$anonfun$4.isDefinedAt(CRUDify.scala:170) at net.liftweb.util.NamedPF.isDefinedAt(NamedPartialFunction.scala:29) at net.liftweb.sitemap.Loc$$anonfun$rewritePF$1$$anon$1.isDefinedAt(Loc.scala:77) at net.liftweb.sitemap.Loc$$anonfun$rewritePF$1$$anon$1.isDefinedAt(Loc.scala:70) at net.liftweb.util.NamedPF$$anonfun$find$1.apply(NamedPartialFunction.scala:51) at net.liftweb.util.NamedPF$$anonfun$find$1.apply(NamedPartialFunction.scala:51) at scala.List.find(List.scala:1048) at net.liftweb.util.NamedPF$.find(NamedPartialFunction.scala:51) at net.liftweb.util.NamedPF$.applyBox(NamedPartialFunction.scala:91) at net.liftweb.http.Req$.processRewrite$1(Req.scala:114) at net.liftweb.http.Req$.apply(Req.scala:123) at net.liftweb.http.provider.HTTPProvider$class.service(HTTPProvider.scala:51) at net.liftweb.http.LiftFilter.service(LiftServlet.scala:481) at net.liftweb.http.provider.servlet.ServletFilterProvider$class.protected$service(ServletFilterProvider.scala:41) at net.liftweb.http.LiftFilter.protected$service(LiftServlet.scala:481) at net.liftweb.http.provider.servlet.ServletFilterProvider$$anonfun$doFilter$1.apply(ServletFilterProvider.scala:41) at net.liftweb.http.provider.servlet.ServletFilterProvider$$anonfun$doFilter$1.apply(ServletFilterProvider.scala:36) at net.liftweb.http.RequestVarHandler$$anonfun$apply$5$$anonfun$apply$6$$anonfun$apply$7$$anonfun$apply$8.apply(Vars.scala:212) at net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:65) at net.liftweb.http.RequestVarHandler$$anonfun$apply$5$$anonfun$apply$6$$anonfun$apply$7.apply(Vars.scala:211) at net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:65) at net.liftweb.http.RequestVarHandler$$anonfun$apply$5$$anonfun$apply$6.apply(Vars.scala:210) at net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:65) at net.liftweb.http.RequestVarHandler$$anonfun$apply$5.apply(Vars.scala:209) at net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:65) at net.liftweb.http.RequestVarHandler$.apply(Vars.scala:208) I think I'm seeing something similar to the problem mentioned here http://groups.google.com/group/liftweb/browse_thread/thread/0190091bcdb6d18a/90a33ace15273d3d?lnk=raot except now also the User.currentUserId SesssionVar seems to be uninitialized. So, is this not supported? Is there a workaround? Just back from two weeks of vacation, I might have missed something obvious :-) /Jeppe -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp Git some: http://github.com/dpp --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Mapper nullability
INFO - CREATE TABLE requestlocationstringvalue (ID BIGINT NOT NULL AUTO_INCREMENT , field BIGINT , requestlocation BIGINT) INFO - CREATE INDEX requestlocationstringvalue_id ON requestlocationstringvalue ( id ) INFO - CREATE INDEX requestlocationstringvalue_requestlocation ON requestlocationstringvalue ( requestlocation ) (output is retyped) - Derek Chen-Beckerdchenbec...@gmail.com wrote: I don't think that Mapper currently supports NOT NULL in the schema generation, although off the top of my head I think that we should be able to add that (please open an issue). I'm not sure about the H2 issue. What does the output from Schemifier look like when it runs? Derek On Sun, Aug 9, 2009 at 7:15 PM, Naftoli Gugenheim naftoli...@gmail.comwrote: Does Mapper have control over the nullability of a column? Is there a way to specify NOT NULL? Also, what am I doing wrong if my IdPK'd tables aren't having their id columns created as primary keys in H2? Thanks. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] makeUtf8 and HttpServletRequest broken in new build???
I just got a type mismatch found error in LiftRules.early.append (makeUtf8) in Boot.scala. It's now looking for an net.liftweb.http.provider.HTTPRequest instead of a javax.servlet.http.HttpServletRequest. Is this a new change, and if so, where is the net.liftweb.http.provider package? Glenn... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: makeUtf8 and HttpServletRequest broken in new build???
There were changes made to remove the requirement for lift to run in a servlet container. See: http://groups.google.com/group/liftweb/browse_thread/thread/a3486a7b9e9ffa40 On Mon, Aug 10, 2009 at 11:49 AM, glenn gl...@exmbly.com wrote: I just got a type mismatch found error in LiftRules.early.append (makeUtf8) in Boot.scala. It's now looking for an net.liftweb.http.provider.HTTPRequest instead of a javax.servlet.http.HttpServletRequest. Is this a new change, and if so, where is the net.liftweb.http.provider package? Glenn... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: makeUtf8 and HttpServletRequest broken in new build???
glenn gl...@exmbly.com writes: I just got a type mismatch found error in LiftRules.early.append (makeUtf8) in Boot.scala. It's now looking for an net.liftweb.http.provider.HTTPRequest instead of a javax.servlet.http.HttpServletRequest. Is this a new change, and if so, where is the net.liftweb.http.provider package? Yes, this was announced on the mailing list a while a go. The provider package is in lift-webkit /Jeppe --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: makeUtf8 and HttpServletRequest broken in new build???
I realize the need to improve the code, but do you have to break existing in the process? That's bad form. Glenn... On Aug 10, 9:55 am, Tim Nelson tnell...@gmail.com wrote: There were changes made to remove the requirement for lift to run in a servlet container. See: http://groups.google.com/group/liftweb/browse_thread/thread/a3486a7b9... On Mon, Aug 10, 2009 at 11:49 AM, glenn gl...@exmbly.com wrote: I just got a type mismatch found error in LiftRules.early.append (makeUtf8) in Boot.scala. It's now looking for an net.liftweb.http.provider.HTTPRequest instead of a javax.servlet.http.HttpServletRequest. Is this a new change, and if so, where is the net.liftweb.http.provider package? Glenn... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: makeUtf8 and HttpServletRequest broken in new build???
It was well warned about (many capital letters and asterisks) and you're clearly compiling against SNAPSHOTs. If you do not want new features, but guaranteed unchanging API, then you should probably use 1.1 milestones or 1.0 instead. -Ross On Aug 10, 2009, at 1:05 PM, glenn wrote: I realize the need to improve the code, but do you have to break existing in the process? That's bad form. Glenn... On Aug 10, 9:55 am, Tim Nelson tnell...@gmail.com wrote: There were changes made to remove the requirement for lift to run in a servlet container. See: http://groups.google.com/group/liftweb/browse_thread/thread/ a3486a7b9... On Mon, Aug 10, 2009 at 11:49 AM, glenn gl...@exmbly.com wrote: I just got a type mismatch found error in LiftRules.early.append (makeUtf8) in Boot.scala. It's now looking for an net.liftweb.http.provider.HTTPRequest instead of a javax.servlet.http.HttpServletRequest. Is this a new change, and if so, where is the net.liftweb.http.provider package? Glenn... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: makeUtf8 and HttpServletRequest broken in new build???
On Mon, Aug 10, 2009 at 10:05 AM, glenn gl...@exmbly.com wrote: I realize the need to improve the code, but do you have to break existing in the process? That's bad form. The issue was discussed on list. The branch was available for inspection in the repository for 1 month. The warning about the API breakage was very well publicized including a message that included BREAKING CHANGE in the title. The API breakage was trivial (requiring the change in a few places in your code and caught by the compiler). The reasons for the change were compelling (moving away from hard coding the Servlets, thus allowing support for non-JEE containers, Portlets, etc.) The change has been on the 1.1 roadmap. So, while I agree that breaking APIs is less than 100% optimal, it does happen from time to time and after significant discussion and warning. Glenn... On Aug 10, 9:55 am, Tim Nelson tnell...@gmail.com wrote: There were changes made to remove the requirement for lift to run in a servlet container. See: http://groups.google.com/group/liftweb/browse_thread/thread/a3486a7b9... On Mon, Aug 10, 2009 at 11:49 AM, glenn gl...@exmbly.com wrote: I just got a type mismatch found error in LiftRules.early.append (makeUtf8) in Boot.scala. It's now looking for an net.liftweb.http.provider.HTTPRequest instead of a javax.servlet.http.HttpServletRequest. Is this a new change, and if so, where is the net.liftweb.http.provider package? Glenn... -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp Git some: http://github.com/dpp --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: makeUtf8 and HttpServletRequest broken in new build???
Your makeUTF8 should look like this: private def makeUtf8(req: HTTPRequest): Unit = {req.setCharacterEncoding(UTF-8)} just use HTTPRequest instead of HttpServletRequest. Br's, Marius On Aug 10, 7:49 pm, glenn gl...@exmbly.com wrote: I just got a type mismatch found error in LiftRules.early.append (makeUtf8) in Boot.scala. It's now looking for an net.liftweb.http.provider.HTTPRequest instead of a javax.servlet.http.HttpServletRequest. Is this a new change, and if so, where is the net.liftweb.http.provider package? Glenn... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Alternate part of view
On Thu, Aug 6, 2009 at 9:28 AM, Naftoli Gugenheim naftoli...@gmail.comwrote: Here's some view xhtml: req:noClient label for=clientqueryClient /label client:query id=clientquery size=5/ client:set / /req:noClient req:client Client client:unset / client:editclient:name //client:editbr / client:details / /req:client hr / How about: def doBinding(xhtml: NodeSeq): NodeSeq = { def doClientBind(c: Client): Box[NodeSeq] = Helpers.template(xhtml, req, client).map(t = bind(client, t, ...)) def doClientFreeBind: Box[NodeSeq] = Helpers.template(xhtml, req, noClient).map(t = bind(client, t, ...)) (client.flatMap(doClientBind) or doClientFreeBind) openOr NodeSeq.Empty } And here's some snippet code: xhtml.bind(req, noClient - noClient _, client - hasClient _, ... ) def noClient(xhtml: NodeSeq) = { var clientQuery: String = def queryClient { ... } client match { case None = xhtml.bind(client, query - keepAttrs(SHtml.text(clientQuery, clientQuery = _)), set - SHtml.submit(?(), ()=queryClient) ) case Some(_) = NodeSeq.Empty } } So both alternatives are always bound to a NodeSeq=NodeSeq function, and both functions have to check if client is None or a Some, and always one function returns NodeSeq.Empty and the other one something useful. So my question is not, how can I do xxx, but, is there a 'DRY'er or more concise way to do it. In another place I used a slightly different technique: val emptyFn = (ns: NodeSeq) = NodeSeq.Empty def noLocationKind = (ns: NodeSeq) = ... def hasLocationKind(kind: LocKind#Value) = (ns:NodeSeq) = ... ns.bind(nlt, //name - {(ns:NodeSeq)=Text(foo)}, locKind - lkOpt.map(hasLocationKind).getOrElse(emptyFn), noLocKind - (if(lkOpt==None) noLocationKind else emptyFn) ).bind(nlt,name-nlt.name.is) Where lkOpt is the value that can be None or a Some. Instead of letting the functions check None/Some, I check outside the function. But it still seems that in theory it could be simplified. chooseTemplate doesn't solve the problem that the alternative NodeSeq has to be transformed to NodeSeq.Empty. P.S. Notice that I'm using my implicit to call bind on the NodeSeq :) P.P.S If you look closely, there's another problem that I had. For some reason the first name - ... was getting ignored, and it only worked in the second bind. Thanks! On Thu, Aug 6, 2009 at 10:49 AM, David Pollak feeder.of.the.be...@gmail.com wrote: I really need to see the resulting view code that you'd like to see depending on the conditions. On Thu, Aug 6, 2009 at 7:47 AM, Naftoli Gugenheim naftoli...@gmail.comwrote: No, I meant that this pattern of parts of the view being alternatives to each other repeats, in other words the view has several pairs of alternatives. I don't understand why the example doesn't allow for alternatives that repeat. - David Pollakfeeder.of.the.be...@gmail.com wrote: On Wed, Aug 5, 2009 at 8:44 PM, Naftoli Gugenheim naftoli...@gmail.com wrote: What's the smartest / most concise way to achieve the following in the corresponding view xhtml and snippet code: Parts of the view have to change, depending on whether something is set. For example, in the area where you select the client, if the client is None, then it displays an interface to select a client. If it's set to a Some then it displays the client's details with a button to unset it. This pattern is repeated. My current strategy is to have two elements, req:noClient and req:client, which have different xhtml contents. Then in the snippet I bind them to two NodeSeq functions, one that binds useful contents when the client is None and returns NodeSeq.Empty otherwise; and another function that binds when it's a Some and returns Empty otherwise. However, it seems to be somewhat redundant in theory. So does anyone have a better way of switching view parts? If it's repeated, then lift:embed / the part that you need. lift:MaybeClient client:yeslift:embed what=/templates/client_edit.html//client:yes client:nolift:embed what=/templates/client_chooser.html/client:no /lift:MaybeClient Thanks. -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp Git some: http://github.com/dpp -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp Git some: http://github.com/dpp -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me:
[Lift] Re: Alternate part of view
The problem with using the template methods is that they pull the node out of context. So if I need to let the view html file decide how everything is assembled, then these calls to the template methods have to be used inside a bind. You can put the alternatives inside a dedicated parent xml node and bind on that (sometimes), but what have I saved? Thanks. - David Pollakfeeder.of.the.be...@gmail.com wrote: On Thu, Aug 6, 2009 at 9:28 AM, Naftoli Gugenheim naftoli...@gmail.comwrote: Here's some view xhtml: req:noClient label for=clientqueryClient /label client:query id=clientquery size=5/ client:set / /req:noClient req:client Client client:unset / client:editclient:name //client:editbr / client:details / /req:client hr / How about: def doBinding(xhtml: NodeSeq): NodeSeq = { def doClientBind(c: Client): Box[NodeSeq] = Helpers.template(xhtml, req, client).map(t = bind(client, t, ...)) def doClientFreeBind: Box[NodeSeq] = Helpers.template(xhtml, req, noClient).map(t = bind(client, t, ...)) (client.flatMap(doClientBind) or doClientFreeBind) openOr NodeSeq.Empty } And here's some snippet code: xhtml.bind(req, noClient - noClient _, client - hasClient _, ... ) def noClient(xhtml: NodeSeq) = { var clientQuery: String = def queryClient { ... } client match { case None = xhtml.bind(client, query - keepAttrs(SHtml.text(clientQuery, clientQuery = _)), set - SHtml.submit(?(), ()=queryClient) ) case Some(_) = NodeSeq.Empty } } So both alternatives are always bound to a NodeSeq=NodeSeq function, and both functions have to check if client is None or a Some, and always one function returns NodeSeq.Empty and the other one something useful. So my question is not, how can I do xxx, but, is there a 'DRY'er or more concise way to do it. In another place I used a slightly different technique: val emptyFn = (ns: NodeSeq) = NodeSeq.Empty def noLocationKind = (ns: NodeSeq) = ... def hasLocationKind(kind: LocKind#Value) = (ns:NodeSeq) = ... ns.bind(nlt, //name - {(ns:NodeSeq)=Text(foo)}, locKind - lkOpt.map(hasLocationKind).getOrElse(emptyFn), noLocKind - (if(lkOpt==None) noLocationKind else emptyFn) ).bind(nlt,name-nlt.name.is) Where lkOpt is the value that can be None or a Some. Instead of letting the functions check None/Some, I check outside the function. But it still seems that in theory it could be simplified. chooseTemplate doesn't solve the problem that the alternative NodeSeq has to be transformed to NodeSeq.Empty. P.S. Notice that I'm using my implicit to call bind on the NodeSeq :) P.P.S If you look closely, there's another problem that I had. For some reason the first name - ... was getting ignored, and it only worked in the second bind. Thanks! On Thu, Aug 6, 2009 at 10:49 AM, David Pollak feeder.of.the.be...@gmail.com wrote: I really need to see the resulting view code that you'd like to see depending on the conditions. On Thu, Aug 6, 2009 at 7:47 AM, Naftoli Gugenheim naftoli...@gmail.comwrote: No, I meant that this pattern of parts of the view being alternatives to each other repeats, in other words the view has several pairs of alternatives. I don't understand why the example doesn't allow for alternatives that repeat. - David Pollakfeeder.of.the.be...@gmail.com wrote: On Wed, Aug 5, 2009 at 8:44 PM, Naftoli Gugenheim naftoli...@gmail.com wrote: What's the smartest / most concise way to achieve the following in the corresponding view xhtml and snippet code: Parts of the view have to change, depending on whether something is set. For example, in the area where you select the client, if the client is None, then it displays an interface to select a client. If it's set to a Some then it displays the client's details with a button to unset it. This pattern is repeated. My current strategy is to have two elements, req:noClient and req:client, which have different xhtml contents. Then in the snippet I bind them to two NodeSeq functions, one that binds useful contents when the client is None and returns NodeSeq.Empty otherwise; and another function that binds when it's a Some and returns Empty otherwise. However, it seems to be somewhat redundant in theory. So does anyone have a better way of switching view parts? If it's repeated, then lift:embed / the part that you need. lift:MaybeClient client:yeslift:embed what=/templates/client_edit.html//client:yes client:nolift:embed what=/templates/client_chooser.html/client:no /lift:MaybeClient Thanks. -- Lift, the simply functional web framework http://liftweb.net Beginning Scala
[Lift] Re: Alternate part of view
On Mon, Aug 10, 2009 at 11:18 AM, Naftoli Gugenheim naftoli...@gmail.comwrote: The problem with using the template methods is that they pull the node out of context. So if I need to let the view html file decide how everything is assembled, then these calls to the template methods have to be used inside a bind. You can put the alternatives inside a dedicated parent xml node and bind on that (sometimes), but what have I saved? I don't understand your question. I don't understand the pattern you are trying to use. I don't understand what kind of context a node might have other than binding based on a condition. What does the code that I wrote not do that your code does? Thanks. - David Pollakfeeder.of.the.be...@gmail.com wrote: On Thu, Aug 6, 2009 at 9:28 AM, Naftoli Gugenheim naftoli...@gmail.com wrote: Here's some view xhtml: req:noClient label for=clientqueryClient /label client:query id=clientquery size=5/ client:set / /req:noClient req:client Client client:unset / client:editclient:name //client:editbr / client:details / /req:client hr / How about: def doBinding(xhtml: NodeSeq): NodeSeq = { def doClientBind(c: Client): Box[NodeSeq] = Helpers.template(xhtml, req, client).map(t = bind(client, t, ...)) def doClientFreeBind: Box[NodeSeq] = Helpers.template(xhtml, req, noClient).map(t = bind(client, t, ...)) (client.flatMap(doClientBind) or doClientFreeBind) openOr NodeSeq.Empty } And here's some snippet code: xhtml.bind(req, noClient - noClient _, client - hasClient _, ... ) def noClient(xhtml: NodeSeq) = { var clientQuery: String = def queryClient { ... } client match { case None = xhtml.bind(client, query - keepAttrs(SHtml.text(clientQuery, clientQuery = _)), set - SHtml.submit(?(), ()=queryClient) ) case Some(_) = NodeSeq.Empty } } So both alternatives are always bound to a NodeSeq=NodeSeq function, and both functions have to check if client is None or a Some, and always one function returns NodeSeq.Empty and the other one something useful. So my question is not, how can I do xxx, but, is there a 'DRY'er or more concise way to do it. In another place I used a slightly different technique: val emptyFn = (ns: NodeSeq) = NodeSeq.Empty def noLocationKind = (ns: NodeSeq) = ... def hasLocationKind(kind: LocKind#Value) = (ns:NodeSeq) = ... ns.bind(nlt, //name - {(ns:NodeSeq)=Text(foo)}, locKind - lkOpt.map(hasLocationKind).getOrElse(emptyFn), noLocKind - (if(lkOpt==None) noLocationKind else emptyFn) ).bind(nlt,name-nlt.name.is) Where lkOpt is the value that can be None or a Some. Instead of letting the functions check None/Some, I check outside the function. But it still seems that in theory it could be simplified. chooseTemplate doesn't solve the problem that the alternative NodeSeq has to be transformed to NodeSeq.Empty. P.S. Notice that I'm using my implicit to call bind on the NodeSeq :) P.P.S If you look closely, there's another problem that I had. For some reason the first name - ... was getting ignored, and it only worked in the second bind. Thanks! On Thu, Aug 6, 2009 at 10:49 AM, David Pollak feeder.of.the.be...@gmail.com wrote: I really need to see the resulting view code that you'd like to see depending on the conditions. On Thu, Aug 6, 2009 at 7:47 AM, Naftoli Gugenheim naftoli...@gmail.com wrote: No, I meant that this pattern of parts of the view being alternatives to each other repeats, in other words the view has several pairs of alternatives. I don't understand why the example doesn't allow for alternatives that repeat. - David Pollakfeeder.of.the.be...@gmail.com wrote: On Wed, Aug 5, 2009 at 8:44 PM, Naftoli Gugenheim naftoli...@gmail.com wrote: What's the smartest / most concise way to achieve the following in the corresponding view xhtml and snippet code: Parts of the view have to change, depending on whether something is set. For example, in the area where you select the client, if the client is None, then it displays an interface to select a client. If it's set to a Some then it displays the client's details with a button to unset it. This pattern is repeated. My current strategy is to have two elements, req:noClient and req:client, which have different xhtml contents. Then in the snippet I bind them to two NodeSeq functions, one that binds useful contents when the client is None and returns NodeSeq.Empty otherwise; and another function that binds when it's
[Lift] Re: Alternate part of view
By context I mean where it is in the xml. For example, br's between the switch and everything else. In other words, your code implements a switch. But where are you putting it back in the view? chooseTemplate etc. extract data out of context as oppo'sed to bind which is in place. And if indeed you are calling it from within bind then why is it better than a NodeSeq function (FuncBindParam)? Thanks. - David Pollakfeeder.of.the.be...@gmail.com wrote: On Mon, Aug 10, 2009 at 11:18 AM, Naftoli Gugenheim naftoli...@gmail.comwrote: The problem with using the template methods is that they pull the node out of context. So if I need to let the view html file decide how everything is assembled, then these calls to the template methods have to be used inside a bind. You can put the alternatives inside a dedicated parent xml node and bind on that (sometimes), but what have I saved? I don't understand your question. I don't understand the pattern you are trying to use. I don't understand what kind of context a node might have other than binding based on a condition. What does the code that I wrote not do that your code does? Thanks. - David Pollakfeeder.of.the.be...@gmail.com wrote: On Thu, Aug 6, 2009 at 9:28 AM, Naftoli Gugenheim naftoli...@gmail.com wrote: Here's some view xhtml: req:noClient label for=clientqueryClient /label client:query id=clientquery size=5/ client:set / /req:noClient req:client Client client:unset / client:editclient:name //client:editbr / client:details / /req:client hr / How about: def doBinding(xhtml: NodeSeq): NodeSeq = { def doClientBind(c: Client): Box[NodeSeq] = Helpers.template(xhtml, req, client).map(t = bind(client, t, ...)) def doClientFreeBind: Box[NodeSeq] = Helpers.template(xhtml, req, noClient).map(t = bind(client, t, ...)) (client.flatMap(doClientBind) or doClientFreeBind) openOr NodeSeq.Empty } And here's some snippet code: xhtml.bind(req, noClient - noClient _, client - hasClient _, ... ) def noClient(xhtml: NodeSeq) = { var clientQuery: String = def queryClient { ... } client match { case None = xhtml.bind(client, query - keepAttrs(SHtml.text(clientQuery, clientQuery = _)), set - SHtml.submit(?(), ()=queryClient) ) case Some(_) = NodeSeq.Empty } } So both alternatives are always bound to a NodeSeq=NodeSeq function, and both functions have to check if client is None or a Some, and always one function returns NodeSeq.Empty and the other one something useful. So my question is not, how can I do xxx, but, is there a 'DRY'er or more concise way to do it. In another place I used a slightly different technique: val emptyFn = (ns: NodeSeq) = NodeSeq.Empty def noLocationKind = (ns: NodeSeq) = ... def hasLocationKind(kind: LocKind#Value) = (ns:NodeSeq) = ... ns.bind(nlt, //name - {(ns:NodeSeq)=Text(foo)}, locKind - lkOpt.map(hasLocationKind).getOrElse(emptyFn), noLocKind - (if(lkOpt==None) noLocationKind else emptyFn) ).bind(nlt,name-nlt.name.is) Where lkOpt is the value that can be None or a Some. Instead of letting the functions check None/Some, I check outside the function. But it still seems that in theory it could be simplified. chooseTemplate doesn't solve the problem that the alternative NodeSeq has to be transformed to NodeSeq.Empty. P.S. Notice that I'm using my implicit to call bind on the NodeSeq :) P.P.S If you look closely, there's another problem that I had. For some reason the first name - ... was getting ignored, and it only worked in the second bind. Thanks! On Thu, Aug 6, 2009 at 10:49 AM, David Pollak feeder.of.the.be...@gmail.com wrote: I really need to see the resulting view code that you'd like to see depending on the conditions. On Thu, Aug 6, 2009 at 7:47 AM, Naftoli Gugenheim naftoli...@gmail.com wrote: No, I meant that this pattern of parts of the view being alternatives to each other repeats, in other words the view has several pairs of alternatives. I don't understand why the example doesn't allow for alternatives that repeat. - David Pollakfeeder.of.the.be...@gmail.com wrote: On Wed, Aug 5, 2009 at 8:44 PM, Naftoli Gugenheim naftoli...@gmail.com wrote: What's the smartest / most concise way to achieve the following in the corresponding view xhtml and snippet code: Parts of the view have to change, depending on whether something is set. For example, in the area where you select the client, if the client is None, then
[Lift] Re: Alternate part of view
On Mon, Aug 10, 2009 at 11:29 AM, Naftoli Gugenheim naftoli...@gmail.comwrote: By context I mean where it is in the xml. For example, br's between the switch and everything else. In other words, your code implements a switch. But where are you putting it back in the view? chooseTemplate etc. extract data out of context as oppo'sed to bind which is in place. And if indeed you are calling it from within bind then why is it better than a NodeSeq function (FuncBindParam)? Put the static content outside the snippet invocation: lift:foo bsome text/b choose:one/choose:one choose:two/choose:two some more stuff /lift:foo Is exactly the same as: bsome text/b lift:foo choose:one/choose:one choose:two/choose:two /lift:foo some more stuff The snippet operates on the content that must be modified and the static text is outside the snippet invocation. Thanks. - David Pollakfeeder.of.the.be...@gmail.com wrote: On Mon, Aug 10, 2009 at 11:18 AM, Naftoli Gugenheim naftoli...@gmail.com wrote: The problem with using the template methods is that they pull the node out of context. So if I need to let the view html file decide how everything is assembled, then these calls to the template methods have to be used inside a bind. You can put the alternatives inside a dedicated parent xml node and bind on that (sometimes), but what have I saved? I don't understand your question. I don't understand the pattern you are trying to use. I don't understand what kind of context a node might have other than binding based on a condition. What does the code that I wrote not do that your code does? Thanks. - David Pollakfeeder.of.the.be...@gmail.com wrote: On Thu, Aug 6, 2009 at 9:28 AM, Naftoli Gugenheim naftoli...@gmail.com wrote: Here's some view xhtml: req:noClient label for=clientqueryClient /label client:query id=clientquery size=5/ client:set / /req:noClient req:client Client client:unset / client:editclient:name //client:editbr / client:details / /req:client hr / How about: def doBinding(xhtml: NodeSeq): NodeSeq = { def doClientBind(c: Client): Box[NodeSeq] = Helpers.template(xhtml, req, client).map(t = bind(client, t, ...)) def doClientFreeBind: Box[NodeSeq] = Helpers.template(xhtml, req, noClient).map(t = bind(client, t, ...)) (client.flatMap(doClientBind) or doClientFreeBind) openOr NodeSeq.Empty } And here's some snippet code: xhtml.bind(req, noClient - noClient _, client - hasClient _, ... ) def noClient(xhtml: NodeSeq) = { var clientQuery: String = def queryClient { ... } client match { case None = xhtml.bind(client, query - keepAttrs(SHtml.text(clientQuery, clientQuery = _)), set - SHtml.submit(?(), ()=queryClient) ) case Some(_) = NodeSeq.Empty } } So both alternatives are always bound to a NodeSeq=NodeSeq function, and both functions have to check if client is None or a Some, and always one function returns NodeSeq.Empty and the other one something useful. So my question is not, how can I do xxx, but, is there a 'DRY'er or more concise way to do it. In another place I used a slightly different technique: val emptyFn = (ns: NodeSeq) = NodeSeq.Empty def noLocationKind = (ns: NodeSeq) = ... def hasLocationKind(kind: LocKind#Value) = (ns:NodeSeq) = ... ns.bind(nlt, //name - {(ns:NodeSeq)=Text(foo)}, locKind - lkOpt.map(hasLocationKind).getOrElse(emptyFn), noLocKind - (if(lkOpt==None) noLocationKind else emptyFn) ).bind(nlt,name-nlt.name.is) Where lkOpt is the value that can be None or a Some. Instead of letting the functions check None/Some, I check outside the function. But it still seems that in theory it could be simplified. chooseTemplate doesn't solve the problem that the alternative NodeSeq has to be transformed to NodeSeq.Empty. P.S. Notice that I'm using my implicit to call bind on the NodeSeq :) P.P.S If you look closely, there's another problem that I had. For some reason the first name - ... was getting ignored, and it only worked in the second bind. Thanks! On Thu, Aug 6, 2009 at 10:49 AM, David Pollak feeder.of.the.be...@gmail.com wrote: I really need to see the resulting view code that you'd like to see depending on the conditions. On Thu, Aug 6, 2009 at 7:47 AM, Naftoli Gugenheim naftoli...@gmail.com wrote: No, I meant that this pattern of parts of the view
[Lift] Re: Alternate part of view
It's not that it doesn't do what my code does. But in the long run it doesn't sound shorter. Also it's not totally based on boxes anymore. Also, my proposal would allow me to write: bindSwitch(req, xhtml, Seq(hasClient, noClient), {(ns:NodeSeq) = xxx match { case yyy = 0 - bind(client, ns, ...) case = 1 - bind(client, ns, ...) }}) Also using my implicit several such invocations could easily be chained. - David Pollakfeeder.of.the.be...@gmail.com wrote: On Mon, Aug 10, 2009 at 11:18 AM, Naftoli Gugenheim naftoli...@gmail.comwrote: The problem with using the template methods is that they pull the node out of context. So if I need to let the view html file decide how everything is assembled, then these calls to the template methods have to be used inside a bind. You can put the alternatives inside a dedicated parent xml node and bind on that (sometimes), but what have I saved? I don't understand your question. I don't understand the pattern you are trying to use. I don't understand what kind of context a node might have other than binding based on a condition. What does the code that I wrote not do that your code does? Thanks. - David Pollakfeeder.of.the.be...@gmail.com wrote: On Thu, Aug 6, 2009 at 9:28 AM, Naftoli Gugenheim naftoli...@gmail.com wrote: Here's some view xhtml: req:noClient label for=clientqueryClient /label client:query id=clientquery size=5/ client:set / /req:noClient req:client Client client:unset / client:editclient:name //client:editbr / client:details / /req:client hr / How about: def doBinding(xhtml: NodeSeq): NodeSeq = { def doClientBind(c: Client): Box[NodeSeq] = Helpers.template(xhtml, req, client).map(t = bind(client, t, ...)) def doClientFreeBind: Box[NodeSeq] = Helpers.template(xhtml, req, noClient).map(t = bind(client, t, ...)) (client.flatMap(doClientBind) or doClientFreeBind) openOr NodeSeq.Empty } And here's some snippet code: xhtml.bind(req, noClient - noClient _, client - hasClient _, ... ) def noClient(xhtml: NodeSeq) = { var clientQuery: String = def queryClient { ... } client match { case None = xhtml.bind(client, query - keepAttrs(SHtml.text(clientQuery, clientQuery = _)), set - SHtml.submit(?(), ()=queryClient) ) case Some(_) = NodeSeq.Empty } } So both alternatives are always bound to a NodeSeq=NodeSeq function, and both functions have to check if client is None or a Some, and always one function returns NodeSeq.Empty and the other one something useful. So my question is not, how can I do xxx, but, is there a 'DRY'er or more concise way to do it. In another place I used a slightly different technique: val emptyFn = (ns: NodeSeq) = NodeSeq.Empty def noLocationKind = (ns: NodeSeq) = ... def hasLocationKind(kind: LocKind#Value) = (ns:NodeSeq) = ... ns.bind(nlt, //name - {(ns:NodeSeq)=Text(foo)}, locKind - lkOpt.map(hasLocationKind).getOrElse(emptyFn), noLocKind - (if(lkOpt==None) noLocationKind else emptyFn) ).bind(nlt,name-nlt.name.is) Where lkOpt is the value that can be None or a Some. Instead of letting the functions check None/Some, I check outside the function. But it still seems that in theory it could be simplified. chooseTemplate doesn't solve the problem that the alternative NodeSeq has to be transformed to NodeSeq.Empty. P.S. Notice that I'm using my implicit to call bind on the NodeSeq :) P.P.S If you look closely, there's another problem that I had. For some reason the first name - ... was getting ignored, and it only worked in the second bind. Thanks! On Thu, Aug 6, 2009 at 10:49 AM, David Pollak feeder.of.the.be...@gmail.com wrote: I really need to see the resulting view code that you'd like to see depending on the conditions. On Thu, Aug 6, 2009 at 7:47 AM, Naftoli Gugenheim naftoli...@gmail.com wrote: No, I meant that this pattern of parts of the view being alternatives to each other repeats, in other words the view has several pairs of alternatives. I don't understand why the example doesn't allow for alternatives that repeat. - David Pollakfeeder.of.the.be...@gmail.com wrote: On Wed, Aug 5, 2009 at 8:44 PM, Naftoli Gugenheim naftoli...@gmail.com wrote: What's the smartest / most concise way to achieve the following in the corresponding view xhtml and snippet code: Parts of the view have to change, depending on whether something is set. For example, in the area where you select the client, if the client
[Lift] Re: Alternate part of view
I sent my last message before I saw your last message, sorry. You made a very valid point that I didn't think of--to split the snippet into a number of snippets. However that doesn't help everywhere. For example: (breaking it into 2 messages) - David Pollakfeeder.of.the.be...@gmail.com wrote: On Mon, Aug 10, 2009 at 11:29 AM, Naftoli Gugenheim naftoli...@gmail.comwrote: By context I mean where it is in the xml. For example, br's between the switch and everything else. In other words, your code implements a switch. But where are you putting it back in the view? chooseTemplate etc. extract data out of context as oppo'sed to bind which is in place. And if indeed you are calling it from within bind then why is it better than a NodeSeq function (FuncBindParam)? Put the static content outside the snippet invocation: lift:foo bsome text/b choose:one/choose:one choose:two/choose:two some more stuff /lift:foo Is exactly the same as: bsome text/b lift:foo choose:one/choose:one choose:two/choose:two /lift:foo some more stuff The snippet operates on the content that must be modified and the static text is outside the snippet invocation. Thanks. - David Pollakfeeder.of.the.be...@gmail.com wrote: On Mon, Aug 10, 2009 at 11:18 AM, Naftoli Gugenheim naftoli...@gmail.com wrote: The problem with using the template methods is that they pull the node out of context. So if I need to let the view html file decide how everything is assembled, then these calls to the template methods have to be used inside a bind. You can put the alternatives inside a dedicated parent xml node and bind on that (sometimes), but what have I saved? I don't understand your question. I don't understand the pattern you are trying to use. I don't understand what kind of context a node might have other than binding based on a condition. What does the code that I wrote not do that your code does? Thanks. - David Pollakfeeder.of.the.be...@gmail.com wrote: On Thu, Aug 6, 2009 at 9:28 AM, Naftoli Gugenheim naftoli...@gmail.com wrote: Here's some view xhtml: req:noClient label for=clientqueryClient /label client:query id=clientquery size=5/ client:set / /req:noClient req:client Client client:unset / client:editclient:name //client:editbr / client:details / /req:client hr / How about: def doBinding(xhtml: NodeSeq): NodeSeq = { def doClientBind(c: Client): Box[NodeSeq] = Helpers.template(xhtml, req, client).map(t = bind(client, t, ...)) def doClientFreeBind: Box[NodeSeq] = Helpers.template(xhtml, req, noClient).map(t = bind(client, t, ...)) (client.flatMap(doClientBind) or doClientFreeBind) openOr NodeSeq.Empty } And here's some snippet code: xhtml.bind(req, noClient - noClient _, client - hasClient _, ... ) def noClient(xhtml: NodeSeq) = { var clientQuery: String = def queryClient { ... } client match { case None = xhtml.bind(client, query - keepAttrs(SHtml.text(clientQuery, clientQuery = _)), set - SHtml.submit(?(), ()=queryClient) ) case Some(_) = NodeSeq.Empty } } So both alternatives are always bound to a NodeSeq=NodeSeq function, and both functions have to check if client is None or a Some, and always one function returns NodeSeq.Empty and the other one something useful. So my question is not, how can I do xxx, but, is there a 'DRY'er or more concise way to do it. In another place I used a slightly different technique: val emptyFn = (ns: NodeSeq) = NodeSeq.Empty def noLocationKind = (ns: NodeSeq) = ... def hasLocationKind(kind: LocKind#Value) = (ns:NodeSeq) = ... ns.bind(nlt, //name - {(ns:NodeSeq)=Text(foo)}, locKind - lkOpt.map(hasLocationKind).getOrElse(emptyFn), noLocKind - (if(lkOpt==None) noLocationKind else emptyFn) ).bind(nlt,name-nlt.name.is) Where lkOpt is the value that can be None or a Some. Instead of letting the functions check None/Some, I check outside the function. But it still seems that in theory it could be simplified. chooseTemplate doesn't solve the problem that the alternative NodeSeq has to be transformed to NodeSeq.Empty. P.S. Notice that I'm using my implicit to call bind on the NodeSeq :) P.P.S If you look closely, there's another problem that I had. For some reason the first name - ... was getting ignored, and it only worked in the second bind. Thanks! On Thu,
[Lift] Re: Mapper Decimal, PostgreSQL, and foreign keys issues
I'm not aware of any database that doesn't support DECIMAL under that name however all the other Mapped types specify their type names in the DriverType declarations including things that never vary between drivers, so I just figured that was the right place for it. It doesn't matter functionally to me, just seemed to be the Right Thing. I'll make tickets on GitHub, thanks for letting me know about that, I didn't know if that was where we should report these things or what. Thanks, Kyle On Aug 10, 10:37 am, Derek Chen-Becker dchenbec...@gmail.com wrote: I can take care of #1 and #3 if you can open issues for them on GitHub. If you could attach a standalone project for #3 that I can test against that would be very helpful. Derby has some other not so fun quirks with types (BINARY support sucks), so I wouldn't be surprised if there's something ridiculous in it's decimal support as well :(. I think that we should probably look at changing to H2 for the archetypes. For #1, is there a particular database that you're aware of that doesn't support SQL DECIMAL types? I only tested against PostgreSQL and MySQL when I wrote it. Derek On Sun, Aug 9, 2009 at 12:48 PM, Kyle Goodwin goodw...@gmail.com wrote: Hello, I'm fairly new to Lift, but I have found what I think are some issues in Mapper. If these have been discussed before or this isn't the proper place to bring them up please let me know: 1. MappedDecimal should use the DriverType framework to determine the type name in fieldCreatorString rather than hardcoding it in the class. 2. The PostgreSQL DriverType should be set up so that it is brokenAutogeneratedKeys but not wickedBrokenAutogeneratedKeys since it does support the RETURNING method of getting keys just not the jdbc3 method. 3. MappedDecimal seems to be truncating the fractional portions of values when using an embedded Derby database (the default archetype- generated setup). Switching to PostgreSQL resulted in normal behavior with no other changes. 4. Should the default for supportsForeignKeys_? really be false? None of the drivers seem to define this as true and most (almost all?) of them do actually support foreign keys. Foreign keys are not generated for PostgreSQL at the moment, for example, but it definitely supports them. Has this been done intentionally because foreign keys are undesired or not working? If they are undesired then it would be nice to have a straightforward way to override that setting...currently I think it would be difficult since the DriverType class for the database is loaded inside the Mapper code without an opportunity to pass in a class that overrides the default for the jdbc driver you're using. Thanks, Kyle Goodwin --~--~-~--~~~---~--~~ 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: Alternate part of view
For example, I have requests. Every request is of a particular nature. Every nature specifies a set of location types--for example a Transportation request has a From and a To--and each type has a set of allowed location kinds--for example, transportation can be from/to a street address, hospital, etc., while a Hospital Visitation has one location type (Location) which only has one location kind (hospital). Now, when you are entering a request, once you select your nature, you are shown a list of location types, each of which you have to choose the location kind for. When you select the location kind of a location type, you then see the fields for that location kind. For example a street address has text fields while a hospital location has two dropdowns and a text field. The point being, that each location type is a switch, depending on whether a location kind has been selected for it. But they are inside an xml node that is reused for each location type, which has to be inside the snippet. But there is static formatting there. Nested snippets isn't a great solution here because the inner xml needs access to the location being iterated in the outer snippet, and class variables are less preferable than direct scope access. Thanks! - David Pollakfeeder.of.the.be...@gmail.com wrote: On Mon, Aug 10, 2009 at 11:29 AM, Naftoli Gugenheim naftoli...@gmail.comwrote: By context I mean where it is in the xml. For example, br's between the switch and everything else. In other words, your code implements a switch. But where are you putting it back in the view? chooseTemplate etc. extract data out of context as oppo'sed to bind which is in place. And if indeed you are calling it from within bind then why is it better than a NodeSeq function (FuncBindParam)? Put the static content outside the snippet invocation: lift:foo bsome text/b choose:one/choose:one choose:two/choose:two some more stuff /lift:foo Is exactly the same as: bsome text/b lift:foo choose:one/choose:one choose:two/choose:two /lift:foo some more stuff The snippet operates on the content that must be modified and the static text is outside the snippet invocation. Thanks. - David Pollakfeeder.of.the.be...@gmail.com wrote: On Mon, Aug 10, 2009 at 11:18 AM, Naftoli Gugenheim naftoli...@gmail.com wrote: The problem with using the template methods is that they pull the node out of context. So if I need to let the view html file decide how everything is assembled, then these calls to the template methods have to be used inside a bind. You can put the alternatives inside a dedicated parent xml node and bind on that (sometimes), but what have I saved? I don't understand your question. I don't understand the pattern you are trying to use. I don't understand what kind of context a node might have other than binding based on a condition. What does the code that I wrote not do that your code does? Thanks. - David Pollakfeeder.of.the.be...@gmail.com wrote: On Thu, Aug 6, 2009 at 9:28 AM, Naftoli Gugenheim naftoli...@gmail.com wrote: Here's some view xhtml: req:noClient label for=clientqueryClient /label client:query id=clientquery size=5/ client:set / /req:noClient req:client Client client:unset / client:editclient:name //client:editbr / client:details / /req:client hr / How about: def doBinding(xhtml: NodeSeq): NodeSeq = { def doClientBind(c: Client): Box[NodeSeq] = Helpers.template(xhtml, req, client).map(t = bind(client, t, ...)) def doClientFreeBind: Box[NodeSeq] = Helpers.template(xhtml, req, noClient).map(t = bind(client, t, ...)) (client.flatMap(doClientBind) or doClientFreeBind) openOr NodeSeq.Empty } And here's some snippet code: xhtml.bind(req, noClient - noClient _, client - hasClient _, ... ) def noClient(xhtml: NodeSeq) = { var clientQuery: String = def queryClient { ... } client match { case None = xhtml.bind(client, query - keepAttrs(SHtml.text(clientQuery, clientQuery = _)), set - SHtml.submit(?(), ()=queryClient) ) case Some(_) = NodeSeq.Empty } } So both alternatives are always bound to a NodeSeq=NodeSeq function, and both functions have to check if client is None or a Some, and always one function returns NodeSeq.Empty and the other one something useful. So my question is not, how can I do xxx, but, is there a 'DRY'er or more concise way to do it. In another place I used a slightly different technique:
[Lift] Re: Package building...
Thanks very much, that works. I'll keep an eye on the defects. Joe On Aug 10, 9:27 am, David Bernard david.bernard...@gmail.com wrote: It's a bug of the maven-war-plugin see *http://jira.codehaus.org/browse/MWAR-169 *http://jira.codehaus.org/browse/MWAR-170 *http://jira.codehaus.org/browse/MWAR-210 could you try : * force version of the plugin to 2.1-beta-1 Add this to build in pom.xml. plugins plugin groupIdorg.apache.maven.plugins/groupId artifactIdmaven-war-plugin/artifactId version2.1-beta-1/version /plugin /plugins * else try with maven 2.0.9 or 2.0.10 /davidB On Mon, Aug 10, 2009 at 08:00, Joe Wass j...@folktunefinder.com wrote: No, that's not it... Apache Maven 2.2.0 (r788681; 2009-06-26 14:04:01+0100) Java version: 1.5.0_13 Java home: /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/ Home Default locale: en_GB, platform encoding: MacRoman OS name: mac os x version: 10.5.6 arch: i386 Family: unix Any other ideas? Is there an installer for a previous version? Joe On Aug 9, 11:09 pm, David Pollak feeder.of.the.be...@gmail.com wrote: Please do mvn -v If you're using Maven prior to 2.0.9, you'll see problems. On Sat, Aug 8, 2009 at 9:53 AM, Joe Wass j...@folktunefinder.com wrote: Hi, I just pulled the latest Mac installer and tried to build an existing project to a package and this happened... $ mvn package [INFO] Scanning for projects... [INFO] [INFO] Building XX [INFO]task-segment: [package] [INFO] [INFO] [resources:resources {execution: default-resources}] [WARNING] Using platform encoding (MacRoman actually) to copy filtered resources, i.e. build is platform dependent! [INFO] Copying 0 resource [INFO] [yuicompressor:compress {execution: default}] [INFO] nb warnings: 0, nb errors: 0 [INFO] [compiler:compile {execution: default-compile}] [INFO] Nothing to compile - all classes are up to date [INFO] [scala:compile {execution: default}] [INFO] Checking for multiple versions of scala [INFO] Nothing to compile - all classes are up to date [INFO] [resources:testResources {execution: default-testResources}] [WARNING] Using platform encoding (MacRoman actually) to copy filtered resources, i.e. build is platform dependent! [INFO] skip non existing resourceDirectory /XX/src/test/ resources [INFO] [compiler:testCompile {execution: default-testCompile}] [INFO] No sources to compile [INFO] [scala:testCompile {execution: default}] [INFO] Checking for multiple versions of scala [WARNING] No source files found. [INFO] [surefire:test {execution: default-test}] [INFO] Surefire report directory: /XX/target/surefire-reports --- T E S T S --- There are no tests to run. Results : Tests run: 0, Failures: 0, Errors: 0, Skipped: 0 [INFO] [war:war {execution: default-war}] [INFO] Packaging webapp [INFO] Assembling webapp[XX] in [/XX/target/ XX-1.0-SNAPSHOT] [INFO] [ERROR] FATAL ERROR [INFO] [INFO] null [INFO] [INFO] Trace java.lang.NullPointerException at org.apache.maven.plugin.war.util.WebappStructure.getDependencies (WebappStructure.java:109) at org.apache.maven.plugin.war.util.WebappStructure.analyseDependencies (WebappStructure.java:288) at org.apache.maven.plugin.war.packaging.DependenciesAnalysisPackagingTask.performPackaging (DependenciesAnalysisPackagingTask.java:46) at org.apache.maven.plugin.war.AbstractWarMojo.buildWebapp (AbstractWarMojo.java:439) at org.apache.maven.plugin.war.AbstractWarMojo.buildExplodedWebapp (AbstractWarMojo.java:375) at org.apache.maven.plugin.war.WarMojo.performPackaging(WarMojo.java: 181) at org.apache.maven.plugin.war.WarMojo.execute(WarMojo.java:143) at org.apache.maven.plugin.DefaultPluginManager.executeMojo (DefaultPluginManager.java:483) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals (DefaultLifecycleExecutor.java:678) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle (DefaultLifecycleExecutor.java:540) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal (DefaultLifecycleExecutor.java:519)
[Lift] Re: Mapper Decimal, PostgreSQL, and foreign keys issues
Thanks. I agree that it would be better to put that kind of thing in DriverTypes, but I wanted to check to make sure that there weren't any exceptions that I should specialize when I do put it in place. Derek On Mon, Aug 10, 2009 at 1:00 PM, Kyle Goodwin goodw...@gmail.com wrote: I'm not aware of any database that doesn't support DECIMAL under that name however all the other Mapped types specify their type names in the DriverType declarations including things that never vary between drivers, so I just figured that was the right place for it. It doesn't matter functionally to me, just seemed to be the Right Thing. I'll make tickets on GitHub, thanks for letting me know about that, I didn't know if that was where we should report these things or what. Thanks, Kyle On Aug 10, 10:37 am, Derek Chen-Becker dchenbec...@gmail.com wrote: I can take care of #1 and #3 if you can open issues for them on GitHub. If you could attach a standalone project for #3 that I can test against that would be very helpful. Derby has some other not so fun quirks with types (BINARY support sucks), so I wouldn't be surprised if there's something ridiculous in it's decimal support as well :(. I think that we should probably look at changing to H2 for the archetypes. For #1, is there a particular database that you're aware of that doesn't support SQL DECIMAL types? I only tested against PostgreSQL and MySQL when I wrote it. Derek On Sun, Aug 9, 2009 at 12:48 PM, Kyle Goodwin goodw...@gmail.com wrote: Hello, I'm fairly new to Lift, but I have found what I think are some issues in Mapper. If these have been discussed before or this isn't the proper place to bring them up please let me know: 1. MappedDecimal should use the DriverType framework to determine the type name in fieldCreatorString rather than hardcoding it in the class. 2. The PostgreSQL DriverType should be set up so that it is brokenAutogeneratedKeys but not wickedBrokenAutogeneratedKeys since it does support the RETURNING method of getting keys just not the jdbc3 method. 3. MappedDecimal seems to be truncating the fractional portions of values when using an embedded Derby database (the default archetype- generated setup). Switching to PostgreSQL resulted in normal behavior with no other changes. 4. Should the default for supportsForeignKeys_? really be false? None of the drivers seem to define this as true and most (almost all?) of them do actually support foreign keys. Foreign keys are not generated for PostgreSQL at the moment, for example, but it definitely supports them. Has this been done intentionally because foreign keys are undesired or not working? If they are undesired then it would be nice to have a straightforward way to override that setting...currently I think it would be difficult since the DriverType class for the database is loaded inside the Mapper code without an opportunity to pass in a class that overrides the default for the jdbc driver you're using. Thanks, Kyle Goodwin --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: New features
It looks like some .is's need to be explicit. I wonder if the implicit doesn't apply now that it's using member types? David, if you choose to volunteer to add .is to references to primaryKeyField it will get on github sooner than if I do it, but I can do it if you don't. - glenngl...@exmbly.com wrote: David, I'm using your new ManyToMany trait and ran across this error: Message: java.lang.ClassCastException: net.liftweb.mapper.ProtoUser$id $ cannot be cast to java.lang.Long scala.runtime.BoxesRunTime.unboxToLong(Unknown Source) net.liftweb.mapper.MappedLong.real_i_set_$bang(MappedLong.scala:223) net.liftweb.mapper.MappedField$class.i_set_$bang(MappedField.scala: 449) net.liftweb.mapper.MappedLong.i_set_$bang(MappedLong.scala:223) net.liftweb.mapper.MappedField$class.set(MappedField.scala:429) net.liftweb.mapper.MappedLong.set(MappedLong.scala:223) net.liftweb.mapper.ManyToMany$MappedManyToMany.own(ManyToMany.scala: 78) My code that generates the error is: entity.roles += r where entity is a User and roles is the MappedManyToMany object in User. Glenn... On Aug 8, 10:35 pm, Naftoli Gugenheim naftoli...@gmail.com wrote: Thanks, David. Glenn, as far as the issue of adding unsaved children, I was thinking about it. If the same Role can be referenced by multiple users, why are you creating Roles at the same time that you are adding them to a User? Shouldn't there be one screen to manage Roles and the User screen would only allow you to add existing Roles? - David Pollakfeeder.of.the.be...@gmail.com wrote: There are dependent types that mirror the parameterized types for Mapper, KeyedMapper, etc. I've updated ManyToMany to use the dependent types... it should eliminate the need to have the type parameters. If it breaks thing, please revert the changes. On Thu, Aug 6, 2009 at 9:55 AM, Naftoli Gugenheim naftoli...@gmail.comwrote: In your use case it can only be Long and User. But there has to be a type parameter because other people might have a String key and a Request mapper. And the contents of ManyToMany have to be type safe to enforce their consistency with however the user of ManyToMany wants them to use it. So I think what you want is that the compiler should figure out that since you're using it with a KeyedMapper[Long, User], which is ManyToMany's T : KeyedMapper[K,T], and ManyToMany extends KeyedMapper[K,T] and it has a self type of T, and therefore it would be a compiler error to write anything besides Long and User, therefore you must want to use Long and User and they should be inferred. I could certainly hear that, although I'm not much of a type theorist. So feel free to open an enhancement ticket on Scala's Trac! :) If I understood correctly... On Thu, Aug 6, 2009 at 12:43 PM, glenn gl...@exmbly.com wrote: Naftoli, As I said at the outset, this is really beyond my expertise. But I think it's too broad and maybe, even unnecessary. In my example, K can only be one type, Long, and T can only be of type User. Anything else, and the compiler can't be guaranteed to catch it, but try running the application and you get things like stack overflow errors. How you would fix this is beyond me. All you can really do, at this point, is make sure to include these kinds of restrictions in the docs. Glenn... On Aug 6, 9:33 am, Naftoli Gugenheim naftoli...@gmail.com wrote: It's too broad, or it's too restrictive/unnecessary? I'm confused, you seem to imply both.If it's too broad, tell me why. But if you want to know why it needs the type parameter, it's because it has to use the type parameter in its implentation -- just count how many times its source code uses it! And if you want to know why the compiler can't infer it or be told to infer it... that's another issue. But if passing a type that creates a conflicting inheritance causes a compiler crash, that's not something I can help. :) Regards. On Thu, Aug 6, 2009 at 12:26 PM, glenn gl...@exmbly.com wrote: Naftoli, At the risk of discussing something obviously beyond my pay grade, isn't the real issue Scala traits and the use of parameterized types. The ManyToMany trait is defined as: trait ManyToMany[K,T:KeyedMapper[K, T]] But this isn't really correct,is it, the parameter is too broad, and that leads to a lot of the confusion and results in the need for unnecessary documentation. When you think about it, why all the duplication? Why do I need to write my User entity as: class User extends MegaProtoUser[User] with ManyToMany[Long,User] when we all know that this would be much cleaner: class User extends MegaProtoUser[User] with ManyToMany. But traits aren't like interfaces. They have implementation and would need to know
[Lift] Re: New features
David, I'm using your new ManyToMany trait and ran across this error: Message: java.lang.ClassCastException: net.liftweb.mapper.ProtoUser$id $ cannot be cast to java.lang.Long scala.runtime.BoxesRunTime.unboxToLong(Unknown Source) net.liftweb.mapper.MappedLong.real_i_set_$bang(MappedLong.scala:223) net.liftweb.mapper.MappedField$class.i_set_$bang(MappedField.scala: 449) net.liftweb.mapper.MappedLong.i_set_$bang(MappedLong.scala:223) net.liftweb.mapper.MappedField$class.set(MappedField.scala:429) net.liftweb.mapper.MappedLong.set(MappedLong.scala:223) net.liftweb.mapper.ManyToMany$MappedManyToMany.own(ManyToMany.scala: 78) My code that generates the error is: entity.roles += r where entity is a User and roles is the MappedManyToMany object in User. Glenn... On Aug 8, 10:35 pm, Naftoli Gugenheim naftoli...@gmail.com wrote: Thanks, David. Glenn, as far as the issue of adding unsaved children, I was thinking about it. If the same Role can be referenced by multiple users, why are you creating Roles at the same time that you are adding them to a User? Shouldn't there be one screen to manage Roles and the User screen would only allow you to add existing Roles? - David Pollakfeeder.of.the.be...@gmail.com wrote: There are dependent types that mirror the parameterized types for Mapper, KeyedMapper, etc. I've updated ManyToMany to use the dependent types... it should eliminate the need to have the type parameters. If it breaks thing, please revert the changes. On Thu, Aug 6, 2009 at 9:55 AM, Naftoli Gugenheim naftoli...@gmail.comwrote: In your use case it can only be Long and User. But there has to be a type parameter because other people might have a String key and a Request mapper. And the contents of ManyToMany have to be type safe to enforce their consistency with however the user of ManyToMany wants them to use it. So I think what you want is that the compiler should figure out that since you're using it with a KeyedMapper[Long, User], which is ManyToMany's T : KeyedMapper[K,T], and ManyToMany extends KeyedMapper[K,T] and it has a self type of T, and therefore it would be a compiler error to write anything besides Long and User, therefore you must want to use Long and User and they should be inferred. I could certainly hear that, although I'm not much of a type theorist. So feel free to open an enhancement ticket on Scala's Trac! :) If I understood correctly... On Thu, Aug 6, 2009 at 12:43 PM, glenn gl...@exmbly.com wrote: Naftoli, As I said at the outset, this is really beyond my expertise. But I think it's too broad and maybe, even unnecessary. In my example, K can only be one type, Long, and T can only be of type User. Anything else, and the compiler can't be guaranteed to catch it, but try running the application and you get things like stack overflow errors. How you would fix this is beyond me. All you can really do, at this point, is make sure to include these kinds of restrictions in the docs. Glenn... On Aug 6, 9:33 am, Naftoli Gugenheim naftoli...@gmail.com wrote: It's too broad, or it's too restrictive/unnecessary? I'm confused, you seem to imply both.If it's too broad, tell me why. But if you want to know why it needs the type parameter, it's because it has to use the type parameter in its implentation -- just count how many times its source code uses it! And if you want to know why the compiler can't infer it or be told to infer it... that's another issue. But if passing a type that creates a conflicting inheritance causes a compiler crash, that's not something I can help. :) Regards. On Thu, Aug 6, 2009 at 12:26 PM, glenn gl...@exmbly.com wrote: Naftoli, At the risk of discussing something obviously beyond my pay grade, isn't the real issue Scala traits and the use of parameterized types. The ManyToMany trait is defined as: trait ManyToMany[K,T:KeyedMapper[K, T]] But this isn't really correct,is it, the parameter is too broad, and that leads to a lot of the confusion and results in the need for unnecessary documentation. When you think about it, why all the duplication? Why do I need to write my User entity as: class User extends MegaProtoUser[User] with ManyToMany[Long,User] when we all know that this would be much cleaner: class User extends MegaProtoUser[User] with ManyToMany. But traits aren't like interfaces. They have implementation and would need to know something about the parent class they are attached to - and how would you accomplish that (reflection, maybe). This is more a Scala issue than a Lift one, I think. Glenn... On Aug 5, 8:24 pm, Naftoli Gugenheim naftoli...@gmail.com wrote: Building causes a stack overflow? So the question is, is it the resident
[Lift] Re: New features
I've got negative available time. Sorry. On Mon, Aug 10, 2009 at 1:28 PM, Naftoli Gugenheim naftoli...@gmail.comwrote: It looks like some .is's need to be explicit. I wonder if the implicit doesn't apply now that it's using member types? David, if you choose to volunteer to add .is to references to primaryKeyField it will get on github sooner than if I do it, but I can do it if you don't. - glenngl...@exmbly.com wrote: David, I'm using your new ManyToMany trait and ran across this error: Message: java.lang.ClassCastException: net.liftweb.mapper.ProtoUser$id $ cannot be cast to java.lang.Long scala.runtime.BoxesRunTime.unboxToLong(Unknown Source) net.liftweb.mapper.MappedLong.real_i_set_$bang(MappedLong.scala:223) net.liftweb.mapper.MappedField$class.i_set_$bang(MappedField.scala: 449) net.liftweb.mapper.MappedLong.i_set_$bang(MappedLong.scala:223) net.liftweb.mapper.MappedField$class.set(MappedField.scala:429) net.liftweb.mapper.MappedLong.set(MappedLong.scala:223) net.liftweb.mapper.ManyToMany$MappedManyToMany.own(ManyToMany.scala: 78) My code that generates the error is: entity.roles += r where entity is a User and roles is the MappedManyToMany object in User. Glenn... On Aug 8, 10:35 pm, Naftoli Gugenheim naftoli...@gmail.com wrote: Thanks, David. Glenn, as far as the issue of adding unsaved children, I was thinking about it. If the same Role can be referenced by multiple users, why are you creating Roles at the same time that you are adding them to a User? Shouldn't there be one screen to manage Roles and the User screen would only allow you to add existing Roles? - David Pollakfeeder.of.the.be...@gmail.com wrote: There are dependent types that mirror the parameterized types for Mapper, KeyedMapper, etc. I've updated ManyToMany to use the dependent types... it should eliminate the need to have the type parameters. If it breaks thing, please revert the changes. On Thu, Aug 6, 2009 at 9:55 AM, Naftoli Gugenheim naftoli...@gmail.com wrote: In your use case it can only be Long and User. But there has to be a type parameter because other people might have a String key and a Request mapper. And the contents of ManyToMany have to be type safe to enforce their consistency with however the user of ManyToMany wants them to use it. So I think what you want is that the compiler should figure out that since you're using it with a KeyedMapper[Long, User], which is ManyToMany's T : KeyedMapper[K,T], and ManyToMany extends KeyedMapper[K,T] and it has a self type of T, and therefore it would be a compiler error to write anything besides Long and User, therefore you must want to use Long and User and they should be inferred. I could certainly hear that, although I'm not much of a type theorist. So feel free to open an enhancement ticket on Scala's Trac! :) If I understood correctly... On Thu, Aug 6, 2009 at 12:43 PM, glenn gl...@exmbly.com wrote: Naftoli, As I said at the outset, this is really beyond my expertise. But I think it's too broad and maybe, even unnecessary. In my example, K can only be one type, Long, and T can only be of type User. Anything else, and the compiler can't be guaranteed to catch it, but try running the application and you get things like stack overflow errors. How you would fix this is beyond me. All you can really do, at this point, is make sure to include these kinds of restrictions in the docs. Glenn... On Aug 6, 9:33 am, Naftoli Gugenheim naftoli...@gmail.com wrote: It's too broad, or it's too restrictive/unnecessary? I'm confused, you seem to imply both.If it's too broad, tell me why. But if you want to know why it needs the type parameter, it's because it has to use the type parameter in its implentation -- just count how many times its source code uses it! And if you want to know why the compiler can't infer it or be told to infer it... that's another issue. But if passing a type that creates a conflicting inheritance causes a compiler crash, that's not something I can help. :) Regards. On Thu, Aug 6, 2009 at 12:26 PM, glenn gl...@exmbly.com wrote: Naftoli, At the risk of discussing something obviously beyond my pay grade, isn't the real issue Scala traits and the use of parameterized types. The ManyToMany trait is defined as: trait ManyToMany[K,T:KeyedMapper[K, T]] But this isn't really correct,is it, the parameter is too broad, and that leads to a lot of the confusion and results in the need for unnecessary documentation. When you think about it, why all the duplication? Why do I need to write my User entity as: class User extends MegaProtoUser[User]
[Lift] passing an attribute to a named template
Say I have a named template section.html (this is obviously a bit simplified from my real world use): div lift:bind name=content / /div Which I call like so: lift:surround with=section at=content !-- some stuff -- /lift:surround Is there someway I can modify both section.html and the callsite to pass in an attribute for the div tag. In my exact use case I want to set a css width style on the div (sometimes 500px, from other callsites 750px)? -harryh --~--~-~--~~~---~--~~ 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] bind with outer element?
Hi, I have a template with the following lift:Snippit t:name shorten=true / t:foo form=POST form:name/ ... /t:foo /lift:Snippet And a snippet like: def doSnippet(x:NodeSeq):NodeSeq = { bind(t, x, name- (doName(_)), foo - (doForm(_)) ) } In the code above only the contents of the bound tags are available for doName and doForm, if I want to be able to read the attribute shorten in doName and have foo render with an enclosing form tag, how do I create the bind params? I am doing an expensive batch operation upfront, so I want everything to be in the same snippet. Thanks, Jon --~--~-~--~~~---~--~~ 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] Looking for an additional team member for ESME
Folks, I'm heavily involved with ESME http://incubator.apache.org/esme/, the Enterprise Social Messaging Experiment, an Apache Incubator project. ESME was founded by folks in the SAP ecosystem and used by some SAP ecosystem companieshttps://www.it-solutions.siemens.com/b2b/it/en/global/press/press-releases/2009/Pages/enterprise-social-messaging-experiment.aspx . We're looking for a stellar UI person to join the project to build leading edge DHTML and Air front ends for ESME. If you'd like to have the opportunity to put your UI skills in front of corporate users, have fun with a very bright bunch of people, materially influence ESME and help shape Lift's multi-front-end APIs, please contact me off list. Thanks, David -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp Git some: http://github.com/dpp --~--~-~--~~~---~--~~ 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: SOAP web services?
Lifted RESTafarians, Has anyone tried the Apache Axis 2 WSDL 2.0 support? i'm looking at this pagehttp://ws.apache.org/axis2/tools/1_2/maven-plugins/maven-wsdl2code-plugin.htmland it claims they have a maven plugin to generate the stubs for a WSDL 2.0 REST binding. i'm going to play around with it to wrap BNF Converter in a RESTful service; but, i was wondering if anyone else had experience with it. Best wishes, --greg On Fri, Aug 7, 2009 at 12:31 AM, Viktor Klang viktor.kl...@gmail.comwrote: Hello Jacek, actually, if I were you I'd consider implementing your webservices as REST services and then just have your SOAP stubs call your rest services. (If you're not using anything voodooesque) Then you have the benefit of using the existing plumbing as much as possible, while still maintaining your SOAP interface as well as a potential migration path to something non-WSDL. (I am severely biased by having to work with SOAP, which has scarred me for life) On Thu, Aug 6, 2009 at 5:26 PM, Jacek Furmankiewicz jace...@gmail.comwrote: I was reading through the Lift book PDF and it mentions only REST- style web services. In our case, we need to look at re-implementing a set of existing SOAP web services (is there anything like 'wsdl2scala' anywhere?). I would appreciate any best practices and suggestions for implementing SOAP web services in the context of a larger Lift app (and Scala in general). -- Viktor Klang Rogue Scala-head Blog: klangism.blogspot.com Twttr: viktorklang -- L.G. Meredith Managing Partner Biosimilarity LLC 1219 NW 83rd St Seattle, WA 98117 +1 206.650.3740 http://biosimilarity.blogspot.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: New features
Okay, done. Wait until hudson builds it. - glenngl...@exmbly.com wrote: I assume this could take a while to fix. Meantime, could someone revert 1.1-SNAPSHOT back to before this change? Thanks Glenn... On Aug 10, 1:43 pm, David Pollak feeder.of.the.be...@gmail.com wrote: I've got negative available time. Sorry. On Mon, Aug 10, 2009 at 1:28 PM, Naftoli Gugenheim naftoli...@gmail.comwrote: It looks like some .is's need to be explicit. I wonder if the implicit doesn't apply now that it's using member types? David, if you choose to volunteer to add .is to references to primaryKeyField it will get on github sooner than if I do it, but I can do it if you don't. - glenngl...@exmbly.com wrote: David, I'm using your new ManyToMany trait and ran across this error: Message: java.lang.ClassCastException: net.liftweb.mapper.ProtoUser$id $ cannot be cast to java.lang.Long scala.runtime.BoxesRunTime.unboxToLong(Unknown Source) net.liftweb.mapper.MappedLong.real_i_set_$bang(MappedLong.scala:223) net.liftweb.mapper.MappedField$class.i_set_$bang(MappedField.scala: 449) net.liftweb.mapper.MappedLong.i_set_$bang(MappedLong.scala:223) net.liftweb.mapper.MappedField$class.set(MappedField.scala:429) net.liftweb.mapper.MappedLong.set(MappedLong.scala:223) net.liftweb.mapper.ManyToMany$MappedManyToMany.own(ManyToMany.scala: 78) My code that generates the error is: entity.roles += r where entity is a User and roles is the MappedManyToMany object in User. Glenn... On Aug 8, 10:35 pm, Naftoli Gugenheim naftoli...@gmail.com wrote: Thanks, David. Glenn, as far as the issue of adding unsaved children, I was thinking about it. If the same Role can be referenced by multiple users, why are you creating Roles at the same time that you are adding them to a User? Shouldn't there be one screen to manage Roles and the User screen would only allow you to add existing Roles? - David Pollakfeeder.of.the.be...@gmail.com wrote: There are dependent types that mirror the parameterized types for Mapper, KeyedMapper, etc. I've updated ManyToMany to use the dependent types... it should eliminate the need to have the type parameters. If it breaks thing, please revert the changes. On Thu, Aug 6, 2009 at 9:55 AM, Naftoli Gugenheim naftoli...@gmail.com wrote: In your use case it can only be Long and User. But there has to be a type parameter because other people might have a String key and a Request mapper. And the contents of ManyToMany have to be type safe to enforce their consistency with however the user of ManyToMany wants them to use it. So I think what you want is that the compiler should figure out that since you're using it with a KeyedMapper[Long, User], which is ManyToMany's T : KeyedMapper[K,T], and ManyToMany extends KeyedMapper[K,T] and it has a self type of T, and therefore it would be a compiler error to write anything besides Long and User, therefore you must want to use Long and User and they should be inferred. I could certainly hear that, although I'm not much of a type theorist. So feel free to open an enhancement ticket on Scala's Trac! :) If I understood correctly... On Thu, Aug 6, 2009 at 12:43 PM, glenn gl...@exmbly.com wrote: Naftoli, As I said at the outset, this is really beyond my expertise. But I think it's too broad and maybe, even unnecessary. In my example, K can only be one type, Long, and T can only be of type User. Anything else, and the compiler can't be guaranteed to catch it, but try running the application and you get things like stack overflow errors. How you would fix this is beyond me. All you can really do, at this point, is make sure to include these kinds of restrictions in the docs. Glenn... On Aug 6, 9:33 am, Naftoli Gugenheim naftoli...@gmail.com wrote: It's too broad, or it's too restrictive/unnecessary? I'm confused, you seem to imply both.If it's too broad, tell me why. But if you want to know why it needs the type parameter, it's because it has to use the type parameter in its implentation -- just count how many times its source code uses it! And if you want to know why the compiler can't infer it or be told to infer it... that's another issue. But if passing a type that creates a conflicting inheritance causes a compiler crash, that's not something I can help. :) Regards. On Thu, Aug 6, 2009 at 12:26 PM, glenn gl...@exmbly.com wrote: Naftoli, At the risk of discussing something obviously beyond my pay grade, isn't the real issue Scala traits and the use of parameterized types. The ManyToMany
[Lift] Re: Db.addLogFunc
Right. The current impl just does a toString on the vendor's PreparedStatement. Some Vendors print GUIDs, some print the SQL, but there really aren't any requirements one way or the other. Derek On Mon, Aug 10, 2009 at 4:40 PM, jon jonhoff...@gmail.com wrote: btw, the query param happens to include the actual sql under h2. On Aug 6, 4:48 pm, Derek Chen-Becker dchenbec...@gmail.com wrote: If there's a consensus that we want our own JDBC wrappers I'll go ahead and write them. Derek On Thu, Aug 6, 2009 at 1:19 PM, marius d. marius.dan...@gmail.com wrote: Probably building our own wrappers would be more lightweight then 3-rd party. Jus' guessing Br's, Marius On Aug 6, 9:58 pm, Derek Chen-Becker dchenbec...@gmail.com wrote: Well, I started looking at it and determined that the only way for us to truly log the queries would be to essentially make our own wrappers over Statement and PreparedStatement. There are projects (log4jdbc, notably) that already do this, and in a transparent manner. I'm not sure that adding a whole bunch of SQL logging directly to Lift is better than leveraging some existing libraries to do it. Derek On Thu, Aug 6, 2009 at 11:03 AM, marius d. marius.dan...@gmail.com wrote: Yeah we're aware of that. That is based on toString application which is JDBC driver dependent. I think Derek started some work on this to correct this behavior. Derek ? Br's, Marius On Aug 6, 8:01 pm, jon jonhoff...@gmail.com wrote: Hi, I have the following in boot: DB.addLogFunc((query, len) = Log.info(The query: +query+ took +len+ milliseconds)) I was expecting the query parameter to be sql, but it's actually some sort of guid INFO - The query: 6839c016-0122-f09a-9c96-003844e8 took 5 milliseconds Any ideas? I'm running with derby. Thanks, Jon --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---