[Lift] Re: Menu generated from database?
Hi Ross, Thanks for the code - however it didn't compile on my machine, why is that? Also I cannot get it to show a menu, can you take a brief look at my code, whats the problem? I notice supplimentalKidMenuItems gets called every time the page is rendered so thats a positive, but no menu items added to the page. Obviously I am a beginner, don't know why I had to change Unit to NullLocParams to get it to compile. I am on scala.version2.7.5/scala.version Lift version version1.1-M6/version I changed code to: case class DynMenuLoc ( override val name: String, override val link: Link[NullLocParams], override val text: LinkText[NullLocParams], _params: LocParam* ) extends Loc[NullLocParams] { override val params = _params.toList // had to comment this out: override val defaultValue = Full(()) // not sure what to set this to override val defaultParams = Empty override def supplimentalKidMenuItems:List [net.liftweb.sitemap.MenuItem] = { Log.info(kid menu function called) var result:ListBuffer[net.liftweb.sitemap.MenuItem] = new ListBuffer[net.liftweb.sitemap.MenuItem] result + (new MenuItem(Text(A), Text(B), Nil, false, false, Nil)) result.toList ::: super.supplimentalKidMenuItems } } def menu: List[Menu] = { Menu(Loc(home, List(index), Home)) :: Menu(DynMenuLoc(Dynamic Menu, Link(List(dynamic), true, / dynamic), Dynamic Menu)) :: Nil } Thanks, Philip On 11月21日, 下午2時56分, Ross Mellgren dri...@gmail.com wrote: Here's an example of doing what David decribed (at least, as I understood it ;-) ): // In Boot.scala // Build SiteMap val entries = ... :: Menu(DynMenuLoc(Dynamic Menu, Link(List(dynamic), true, /dynamic), Dynamic Menu)) :: ... case class DynMenuLoc ( override val name: String, override val link: Link[Unit], override val text: LinkText[Unit], _params: LocParam[Unit]* ) extends Loc[Unit] { override val params = _params.toList override val defaultValue = Full(()) override def supplimentalKidMenuItems = { DynMenuItem.findAll.map(dmi = { MenuItem(Text(dmi.label.is), Text(dmi.link.is), Nil, false, false, Nil) }) ::: super.supplimentalKidMenuItems } } object DynMenuItem extends DynMenuItem with LongKeyedMetaMapper[DynMenuItem] with CRUDify[Long, DynMenuItem] class DynMenuItem extends LongKeyedMapper[DynMenuItem] with IdPK { def getSingleton = DynMenuItem object label extends MappedString(this, 32) object link extends MappedString(this, 255) } I can post the full example code on github if it'd help, also. -Ross On Nov 20, 2009, at 10:37 PM, philip wrote: Hi David, Really looking forward to this - I spent a day on this with absolute failure. Philip On 11月20日, 上午1時56分, David Pollak feeder.of.the.be...@gmail.com wrote: Philip list, I've had it on my to-do list to write up an example... and haven't... but... In your Loc, you can override def supplimentalKidMenuItems and dynamically generate kid menu items. I'll try to get to an example but not today... sorry :-( Thanks, David On Thu, Nov 19, 2009 at 12:35 AM, philip philip14...@gmail.com wrote: Hi David, Since I am programming a CMS for my client, I need my lift menu to come from the database. LiftRules.setSiteMap(SiteMap(MenuInfo.menu :_*)) def menu: List[Menu] = { Log.info(Menu called) ... It seems my menu function only gets called once, on subsquent calls I do not get any log message. Maybe I have to subclass SiteMap? Can you point me in the right direction? Thanks, Philip On 10月21日, 下午11時20分, David Pollak feeder.of.the.be...@gmail.com wrote: I owe the list example code to do this... maybe tomorrow. On Wed, Oct 21, 2009 at 6:26 AM, philip philip14...@gmail.com wrote: Hi, How can I get a Liftweb menu to be generated from database content? Alternatively, can the menu come from a XML datasource? could I load/ serialize from that? Could it change dynamically at any time? Thanks, Philip -- Lift, the simply functional web frameworkhttp://liftweb.net Beginning Scalahttp://www.apress.com/book/view/1430219890 Follow me:http://twitter.com/dpp Surf the harmonics -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com- . For more options, visit this group at http://groups.google.com/group/liftweb?hl=. -- Lift, the simply functional web frameworkhttp://liftweb.net Beginning Scalahttp://www.apress.com/book/view/1430219890 Follow me:http://twitter.com/dpp Surf the harmonics- 隱藏被引用文字 - - 顯示被引用文字 - -- You received this message because you are subscribed to the Google
[Lift] Re: Menu generated from database?
Also I guess there is another problem with this approach, it does not render the entire menu, only one of 2nd level menu items. The 1st level menu items are Menu. Am I right in saying this? On 11月21日, 下午2時56分, Ross Mellgren dri...@gmail.com wrote: Here's an example of doing what David decribed (at least, as I understood it ;-) ): // In Boot.scala // Build SiteMap val entries = ... :: Menu(DynMenuLoc(Dynamic Menu, Link(List(dynamic), true, /dynamic), Dynamic Menu)) :: ... case class DynMenuLoc ( override val name: String, override val link: Link[Unit], override val text: LinkText[Unit], _params: LocParam[Unit]* ) extends Loc[Unit] { override val params = _params.toList override val defaultValue = Full(()) override def supplimentalKidMenuItems = { DynMenuItem.findAll.map(dmi = { MenuItem(Text(dmi.label.is), Text(dmi.link.is), Nil, false, false, Nil) }) ::: super.supplimentalKidMenuItems } } object DynMenuItem extends DynMenuItem with LongKeyedMetaMapper[DynMenuItem] with CRUDify[Long, DynMenuItem] class DynMenuItem extends LongKeyedMapper[DynMenuItem] with IdPK { def getSingleton = DynMenuItem object label extends MappedString(this, 32) object link extends MappedString(this, 255) } I can post the full example code on github if it'd help, also. -Ross On Nov 20, 2009, at 10:37 PM, philip wrote: Hi David, Really looking forward to this - I spent a day on this with absolute failure. Philip On 11月20日, 上午1時56分, David Pollak feeder.of.the.be...@gmail.com wrote: Philip list, I've had it on my to-do list to write up an example... and haven't... but... In your Loc, you can override def supplimentalKidMenuItems and dynamically generate kid menu items. I'll try to get to an example but not today... sorry :-( Thanks, David On Thu, Nov 19, 2009 at 12:35 AM, philip philip14...@gmail.com wrote: Hi David, Since I am programming a CMS for my client, I need my lift menu to come from the database. LiftRules.setSiteMap(SiteMap(MenuInfo.menu :_*)) def menu: List[Menu] = { Log.info(Menu called) ... It seems my menu function only gets called once, on subsquent calls I do not get any log message. Maybe I have to subclass SiteMap? Can you point me in the right direction? Thanks, Philip On 10月21日, 下午11時20分, David Pollak feeder.of.the.be...@gmail.com wrote: I owe the list example code to do this... maybe tomorrow. On Wed, Oct 21, 2009 at 6:26 AM, philip philip14...@gmail.com wrote: Hi, How can I get a Liftweb menu to be generated from database content? Alternatively, can the menu come from a XML datasource? could I load/ serialize from that? Could it change dynamically at any time? Thanks, Philip -- Lift, the simply functional web frameworkhttp://liftweb.net Beginning Scalahttp://www.apress.com/book/view/1430219890 Follow me:http://twitter.com/dpp Surf the harmonics -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com- . For more options, visit this group at http://groups.google.com/group/liftweb?hl=. -- Lift, the simply functional web frameworkhttp://liftweb.net Beginning Scalahttp://www.apress.com/book/view/1430219890 Follow me:http://twitter.com/dpp Surf the harmonics- 隱藏被引用文字 - - 顯示被引用文字 - -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/liftweb?hl=.- 隱藏被引用文字 - - 顯示被引用文字 - -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=.
Re: [Lift] Re: Call it Lift 2.0
Heiko, Sounds pretty rational - couldn't agree more that we need a suitable policy in place. Cheers, Tim On 21 Nov 2009, at 08:27, Heiko Seeberger wrote: For me it is important that there is a version policy in place, such that everyone knows what's the difference between a change to 1.1 or to 1.0.2. As we probably will stick to Lift 1.1, IMHO the version policy has to be: Increasing the major or minor version number means breaking changes, increasing the micro version number keeps the API stable.. Opinions? -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=.
[Lift] Re: Menu generated from database?
Got my code working so it generates a menu. Looked at WikiLoc in the Wiki Liftweb example, it has: def defaultParams = Full(WikiLoc(HomePage, false)) So I guessed that it needs to have something with a Full Changed it to: override val defaultParams = Full(NullLocParams) So now my code is case class DynMenuLoc ( override val name: String, override val link: Link[NullLocParams], override val text: LinkText[NullLocParams], _params: LocParam* ) extends Loc[NullLocParams] { override val params = _params.toList // had to comment this out: override val defaultValue = Full(()) // not sure what to set this to override val defaultParams = Full(NullLocParams) override def supplimentalKidMenuItems:List [net.liftweb.sitemap.MenuItem] = { Log.info(kid menu function called) var result:ListBuffer[net.liftweb.sitemap.MenuItem] = new ListBuffer[net.liftweb.sitemap.MenuItem] result + (new MenuItem(Text(A), Text(B), Nil, false, false, Nil)) result + (new MenuItem(Text(C), Text(D), Nil, false, false, Nil)) result.toList ::: super.supplimentalKidMenuItems } } Thats great, but still there is a problem of the top level menu. On 11月21日, 下午2時56分, Ross Mellgren dri...@gmail.com wrote: Here's an example of doing what David decribed (at least, as I understood it ;-) ): // In Boot.scala // Build SiteMap val entries = ... :: Menu(DynMenuLoc(Dynamic Menu, Link(List(dynamic), true, /dynamic), Dynamic Menu)) :: ... case class DynMenuLoc ( override val name: String, override val link: Link[Unit], override val text: LinkText[Unit], _params: LocParam[Unit]* ) extends Loc[Unit] { override val params = _params.toList override val defaultValue = Full(()) override def supplimentalKidMenuItems = { DynMenuItem.findAll.map(dmi = { MenuItem(Text(dmi.label.is), Text(dmi.link.is), Nil, false, false, Nil) }) ::: super.supplimentalKidMenuItems } } object DynMenuItem extends DynMenuItem with LongKeyedMetaMapper[DynMenuItem] with CRUDify[Long, DynMenuItem] class DynMenuItem extends LongKeyedMapper[DynMenuItem] with IdPK { def getSingleton = DynMenuItem object label extends MappedString(this, 32) object link extends MappedString(this, 255) } I can post the full example code on github if it'd help, also. -Ross On Nov 20, 2009, at 10:37 PM, philip wrote: Hi David, Really looking forward to this - I spent a day on this with absolute failure. Philip On 11月20日, 上午1時56分, David Pollak feeder.of.the.be...@gmail.com wrote: Philip list, I've had it on my to-do list to write up an example... and haven't... but... In your Loc, you can override def supplimentalKidMenuItems and dynamically generate kid menu items. I'll try to get to an example but not today... sorry :-( Thanks, David On Thu, Nov 19, 2009 at 12:35 AM, philip philip14...@gmail.com wrote: Hi David, Since I am programming a CMS for my client, I need my lift menu to come from the database. LiftRules.setSiteMap(SiteMap(MenuInfo.menu :_*)) def menu: List[Menu] = { Log.info(Menu called) ... It seems my menu function only gets called once, on subsquent calls I do not get any log message. Maybe I have to subclass SiteMap? Can you point me in the right direction? Thanks, Philip On 10月21日, 下午11時20分, David Pollak feeder.of.the.be...@gmail.com wrote: I owe the list example code to do this... maybe tomorrow. On Wed, Oct 21, 2009 at 6:26 AM, philip philip14...@gmail.com wrote: Hi, How can I get a Liftweb menu to be generated from database content? Alternatively, can the menu come from a XML datasource? could I load/ serialize from that? Could it change dynamically at any time? Thanks, Philip -- Lift, the simply functional web frameworkhttp://liftweb.net Beginning Scalahttp://www.apress.com/book/view/1430219890 Follow me:http://twitter.com/dpp Surf the harmonics -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com- . For more options, visit this group at http://groups.google.com/group/liftweb?hl=. -- Lift, the simply functional web frameworkhttp://liftweb.net Beginning Scalahttp://www.apress.com/book/view/1430219890 Follow me:http://twitter.com/dpp Surf the harmonics- 隱藏被引用文字 - - 顯示被引用文字 - -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group
[Lift] Re: Missing source files in 1.1-SNAPSHOT
FWIW, I'm seeing the same thing. Unfortunately. I'm downloading the source on another folder and cross referencing as I need. Thanks. regards, CH On Nov 19, 5:29 am, glenn gl...@exmbly.com wrote: You can either use debugging facilities in Eclipse or, as I mostly do, sprinkle a lot of println or Log.info statements around. But coding it right in the first place requires access to Lift source code, and for that I use maven's facility for downloading source jars from the pom. If the source jar isn't complete, or isn't in the maven repository, I'm out of luck. Glenn On Nov 18, 1:19 pm, Jeppe Nejsum Madsen je...@ingolfs.dk wrote: Kris Nuttycombe kris.nuttyco...@gmail.com writes: On Wed, Nov 18, 2009 at 1:51 PM, Jeppe Nejsum Madsen je...@ingolfs.dk wrote: Kris Nuttycombe kris.nuttyco...@gmail.com writes: On Wed, Nov 18, 2009 at 12:31 PM, glenn gl...@exmbly.com wrote: Kris, Don't want to clone the GitHub repo, as I need a Maven repo. Glenn Out of curiosity, is this because you have a Maven tool that helps automate interaction with a debugger? If so I'd be interested in learning about it - I've got a Lift bug I'm looking at now that would probably benefit from using an actual debugger on. If you use Eclipse, it can automatically get the sourc files from the sources jar. Open Type - Select e.g. Box - You get the Box.scala file. It is readonly though, so you can't easily try a quick hack /Jeppe Eclipse required? println debugging it is then! Yeah, 2.7.x is not that great. I'm really looking forward to 2.8, keep hearing lots of good stuff. But first we need Lift to work on 2.8 :-) /Jeppe -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=.
[Lift] My Scala - ByteCode preso at the JVM Language Summit
http://www.infoq.com/presentations/Scala-Basics-Bytecode-David-Pollak -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp Surf the harmonics -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=.
Re: [Lift] Re: Call it Lift 2.0
On Sat, Nov 21, 2009 at 4:29 AM, Timothy Perrett timo...@getintheloop.euwrote: Heiko, Sounds pretty rational - couldn't agree more that we need a suitable policy in place. Heiko, can you find the stated version number policies of 3 or 4 other well regarded open source projects? That will allow us to synthesize the best of what others have done into a coherent policy for Lift. Cheers, Tim On 21 Nov 2009, at 08:27, Heiko Seeberger wrote: For me it is important that there is a version policy in place, such that everyone knows what's the difference between a change to 1.1 or to 1.0.2. As we probably will stick to Lift 1.1, IMHO the version policy has to be: Increasing the major or minor version number means breaking changes, increasing the micro version number keeps the API stable.. Opinions? -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/liftweb?hl=. -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp Surf the harmonics -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=.
[Lift] Devoxx 2009
Folks, I got back from Devoxx late last night and thought I would just post some thoughts and experiences from the event. Firstly, there was an awesome interest in Scala and Lift - my talk was really busy (~550 people) and the general Scala Enthusiast BOF right afterwards was packed. Myself, Bill Venners, Viktor Klang and Frank Sommers pretty much represented a cross-section of Scala projects at the BOF and throughout the whole week we were pretty much swamped with Scala questions and interest. Lift was getting a lot of attention and was even used by Oracle in the Devoxx keynote!!! Another event of note was when myself, viktor and john were sat in the hotel reception hacking on Scala and showing it so some interested people at around 10pm, the JavaPosse turned up and were like wow, we appear to have stumbled upon the Scala geeks - they then proceeded to join the hackfest which was über cool. All in all, a very very successful week and I think the above mentioned group did an amazing job of raising the profile of Scala even further; moreover, some of the Lift discussions were brilliant - appeared to be a lot of people wanting to convert from Spring bean hell ;-) We as a team should be made up with the awesome framework that has been created here -- the next 12 months I believe will be somewhat of a Scala / Lift golden age where we have the opportunity to really make our mark on the industry. Congratulations everyone! Cheers, Tim PS: If you were at Devoxx and came to my talk, thanks for attending :-) -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=.
[Lift] Re: Devoxx 2009
By the way, the slide from my presentation can be found here: http://is.gd/50jVi Cheers, tim On Nov 21, 3:37 pm, Timothy Perrett timo...@getintheloop.eu wrote: Folks, I got back from Devoxx late last night and thought I would just post some thoughts and experiences from the event. Firstly, there was an awesome interest in Scala and Lift - my talk was really busy (~550 people) and the general Scala Enthusiast BOF right afterwards was packed. Myself, Bill Venners, Viktor Klang and Frank Sommers pretty much represented a cross-section of Scala projects at the BOF and throughout the whole week we were pretty much swamped with Scala questions and interest. Lift was getting a lot of attention and was even used by Oracle in the Devoxx keynote!!! Another event of note was when myself, viktor and john were sat in the hotel reception hacking on Scala and showing it so some interested people at around 10pm, the JavaPosse turned up and were like wow, we appear to have stumbled upon the Scala geeks - they then proceeded to join the hackfest which was über cool. All in all, a very very successful week and I think the above mentioned group did an amazing job of raising the profile of Scala even further; moreover, some of the Lift discussions were brilliant - appeared to be a lot of people wanting to convert from Spring bean hell ;-) We as a team should be made up with the awesome framework that has been created here -- the next 12 months I believe will be somewhat of a Scala / Lift golden age where we have the opportunity to really make our mark on the industry. Congratulations everyone! Cheers, Tim PS: If you were at Devoxx and came to my talk, thanks for attending :-) -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=.
[Lift] InputStream to String
I have seen this problem around and it seems basic but I haven't found a solution. I need to turn an InputStream into a String. There seems to be a bug in the Source class that fails for large files so I don't want to use that (though it is an elegant approach). The following doesn't work because reader.readLine returns Unit and not null, as in Java. val reader = new BufferedReader(new InputStreamReader(is)) var responseBody = var line = reader.readLine() while(line != null){ responseBody += line line = reader.readLine() } return responseBody What to do? -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=.
Re: [Lift] Re: Jetty or Tomcat, Which web container is recommended to use to deploy the Lift app ?
2009/11/20 monty chen montyc...@qq.com David Pollk, thanks you reply! Let us talk about tomcat or jetty Which web container is recommended to use to deploy the Lift app. I remember your reply of Derek Chen-Becker: On 5月5日, 上午5时59分, David Pollak feeder.of.the.be...@gmail.com wrote: Derek, Please note that about half of the requests failed in Jetty. Jetty does not seem to be explicitly closing the NIO sockets leading to an out of IO descriptor problem... that's why I used Tomcat. Thanks, David But at now why you recommend Nginx + Jetty ? The particular version of Jetty I used for the test had this problem. The problem manifest during significant churn of http requests ( 2K serviced per second). This is different from the long polling scenario. Further, if you're serving 2K/second sustained, you are in the top 1% of all web sites... you're in Twitter/LinkedIn territory. Jetty is the best option for Lift Comet (long polling) apps. On Mon, May 4, 2009 at 2:47 PM, Derek Chen-Becker dchenbec...@gmail.com wrote: Just to throw in another data point, I ran the tests on my AMD Phenom X2 720 (3 cores, 6GB of RAM): I generated the archetype exactly as you have it here. Ran mvn -Drun.mode=production -Djetty.port=9090 jetty:run Output from Apache Bench: $ ab -c 10 -n 2http://192.168.2.254:9090/user_mgt/login This is ApacheBench, Version 2.3 $Revision: 655654 $ Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Licensed to The Apache Software Foundation,http://www.apache.org/ Benchmarking 192.168.2.254 (be patient) Completed 2000 requests Completed 4000 requests Completed 6000 requests Completed 8000 requests Completed 1 requests Completed 12000 requests Completed 14000 requests Completed 16000 requests Completed 18000 requests Completed 2 requests Finished 2 requests Server Software:Jetty(6.1.16) Server Hostname:192.168.2.254 Server Port:9090 Document Path: /user_mgt/login Document Length:3635 bytes Concurrency Level: 10 Time taken for tests: 37.110 seconds Complete requests: 2 Failed requests:10191 (Connect: 0, Receive: 0, Length: 10191, Exceptions: 0) Write errors: 0 Total transferred: 79276096 bytes HTML transferred: 72626584 bytes Requests per second:538.94 [#/sec] (mean) Time per request: 18.555 [ms] (mean) -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/liftweb?hl=. -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp Surf the harmonics -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=.
Re: [Lift] InputStream to String
Helpers.readWholeThing(reader): String Yes... this method name is ripe for bettering. On Sat, Nov 21, 2009 at 6:47 AM, jack jack.wid...@gmail.com wrote: I have seen this problem around and it seems basic but I haven't found a solution. I need to turn an InputStream into a String. There seems to be a bug in the Source class that fails for large files so I don't want to use that (though it is an elegant approach). The following doesn't work because reader.readLine returns Unit and not null, as in Java. val reader = new BufferedReader(new InputStreamReader(is)) var responseBody = var line = reader.readLine() while(line != null){ responseBody += line line = reader.readLine() } return responseBody What to do? -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/liftweb?hl=. -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp Surf the harmonics -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=.
Re: [Lift] Devoxx 2009
Awesome write-up. Perfect way to start my day! Thanks for working hard to promote Scala and Lift and community the value of both to a broader audience. On Sat, Nov 21, 2009 at 6:37 AM, Timothy Perrett timo...@getintheloop.euwrote: Folks, I got back from Devoxx late last night and thought I would just post some thoughts and experiences from the event. Firstly, there was an awesome interest in Scala and Lift - my talk was really busy (~550 people) and the general Scala Enthusiast BOF right afterwards was packed. Myself, Bill Venners, Viktor Klang and Frank Sommers pretty much represented a cross-section of Scala projects at the BOF and throughout the whole week we were pretty much swamped with Scala questions and interest. Lift was getting a lot of attention and was even used by Oracle in the Devoxx keynote!!! Another event of note was when myself, viktor and john were sat in the hotel reception hacking on Scala and showing it so some interested people at around 10pm, the JavaPosse turned up and were like wow, we appear to have stumbled upon the Scala geeks - they then proceeded to join the hackfest which was über cool. All in all, a very very successful week and I think the above mentioned group did an amazing job of raising the profile of Scala even further; moreover, some of the Lift discussions were brilliant - appeared to be a lot of people wanting to convert from Spring bean hell ;-) We as a team should be made up with the awesome framework that has been created here -- the next 12 months I believe will be somewhat of a Scala / Lift golden age where we have the opportunity to really make our mark on the industry. Congratulations everyone! Cheers, Tim PS: If you were at Devoxx and came to my talk, thanks for attending :-) -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/liftweb?hl=. -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp Surf the harmonics -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=.
[Lift] Re: Call it Lift 2.0
Hi, Heiko, can you find the stated version number policies of 3 or 4 other well regarded open source projects? That will allow us to synthesize the best of what others have done into a coherent policy for Lift. Take a look at the recommended OSGi version policy: http://www.aqute.biz/Code/XBnd Then take a look at Eclipse (pretty well known, eh?): http://wiki.eclipse.org/index.php/Version_Numbering Both use a major increment (1.x - 2) to show breaking changes in API, a minor increment (1.1.x - 1.2) to show non-breaking changes in API and a micro increment to show internal (no class name changes, no method signature changes, ...) changes (e.g. bug fixes in the implementation). -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=.
Re: [Lift] Devoxx 2009
No worries David - it was a great event, and something im really proud of :-) Cheers, Tim On 21 Nov 2009, at 15:58, David Pollak wrote: Awesome write-up. Perfect way to start my day! Thanks for working hard to promote Scala and Lift and community the value of both to a broader audience. -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=.
Re: [Lift] InputStream to String
I kind of like it. Says exactly what it does :) On Sat, Nov 21, 2009 at 9:56 AM, David Pollak feeder.of.the.be...@gmail.com wrote: Helpers.readWholeThing(reader): String Yes... this method name is ripe for bettering. On Sat, Nov 21, 2009 at 6:47 AM, jack jack.wid...@gmail.com wrote: I have seen this problem around and it seems basic but I haven't found a solution. I need to turn an InputStream into a String. There seems to be a bug in the Source class that fails for large files so I don't want to use that (though it is an elegant approach). The following doesn't work because reader.readLine returns Unit and not null, as in Java. val reader = new BufferedReader(new InputStreamReader(is)) var responseBody = var line = reader.readLine() while(line != null){ responseBody += line line = reader.readLine() } return responseBody What to do? -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/liftweb?hl=. -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp Surf the harmonics -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/liftweb?hl=. -- Jack Widman co-founder / cto, Authoritude, Inc. 203-641-9355 -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=.
[Lift] Re: InputStream to String
HAHAHA. That is an awesome method name if ever i did see one. Little confused why readWholeInputStream was somehow not the obvious choice ;-) Cheers, Tim On Nov 21, 4:37 pm, Jack Widman jack.wid...@gmail.com wrote: I kind of like it. Says exactly what it does :) On Sat, Nov 21, 2009 at 9:56 AM, David Pollak feeder.of.the.be...@gmail.com wrote: Helpers.readWholeThing(reader): String Yes... this method name is ripe for bettering. On Sat, Nov 21, 2009 at 6:47 AM, jack jack.wid...@gmail.com wrote: I have seen this problem around and it seems basic but I haven't found a solution. I need to turn an InputStream into a String. There seems to be a bug in the Source class that fails for large files so I don't want to use that (though it is an elegant approach). The following doesn't work because reader.readLine returns Unit and not null, as in Java. val reader = new BufferedReader(new InputStreamReader(is)) var responseBody = var line = reader.readLine() while(line != null){ responseBody += line line = reader.readLine() } return responseBody What to do? -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/liftweb?hl=. -- Lift, the simply functional web frameworkhttp://liftweb.net Beginning Scalahttp://www.apress.com/book/view/1430219890 Follow me:http://twitter.com/dpp Surf the harmonics -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/liftweb?hl=. -- Jack Widman co-founder / cto, Authoritude, Inc. 203-641-9355 -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=.
Re: [Lift] Re: InputStream to String
How about pleaseGoOutAndConvertThisInputStreamToAStringAndReturnIt And then after returns the String you can call a function called thankYou On Sat, Nov 21, 2009 at 10:40 AM, Timothy Perrett timo...@getintheloop.euwrote: HAHAHA. That is an awesome method name if ever i did see one. Little confused why readWholeInputStream was somehow not the obvious choice ;-) Cheers, Tim On Nov 21, 4:37 pm, Jack Widman jack.wid...@gmail.com wrote: I kind of like it. Says exactly what it does :) On Sat, Nov 21, 2009 at 9:56 AM, David Pollak feeder.of.the.be...@gmail.com wrote: Helpers.readWholeThing(reader): String Yes... this method name is ripe for bettering. On Sat, Nov 21, 2009 at 6:47 AM, jack jack.wid...@gmail.com wrote: I have seen this problem around and it seems basic but I haven't found a solution. I need to turn an InputStream into a String. There seems to be a bug in the Source class that fails for large files so I don't want to use that (though it is an elegant approach). The following doesn't work because reader.readLine returns Unit and not null, as in Java. val reader = new BufferedReader(new InputStreamReader(is)) var responseBody = var line = reader.readLine() while(line != null){ responseBody += line line = reader.readLine() } return responseBody What to do? -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com liftweb%2bunsubscr...@googlegroups.comliftweb%252bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/liftweb?hl=. -- Lift, the simply functional web frameworkhttp://liftweb.net Beginning Scalahttp://www.apress.com/book/view/1430219890 Follow me:http://twitter.com/dpp Surf the harmonics -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com liftweb%2bunsubscr...@googlegroups.comliftweb%252bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/liftweb?hl=. -- Jack Widman co-founder / cto, Authoritude, Inc. 203-641-9355 -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/liftweb?hl=. -- Jack Widman co-founder / cto, Authoritude, Inc. 203-641-9355 -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=.
Re: [Lift] Re: scala eclipse plugin with lift
I am finally able to use the plugin. I noticed the plugin version is 2.7.7 and that the lift project scala version was 2.7.3 so I changed the scala version to 2.7.7 It works now. Actually I am not sure this was the change that made it work because just before I restarted eclipse and it already seemed to work. On Wed, Nov 18, 2009 at 7:27 AM, Miles Sabin mi...@milessabin.com wrote: On Wed, Nov 18, 2009 at 12:17 PM, Marius marius.dan...@gmail.com wrote: It interpreted my scala code as java out of the sudden. I tried the JDT weving trick and nothing. If you had JDT weaving enabled then only way you would see Scala code interpreted as Java is if the .project file included the Java builder. That only happens when you use Maven to generate your project metadata. So please report this issue to whoever is responsible for that Maven behaviour. Cheers, Miles -- Miles Sabin tel: +44 (0)7813 944 528 skype: milessabin http://www.chuusai.com/ http://twitter.com/milessabin -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/liftweb?hl=. -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=.
Re: [Lift] scala eclipse plugin with lift
Hi David, Thanks for your welcome. I hope to have now a little more time to take a deeper look at lift. I am delighted to see how much the community as grown around this exciting framework. I am really impressed by both the framework and the community. Congratulations. Oscar On Tue, Nov 17, 2009 at 10:40 PM, David Pollak feeder.of.the.be...@gmail.com wrote: Hey Oscar, Welcome back to Lift-land... haven't seen you in almost two years. Thanks, David On Tue, Nov 17, 2009 at 6:56 PM, Oscar Picasso oscarpica...@gmail.comwrote: Hi, I did import a new created lift project in a eclipse as a maven project. The project is recognized as a scala project but there is neither syntax syntax highlighting nor auto completion while it works fine, in the same workspace when I create directly a scala project with the scala eclipse plugin. Any idea? -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/liftweb?hl=. -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp Surf the harmonics -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/liftweb?hl=. -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=.
[Lift] Basic view question
Hi, I just created a simple project with the maven archetype and tried to add a view as explained in the The Definitive Guide to Lift. package org.opicasso.two.view import net.liftweb.http.LiftView import scala.xml.NodeSeq class SomeView extends LiftView { override def dispatch = { case show = doShow _ } def doShow () : NodeSeq = { lift:surround with=default at=content h1hello/h1 /lift:surround } } The Boot class was not changed: package bootstrap.liftweb import _root_.net.liftweb.util._ import _root_.net.liftweb.http._ import _root_.net.liftweb.sitemap._ import _root_.net.liftweb.sitemap.Loc._ import Helpers._ /** * A class that's instantiated early and run. It allows the application * to modify lift's environment */ class Boot { def boot { // where to search snippet LiftRules.addToPackages(org.opicasso.two) // Build SiteMap val entries = Menu(Loc(Home, List(index), Home)) :: Nil LiftRules.setSiteMap(SiteMap(entries:_*)) } } However when trying http://localhost:8080/SomeView/show I get The Requested URL /SomeView/show was not found on this server Is there something else that needs to be done? Is the url correct? Oscar -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=.
[Lift] Issue 201 - checkbox not returning all checked
yejun on github opened up an issue: def checkbox[T](possible : Seq[T], actual : Seq[T], func : (Seq[T]) = Any, attrs : (String, String)*) Func will only return first element in possible when it is checked or List(). It is easily reproducible. Based on the type of func, I agree it looks like it should give all checked boxes, not just either the first checked box or an empty list. If it's supposed to be for a single checkbox only, then I think the type should be changed to Box[T] = Any, or at the very least a doc comment indicating that it only supports a single check box. This behavior was introduced withhttp://github.com/dpp/liftweb/commit/ 8b2a92a58ded608a0d3a7b6ead29cd2af6302c5e. Since there is no doc comment on the function I wanted to check what is the intended behavior before making and posting a patch to either do multiple checkbox or make the doc comment / type more clear and add another function to do the multi behavior. Thoughts? -Ross -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=.
Re: [Lift] Devoxx 2009
Amazing. Great news. Good job guys. Wish I was there. 2009/11/21 Timothy Perrett timo...@getintheloop.eu: Folks, I got back from Devoxx late last night and thought I would just post some thoughts and experiences from the event. Firstly, there was an awesome interest in Scala and Lift - my talk was really busy (~550 people) and the general Scala Enthusiast BOF right afterwards was packed. Myself, Bill Venners, Viktor Klang and Frank Sommers pretty much represented a cross-section of Scala projects at the BOF and throughout the whole week we were pretty much swamped with Scala questions and interest. Lift was getting a lot of attention and was even used by Oracle in the Devoxx keynote!!! Another event of note was when myself, viktor and john were sat in the hotel reception hacking on Scala and showing it so some interested people at around 10pm, the JavaPosse turned up and were like wow, we appear to have stumbled upon the Scala geeks - they then proceeded to join the hackfest which was über cool. All in all, a very very successful week and I think the above mentioned group did an amazing job of raising the profile of Scala even further; moreover, some of the Lift discussions were brilliant - appeared to be a lot of people wanting to convert from Spring bean hell ;-) We as a team should be made up with the awesome framework that has been created here -- the next 12 months I believe will be somewhat of a Scala / Lift golden age where we have the opportunity to really make our mark on the industry. Congratulations everyone! Cheers, Tim PS: If you were at Devoxx and came to my talk, thanks for attending :-) -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=. -- Jonas Bonér twitter: @jboner blog:http://jonasboner.com work: http://scalablesolutions.se code: http://github.com/jboner code: http://akkasource.org also:http://letitcrash.com -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=.
Re: [Lift] Basic view question
Oscar, Please use Lift 1.1. You'll get a much more information error message. Basically, you need to add an entry to SiteMap. Thanks, David On Sat, Nov 21, 2009 at 9:32 AM, Oscar Picasso oscarpica...@gmail.comwrote: Hi, I just created a simple project with the maven archetype and tried to add a view as explained in the The Definitive Guide to Lift. package org.opicasso.two.view import net.liftweb.http.LiftView import scala.xml.NodeSeq class SomeView extends LiftView { override def dispatch = { case show = doShow _ } def doShow () : NodeSeq = { lift:surround with=default at=content h1hello/h1 /lift:surround } } The Boot class was not changed: package bootstrap.liftweb import _root_.net.liftweb.util._ import _root_.net.liftweb.http._ import _root_.net.liftweb.sitemap._ import _root_.net.liftweb.sitemap.Loc._ import Helpers._ /** * A class that's instantiated early and run. It allows the application * to modify lift's environment */ class Boot { def boot { // where to search snippet LiftRules.addToPackages(org.opicasso.two) // Build SiteMap val entries = Menu(Loc(Home, List(index), Home)) :: Nil LiftRules.setSiteMap(SiteMap(entries:_*)) } } However when trying http://localhost:8080/SomeView/show I get The Requested URL /SomeView/show was not found on this server Is there something else that needs to be done? Is the url correct? Oscar -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/liftweb?hl=. -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp Surf the harmonics -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=.
Re: [Lift] Re: Menu generated from database?
Yeah, Full(()) makes sense for 1.1-SNAPSHOT which is what my code was using, and Full(NullLocParams) makes sense for M7 and earlier. I apologize; I should have asked what version you were developing against. I think that you are correct with regard to the top level menu having to be static -- looking at it it seems like only child menu items can be dynamic. Maybe you can have one top level Menu and then use a custom Menu snippet that skips the top level? Someone with more experience doing deep SiteMap stuff hopefully can chime in. -Ross On Nov 21, 2009, at 8:51 AM, philip wrote: Got my code working so it generates a menu. Looked at WikiLoc in the Wiki Liftweb example, it has: def defaultParams = Full(WikiLoc(HomePage, false)) So I guessed that it needs to have something with a Full Changed it to: override val defaultParams = Full(NullLocParams) So now my code is case class DynMenuLoc ( override val name: String, override val link: Link[NullLocParams], override val text: LinkText[NullLocParams], _params: LocParam* ) extends Loc[NullLocParams] { override val params = _params.toList // had to comment this out: override val defaultValue = Full(()) // not sure what to set this to override val defaultParams = Full(NullLocParams) override def supplimentalKidMenuItems:List [net.liftweb.sitemap.MenuItem] = { Log.info(kid menu function called) var result:ListBuffer[net.liftweb.sitemap.MenuItem] = new ListBuffer[net.liftweb.sitemap.MenuItem] result + (new MenuItem(Text(A), Text(B), Nil, false, false, Nil)) result + (new MenuItem(Text(C), Text(D), Nil, false, false, Nil)) result.toList ::: super.supplimentalKidMenuItems } } Thats great, but still there is a problem of the top level menu. On 11月21日, 下午2時56分, Ross Mellgren dri...@gmail.com wrote: Here's an example of doing what David decribed (at least, as I understood it ;-) ): // In Boot.scala // Build SiteMap val entries = ... :: Menu(DynMenuLoc(Dynamic Menu, Link(List(dynamic), true, /dynamic), Dynamic Menu)) :: ... case class DynMenuLoc ( override val name: String, override val link: Link[Unit], override val text: LinkText[Unit], _params: LocParam[Unit]* ) extends Loc[Unit] { override val params = _params.toList override val defaultValue = Full(()) override def supplimentalKidMenuItems = { DynMenuItem.findAll.map(dmi = { MenuItem(Text(dmi.label.is), Text(dmi.link.is), Nil, false, false, Nil) }) ::: super.supplimentalKidMenuItems } } object DynMenuItem extends DynMenuItem with LongKeyedMetaMapper[DynMenuItem] with CRUDify[Long, DynMenuItem] class DynMenuItem extends LongKeyedMapper[DynMenuItem] with IdPK { def getSingleton = DynMenuItem object label extends MappedString(this, 32) object link extends MappedString(this, 255) } I can post the full example code on github if it'd help, also. -Ross On Nov 20, 2009, at 10:37 PM, philip wrote: Hi David, Really looking forward to this - I spent a day on this with absolute failure. Philip On 11月20日, 上午1時56分, David Pollak feeder.of.the.be...@gmail.com wrote: Philip list, I've had it on my to-do list to write up an example... and haven't... but... In your Loc, you can override def supplimentalKidMenuItems and dynamically generate kid menu items. I'll try to get to an example but not today... sorry :-( Thanks, David On Thu, Nov 19, 2009 at 12:35 AM, philip philip14...@gmail.com wrote: Hi David, Since I am programming a CMS for my client, I need my lift menu to come from the database. LiftRules.setSiteMap(SiteMap(MenuInfo.menu :_*)) def menu: List[Menu] = { Log.info(Menu called) ... It seems my menu function only gets called once, on subsquent calls I do not get any log message. Maybe I have to subclass SiteMap? Can you point me in the right direction? Thanks, Philip On 10月21日, 下午11時20分, David Pollak feeder.of.the.be...@gmail.com wrote: I owe the list example code to do this... maybe tomorrow. On Wed, Oct 21, 2009 at 6:26 AM, philip philip14...@gmail.com wrote: Hi, How can I get a Liftweb menu to be generated from database content? Alternatively, can the menu come from a XML datasource? could I load/ serialize from that? Could it change dynamically at any time? Thanks, Philip -- Lift, the simply functional web frameworkhttp://liftweb.net Beginning Scalahttp://www.apress.com/book/view/1430219890 Follow me:http://twitter.com/dpp Surf the harmonics -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com- . For more options, visit
[Lift] Change to support dynamic top level menu items
In the recent thread, a couple people asked for the ability to create dynamic menu items per request from the database. David suggested Loc.supplimentalKidMenuItems which works fine for dynamic children of a static menu, but doesn't support the ability to make the top level menu dynamic. Menu has a method called makeMenuItem which gives a Box of MenuItem. What about a new method makeMenuItems that gives a possible plurality of MenuItems whose default implementation deferred to the existing makeMenuItem in the case where it's not overridden? I made this change to my local copy of lift and it seems to work alright. Example Menu: case class DynMenu() extends Menu(Loc(dynmenu, Link(List(dynmenu), true, /dynmenu), Dynamic Menu)) { override def makeMenuItems(path: List[Loc[_]]): Iterable[MenuItem] = DynMenuItem.findAll.map(dmi = { MenuItem(Text(dmi.label.is), Text(dmi.link.is), Nil, false, false, Nil) }) } That is, a Menu can generate 0 or more MenuItems when the menu is being generated. The disadvantage I see is similar to the one with supplimentalKidMenuItems -- that is, you have to manually compute the attributes of MenuItem such as current. However, it does give you the full power to make whatever kind of menu items you want. I looked briefly at seeing if it would be feasible to use a function Box[Req] = SiteMap on LiftRules, but I think the RewritePF auto detection thing in LiftRules.setSiteMap prevents this from being the right thing. The change to lift-webkit: diff --git a/lift-base/lift-webkit/src/main/scala/net/liftweb/sitemap/Menu.scala b/lift-base/lift-webkit/src/main/scala/net/liftweb/sitemap/Menu.scala index d33d1dc..79194f5 100644 --- a/lift-base/lift-webkit/src/main/scala/net/liftweb/sitemap/Menu.scala +++ b/lift-base/lift-webkit/src/main/scala/net/liftweb/sitemap/Menu.scala @@ -61,8 +61,10 @@ case class Menu(loc: Loc[_], kids: Menu*) extends HasKids { } // def buildChildLine: List[MenuItem] = kids.toList.flatMap(m = m.loc.buildItem(Nil, false, false)) + def makeMenuItems(path: List[Loc[_]]): Iterable[MenuItem] = makeMenuItem(path) + def makeMenuItem(path: List[Loc[_]]): Box[MenuItem] = - loc.buildItem(loc.buildKidMenuItems(kids), _lastInPath(path), _inPath(path)) +loc.buildItem(loc.buildKidMenuItems(kids), _lastInPath(path), _inPath(path)) private def _inPath(in: List[Loc[_]]): Boolean = in match { case Nil = false diff --git a/lift-base/lift-webkit/src/main/scala/net/liftweb/sitemap/SiteMap.scala b/lift-base/lift-webkit/src/main/scala/net/liftweb/sitemap/SiteMap.scala index 7939938..f8fa307 100644 --- a/lift-base/lift-webkit/src/main/scala/net/liftweb/sitemap/SiteMap.scala +++ b/lift-base/lift-webkit/src/main/scala/net/liftweb/sitemap/SiteMap.scala @@ -66,7 +66,7 @@ case class SiteMap(globalParamFuncs: List[PartialFunction[Box[Req], Loc.AnyLocPa case Full(loc) = loc.breadCrumbs case _ = Nil } -CompleteMenu(kids.flatMap(_.makeMenuItem(path))) +CompleteMenu(kids.flatMap(_.makeMenuItems(path))) } } Thoughts? -Ross -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=.
[Lift] NPE in S.?! if used outside a request
I'm poking around the LiftTicket codebase, and currently it suffers from an NPE on Boot: ERROR - Failed to Boot java.lang.ExceptionInInitializerError at org.liftticket.liftticket.snippet.UserAdmin$.menus(UserAdmin.scala:41) at bootstrap.liftweb.Boot.buildMenus(Boot.scala:74) at bootstrap.liftweb.Boot.boot(Boot.scala:67) ... Caused by: java.lang.NullPointerException at net.liftweb.http.S$.$qmark$bang(S.scala:675) at net.liftweb.http.S$.$qmark(S.scala:636) at org.liftticket.liftticket.snippet.RoleAdmin$.init(RoleAdmin.scala:94) at org.liftticket.liftticket.snippet.RoleAdmin$.clinit(RoleAdmin.scala) ... 57 more This is apparently due to S._resBundle being null because S.init has not yet been entered, so S._resBundle.doWith(Nil) is not in the enclosing scope, and so: private def ?!(str: String, resBundle: List[ResourceBundle]): String = resBundle.flatMap(r = tryo(r.getObject(str) match { Blows up with NPE. resBundle is passed in from S.? by calling S.resourceBundles, which is defined thus: def resourceBundles: List[ResourceBundle] = { _resBundle.value match { case Nil = { // loads the resource bundles here } case bundles = bundles } } I don't think the resource bundles can be reasonably loaded outside a request since no locale can be computed -- the call site should lazily compute the menu text at request time using LinkText rather than eagerly using S.?, but the error case is not helpful. What I propose is changing S.resourceBundles like this: def resourceBundles: List[ResourceBundle] = { _resBundle.box match { case Full(Nil) = { // same code } case Full(bundles) = bundles case _ = { Log.error(Resource bundles cannot be loaded outside of a request scope since the current locale cannot be computed. Did you use S.? during Boot time?) Nil } } } -Ross -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=.
Re: [Lift] Re: Call it Lift 2.0
I think eclipse and maven might be two of the only projects following that convention (besides others in the eclipse ecosystem). The question in my mind is what is the popular version number convention in the Scala ecosystem. - Josh On Sat, Nov 21, 2009 at 9:59 AM, Heiko Seeberger seeber...@weiglewilczek.com wrote: Hi, Heiko, can you find the stated version number policies of 3 or 4 other well regarded open source projects? That will allow us to synthesize the best of what others have done into a coherent policy for Lift. Take a look at the recommended OSGi version policy: http://www.aqute.biz/Code/XBnd Then take a look at Eclipse (pretty well known, eh?): http://wiki.eclipse.org/index.php/Version_Numbering Both use a major increment (1.x - 2) to show breaking changes in API, a minor increment (1.1.x - 1.2) to show non-breaking changes in API and a micro increment to show internal (no class name changes, no method signature changes, ...) changes (e.g. bug fixes in the implementation). -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/liftweb?hl=. -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=.
Re: [Lift] NPE in S.?! if used outside a request
Ross, Where in your code are you calling this method? What I'd the context that puts it outside of a request? Cheers, Tim Sent from my iPhone On 21 Nov 2009, at 23:03, Ross Mellgren dri...@gmail.com wrote: I'm poking around the LiftTicket codebase, and currently it suffers from an NPE on Boot: ERROR - Failed to Boot java.lang.ExceptionInInitializerError at org.liftticket.liftticket.snippet.UserAdmin$.menus (UserAdmin.scala:41) at bootstrap.liftweb.Boot.buildMenus(Boot.scala:74) at bootstrap.liftweb.Boot.boot(Boot.scala:67) ... Caused by: java.lang.NullPointerException at net.liftweb.http.S$.$qmark$bang(S.scala:675) at net.liftweb.http.S$.$qmark(S.scala:636) at org.liftticket.liftticket.snippet.RoleAdmin$.init (RoleAdmin.scala:94) at org.liftticket.liftticket.snippet.RoleAdmin$.clinit (RoleAdmin.scala) ... 57 more This is apparently due to S._resBundle being null because S.init has not yet been entered, so S._resBundle.doWith(Nil) is not in the enclosing scope, and so: private def ?!(str: String, resBundle: List[ResourceBundle]): String = resBundle.flatMap(r = tryo(r.getObject(str) match { Blows up with NPE. resBundle is passed in from S.? by calling S.resourceBundles, which is defined thus: def resourceBundles: List[ResourceBundle] = { _resBundle.value match { case Nil = { // loads the resource bundles here } case bundles = bundles } } I don't think the resource bundles can be reasonably loaded outside a request since no locale can be computed -- the call site should lazily compute the menu text at request time using LinkText rather than eagerly using S.?, but the error case is not helpful. What I propose is changing S.resourceBundles like this: def resourceBundles: List[ResourceBundle] = { _resBundle.box match { case Full(Nil) = { // same code } case Full(bundles) = bundles case _ = { Log.error(Resource bundles cannot be loaded outside of a request scope since the current locale cannot be computed. Did you use S.? during Boot time?) Nil } } } -Ross -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/liftweb?hl= . -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=.
Re: [Lift] NPE in S.?! if used outside a request
It's being called to provide the link text for menus during sitemap creation at boot time, as well as during class initialization time to make some vals that contain error text. I believe initializing these at Boot time to be incorrect since the correct locale cannot be known until a request is made (unless you force one locale for the entire site, I guess), but the NPE seems uglier than providing an error log explaining the problem. -Ross On Nov 21, 2009, at 5:57 PM, Timothy Perrett wrote: Ross, Where in your code are you calling this method? What I'd the context that puts it outside of a request? Cheers, Tim Sent from my iPhone On 21 Nov 2009, at 23:03, Ross Mellgren dri...@gmail.com wrote: I'm poking around the LiftTicket codebase, and currently it suffers from an NPE on Boot: ERROR - Failed to Boot java.lang.ExceptionInInitializerError at org.liftticket.liftticket.snippet.UserAdmin$.menus (UserAdmin.scala:41) at bootstrap.liftweb.Boot.buildMenus(Boot.scala:74) at bootstrap.liftweb.Boot.boot(Boot.scala:67) ... Caused by: java.lang.NullPointerException at net.liftweb.http.S$.$qmark$bang(S.scala:675) at net.liftweb.http.S$.$qmark(S.scala:636) at org.liftticket.liftticket.snippet.RoleAdmin$.init (RoleAdmin.scala:94) at org.liftticket.liftticket.snippet.RoleAdmin$.clinit (RoleAdmin.scala) ... 57 more This is apparently due to S._resBundle being null because S.init has not yet been entered, so S._resBundle.doWith(Nil) is not in the enclosing scope, and so: private def ?!(str: String, resBundle: List[ResourceBundle]): String = resBundle.flatMap(r = tryo(r.getObject(str) match { Blows up with NPE. resBundle is passed in from S.? by calling S.resourceBundles, which is defined thus: def resourceBundles: List[ResourceBundle] = { _resBundle.value match { case Nil = { // loads the resource bundles here } case bundles = bundles } } I don't think the resource bundles can be reasonably loaded outside a request since no locale can be computed -- the call site should lazily compute the menu text at request time using LinkText rather than eagerly using S.?, but the error case is not helpful. What I propose is changing S.resourceBundles like this: def resourceBundles: List[ResourceBundle] = { _resBundle.box match { case Full(Nil) = { // same code } case Full(bundles) = bundles case _ = { Log.error(Resource bundles cannot be loaded outside of a request scope since the current locale cannot be computed. Did you use S.? during Boot time?) Nil } } } -Ross -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/liftweb?hl= . -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=. -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=.
Re: [Lift] NPE in S.?! if used outside a request
Oops I misspoke, the strToLinkText conversion is already lazy, so it's not the menu text, just the message. Here is the diff: @@ -91,7 +91,7 @@ object RoleAdmin { case _ = Text(S.?(No instance to delete)) } - val missingTemplate = Text(S.?(Missing template)) + def missingTemplate = Text(S.?(Missing template)) def menus = { import Loc._ -Ross On Nov 21, 2009, at 6:02 PM, Ross Mellgren wrote: It's being called to provide the link text for menus during sitemap creation at boot time, as well as during class initialization time to make some vals that contain error text. I believe initializing these at Boot time to be incorrect since the correct locale cannot be known until a request is made (unless you force one locale for the entire site, I guess), but the NPE seems uglier than providing an error log explaining the problem. -Ross On Nov 21, 2009, at 5:57 PM, Timothy Perrett wrote: Ross, Where in your code are you calling this method? What I'd the context that puts it outside of a request? Cheers, Tim Sent from my iPhone On 21 Nov 2009, at 23:03, Ross Mellgren dri...@gmail.com wrote: I'm poking around the LiftTicket codebase, and currently it suffers from an NPE on Boot: ERROR - Failed to Boot java.lang.ExceptionInInitializerError at org.liftticket.liftticket.snippet.UserAdmin$.menus (UserAdmin.scala:41) at bootstrap.liftweb.Boot.buildMenus(Boot.scala:74) at bootstrap.liftweb.Boot.boot(Boot.scala:67) ... Caused by: java.lang.NullPointerException at net.liftweb.http.S$.$qmark$bang(S.scala:675) at net.liftweb.http.S$.$qmark(S.scala:636) at org.liftticket.liftticket.snippet.RoleAdmin$.init (RoleAdmin.scala:94) at org.liftticket.liftticket.snippet.RoleAdmin$.clinit (RoleAdmin.scala) ... 57 more This is apparently due to S._resBundle being null because S.init has not yet been entered, so S._resBundle.doWith(Nil) is not in the enclosing scope, and so: private def ?!(str: String, resBundle: List[ResourceBundle]): String = resBundle.flatMap(r = tryo(r.getObject(str) match { Blows up with NPE. resBundle is passed in from S.? by calling S.resourceBundles, which is defined thus: def resourceBundles: List[ResourceBundle] = { _resBundle.value match { case Nil = { // loads the resource bundles here } case bundles = bundles } } I don't think the resource bundles can be reasonably loaded outside a request since no locale can be computed -- the call site should lazily compute the menu text at request time using LinkText rather than eagerly using S.?, but the error case is not helpful. What I propose is changing S.resourceBundles like this: def resourceBundles: List[ResourceBundle] = { _resBundle.box match { case Full(Nil) = { // same code } case Full(bundles) = bundles case _ = { Log.error(Resource bundles cannot be loaded outside of a request scope since the current locale cannot be computed. Did you use S.? during Boot time?) Nil } } } -Ross -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/liftweb?hl= . -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=. -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=.
Re: [Lift] NPE in S.?! if used outside a request
I agree that getting an NPE is less than desirable! I'm not sure things are wrong per-say; the defualt locale calculator has an app wide setting and there is nothing to say that that a user must implement their locale calculator in a particular way... This is one of the great things about lift ;-) So the issue here seems to be the lazy / eager evaluation of bald rather than localization out of request context? I'm all for getting rid of these NPE scenarios though :-) Cheers, Tim Sent from my iPhone On 22 Nov 2009, at 00:02, Ross Mellgren dri...@gmail.com wrote: It's being called to provide the link text for menus during sitemap creation at boot time, as well as during class initialization time to make some vals that contain error text. I believe initializing these at Boot time to be incorrect since the correct locale cannot be known until a request is made (unless you force one locale for the entire site, I guess), but the NPE seems uglier than providing an error log explaining the problem. -Ross On Nov 21, 2009, at 5:57 PM, Timothy Perrett wrote: Ross, Where in your code are you calling this method? What I'd the context that puts it outside of a request? Cheers, Tim Sent from my iPhone On 21 Nov 2009, at 23:03, Ross Mellgren dri...@gmail.com wrote: I'm poking around the LiftTicket codebase, and currently it suffers from an NPE on Boot: ERROR - Failed to Boot java.lang.ExceptionInInitializerError at org.liftticket.liftticket.snippet.UserAdmin$.menus (UserAdmin.scala:41) at bootstrap.liftweb.Boot.buildMenus(Boot.scala:74) at bootstrap.liftweb.Boot.boot(Boot.scala:67) ... Caused by: java.lang.NullPointerException at net.liftweb.http.S$.$qmark$bang(S.scala:675) at net.liftweb.http.S$.$qmark(S.scala:636) at org.liftticket.liftticket.snippet.RoleAdmin$.init (RoleAdmin.scala:94) at org.liftticket.liftticket.snippet.RoleAdmin$.clinit (RoleAdmin.scala) ... 57 more This is apparently due to S._resBundle being null because S.init has not yet been entered, so S._resBundle.doWith(Nil) is not in the enclosing scope, and so: private def ?!(str: String, resBundle: List[ResourceBundle]): String = resBundle.flatMap(r = tryo(r.getObject(str) match { Blows up with NPE. resBundle is passed in from S.? by calling S.resourceBundles, which is defined thus: def resourceBundles: List[ResourceBundle] = { _resBundle.value match { case Nil = { // loads the resource bundles here } case bundles = bundles } } I don't think the resource bundles can be reasonably loaded outside a request since no locale can be computed -- the call site should lazily compute the menu text at request time using LinkText rather than eagerly using S.?, but the error case is not helpful. What I propose is changing S.resourceBundles like this: def resourceBundles: List[ResourceBundle] = { _resBundle.box match { case Full(Nil) = { // same code } case Full(bundles) = bundles case _ = { Log.error(Resource bundles cannot be loaded outside of a request scope since the current locale cannot be computed. Did you use S.? during Boot time?) Nil } } } -Ross -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/liftweb?hl= . -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/liftweb?hl= . -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/liftweb?hl= . -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=.
Re: [Lift] NPE in S.?! if used outside a request
Hmm, you raise an interesting point. So I guess the situation is more variegated: 1) If you have a locale calculator that works per-request and does not have an app default, then it is definitely incorrect to call S.? out of a request context, 2) but if you have one that works app-wide then it should work -- but doesn't, unless you call S.init or one of those by yourself, 3) so my proposed error is not good. It would be nice to catch uses of S.? outside of a request context when your intended behavior is that you only have per-request locales, so I guess if that is the desire then one should make their locale calculator log the error text, and the change to lift should be something more like: def resourceBundles: List[ResourceBundle] = { -_resBundle.value match { - case Nil = { +_resBundle.box match { + case Full(bundles) if !bundles.isEmpty = bundles + case _ = { _resBundle.set(LiftRules.resourceNames.flatMap(name = tryo( List(ResourceBundle.getBundle(name, locale)) ).openOr( NamedPF.applyBox((name, locale), LiftRules.resourceBundleFactories.toList).map(List(_)) openOr Nil ))) _resBundle.value } - case bundles = bundles } } That is, if the _resBundle ThreadGlobal has not been initialized yet, or it's been initialized with the empty list, then do resource bundle loading. If it has been initialized with a non-empty list then use that. I don't think this should interact badly with S.init, since S.init uses _resBundle.doWith(Nil) ... which will both overwrite any loaded app-level bundles with the empty list, but also restore them upon completion of the S scope. -Ross On Nov 21, 2009, at 6:15 PM, Timothy Perrett wrote: I agree that getting an NPE is less than desirable! I'm not sure things are wrong per-say; the defualt locale calculator has an app wide setting and there is nothing to say that that a user must implement their locale calculator in a particular way... This is one of the great things about lift ;-) So the issue here seems to be the lazy / eager evaluation of bald rather than localization out of request context? I'm all for getting rid of these NPE scenarios though :-) Cheers, Tim Sent from my iPhone On 22 Nov 2009, at 00:02, Ross Mellgren dri...@gmail.com wrote: It's being called to provide the link text for menus during sitemap creation at boot time, as well as during class initialization time to make some vals that contain error text. I believe initializing these at Boot time to be incorrect since the correct locale cannot be known until a request is made (unless you force one locale for the entire site, I guess), but the NPE seems uglier than providing an error log explaining the problem. -Ross On Nov 21, 2009, at 5:57 PM, Timothy Perrett wrote: Ross, Where in your code are you calling this method? What I'd the context that puts it outside of a request? Cheers, Tim Sent from my iPhone On 21 Nov 2009, at 23:03, Ross Mellgren dri...@gmail.com wrote: I'm poking around the LiftTicket codebase, and currently it suffers from an NPE on Boot: ERROR - Failed to Boot java.lang.ExceptionInInitializerError at org.liftticket.liftticket.snippet.UserAdmin$.menus (UserAdmin.scala:41) at bootstrap.liftweb.Boot.buildMenus(Boot.scala:74) at bootstrap.liftweb.Boot.boot(Boot.scala:67) ... Caused by: java.lang.NullPointerException at net.liftweb.http.S$.$qmark$bang(S.scala:675) at net.liftweb.http.S$.$qmark(S.scala:636) at org.liftticket.liftticket.snippet.RoleAdmin$.init (RoleAdmin.scala:94) at org.liftticket.liftticket.snippet.RoleAdmin$.clinit (RoleAdmin.scala) ... 57 more This is apparently due to S._resBundle being null because S.init has not yet been entered, so S._resBundle.doWith(Nil) is not in the enclosing scope, and so: private def ?!(str: String, resBundle: List[ResourceBundle]): String = resBundle.flatMap(r = tryo(r.getObject(str) match { Blows up with NPE. resBundle is passed in from S.? by calling S.resourceBundles, which is defined thus: def resourceBundles: List[ResourceBundle] = { _resBundle.value match { case Nil = { // loads the resource bundles here } case bundles = bundles } } I don't think the resource bundles can be reasonably loaded outside a request since no locale can be computed -- the call site should lazily compute the menu text at request time using LinkText rather than eagerly using S.?, but the error case is not helpful. What I propose is changing S.resourceBundles like this: def resourceBundles: List[ResourceBundle] = { _resBundle.box match { case Full(Nil) = { // same code } case Full(bundles) = bundles case _ = { Log.error(Resource bundles cannot be loaded outside of a request scope since the current locale cannot be computed. Did you use S.? during Boot time?) Nil } } }
Re: [Lift] JPA and eager fetch
OK - just a quick follow up. I got a chance this afternoon to test the simple demo app that Jean-Luc suggested. I changed the mapping on books to be fetch=EAGER. and put a debug statement on the list method in authorOps. Of course it works just fine :-) - so the problem lies somewhere else in my code. I'll keep digging. Warren On Fri, Nov 20, 2009 at 12:48 PM, Warren Strange warren.stra...@gmail.com wrote: Jim and Jean-Luc - thanks so much for your offer of assistance. It might take me a while to put together a buildable sample. I'm just learning lift and scala right now. This is not a critical problem for me, and I can work around it. When I have something I will post a follow up. Warren On Fri, Nov 20, 2009 at 12:26 PM, Jean-Luc jlcane...@gmail.com wrote: Your mapping looks like normal. If you provide a buildable project, either tgz or link to github.com, I may be able to reproduce your problem and help you identify the issue. Jean-Luc PS : If you need a git project to fork, I just prepared http://github.com/jlcanela/scalajpademo (based on the maven scalajpa archetype) 2009/11/20 wstrange warren.stra...@gmail.com Newbie Lift / JPA alert! I am sure I am doing something dumb here, but I can't quite figure it out. I have a JPA project (modelled after the lift JPA demo app). I have an object with a one-to-many association, and I want to eager fetch the collection. It is declared like : �...@onetomany(){ val targetEntity = classOf[OpenIdUser], val cascade = Array(CascadeType.ALL), val fetch=FetchType.EAGER} var openIds : _root_.java.util.Set[OpenIdUser] = new _root_.java.util.HashSet[OpenIdUser]() In my spa persistence unit, eager fetching works fine from the unit test. The unit test uses plain old emf factory instances. However, from my web application (run with jetty:run) and using Model.createNamedQuery, or Model.find, only the parent object is fetched. The collection is not. I gather this has something to do with the way that Model works? Or are my annotations being ignored when they are packed in a .jar file? Clues would be appreciated. Thanks Warren -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=. -- Jean-Luc Canela jlcane...@gmail.com -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=. -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=.
[Lift] H2 Database?
Hi all, I'm planning for a simple project that involves a small web site and database. I plan to use Lift for the web part so that I can learn it. For database, I'm interested in H2 database for its speed and flexibility. I've seen H2 database mentioned a few times on the list. I wonder if those who have used it can tell me if it's a good idea to start a lift project with H2 database, and if there are anything to pay attention to when used with Lift? Do you use it in a standalone mode or embedded mode? Thanks. -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=.
[Lift] Re: H2 Database?
Hi, I am using H2 database without any problems so far. Just change the connection, use the right maven build or jars. val driverName: String = Props.get(db.driver) openOr org.h2.Driver val dbUrl: String = Props.get(db.url) openOr jdbc:h2:tcp://localhost/~/databasename On 11月22日, 上午9時30分, jlist9 jli...@gmail.com wrote: Hi all, I'm planning for a simple project that involves a small web site and database. I plan to use Lift for the web part so that I can learn it. For database, I'm interested in H2 database for its speed and flexibility. I've seen H2 database mentioned a few times on the list. I wonder if those who have used it can tell me if it's a good idea to start a lift project with H2 database, and if there are anything to pay attention to when used with Lift? Do you use it in a standalone mode or embedded mode? Thanks. -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=.
Re: [Lift] Issue 201 - checkbox not returning all checked
Looks like I was over-eager with the HPP stuff. Yeah, checkbox should return the entire list of things checked. On Sat, Nov 21, 2009 at 9:48 AM, Ross Mellgren dri...@gmail.com wrote: yejun on github opened up an issue: def checkbox[T](possible : Seq[T], actual : Seq[T], func : (Seq[T]) = Any, attrs : (String, String)*) Func will only return first element in possible when it is checked or List(). It is easily reproducible. Based on the type of func, I agree it looks like it should give all checked boxes, not just either the first checked box or an empty list. If it's supposed to be for a single checkbox only, then I think the type should be changed to Box[T] = Any, or at the very least a doc comment indicating that it only supports a single check box. This behavior was introduced withhttp://github.com/dpp/liftweb/commit/8b2a92a58ded608a0d3a7b6ead29cd2af6302c5e http://github.com/dpp/liftweb/commit/8b2a92a58ded608a0d3a7b6ead29cd2af6302c5e . Since there is no doc comment on the function I wanted to check what is the intended behavior before making and posting a patch to either do multiple checkbox or make the doc comment / type more clear and add another function to do the multi behavior. Thoughts? -Ross -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/liftweb?hl=. -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp Surf the harmonics -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=.
Re: [Lift] Re: H2 Database?
OK that's good to know. Thanks! I'll give that a try. On Sat, Nov 21, 2009 at 5:45 PM, philip philip14...@gmail.com wrote: Hi, I am using H2 database without any problems so far. Just change the connection, use the right maven build or jars. val driverName: String = Props.get(db.driver) openOr org.h2.Driver val dbUrl: String = Props.get(db.url) openOr jdbc:h2:tcp://localhost/~/databasename On 11月22日, 上午9時30分, jlist9 jli...@gmail.com wrote: Hi all, I'm planning for a simple project that involves a small web site and database. I plan to use Lift for the web part so that I can learn it. For database, I'm interested in H2 database for its speed and flexibility. I've seen H2 database mentioned a few times on the list. I wonder if those who have used it can tell me if it's a good idea to start a lift project with H2 database, and if there are anything to pay attention to when used with Lift? Do you use it in a standalone mode or embedded mode? Thanks. -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=. -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=.
Re: [Lift] Issue 201 - checkbox not returning all checked
On review board: http://reviewboard.liftweb.net/r/117/ I added a few doc comments to nearby stuff, let me know if there are inaccuracies or style changes that should be made. -Ross On Nov 21, 2009, at 9:37 PM, David Pollak wrote: Looks like I was over-eager with the HPP stuff. Yeah, checkbox should return the entire list of things checked. On Sat, Nov 21, 2009 at 9:48 AM, Ross Mellgren dri...@gmail.com wrote: yejun on github opened up an issue: def checkbox[T](possible : Seq[T], actual : Seq[T], func : (Seq[T]) = Any, attrs : (String, String)*) Func will only return first element in possible when it is checked or List(). It is easily reproducible. Based on the type of func, I agree it looks like it should give all checked boxes, not just either the first checked box or an empty list. If it's supposed to be for a single checkbox only, then I think the type should be changed to Box[T] = Any, or at the very least a doc comment indicating that it only supports a single check box. This behavior was introduced withhttp://github.com/dpp/liftweb/commit/8b2a92a58ded608a0d3a7b6ead29cd2af6302c5e. Since there is no doc comment on the function I wanted to check what is the intended behavior before making and posting a patch to either do multiple checkbox or make the doc comment / type more clear and add another function to do the multi behavior. Thoughts? -Ross -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=. -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp Surf the harmonics -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=. -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=.