[Lift] Re: OpenID defect and fix
It's done. On Mar 16, 3:05 am, David Pollak feeder.of.the.be...@gmail.com wrote: Marius, Go ahead and make the change. I think I'm the only one using the OpenID stuff and I'm happy to fix it. The following maven packages are heavily used and I consider it a serious negative to break APIs: lift-util, lift-http, and lift-mapper. The others I consider to be a little more slushy. Thanks, David On Sun, Mar 15, 2009 at 8:44 PM, marius d. marius.dan...@gmail.com wrote: Good points but OpenIdConsumer is typically not directly used. To make it work from your application you just use OpenIdVendor On Mar 15, 8:52 pm, Jan Lohre jan.lo...@googlemail.com wrote: Breaking the api IMHO needs stronger justification than naming consistency. But thats just my two cents. Kind regards, Jan 2009/3/15 Marius marius.dan...@gmail.com Folks, Writing about OpenID in LIftBook inherently made me use it so I can use valid examples. Everything worked smoothly ... util I turned off cookies. This broke the OpenID flow and the Identity Provider side returned an error page. There were two fundamental problems: 1. On redirect the Location was updated encodeURL from response regardless if this was an absolute URL and jsessionid part was becoming part of the redirect of the Identity Provider destination URL which was obviously wrong 2. OpenID code did not call S.encodeURL for the return_url meaning that the Identity Provider was redirecting back to our site and since jsessionid part was no there it was pocessed in the context of a new session and not the correct one. I will be committing the fix for this a a couple of minutes ... woks smooth now. But there is a minor thing. We have the traits: OpenIdVendor and OpenIDConsumer does anyone has any objections renaming OpenIDConsumer to OpenIdConsumer (for naming consistency purposes)? Br's, Marius -- Lift, the simply functional web frameworkhttp://liftweb.net Beginning Scalahttp://www.apress.com/book/view/1430219890 Follow me:http://twitter.com/dpp Git some:http://github.com/dpp --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Change default port 8080
A google search didnt't helpedthanks anyway! mvn -Djetty.port= jetty:run A google search would tell you this as well. On Mar 15, 2:37 pm, Tobias Daub hannes.flo...@gmx.li wrote: Hi Folks, Does anybody know how I can change the default port 8080? thanks! Tobias --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: xml parser, utf-8, special characters... kill me now
I agree - it does seem like we should really be doing this by default. Even chinese, hebrew and double byte languages will be good using UTF-8 right? Is there a reason someone might want to set it to another encoding / collation other than UTF-8? I cant think of one right now... @chas - from your previous post, are you saying your using maven on the server for production?! or did you just mean jetty...? Cheers Tim On Mar 16, 4:23 am, Derek Chen-Becker dchenbec...@gmail.com wrote: Argh. I even thought of that but setting it *after* the request had been accessed (by Lift internals) appears to have no effect. I suppose there's some caching going on there. Any possibility we could add a control to LiftRules? Something like: var totallyBrokenDefaultPostCharsetHandling = false Where a false value means we automatically set the request charset to UTF-8 and a true value means that we don't touch the request. My expectation given that we're already 9 years into the new millenium (yeah, yeah, only 8) is that *everything* on the net would be UTF-8 unless explicitly forced to be something else. Derek On Sun, Mar 15, 2009 at 8:34 PM, David Pollak feeder.of.the.be...@gmail.com wrote: On Mon, Mar 16, 2009 at 2:07 AM, Charles F. Munat c...@munat.com wrote: That's got it. I added it to the FAQ on the wiki. Thanks, David! Wish I'd been smart enough to ask this a week ago! I bloodies my head with that one for a good couple of weeks. Glad it's working. Chas. David Pollak wrote: Folks, Please make sure you've got this method in your Boot.scala class: /** * Force the request to be UTF-8 */ private def makeUtf8(req: HttpServletRequest) { req.setCharacterEncoding(UTF-8) } And also in the boot method, put: LiftRules.early.append(makeUtf8) By default, various app servers (Tomcat is the worst) does not use UTF-8... I mean WTF... the web is UTF unless otherwise specified. Anyway... please give that a try and let me know if it works. Thanks, David On Sun, Mar 15, 2009 at 1:26 PM, Derek Chen-Becker dchenbec...@gmail.com mailto:dchenbec...@gmail.com wrote: OK, I can replicate this in our PocketChange app (also going against a PostgreSQL DB). Let me dig a bit. Derek On Sun, Mar 15, 2009 at 3:58 AM, Charles F. Munat c...@munat.com mailto:c...@munat.com wrote: This might help, but I don't think I was clear. I have an online form. My clients enter text into it. Their text has characters like a c with a cedilla. That text gets saved into a PostgreSQL database (UTF-8) varchar field via JPA/Hibernate. Then I pull it back out and dump it into a template, and it comes out gibberish. If I try using ccedil; instead, I get amp;cedil; back out. Here is what I have: name - SHtml.text(thing.name http://thing.name, thing.name http://thing.name = _, (size, 40)) If I enter cachaça in the field, I get cachaça back out. The weird thing is that sometimes when I copy and paste text from another document into the form, it works. But if I use the keyboard, it fails every time. I'll play around with this. Thanks. Chas. Derek Chen-Becker wrote: Oops, forgot scala.xml.Unparsed, too: scala val m = spana{ scala.xml.Unparsed(ccedil;) }b/span m: scala.xml.Elem = spanaccedil;b/span That one might be what you're looking for. Derek On Sat, Mar 14, 2009 at 9:57 PM, Derek Chen-Becker dchenbec...@gmail.com mailto:dchenbec...@gmail.com mailto:dchenbec...@gmail.com mailto:dchenbec...@gmail.com wrote: I think it depends on how you're embedding them in the XML: scala val m = spanaccedil;b/span m: scala.xml.Elem = spanaccedil;b/span scala val m = spana{ccedil;}b/span m: scala.xml.Elem = spanaamp;ccedil;b/span scala val m = spana{ç}b/span m: scala.xml.Elem = spanaçb/span That last one was input using dead keys (alt+,) on my linux (USA International with dead keys) layout. Let me know if this doesn't help; if not, could you send the code/template that's having issues? Derek On Sat, Mar 14, 2009 at 6:36 PM, Charles F. Munat c...@munat.com mailto:c...@munat.com mailto:c...@munat.com mailto:c...@munat.com wrote: I have a site that uses a lot of special characters (a remarkably biased description, since there is nothing special
[Lift] Re: Where to continue after Getting Started?
Hi, the latest links to the builds return: Error CodeAccessDenied/Code MessageAccess Denied/Message RequestIdC87ED4585A9C1779/RequestId - HostId x0HS/frEu0GSF1QKQJDV0LpKWWhpp7azNbX3V3fYLLWLsMM9yGHAnqocYvh7YBCx /HostId /Error Could you fix this, please TIA Martin Derek Chen-Becker wrote: Tyler, Marius and I are writing a book on Lift. You can access the LyX source (as well as a few builds of the PDF) here: http://github.com/tjweir/liftbook/tree/master We hope to have something more formal soon. Derek On Sun, Mar 15, 2009 at 6:29 AM, erik.fris...@googlemail.com erik.fris...@googlemail.com wrote: Hi guys, I finally managed to work my way through the Getting Started examples. I am getting an impression of Lift, and I must say I am absolutely amazed. Now, I come pretty much from a PHP background. I did Java and Haskell (once a long, long time ago), I dare say I am a pretty good JavaScript programmer, but after reading through the Getting Started, I realize that I have a lot of work to do until I can truly appreciate the power of Lift (and Scala). I don't know where to continue, though. Do you guys know any good references (books, blogs,...) where someone like me can go now to increase my knowledge? I guess I could hack together a small app, but I feel like I am too stuck on my PHP perspective of things and don't really know how to productively program in Scala and Lift. So, any references, book recommendations, and so forth, would be GREATLY appreciated. And, once again, amazing work from what I can see so far. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: xml parser, utf-8, special characters... kill me now
Just Jetty on the server. Maven/Jetty while developing. (I'm not that dumb.) :-) Chas. Timothy Perrett wrote: I agree - it does seem like we should really be doing this by default. Even chinese, hebrew and double byte languages will be good using UTF-8 right? Is there a reason someone might want to set it to another encoding / collation other than UTF-8? I cant think of one right now... @chas - from your previous post, are you saying your using maven on the server for production?! or did you just mean jetty...? Cheers Tim On Mar 16, 4:23 am, Derek Chen-Becker dchenbec...@gmail.com wrote: Argh. I even thought of that but setting it *after* the request had been accessed (by Lift internals) appears to have no effect. I suppose there's some caching going on there. Any possibility we could add a control to LiftRules? Something like: var totallyBrokenDefaultPostCharsetHandling = false Where a false value means we automatically set the request charset to UTF-8 and a true value means that we don't touch the request. My expectation given that we're already 9 years into the new millenium (yeah, yeah, only 8) is that *everything* on the net would be UTF-8 unless explicitly forced to be something else. Derek On Sun, Mar 15, 2009 at 8:34 PM, David Pollak feeder.of.the.be...@gmail.com wrote: On Mon, Mar 16, 2009 at 2:07 AM, Charles F. Munat c...@munat.com wrote: That's got it. I added it to the FAQ on the wiki. Thanks, David! Wish I'd been smart enough to ask this a week ago! I bloodies my head with that one for a good couple of weeks. Glad it's working. Chas. David Pollak wrote: Folks, Please make sure you've got this method in your Boot.scala class: /** * Force the request to be UTF-8 */ private def makeUtf8(req: HttpServletRequest) { req.setCharacterEncoding(UTF-8) } And also in the boot method, put: LiftRules.early.append(makeUtf8) By default, various app servers (Tomcat is the worst) does not use UTF-8... I mean WTF... the web is UTF unless otherwise specified. Anyway... please give that a try and let me know if it works. Thanks, David On Sun, Mar 15, 2009 at 1:26 PM, Derek Chen-Becker dchenbec...@gmail.com mailto:dchenbec...@gmail.com wrote: OK, I can replicate this in our PocketChange app (also going against a PostgreSQL DB). Let me dig a bit. Derek On Sun, Mar 15, 2009 at 3:58 AM, Charles F. Munat c...@munat.com mailto:c...@munat.com wrote: This might help, but I don't think I was clear. I have an online form. My clients enter text into it. Their text has characters like a c with a cedilla. That text gets saved into a PostgreSQL database (UTF-8) varchar field via JPA/Hibernate. Then I pull it back out and dump it into a template, and it comes out gibberish. If I try using ccedil; instead, I get amp;cedil; back out. Here is what I have: name - SHtml.text(thing.name http://thing.name, thing.name http://thing.name = _, (size, 40)) If I enter cachaça in the field, I get cachaça back out. The weird thing is that sometimes when I copy and paste text from another document into the form, it works. But if I use the keyboard, it fails every time. I'll play around with this. Thanks. Chas. Derek Chen-Becker wrote: Oops, forgot scala.xml.Unparsed, too: scala val m = spana{ scala.xml.Unparsed(ccedil;) }b/span m: scala.xml.Elem = spanaccedil;b/span That one might be what you're looking for. Derek On Sat, Mar 14, 2009 at 9:57 PM, Derek Chen-Becker dchenbec...@gmail.com mailto:dchenbec...@gmail.com mailto:dchenbec...@gmail.com mailto:dchenbec...@gmail.com wrote: I think it depends on how you're embedding them in the XML: scala val m = spanaccedil;b/span m: scala.xml.Elem = spanaccedil;b/span scala val m = spana{ccedil;}b/span m: scala.xml.Elem = spanaamp;ccedil;b/span scala val m = spana{ç}b/span m: scala.xml.Elem = spanaçb/span That last one was input using dead keys (alt+,) on my linux (USA International with dead keys) layout. Let me know if this doesn't help; if not, could you send the code/template that's having issues? Derek On Sat, Mar 14, 2009 at 6:36 PM, Charles F. Munat c...@munat.com mailto:c...@munat.com mailto:c...@munat.com mailto:c...@munat.com wrote: I have a site that uses a lot of special characters (a remarkably biased description, since there is nothing special about accented characters to the
[Lift] Re: xml parser, utf-8, special characters... kill me now
Phew :) Out of interest, why do you want to use glashfish rather than jetty? Tim On 16/03/2009 10:08, Charles F. Munat c...@munat.com wrote: Just Jetty on the server. Maven/Jetty while developing. (I'm not that dumb.) :-) Chas. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Custom Boot Class
Jorge, I am using a custom Boot class and it works just fine. I believe that if you create a Brat.scala and put your class there, it will solve the problem Regards, Sergey On Mon, Mar 16, 2009 at 1:31 PM, Jorge Ortiz jorge.or...@gmail.com wrote: Folks, I'm trying to specify a custom Boot class, as per Chapter 3 of the Lift Book. To my web.xml I've added: context-param param-namebootloader/param-name param-valuebootstrap.liftweb.Brat/param-value /context-param and in Boot.scala I've commented out the regular Boot class and added a Brat class with identical implementation, except it extends Bootable. class Brat extends Bootable { ... } Unfortunately, I'm getting a: ERROR - Failed to Boot java.lang.ClassNotFoundException: bootstrap.liftweb.Boot Attached is the zipped project. Thanks, --j --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] XML unescaping
Hi, I've been mucking around with lift and having a great time. I have cooked up a page that retrieves XML from a datasource and renders it. However some of the text elements I extract are HTML encoded. When rendered in the browser it looks like HTML code, rather than rendered HTML. I looked for a scala utility to unescape this, found scala.xml.Utility.unescape, but could not get it working. Here's how I've tried to use it. val title = Utility.unescape(result \ title text, new StringBuilder) Unfortunately this always gives me a value of null, even though result.\(title).text is something like - Tsvangiraiamp;#39;s wife killed inlt;bgt;carlt;/bgt;crash - ABC News What could I be doing wrong? I realise this is probably a plain old scala question, but I hope someone here can help me anyway. Thanks Jeremy --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Objections to merging jpa archetype?
Isn't the templates-hidden directory still missing from http://github.com/dpp/liftweb/tree/master/lift-archetype-jpa-basic/src/main/resources/archetype-resources/web/src/main/webapp ? Best regards, Silvestre On 16 Mrz., 05:37, Derek Chen-Becker dchenbec...@gmail.com wrote: Darnit. I had this error before and thought I had it fixed. For some reason the **/* include in the archetype-metadata.xml doesn't match the default.html file. I've fixed it (again?) and pushed the changes. It should show up in a new build soon. In the meantime what you did should work fine, since the default.html is cribbed from the basic archetype anyway. Cheers, Derek On Sun, Mar 15, 2009 at 10:24 AM, Silvestre Zabala silves...@zabala.namewrote: Derek Chen-Becker wrote: OK, it built and deployed. I just confirmed that you can create it with: mvn archetype:generate \ -DarchetypeRepository=http://scala-tools.org/repo-snapshots\ -DarchetypeGroupId=net.liftweb \ -DarchetypeArtifactId=lift-archetype-jpa-basic \ -DarchetypeVersion=1.1-SNAPSHOT It seems as if the default.html template is missing from the archetype- resources. I've used the one from lift-archetype-basic to fix the xml error that occurs in Firefox. Best regards, Silvestre --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Custom Boot Class
I get the same error, unfortunately. --j On Mon, Mar 16, 2009 at 4:48 AM, Sergey Andreev andser...@gmail.com wrote: Jorge, I am using a custom Boot class and it works just fine. I believe that if you create a Brat.scala and put your class there, it will solve the problem Regards, Sergey On Mon, Mar 16, 2009 at 1:31 PM, Jorge Ortiz jorge.or...@gmail.comwrote: Folks, I'm trying to specify a custom Boot class, as per Chapter 3 of the Lift Book. To my web.xml I've added: context-param param-namebootloader/param-name param-valuebootstrap.liftweb.Brat/param-value /context-param and in Boot.scala I've commented out the regular Boot class and added a Brat class with identical implementation, except it extends Bootable. class Brat extends Bootable { ... } Unfortunately, I'm getting a: ERROR - Failed to Boot java.lang.ClassNotFoundException: bootstrap.liftweb.Boot Attached is the zipped project. Thanks, --j --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: xml parser, utf-8, special characters... kill me now
Im hosting several sites on a single jetty install - its working perfectly right now. Are you not familiar with the virtual hosting options in jetty? Its pretty well documented on their wiki and will let you host from the root context. Someone can correct me if im wrong, but until servlet 3.0 spec comes out, I believe were only supporting comet in Jetty. So if your planning a move to Glassfish, you'll loose the comet support. Can you not use the context deployer in jetty to do what you need? Thanks Tim On 16/03/2009 13:07, Charles F. Munat c...@munat.com wrote: Right now I'm running about a half dozen instances of Jetty (one per site). I'm starting them with java -jar ..., and stopping them with kill -9, which I think is a total hack. To find out what's running, I do a ps aux | grep jetty. Seriously? In 2009? With Glassfish (or Geronimo or equivalent), I get a nice interface and I can deploy pretty easily. I can see exactly what's going on. I can start and stop servlets easily, and I can set things up to restart automatically on server reboot (instead of writing a shell script). And I'm hoping that despite the higher overhead of Glassfish, that when I get enough sites in there it will be lower than running that many separate instances of Jetty. There may be other things I'd like to play with as well (access control, etc.). The thing that holds me back is that when I deploy multiple sites to Glassfish, a site like mysite.com is actually deployed to mysite.com/mysite. That extra context in the path is a showstopper. But I have been unable to figure out how to get rid of it. I'm open to other suggestions, but there has to be some way for me to host multiple sites with some sort of interface and an easy way to deploy, restart, monitor, etc. them. Chas. Timothy Perrett wrote: Phew :) Out of interest, why do you want to use glashfish rather than jetty? Tim On 16/03/2009 10:08, Charles F. Munat c...@munat.com wrote: Just Jetty on the server. Maven/Jetty while developing. (I'm not that dumb.) :-) Chas. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Where to continue after Getting Started?
I don't know what's wrong with GitHub, but I've put the latest PDF up on the Google groups web page under Files. Derek On Mon, Mar 16, 2009 at 3:37 AM, maku martin.kuhn...@gmail.com wrote: Hi, the latest links to the builds return: Error CodeAccessDenied/Code MessageAccess Denied/Message RequestIdC87ED4585A9C1779/RequestId - HostId x0HS/frEu0GSF1QKQJDV0LpKWWhpp7azNbX3V3fYLLWLsMM9yGHAnqocYvh7YBCx /HostId /Error Could you fix this, please TIA Martin Derek Chen-Becker wrote: Tyler, Marius and I are writing a book on Lift. You can access the LyX source (as well as a few builds of the PDF) here: http://github.com/tjweir/liftbook/tree/master We hope to have something more formal soon. Derek On Sun, Mar 15, 2009 at 6:29 AM, erik.fris...@googlemail.com erik.fris...@googlemail.com wrote: Hi guys, I finally managed to work my way through the Getting Started examples. I am getting an impression of Lift, and I must say I am absolutely amazed. Now, I come pretty much from a PHP background. I did Java and Haskell (once a long, long time ago), I dare say I am a pretty good JavaScript programmer, but after reading through the Getting Started, I realize that I have a lot of work to do until I can truly appreciate the power of Lift (and Scala). I don't know where to continue, though. Do you guys know any good references (books, blogs,...) where someone like me can go now to increase my knowledge? I guess I could hack together a small app, but I feel like I am too stuck on my PHP perspective of things and don't really know how to productively program in Scala and Lift. So, any references, book recommendations, and so forth, would be GREATLY appreciated. And, once again, amazing work from what I can see so far. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: XML unescaping
Well, it may be that the XML output portion of Scala is escaping your ampersands a second time. For instance, check out this session in the interpreter: scala val title = Catsby amp; Twisp title: java.lang.String = Catsby amp; Twisp scala val escaped = span{title}/span escaped: scala.xml.Elem = spanCatsby amp;amp; Twisp/span scala val unescaped = span{ scala.xml.Unparsed(title) }/span unescaped: scala.xml.Elem = spanCatsby amp; Twisp/span Note that if you embed a String within XML elements, Scala will automatically escape any ampersands unless you wrap the String in a scala.xml.Unparsed instance. The second test there will render in the browser like Catsby amp; Twisp, because the ampersand was escaped. I know you're asking about the Utility object, but I think that would be fixing the symptom rather than the cause. Derek On Mon, Mar 16, 2009 at 6:13 AM, Jeremy Mawson jeremy.mawson.w...@gmail.com wrote: Hi, I've been mucking around with lift and having a great time. I have cooked up a page that retrieves XML from a datasource and renders it. However some of the text elements I extract are HTML encoded. When rendered in the browser it looks like HTML code, rather than rendered HTML. I looked for a scala utility to unescape this, found scala.xml.Utility.unescape, but could not get it working. Here's how I've tried to use it. val title = Utility.unescape(result \ title text, new StringBuilder) Unfortunately this always gives me a value of null, even though result.\(title).text is something like - Tsvangiraiamp;#39;s wife killed inlt;bgt;carlt;/bgt;crash - ABC News What could I be doing wrong? I realise this is probably a plain old scala question, but I hope someone here can help me anyway. Thanks Jeremy --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Objections to merging jpa archetype?
Argh. It is now. I was building local and so it picked it up. For some reason, Git didn't add this file when I committed, and didn't show the file as missing (no .gitignore, either). Sorry about that. Derek On Mon, Mar 16, 2009 at 6:15 AM, Silvestre Zabala silves...@zabala.namewrote: Isn't the templates-hidden directory still missing from http://github.com/dpp/liftweb/tree/master/lift-archetype-jpa-basic/src/main/resources/archetype-resources/web/src/main/webapp ? Best regards, Silvestre On 16 Mrz., 05:37, Derek Chen-Becker dchenbec...@gmail.com wrote: Darnit. I had this error before and thought I had it fixed. For some reason the **/* include in the archetype-metadata.xml doesn't match the default.html file. I've fixed it (again?) and pushed the changes. It should show up in a new build soon. In the meantime what you did should work fine, since the default.html is cribbed from the basic archetype anyway. Cheers, Derek On Sun, Mar 15, 2009 at 10:24 AM, Silvestre Zabala silves...@zabala.namewrote: Derek Chen-Becker wrote: OK, it built and deployed. I just confirmed that you can create it with: mvn archetype:generate \ -DarchetypeRepository=http://scala-tools.org/repo-snapshots\ -DarchetypeGroupId=net.liftweb \ -DarchetypeArtifactId=lift-archetype-jpa-basic \ -DarchetypeVersion=1.1-SNAPSHOT It seems as if the default.html template is missing from the archetype- resources. I've used the one from lift-archetype-basic to fix the xml error that occurs in Firefox. Best regards, Silvestre --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Custom Boot Class
I wonder if this is something that broke when we moved to a Filter... Derek On Mon, Mar 16, 2009 at 7:02 AM, Jorge Ortiz jorge.or...@gmail.com wrote: I get the same error, unfortunately. --j On Mon, Mar 16, 2009 at 4:48 AM, Sergey Andreev andser...@gmail.comwrote: Jorge, I am using a custom Boot class and it works just fine. I believe that if you create a Brat.scala and put your class there, it will solve the problem Regards, Sergey On Mon, Mar 16, 2009 at 1:31 PM, Jorge Ortiz jorge.or...@gmail.comwrote: Folks, I'm trying to specify a custom Boot class, as per Chapter 3 of the Lift Book. To my web.xml I've added: context-param param-namebootloader/param-name param-valuebootstrap.liftweb.Brat/param-value /context-param and in Boot.scala I've commented out the regular Boot class and added a Brat class with identical implementation, except it extends Bootable. class Brat extends Bootable { ... } Unfortunately, I'm getting a: ERROR - Failed to Boot java.lang.ClassNotFoundException: bootstrap.liftweb.Boot Attached is the zipped project. Thanks, --j --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Starting with Lift on the wiki
Thanks. The link on liftweb.net under the Jump right in! section should probably be updated. On Mon, Mar 16, 2009 at 12:39 AM, Derek Chen-Becker dchenbec...@gmail.com wrote: Maybe, but in any case that's the old link. The newest version is at http://liftweb.net/docs/getting_started.html In both PDF and HTML. Derek On Sun, Mar 15, 2009 at 1:51 PM, Xavi Ramirez xavi@gmail.com wrote: Hello, Would you guys be amenable to adding Starting with Lift (http://static.liftweb.net/StartingWithLift.pdf) to the lift wiki? It's an excellent tutorial and I think it'd benefit from things like easy copy-and-pasteing, hyperlinks to relevant material, and syntax highlighting. It'll also make it easier to maintain as the Lift framework evolves. Thanks, Xavi --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: why is the lift web framework scalable?
Depending on what your workload and goals are, Lift can scale quite nicely by just adding more boxes as long as you have session affinity (and a load balancer). Derek On Sun, Mar 15, 2009 at 7:34 PM, parag978978 parag978...@gmail.com wrote: I want to know the technical reasons why the lift webframework has high performance and scalability? I know it uses scala, which has an actor library, but according to the install instructions it default configuration is with jetty. So does it use the actor library to scale? Now is the scalability built right out of the box. Just add additional servers and nodes and it will automatically scale, is that how it works? Can t handle 50+ concurrent connections with supporting servers. I am trying to create a web services framework for the enterprise level, that can beat what is out there and is easy to scale, configurable, and maintainable. My definition of scaling is just adding more servers and you should be able to accommodate the extra load. Thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Starting with Lift on the wiki
Doh. Fixed, but give it a minute to push out to the site. Thanks, Derek On Mon, Mar 16, 2009 at 7:06 AM, Xavi Ramirez xavi@gmail.com wrote: Thanks. The link on liftweb.net under the Jump right in! section should probably be updated. On Mon, Mar 16, 2009 at 12:39 AM, Derek Chen-Becker dchenbec...@gmail.com wrote: Maybe, but in any case that's the old link. The newest version is at http://liftweb.net/docs/getting_started.html In both PDF and HTML. Derek On Sun, Mar 15, 2009 at 1:51 PM, Xavi Ramirez xavi@gmail.com wrote: Hello, Would you guys be amenable to adding Starting with Lift (http://static.liftweb.net/StartingWithLift.pdf) to the lift wiki? It's an excellent tutorial and I think it'd benefit from things like easy copy-and-pasteing, hyperlinks to relevant material, and syntax highlighting. It'll also make it easier to maintain as the Lift framework evolves. Thanks, Xavi --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Change default port 8080
On Sun, Mar 15, 2009 at 11:48 PM, Tobias Daub hannes.flo...@gmx.li wrote: A google search didnt't helpedthanks anyway! Please feel encouraged to post questions like this to this group. We're here to help and the knowledge base grows. You're only obligation is to help out other people when they have questions that you know the answer to. :-) mvn -Djetty.port= jetty:run A google search would tell you this as well. On Mar 15, 2:37 pm, Tobias Daub hannes.flo...@gmx.li wrote: Hi Folks, Does anybody know how I can change the default port 8080? thanks! Tobias -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp Git some: http://github.com/dpp --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Custom Boot Class
No, it was working when we switched to the filter. :/ On Mon, Mar 16, 2009 at 2:58 PM, Derek Chen-Becker dchenbec...@gmail.comwrote: I wonder if this is something that broke when we moved to a Filter... Derek On Mon, Mar 16, 2009 at 7:02 AM, Jorge Ortiz jorge.or...@gmail.comwrote: I get the same error, unfortunately. --j On Mon, Mar 16, 2009 at 4:48 AM, Sergey Andreev andser...@gmail.comwrote: Jorge, I am using a custom Boot class and it works just fine. I believe that if you create a Brat.scala and put your class there, it will solve the problem Regards, Sergey On Mon, Mar 16, 2009 at 1:31 PM, Jorge Ortiz jorge.or...@gmail.comwrote: Folks, I'm trying to specify a custom Boot class, as per Chapter 3 of the Lift Book. To my web.xml I've added: context-param param-namebootloader/param-name param-valuebootstrap.liftweb.Brat/param-value /context-param and in Boot.scala I've commented out the regular Boot class and added a Brat class with identical implementation, except it extends Bootable. class Brat extends Bootable { ... } Unfortunately, I'm getting a: ERROR - Failed to Boot java.lang.ClassNotFoundException: bootstrap.liftweb.Boot Attached is the zipped project. Thanks, --j -- Viktor Klang Senior Systems Analyst --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Custom Boot Class
I think we might have an error in the book. The example you give uses context-param, but I think it needs to be an init-param within the filter portion of the web.xml. Derek On Mon, Mar 16, 2009 at 9:04 AM, Viktor Klang viktor.kl...@gmail.comwrote: No, it was working when we switched to the filter. :/ On Mon, Mar 16, 2009 at 2:58 PM, Derek Chen-Becker dchenbec...@gmail.comwrote: I wonder if this is something that broke when we moved to a Filter... Derek On Mon, Mar 16, 2009 at 7:02 AM, Jorge Ortiz jorge.or...@gmail.comwrote: I get the same error, unfortunately. --j On Mon, Mar 16, 2009 at 4:48 AM, Sergey Andreev andser...@gmail.comwrote: Jorge, I am using a custom Boot class and it works just fine. I believe that if you create a Brat.scala and put your class there, it will solve the problem Regards, Sergey On Mon, Mar 16, 2009 at 1:31 PM, Jorge Ortiz jorge.or...@gmail.comwrote: Folks, I'm trying to specify a custom Boot class, as per Chapter 3 of the Lift Book. To my web.xml I've added: context-param param-namebootloader/param-name param-valuebootstrap.liftweb.Brat/param-value /context-param and in Boot.scala I've commented out the regular Boot class and added a Brat class with identical implementation, except it extends Bootable. class Brat extends Bootable { ... } Unfortunately, I'm getting a: ERROR - Failed to Boot java.lang.ClassNotFoundException: bootstrap.liftweb.Boot Attached is the zipped project. Thanks, --j -- Viktor Klang Senior Systems Analyst --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Custom Boot Class
Just confirmed. Changing you web.xml to: ?xml version=1.0 encoding=ISO-8859-1? !DOCTYPE web-app PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN http://java.sun.com/dtd/web-app_2_3.dtd; web-app filter filter-nameLiftFilter/filter-name display-nameLift Filter/display-name descriptionThe Filter that intercepts lift calls/description filter-classnet.liftweb.http.LiftFilter/filter-class init-param param-namebootloader/param-name param-valuebootstrap.liftweb.Brat/param-value /init-param /filter filter-mapping filter-nameLiftFilter/filter-name url-pattern/*/url-pattern /filter-mapping /web-app Fixes it. I'll fix the book. Derek On Mon, Mar 16, 2009 at 9:19 AM, Derek Chen-Becker dchenbec...@gmail.comwrote: I think we might have an error in the book. The example you give uses context-param, but I think it needs to be an init-param within the filter portion of the web.xml. Derek On Mon, Mar 16, 2009 at 9:04 AM, Viktor Klang viktor.kl...@gmail.comwrote: No, it was working when we switched to the filter. :/ On Mon, Mar 16, 2009 at 2:58 PM, Derek Chen-Becker dchenbec...@gmail.com wrote: I wonder if this is something that broke when we moved to a Filter... Derek On Mon, Mar 16, 2009 at 7:02 AM, Jorge Ortiz jorge.or...@gmail.comwrote: I get the same error, unfortunately. --j On Mon, Mar 16, 2009 at 4:48 AM, Sergey Andreev andser...@gmail.comwrote: Jorge, I am using a custom Boot class and it works just fine. I believe that if you create a Brat.scala and put your class there, it will solve the problem Regards, Sergey On Mon, Mar 16, 2009 at 1:31 PM, Jorge Ortiz jorge.or...@gmail.comwrote: Folks, I'm trying to specify a custom Boot class, as per Chapter 3 of the Lift Book. To my web.xml I've added: context-param param-namebootloader/param-name param-valuebootstrap.liftweb.Brat/param-value /context-param and in Boot.scala I've commented out the regular Boot class and added a Brat class with identical implementation, except it extends Bootable. class Brat extends Bootable { ... } Unfortunately, I'm getting a: ERROR - Failed to Boot java.lang.ClassNotFoundException: bootstrap.liftweb.Boot Attached is the zipped project. Thanks, --j -- Viktor Klang Senior Systems Analyst --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: why is the lift web framework scalable?
On Sun, Mar 15, 2009 at 6:34 PM, parag978978 parag978...@gmail.com wrote: I want to know the technical reasons why the lift webframework has high performance and scalability? The JVM and not getting in its way. :-) The JVM is the best way to deploy high performance software. HotSpot does a better job of optimizing code than any static compiler and GC-based memory management is faster in aggregate than malloc/free. Yes, folks can find micro-benchmarks that demonstrate that C programs are faster, but those examples don't scale as the complexity of the systems grow. Scala's immutable data structures make scaling apps much easier. I know it uses scala, which has an actor library, but according to the install instructions it default configuration is with jetty. So does it use the actor library to scale? Actors and Jetty have nothing to do with each other. Lift takes advantage of Jetty and Servlet 3.0 continuations for long polling operations. Lift also use Actors for long polling so there are no threads consumed during the polling. Now is the scalability built right out of the box. Just add additional servers and nodes and it will automatically scale, is that how it works? Can t handle 50+ concurrent connections with supporting servers. Can you elaborate on this goal. There's no enterprise system that I know of that has this kind of requirement. Most enterprise systems need no support more than a few thousand open sessions. Even the largest companies don't have more than a few thousand people accessing the same app. Thanks, David I am trying to create a web services framework for the enterprise level, that can beat what is out there and is easy to scale, configurable, and maintainable. My definition of scaling is just adding more servers and you should be able to accommodate the extra load. Thanks -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp Git some: http://github.com/dpp --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Error in Msgs
Line 54 in net.liftweb.builtin.snippet.Msgs.scala reads: (styles \\ error_msg \\ @class)), 1), It should read: (styles \\ warning_msg \\ @class)), 1), Chas. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Error in Msgs
You're right. Can you fix and commit it ? On Mar 16, 8:20 pm, Charles F. Munat c...@munat.com wrote: Line 54 in net.liftweb.builtin.snippet.Msgs.scala reads: (styles \\ error_msg \\ @class)), 1), It should read: (styles \\ warning_msg \\ @class)), 1), Chas. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Error in Msgs
On Mon, Mar 16, 2009 at 11:49 AM, marius d. marius.dan...@gmail.com wrote: You're right. Can you fix and commit it ? Charles is not on the committer list. We need to fix this in 1.1 and the 1.0 branch. On Mar 16, 8:20 pm, Charles F. Munat c...@munat.com wrote: Line 54 in net.liftweb.builtin.snippet.Msgs.scala reads: (styles \\ error_msg \\ @class)), 1), It should read: (styles \\ warning_msg \\ @class)), 1), Chas. -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp Git some: http://github.com/dpp --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: xml parser, utf-8, special characters... kill me now
On Mon, Mar 16, 2009 at 6:39 AM, Timothy Perrett timo...@getintheloop.euwrote: Im hosting several sites on a single jetty install - its working perfectly right now. Are you not familiar with the virtual hosting options in jetty? Its pretty well documented on their wiki and will let you host from the root context. Someone can correct me if im wrong, but until servlet 3.0 spec comes out, I believe were only supporting comet in Jetty. So if your planning a move to Glassfish, you'll loose the comet support. This is absolutely wrong. Lift supports Comet *NO MATTER WHAT CONTAINER YOU USE*!!! (Sorry for jumping up and down on this, but it's very important that people not think that Lift's features are container dependent.) Lift takes advantage of Jetty continuations to reduce resource consumption on the server by not consuming a thread during long polling. This means that if you have more than 500 simultaneous connections to a server, it'll consume a ton of resources on Tomcat and very few on Jetty. Can you not use the context deployer in jetty to do what you need? Thanks Tim On 16/03/2009 13:07, Charles F. Munat c...@munat.com wrote: Right now I'm running about a half dozen instances of Jetty (one per site). I'm starting them with java -jar ..., and stopping them with kill -9, which I think is a total hack. To find out what's running, I do a ps aux | grep jetty. Seriously? In 2009? With Glassfish (or Geronimo or equivalent), I get a nice interface and I can deploy pretty easily. I can see exactly what's going on. I can start and stop servlets easily, and I can set things up to restart automatically on server reboot (instead of writing a shell script). And I'm hoping that despite the higher overhead of Glassfish, that when I get enough sites in there it will be lower than running that many separate instances of Jetty. There may be other things I'd like to play with as well (access control, etc.). The thing that holds me back is that when I deploy multiple sites to Glassfish, a site like mysite.com is actually deployed to mysite.com/mysite. That extra context in the path is a showstopper. But I have been unable to figure out how to get rid of it. I'm open to other suggestions, but there has to be some way for me to host multiple sites with some sort of interface and an easy way to deploy, restart, monitor, etc. them. Chas. Timothy Perrett wrote: Phew :) Out of interest, why do you want to use glashfish rather than jetty? Tim On 16/03/2009 10:08, Charles F. Munat c...@munat.com wrote: Just Jetty on the server. Maven/Jetty while developing. (I'm not that dumb.) :-) Chas. -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp Git some: http://github.com/dpp --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: xml parser, utf-8, special characters... kill me now
Sorry! My bad we¹ve had so many convo¹s about this and I had become muddled :-) I was talking about continuations as you say, not the the comet support! Sorry again! Doh! Cheers, Tim On 16/03/2009 19:15, David Pollak feeder.of.the.be...@gmail.com wrote: On Mon, Mar 16, 2009 at 6:39 AM, Timothy Perrett timo...@getintheloop.eu wrote: Im hosting several sites on a single jetty install - its working perfectly right now. Are you not familiar with the virtual hosting options in jetty? Its pretty well documented on their wiki and will let you host from the root context. Someone can correct me if im wrong, but until servlet 3.0 spec comes out, I believe were only supporting comet in Jetty. So if your planning a move to Glassfish, you'll loose the comet support. This is absolutely wrong. Lift supports Comet *NO MATTER WHAT CONTAINER YOU USE*!!! (Sorry for jumping up and down on this, but it's very important that people not think that Lift's features are container dependent.) Lift takes advantage of Jetty continuations to reduce resource consumption on the server by not consuming a thread during long polling. This means that if you have more than 500 simultaneous connections to a server, it'll consume a ton of resources on Tomcat and very few on Jetty. Can you not use the context deployer in jetty to do what you need? Thanks Tim On 16/03/2009 13:07, Charles F. Munat c...@munat.com wrote: Right now I'm running about a half dozen instances of Jetty (one per site). I'm starting them with java -jar ..., and stopping them with kill -9, which I think is a total hack. To find out what's running, I do a ps aux | grep jetty. Seriously? In 2009? With Glassfish (or Geronimo or equivalent), I get a nice interface and I can deploy pretty easily. I can see exactly what's going on. I can start and stop servlets easily, and I can set things up to restart automatically on server reboot (instead of writing a shell script). And I'm hoping that despite the higher overhead of Glassfish, that when I get enough sites in there it will be lower than running that many separate instances of Jetty. There may be other things I'd like to play with as well (access control, etc.). The thing that holds me back is that when I deploy multiple sites to Glassfish, a site like mysite.com http://mysite.com is actually deployed to mysite.com/mysite http://mysite.com/mysite . That extra context in the path is a showstopper. But I have been unable to figure out how to get rid of it. I'm open to other suggestions, but there has to be some way for me to host multiple sites with some sort of interface and an easy way to deploy, restart, monitor, etc. them. Chas. Timothy Perrett wrote: Phew :) Out of interest, why do you want to use glashfish rather than jetty? Tim On 16/03/2009 10:08, Charles F. Munat c...@munat.com wrote: Just Jetty on the server. Maven/Jetty while developing. (I'm not that dumb.) :-) Chas. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Error in Msgs
Heh, heh. You don't want me sticking my nose in there... Chas. marius d. wrote: You're right. Can you fix and commit it ? On Mar 16, 8:20 pm, Charles F. Munat c...@munat.com wrote: Line 54 in net.liftweb.builtin.snippet.Msgs.scala reads: (styles \\ error_msg \\ @class)), 1), It should read: (styles \\ warning_msg \\ @class)), 1), Chas. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: xml parser, utf-8, special characters... kill me now
That's good to know. But now that Tim has made me aware of the possibilities of Jetty, I might be persuaded to stick with it. Need to figure out how to host multiple sites in one instance, and discover where this context deployer is hidden. If I can get that running, I write a brief tutorial for the website. (Don't hold your breath... I'm buried with work and not very bright.) Chas. David Pollak wrote: On Mon, Mar 16, 2009 at 6:39 AM, Timothy Perrett timo...@getintheloop.eu wrote: Im hosting several sites on a single jetty install - its working perfectly right now. Are you not familiar with the virtual hosting options in jetty? Its pretty well documented on their wiki and will let you host from the root context. Someone can correct me if im wrong, but until servlet 3.0 spec comes out, I believe were only supporting comet in Jetty. So if your planning a move to Glassfish, you'll loose the comet support. This is absolutely wrong. Lift supports Comet *NO MATTER WHAT CONTAINER YOU USE*!!! (Sorry for jumping up and down on this, but it's very important that people not think that Lift's features are container dependent.) Lift takes advantage of Jetty continuations to reduce resource consumption on the server by not consuming a thread during long polling. This means that if you have more than 500 simultaneous connections to a server, it'll consume a ton of resources on Tomcat and very few on Jetty. Can you not use the context deployer in jetty to do what you need? Thanks Tim On 16/03/2009 13:07, Charles F. Munat c...@munat.com mailto:c...@munat.com wrote: Right now I'm running about a half dozen instances of Jetty (one per site). I'm starting them with java -jar ..., and stopping them with kill -9, which I think is a total hack. To find out what's running, I do a ps aux | grep jetty. Seriously? In 2009? With Glassfish (or Geronimo or equivalent), I get a nice interface and I can deploy pretty easily. I can see exactly what's going on. I can start and stop servlets easily, and I can set things up to restart automatically on server reboot (instead of writing a shell script). And I'm hoping that despite the higher overhead of Glassfish, that when I get enough sites in there it will be lower than running that many separate instances of Jetty. There may be other things I'd like to play with as well (access control, etc.). The thing that holds me back is that when I deploy multiple sites to Glassfish, a site like mysite.com http://mysite.com is actually deployed to mysite.com/mysite http://mysite.com/mysite. That extra context in the path is a showstopper. But I have been unable to figure out how to get rid of it. I'm open to other suggestions, but there has to be some way for me to host multiple sites with some sort of interface and an easy way to deploy, restart, monitor, etc. them. Chas. Timothy Perrett wrote: Phew :) Out of interest, why do you want to use glashfish rather than jetty? Tim On 16/03/2009 10:08, Charles F. Munat c...@munat.com mailto:c...@munat.com wrote: Just Jetty on the server. Maven/Jetty while developing. (I'm not that dumb.) :-) Chas. -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp Git some: http://github.com/dpp --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: xml parser, utf-8, special characters... kill me now
Where's Lassie when you need her? Timothy Perrett wrote: Sorry! My bad – we’ve had so many convo’s about this and I had become muddled :-) I was talking about continuations as you say, not the the comet support! Sorry again! Doh! Cheers, Tim On 16/03/2009 19:15, David Pollak feeder.of.the.be...@gmail.com wrote: On Mon, Mar 16, 2009 at 6:39 AM, Timothy Perrett timo...@getintheloop.eu wrote: Im hosting several sites on a single jetty install - its working perfectly right now. Are you not familiar with the virtual hosting options in jetty? Its pretty well documented on their wiki and will let you host from the root context. Someone can correct me if im wrong, but until servlet 3.0 spec comes out, I believe were only supporting comet in Jetty. So if your planning a move to Glassfish, you'll loose the comet support. This is absolutely wrong. Lift supports Comet *NO MATTER WHAT CONTAINER YOU USE*!!! (Sorry for jumping up and down on this, but it's very important that people not think that Lift's features are container dependent.) Lift takes advantage of Jetty continuations to reduce resource consumption on the server by not consuming a thread during long polling. This means that if you have more than 500 simultaneous connections to a server, it'll consume a ton of resources on Tomcat and very few on Jetty. Can you not use the context deployer in jetty to do what you need? Thanks Tim On 16/03/2009 13:07, Charles F. Munat c...@munat.com wrote: Right now I'm running about a half dozen instances of Jetty (one per site). I'm starting them with java -jar ..., and stopping them with kill -9, which I think is a total hack. To find out what's running, I do a ps aux | grep jetty. Seriously? In 2009? With Glassfish (or Geronimo or equivalent), I get a nice interface and I can deploy pretty easily. I can see exactly what's going on. I can start and stop servlets easily, and I can set things up to restart automatically on server reboot (instead of writing a shell script). And I'm hoping that despite the higher overhead of Glassfish, that when I get enough sites in there it will be lower than running that many separate instances of Jetty. There may be other things I'd like to play with as well (access control, etc.). The thing that holds me back is that when I deploy multiple sites to Glassfish, a site like mysite.com http://mysite.com is actually deployed to mysite.com/mysite http://mysite.com/mysite . That extra context in the path is a showstopper. But I have been unable to figure out how to get rid of it. I'm open to other suggestions, but there has to be some way for me to host multiple sites with some sort of interface and an easy way to deploy, restart, monitor, etc. them. Chas. Timothy Perrett wrote: Phew :) Out of interest, why do you want to use glashfish rather than jetty? Tim On 16/03/2009 10:08, Charles F. Munat c...@munat.com wrote: Just Jetty on the server. Maven/Jetty while developing. (I'm not that dumb.) :-) Chas. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: xml parser, utf-8, special characters... kill me now
Lol! Lassie?! What?! Haha. Check out this in my jetty.xml: New class=org.mortbay.jetty.webapp.WebAppContext ArgRef id=Contexts//Arg ArgSystemProperty name=jetty.home//webapps/myapplication.war/Arg Arg//Arg Set name=defaultsDescriptorSystemProperty name=jetty.home default=.//etc/webdefault.xml/Set Set name=VirtualHosts Array type=java.lang.String Item127.0.0.1/Item Itemmylovelydomain.com/Item /Array /Set /New Its fairly self explanatory - this virtually hosts an application at the root context / Does this help? Tim On 16/03/2009 19:29, Charles F. Munat c...@munat.com wrote: Where's Lassie when you need her? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: xml parser, utf-8, special characters... kill me now
So will this do the virtual hosting? (At first glance, I'm not seeing how.) Right now I use Apache to forward to the port and I run each Jetty on a different port. And if I need to reboot one application, do I have to reboot them all? (You do remember Lassie, right? Always getting Timmy out of trouble. Maybe you're too young.) Chas. Timothy Perrett wrote: Lol! Lassie?! What?! Haha. Check out this in my jetty.xml: New class=org.mortbay.jetty.webapp.WebAppContext ArgRef id=Contexts//Arg ArgSystemProperty name=jetty.home//webapps/myapplication.war/Arg Arg//Arg Set name=defaultsDescriptorSystemProperty name=jetty.home default=.//etc/webdefault.xml/Set Set name=VirtualHosts Array type=java.lang.String Item127.0.0.1/Item Itemmylovelydomain.com/Item /Array /Set /New Its fairly self explanatory - this virtually hosts an application at the root context / Does this help? Tim On 16/03/2009 19:29, Charles F. Munat c...@munat.com wrote: Where's Lassie when you need her? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Error in Msgs
Wow I could have swear that Charles is on bord ! LOL I'll commit it in a bit :) On Mar 16, 9:26 pm, Charles F. Munat c...@munat.com wrote: Heh, heh. You don't want me sticking my nose in there... Chas. marius d. wrote: You're right. Can you fix and commit it ? On Mar 16, 8:20 pm, Charles F. Munat c...@munat.com wrote: Line 54 in net.liftweb.builtin.snippet.Msgs.scala reads: (styles \\ error_msg \\ @class)), 1), It should read: (styles \\ warning_msg \\ @class)), 1), Chas. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: xml parser, utf-8, special characters... kill me now
So will this do the virtual hosting? (At first glance, I'm not seeing how.) Correct :-) Its all on the jetty wiki - http://docs.codehaus.org/display/JETTY/Virtual+hosts And if I need to reboot one application, do I have to reboot them all? Hmm good question - right now im not 100% sure as my apps are internal so we don't care - I just reboot jetty and its not an issue. Its probably on the wiki, or the mailing list someplace but I cant look right now. (You do remember Lassie, right? Always getting Timmy out of trouble. Maybe you're too young.) Lol I do remember, just didn't make the connection! Ha!. Cheers, Tim --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Default NodeSeq for message box
Don't know if this will be useful to anyone else, but I wanted my error/warning/notice messages to replace a default bit of text (a tagline). After some fiddling, I came up with this, which works quite nicely. (Feel free to suggest improvements.) (Note: I removed some other code I didn't need and this is my own version, hence Messages.) class Messages { def render(styles: NodeSeq): NodeSeq = { val f = noIdMessages _ val msgs = List((f(S.errors), (styles \\ error_msg), S.??(msg.error), ((styles \\ error_class) ++ (styles \\ error_msg \\ @class)), 0), (f(S.warnings), (styles \\ warning_msg), S.??(msg.warning), ((styles \\ warning_class)++ (styles \\ warning_msg \\ @class)), 1), (f(S.notices), (styles \\ notice_msg), S.??(msg.notice), ((styles \\ notice_class)) ++ (styles \\ notice_msg \\ @class), 2)).flatMap { case (msg, titleList, defaultTitle, styleList, ord) = val title: String = titleList.toList. filter(_.prefix == lift). map(_.text.trim).filter(_.length 0) headOr defaultTitle val styles = styleList.toList.map(_.text.trim) if (!styles.isEmpty) { ord match { case 0 = MsgsErrorMeta(Full(AjaxMessageMeta(Full(title), Full(styles.mkString( ) case 1 = MsgsWarningMeta(Full(AjaxMessageMeta(Full(title), Full(styles.mkString( ) case 2 = MsgsNoticeMeta(Full(AjaxMessageMeta(Full(title), Full(styles.mkString( ) } } msg.toList.map(e = (li{e}/li) ) match { case Nil = Nil case msgList = val ret = (divul{msgList}/ul/div) styles.foldLeft(ret)((xml, style) = xml % new UnprefixedAttribute(class, Text(style), Null)) } } div{if (msgs.isEmpty) styles \\ default else msgs}/div } } Then I do this in the template: lift:Messages lift:error_classerrorBox/lift:error_class lift:warning_classwarningBox/lift:warning_class lift:notice_classnoticeBox/lift:notice_class lift:defaultspan id=taglineJust do it/span/lift:default /lift:Messages So now I get a span with Just do it that is replaced by the error, warning, or notice message. Chas. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Error in Msgs
committed in both master anf 1.0 On Mar 16, 10:00 pm, marius d. marius.dan...@gmail.com wrote: Wow I could have swear that Charles is on bord ! LOL I'll commit it in a bit :) On Mar 16, 9:26 pm, Charles F. Munat c...@munat.com wrote: Heh, heh. You don't want me sticking my nose in there... Chas. marius d. wrote: You're right. Can you fix and commit it ? On Mar 16, 8:20 pm, Charles F. Munat c...@munat.com wrote: Line 54 in net.liftweb.builtin.snippet.Msgs.scala reads: (styles \\ error_msg \\ @class)), 1), It should read: (styles \\ warning_msg \\ @class)), 1), Chas. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] !...@#$% Hibernate!
I am trying to permit upload of a profile photo to go with a member. My edit method is below. (I'm using id numbers in the URL, which explains the first part of the code. Sue me.) The problem is that no matter where I move the damn Model.merge() call, I get one of two outcomes on persisting a new object, neither of them salutary: 1. I end up with an image file named image_0.jpg. This despite calling merge *before* I determine the file name. So why is the ID still 0 after the merge? 2. I end up with two (2) new members! It works fine on edit, so currently my workaround is to create a new member, then go back and upload the photo. But surely there is a way around this... I just can't seem to wrap my head around this detached stuff. def edit (xhtml : NodeSeq) : NodeSeq = { val member = S.param(id).openOr(new) match { case new = new Member() case id = Model.createNamedQuery[Member](findMemberById, id - getId(id)).findOne match { case Full(m) = m case _ = S.error(Cannot find member with id # + id) redirectTo(/admin/members/) } } def addOrUpdate () = { val f = for ( ul - theUpload.is; uf - Box.legacyNullTest(ul) ) yield uf if (member.nameLast.length == 0) { S.error(The member's last name cannot be blank) } else { Model.merge(member) Model.flush() f match { case Full(p) = if (p.mimeType.contains(image/)) { member.fileSize = p.file.length member.mimeType = p.mimeType member.fileName = image_ + member.id.toString + . + member.mimeType.replaceAll(image/,). replaceAll(jpeg, jpg) Model.merge(member) Model.flush() val fos: FileOutputStream = new FileOutputStream( absolutePath() + images/profile/ + member.fileName ) fos.write(p.file) fos.close() } case _ = } redirectTo(/admin/members/) } } bind(member, xhtml, name - FocusOnLoad(SHtml.text(member.name, member.name = _, (size, 24))), fileUpload - SHtml.fileUpload(u = theUpload(Full(u))), submit - SHtml.submit(Save, addOrUpdate) ) } Any and all ideas appreciated. Chas. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Error in Msgs
list verbosity != committer status (but you can be forgiven for thinking otherwise) Chas. marius d. wrote: Wow I could have swear that Charles is on bord ! LOL I'll commit it in a bit :) On Mar 16, 9:26 pm, Charles F. Munat c...@munat.com wrote: Heh, heh. You don't want me sticking my nose in there... Chas. marius d. wrote: You're right. Can you fix and commit it ? On Mar 16, 8:20 pm, Charles F. Munat c...@munat.com wrote: Line 54 in net.liftweb.builtin.snippet.Msgs.scala reads: (styles \\ error_msg \\ @class)), 1), It should read: (styles \\ warning_msg \\ @class)), 1), Chas. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Error in Msgs
P.S. If I'm not on board, does that mean I'm overboard? marius d. wrote: Wow I could have swear that Charles is on bord ! LOL I'll commit it in a bit :) On Mar 16, 9:26 pm, Charles F. Munat c...@munat.com wrote: Heh, heh. You don't want me sticking my nose in there... Chas. marius d. wrote: You're right. Can you fix and commit it ? On Mar 16, 8:20 pm, Charles F. Munat c...@munat.com wrote: Line 54 in net.liftweb.builtin.snippet.Msgs.scala reads: (styles \\ error_msg \\ @class)), 1), It should read: (styles \\ warning_msg \\ @class)), 1), Chas. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Custom Boot Class
Thanks Derek! --j On Mon, Mar 16, 2009 at 8:33 AM, Derek Chen-Becker dchenbec...@gmail.comwrote: Just confirmed. Changing you web.xml to: ?xml version=1.0 encoding=ISO-8859-1? !DOCTYPE web-app PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN http://java.sun.com/dtd/web-app_2_3.dtd; web-app filter filter-nameLiftFilter/filter-name display-nameLift Filter/display-name descriptionThe Filter that intercepts lift calls/description filter-classnet.liftweb.http.LiftFilter/filter-class init-param param-namebootloader/param-name param-valuebootstrap.liftweb.Brat/param-value /init-param /filter filter-mapping filter-nameLiftFilter/filter-name url-pattern/*/url-pattern /filter-mapping /web-app Fixes it. I'll fix the book. Derek On Mon, Mar 16, 2009 at 9:19 AM, Derek Chen-Becker dchenbec...@gmail.comwrote: I think we might have an error in the book. The example you give uses context-param, but I think it needs to be an init-param within the filter portion of the web.xml. Derek On Mon, Mar 16, 2009 at 9:04 AM, Viktor Klang viktor.kl...@gmail.comwrote: No, it was working when we switched to the filter. :/ On Mon, Mar 16, 2009 at 2:58 PM, Derek Chen-Becker dchenbec...@gmail.com wrote: I wonder if this is something that broke when we moved to a Filter... Derek On Mon, Mar 16, 2009 at 7:02 AM, Jorge Ortiz jorge.or...@gmail.comwrote: I get the same error, unfortunately. --j On Mon, Mar 16, 2009 at 4:48 AM, Sergey Andreev andser...@gmail.comwrote: Jorge, I am using a custom Boot class and it works just fine. I believe that if you create a Brat.scala and put your class there, it will solve the problem Regards, Sergey On Mon, Mar 16, 2009 at 1:31 PM, Jorge Ortiz jorge.or...@gmail.comwrote: Folks, I'm trying to specify a custom Boot class, as per Chapter 3 of the Lift Book. To my web.xml I've added: context-param param-namebootloader/param-name param-valuebootstrap.liftweb.Brat/param-value /context-param and in Boot.scala I've commented out the regular Boot class and added a Brat class with identical implementation, except it extends Bootable. class Brat extends Bootable { ... } Unfortunately, I'm getting a: ERROR - Failed to Boot java.lang.ClassNotFoundException: bootstrap.liftweb.Boot Attached is the zipped project. Thanks, --j -- Viktor Klang Senior Systems Analyst --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Where to continue after Getting Started?
Erik, What would you like to learn next? Perhaps we can continue to enhance the Lift mind-bending if we know which direction to bend it in. Thanks, David On Sun, Mar 15, 2009 at 5:29 AM, erik.fris...@googlemail.com erik.fris...@googlemail.com wrote: Hi guys, I finally managed to work my way through the Getting Started examples. I am getting an impression of Lift, and I must say I am absolutely amazed. Now, I come pretty much from a PHP background. I did Java and Haskell (once a long, long time ago), I dare say I am a pretty good JavaScript programmer, but after reading through the Getting Started, I realize that I have a lot of work to do until I can truly appreciate the power of Lift (and Scala). I don't know where to continue, though. Do you guys know any good references (books, blogs,...) where someone like me can go now to increase my knowledge? I guess I could hack together a small app, but I feel like I am too stuck on my PHP perspective of things and don't really know how to productively program in Scala and Lift. So, any references, book recommendations, and so forth, would be GREATLY appreciated. And, once again, amazing work from what I can see so far. -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp Git some: http://github.com/dpp --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: !...@#$% Hibernate!
At first glance, you're not operating on the merged object. Merge takes an instance as an argument and returns a *new* copy of that instance that is attached. Model.merge(member) is essentially a NOOP in your code because you're not using the returned, attached instance. In other words, your addOrUpdate method is operating on a detached object in all code paths. Derek On Mon, Mar 16, 2009 at 2:47 PM, Charles F. Munat c...@munat.com wrote: I am trying to permit upload of a profile photo to go with a member. My edit method is below. (I'm using id numbers in the URL, which explains the first part of the code. Sue me.) The problem is that no matter where I move the damn Model.merge() call, I get one of two outcomes on persisting a new object, neither of them salutary: 1. I end up with an image file named image_0.jpg. This despite calling merge *before* I determine the file name. So why is the ID still 0 after the merge? 2. I end up with two (2) new members! It works fine on edit, so currently my workaround is to create a new member, then go back and upload the photo. But surely there is a way around this... I just can't seem to wrap my head around this detached stuff. def edit (xhtml : NodeSeq) : NodeSeq = { val member = S.param(id).openOr(new) match { case new = new Member() case id = Model.createNamedQuery[Member](findMemberById, id - getId(id)).findOne match { case Full(m) = m case _ = S.error(Cannot find member with id # + id) redirectTo(/admin/members/) } } def addOrUpdate () = { val f = for ( ul - theUpload.is; uf - Box.legacyNullTest(ul) ) yield uf if (member.nameLast.length == 0) { S.error(The member's last name cannot be blank) } else { Model.merge(member) Model.flush() f match { case Full(p) = if (p.mimeType.contains(image/)) { member.fileSize = p.file.length member.mimeType = p.mimeType member.fileName = image_ + member.id.toString + . + member.mimeType.replaceAll(image/,). replaceAll(jpeg, jpg) Model.merge(member) Model.flush() val fos: FileOutputStream = new FileOutputStream( absolutePath() + images/profile/ + member.fileName ) fos.write(p.file) fos.close() } case _ = } redirectTo(/admin/members/) } } bind(member, xhtml, name - FocusOnLoad(SHtml.text(member.name, member.name = _, (size, 24))), fileUpload - SHtml.fileUpload(u = theUpload(Full(u))), submit - SHtml.submit(Save, addOrUpdate) ) } Any and all ideas appreciated. Chas. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Where to continue after Getting Started?
I like the Programming in Scala book quite a bit. The index isn't as good as I'd like it to be, and I wish it had a bit more on Scala Swing (I'm building a Scala desktop app), but having the PDF version makes searching easy, and the dead trees version is a permanent fixture in my bathroom (where else does one read dead trees books?) Be sure to check out the online APIs for both Scala and Lift: http://www.scala-lang.org/docu/files/api/index.html http://scala-tools.org/scaladocs/liftweb/1.0/ Another useful thing is the Java tutorials. Lots of Scala stuff is based on Java, so you can fill in gaps this way. http://java.sun.com/docs/books/tutorial/index.html (You can access the relevant Javadocs from the Scaladocs.) I've been doing most of my Lift work in TextMate, but I'm working on my desktop application in NetBeans and that's working reasonably well -- after several false starts. And of course, there is this list, without which I would have abandoned Lift long ago. It is difficult to overestimate the generosity and sincere helpfulness of the Lift team. I think everyone here wants Lift to succeed, and they're willing to put forth a lot of effort to that end. Where you go next depends on where you want to be. Surely you have some goal in mind and you are not just idly learning a new language. What is that goal? If we know that, perhaps someone here can suggest a second step. Good luck. Thanks to the hard work of David, Derek, Tyler, Kris, and numerous others, there's a hell of a lot better and much more documentation than when I started with Lift a year ago (though it's never enough, is it?). Go forth and prosper. Chas. David Pollak wrote: Erik, What would you like to learn next? Perhaps we can continue to enhance the Lift mind-bending if we know which direction to bend it in. Thanks, David On Sun, Mar 15, 2009 at 5:29 AM, erik.fris...@googlemail.com mailto:erik.fris...@googlemail.com erik.fris...@googlemail.com mailto:erik.fris...@googlemail.com wrote: Hi guys, I finally managed to work my way through the Getting Started examples. I am getting an impression of Lift, and I must say I am absolutely amazed. Now, I come pretty much from a PHP background. I did Java and Haskell (once a long, long time ago), I dare say I am a pretty good JavaScript programmer, but after reading through the Getting Started, I realize that I have a lot of work to do until I can truly appreciate the power of Lift (and Scala). I don't know where to continue, though. Do you guys know any good references (books, blogs,...) where someone like me can go now to increase my knowledge? I guess I could hack together a small app, but I feel like I am too stuck on my PHP perspective of things and don't really know how to productively program in Scala and Lift. So, any references, book recommendations, and so forth, would be GREATLY appreciated. And, once again, amazing work from what I can see so far. -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp Git some: http://github.com/dpp --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Where to continue after Getting Started?
Thanks for the links, guys. I really appreciate it. To be totally honest, I just by luck found out that Lift even existed; John Resig did a Tweet that involved a Chat Application using Lift and Web Sockets. So I searched for Lift and found the framework. And since I make it a habit to learn something new every day for at least an hour, I decided to dive right in. After the Getting Started, I am really intrigued. But I am, as I said, coming from a strict PHP background. I am, for example, totally unable to tell Lift and Scala apart. My goal so far is to get knee-deep into Scala and Lift. For work I develop high scalability web apps, and I feel like Lift and Scala fit right in there. I guess I want to figure out how much of a productivity boost I can get from Lift, and if I can do things with Lift that are not even possible with PHP. I guess this is pretty vague, but so is my idea of Lift ;) I hope it gives you an idea of where I am coming from. What I would really really love to see is a comparison between the Lift Framework and the Zend Framework, or Scala and PHP. Thanks for your attention. I really appreciate all the input and help coming from you, it makes it that much easier to wrap my head around Lift and Scala. Erik On Mar 17, 9:34 am, Charles F. Munat c...@munat.com wrote: I like the Programming in Scala book quite a bit. The index isn't as good as I'd like it to be, and I wish it had a bit more on Scala Swing (I'm building a Scala desktop app), but having the PDF version makes searching easy, and the dead trees version is a permanent fixture in my bathroom (where else does one read dead trees books?) Be sure to check out the online APIs for both Scala and Lift: http://www.scala-lang.org/docu/files/api/index.htmlhttp://scala-tools.org/scaladocs/liftweb/1.0/ Another useful thing is the Java tutorials. Lots of Scala stuff is based on Java, so you can fill in gaps this way. http://java.sun.com/docs/books/tutorial/index.html (You can access the relevant Javadocs from the Scaladocs.) I've been doing most of my Lift work in TextMate, but I'm working on my desktop application in NetBeans and that's working reasonably well -- after several false starts. And of course, there is this list, without which I would have abandoned Lift long ago. It is difficult to overestimate the generosity and sincere helpfulness of the Lift team. I think everyone here wants Lift to succeed, and they're willing to put forth a lot of effort to that end. Where you go next depends on where you want to be. Surely you have some goal in mind and you are not just idly learning a new language. What is that goal? If we know that, perhaps someone here can suggest a second step. Good luck. Thanks to the hard work of David, Derek, Tyler, Kris, and numerous others, there's a hell of a lot better and much more documentation than when I started with Lift a year ago (though it's never enough, is it?). Go forth and prosper. Chas. David Pollak wrote: Erik, What would you like to learn next? Perhaps we can continue to enhance the Lift mind-bending if we know which direction to bend it in. Thanks, David On Sun, Mar 15, 2009 at 5:29 AM, erik.fris...@googlemail.com mailto:erik.fris...@googlemail.com erik.fris...@googlemail.com mailto:erik.fris...@googlemail.com wrote: Hi guys, I finally managed to work my way through the Getting Started examples. I am getting an impression of Lift, and I must say I am absolutely amazed. Now, I come pretty much from a PHP background. I did Java and Haskell (once a long, long time ago), I dare say I am a pretty good JavaScript programmer, but after reading through the Getting Started, I realize that I have a lot of work to do until I can truly appreciate the power of Lift (and Scala). I don't know where to continue, though. Do you guys know any good references (books, blogs,...) where someone like me can go now to increase my knowledge? I guess I could hack together a small app, but I feel like I am too stuck on my PHP perspective of things and don't really know how to productively program in Scala and Lift. So, any references, book recommendations, and so forth, would be GREATLY appreciated. And, once again, amazing work from what I can see so far. -- Lift, the simply functional web frameworkhttp://liftweb.net Beginning Scalahttp://www.apress.com/book/view/1430219890 Follow me:http://twitter.com/dpp Git some:http://github.com/dpp --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en
[Lift] Re: Where to continue after Getting Started?
PHP is a language that's easy to learn thus easy to get started with. But down the road, that ease comes with a steep price unless you are very disciplined about establishing protocols for coding and sticking to them. It is very easy to end up with unmaintainable spaghetti code. I speak from painful experience. PHP grew up by aggregation, thus it has an odd mixture of syntax and conventions, some from Perl, many from other languages. Very little is consistent. Not surprising from a language originally called personal home page -- though PHP coders don't like to be reminded of that. In short, PHP is fine for small sites and quick prototyping, or solving some minor problem, but I wouldn't recommend it for anything serious. Yes, I know that Facebook and many other big enterprise apps are written in PHP, but just because it's possible doesn't make it wise. Ruby and Python are dynamically-typed languages that typically run in an interpreter. Ruby in particular is very open, providing unwary coders with more than enough rope to hang themselves. They have very different styles. If I were doing it all over again and choosing between the two, I'd probably choose Python. I think it has more staying power (not least because of Google). And there are some very interesting frameworks available. Java is a powerful, statically-typed language that is compiled into byte-code and run in a virtual machine. (C# is Microsoft's rip of Java after they lost a lawsuit. In many ways it's a better language, but when you start later and can learn from the mistakes of your competition, then that helps.) Java is fine if you are doing enterprise work and you have a team of programmers and deep pockets. But the amount of configuration and boilerplate code is absurd (thought slowly improving). The sad thing is that the JVM rocks. It's solid and fast. Would that we could take advantage of this without all the Java boilerplate. Enter Scala. Scala does essentially what C# tried to do, but goes one better (thus F#). Not only does it compile into Java byte code, but it is a hybrid functional and objected-oriented language, so you get the best of both worlds (or the worst, depending on your viewpoint). And Scala learned from Java's mistakes. Boilerplate is significantly reduced. Best of all, you can use the Java libraries and even mix Java and Scala, so we don't have to wait another five years for Scala to mature. We can get all the power of Java and eliminate most of the hassle. I'd be remiss if I didn't mention some other options you should look at. I think that the abandonment of Smalltalk by its biggest backer is a bad sign, but it's a very cool language. Erlang has some great possibilities. And there are plenty of others. Scala, like Ruby, Python, Java, and PHP is a programming language. You can write any kind of program in it, including command line executables and GUI desktop applications. You can even program for Android in Scala. Lift, in contrast, is a web development framework. It is a tool for building websites. Period. (Well, web services, too, but that's a kind of website.) You don't use Lift to build a desktop app. The equivalents in other languages are (among others) Rails and Merb in Ruby, Django and TurboGears in Python, Seaside in Smalltalk, etc. The reason you are probably confused is that there aren't to my knowledge many very mature web development frameworks in PHP. I know they're out there, but they haven't made much of a splash yet. So your experience is probably just writing code in PHP and presto! You have a website. With Lift it's very different. You use Maven -- a project management tool that can build your project, package it, run tests, handle dependencies, and much more -- to create your basic website. Maven sets up a specific directory structure which you must follow (you can change it possibly, but it's not worth it). Then you build the pieces of the site, placing the code in the appropriate places. Lift handles all the hard work of getting the request from the user and sending the response back. It does this by working through the servlet container -- an application that serves web pages written in Java (or Scala). I am greatly oversimplifying, but this is all you need to know for now. Lift uses a modified MVC (model-view-controller) architecture. Generally, you save your data in a back end database as objects (using an object-relational mapper such as Lift's Mapper or JPA). When these objects are pulled back out and instantiated in memory, that is pretty much your model (that and some business logic). The view is what gets sent back to the user, after it has been populated with data from the model. The controller acts as the go-between between the view and the model. In traditional MVC systems, the request comes into the controller, which accesses the model as necessary and then fills in the view and sends the response off to the user.
[Lift] Re: why is the lift web framework scalable?
Hi David, Thanks for the feedback. The goal I am trying to accomplish to create a web service framework written in scala that uses a rest api to communicate to the outside world. This web services framework would be the deployer for pojos/scala applications. It only reason for being is to process requests and return them. Now web services that could be created could be very processor intensive. The web services themselves might be communicating with a mulitude of web apps / applications that need its services. To be more specific these web services sits in the domain of healthcare. So I am trying to implement the web services framework in the stack below --- Applications - Electronic Medical Records, Patient Health Monitor, etcs Applications Frameworks - Ruby on Rail, Django, J2EE, Lift...etc ___ web services framework - can easily deploy new web services, rest api for communication with outside, very scalable, scaling is just as easy as adding a new server. automates deployment, scaling, and load- balancing. Web services are just pojo and scala classes. Uses Scala Actors and manages the actors similarly to Erlang OTP. Has properties for being fault tolerant (server dies no problem mon, another one takes it place right away). Needs to handle large number concurrent users since #concurrent_sessions = sum(applications(i)+users(i)). _ The DB it uses will be some sort of key/value or key/value/document db that is already an open source project like couchdb. So initially I thought of using Lift so it might already have some of the things, but now I feel that it might need to be done from scratch, unless you know any other open source framework that has the qualities I described. Thanks Parag On Mar 16, 12:54 pm, David Pollak feeder.of.the.be...@gmail.com wrote: On Sun, Mar 15, 2009 at 6:34 PM, parag978978 parag978...@gmail.com wrote: I want to know the technical reasons why the lift webframework has high performance and scalability? The JVM and not getting in its way. :-) The JVM is the best way to deploy high performance software. HotSpot does a better job of optimizing code than any static compiler and GC-based memory management is faster in aggregate than malloc/free. Yes, folks can find micro-benchmarks that demonstrate that C programs are faster, but those examples don't scale as the complexity of the systems grow. Scala's immutable data structures make scaling apps much easier. I know it uses scala, which has an actor library, but according to the install instructions it default configuration is with jetty. So does it use the actor library to scale? Actors and Jetty have nothing to do with each other. Lift takes advantage of Jetty and Servlet 3.0 continuations for long polling operations. Lift also use Actors for long polling so there are no threads consumed during the polling. Now is the scalability built right out of the box. Just add additional servers and nodes and it will automatically scale, is that how it works? Can t handle 50+ concurrent connections with supporting servers. Can you elaborate on this goal. There's no enterprise system that I know of that has this kind of requirement. Most enterprise systems need no support more than a few thousand open sessions. Even the largest companies don't have more than a few thousand people accessing the same app. Thanks, David I am trying to create a web services framework for the enterprise level, that can beat what is out there and is easy to scale, configurable, and maintainable. My definition of scaling is just adding more servers and you should be able to accommodate the extra load. Thanks -- Lift, the simply functional web frameworkhttp://liftweb.net Beginning Scalahttp://www.apress.com/book/view/1430219890 Follow me:http://twitter.com/dpp Git some:http://github.com/dpp --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: XML unescaping
Thanks Derek. Familiarity with the APIs is one of the tricks when moving to a new language I guess. This worked for me, but I have a follow-on issue. Just as a background I am rendering search results which are provided as XML. Here's my binding code: result = bind(entry, chooseTemplate(listings, listing, xhtml), title - a href={result.url}{Unparsed(result.title)}/a, description - Unparsed(result.description), link - Text(result.url)) }) This fails to compile as the Unparsed in the description line is not a valid parameter for the bind function. (I'm not sure why, it's just a fancy Node like any other right?) The exact error is: overloaded method value bind with alternatives (String,net.liftweb.util.Box[(scala.xml.NodeSeq) = scala.xml.NodeSeq],net.liftweb.util.Box[(scala.xml.PrefixedAttribute) = scala.xml.MetaData],scala.xml.NodeSeq,net.liftweb.util.Helpers.BindParam*)scala.xml.NodeSeq and (String,scala.xml.NodeSeq,net.liftweb.util.Helpers.BindParam*)scala.xml.NodeSeq cannot be applied to (java.lang.String,scala.xml.NodeSeq,net.liftweb.util.Helpers.TheBindParam,(String, scala.xml.Unparsed),net.liftweb.util.Helpers.TheBindParam) If I change that line to * description - Text(Unparsed(result.description))* it compiles, but the Text constructor will re-escape so I'm back to square one. If I change the line to description - * span{Unparsed(result.description)}/span*, it compiles but I have an unwanted span tag and worse ... if result.description is not well formed XML my page will fail to render! Firefox complains of an XML Parsing Error. The description field has an unmatched br tag (literally lt;brgt;) in the middle of it to force it onto two lines. So my first question is, how can I avoid the extra span tag? Secondly, can I render (!X)HTML via Lift? Thanks Jeremy 2009/3/17 Derek Chen-Becker dchenbec...@gmail.com Well, it may be that the XML output portion of Scala is escaping your ampersands a second time. For instance, check out this session in the interpreter: scala val title = Catsby amp; Twisp title: java.lang.String = Catsby amp; Twisp scala val escaped = span{title}/span escaped: scala.xml.Elem = spanCatsby amp;amp; Twisp/span scala val unescaped = span{ scala.xml.Unparsed(title) }/span unescaped: scala.xml.Elem = spanCatsby amp; Twisp/span Note that if you embed a String within XML elements, Scala will automatically escape any ampersands unless you wrap the String in a scala.xml.Unparsed instance. The second test there will render in the browser like Catsby amp; Twisp, because the ampersand was escaped. I know you're asking about the Utility object, but I think that would be fixing the symptom rather than the cause. Derek On Mon, Mar 16, 2009 at 6:13 AM, Jeremy Mawson jeremy.mawson.w...@gmail.com wrote: Hi, I've been mucking around with lift and having a great time. I have cooked up a page that retrieves XML from a datasource and renders it. However some of the text elements I extract are HTML encoded. When rendered in the browser it looks like HTML code, rather than rendered HTML. I looked for a scala utility to unescape this, found scala.xml.Utility.unescape, but could not get it working. Here's how I've tried to use it. val title = Utility.unescape(result \ title text, new StringBuilder) Unfortunately this always gives me a value of null, even though result.\(title).text is something like - Tsvangiraiamp;#39;s wife killed inlt;bgt;carlt;/bgt;crash - ABC News What could I be doing wrong? I realise this is probably a plain old scala question, but I hope someone here can help me anyway. Thanks Jeremy -- Jeremy Mawson Senior Developer | Online Directories Sensis Pty Ltd 222 Lonsdale St Melbourne 3000 E: jeremy.maw...@sensis.com.au --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: XML unescaping
On 17/03/2009, at 12:36 PM, Jeremy Mawson wrote: If I change the line to description - span{Unparsed(result.description)}/span, it compiles but I have an unwanted span tag and worse ... if result.description is not well formed XML my page will fail to render! Firefox complains of an XML Parsing Error. The description field has an unmatched br tag (literally lt;brgt;) in the middle of it to force it onto two lines. Try description - xml:group{Unparsed(result.description)}/ xml:group That wraps the string in a scala XML group node... With respect to the br tag, it should be br/ or br/br to be well formed. If you want to support non-well formed XML fro the database wouldn't you need to parse it and convert it to well formed first or upon retrieval ? Regards, Marc --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: XML unescaping
Thanks Marc. xml:group works nicely. For this exercise this is hypothetical, but it matches very closely a project I have enabled in the past using struts and JIBX... Say the data was sourced from an external party's service and there was a contractual agreement to not alter the data in any way? I.E. I'm stuck with the poorly formed HTML. Probably one could agree with the partner that the transformation to valid XHTML is appropriate, but I'll let the question stand anyway. Is poorly formed (but otherwise supported-by-browsers) HTML renderable via Lift at all? Cheers Jeremy 2009/3/17 Marc Boschma marc+lift...@boschma.cx marc%2blift...@boschma.cx On 17/03/2009, at 12:36 PM, Jeremy Mawson wrote: If I change the line to description - * span{Unparsed(result.description)}/span*, it compiles but I have an unwanted span tag and worse ... if result.description is not well formed XML my page will fail to render! Firefox complains of an XML Parsing Error. The description field has an unmatched br tag (literally lt;brgt;) in the middle of it to force it onto two lines. Try description - xml:group{Unparsed(result.description)}/xml:group That wraps the string in a scala XML group node... With respect to the br tag, it should be br/ or br/br to be well formed. If you want to support non-well formed XML fro the database wouldn't you need to parse it and convert it to well formed first or upon retrieval ? Regards, Marc -- Jeremy Mawson Senior Developer | Online Directories Sensis Pty Ltd 222 Lonsdale St Melbourne 3000 E: jeremy.maw...@sensis.com.au --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: XML unescaping
On Mon, Mar 16, 2009 at 8:51 PM, Jeremy Mawson jeremy.mawson.w...@gmail.com wrote: Thanks Marc. xml:group works nicely. For this exercise this is hypothetical, but it matches very closely a project I have enabled in the past using struts and JIBX... Say the data was sourced from an external party's service and there was a contractual agreement to not alter the data in any way? I.E. I'm stuck with the poorly formed HTML. Probably one could agree with the partner that the transformation to valid XHTML is appropriate, but I'll let the question stand anyway. Is poorly formed (but otherwise supported-by-browsers) HTML renderable via Lift at all? If it's supported by the browser, it will be rendered, but Firefox and Chrome will both complain about malformed XHTML. You could run the String through an HTML parser (there are a few floating around for Java that will parse poorly formed HTML) and then walk the nodes and build XML. I would argue that this would satisfy any contractual requirements, although I no longer practice law, so I can't argue it on your behalf. :-) Cheers Jeremy 2009/3/17 Marc Boschma marc+lift...@boschma.cxmarc%2blift...@boschma.cx On 17/03/2009, at 12:36 PM, Jeremy Mawson wrote: If I change the line to description - * span{Unparsed(result.description)}/span*, it compiles but I have an unwanted span tag and worse ... if result.description is not well formed XML my page will fail to render! Firefox complains of an XML Parsing Error. The description field has an unmatched br tag (literally lt;brgt;) in the middle of it to force it onto two lines. Try description - xml:group{Unparsed(result.description)}/xml:group That wraps the string in a scala XML group node... With respect to the br tag, it should be br/ or br/br to be well formed. If you want to support non-well formed XML fro the database wouldn't you need to parse it and convert it to well formed first or upon retrieval ? Regards, Marc -- Jeremy Mawson Senior Developer | Online Directories Sensis Pty Ltd 222 Lonsdale St Melbourne 3000 E: jeremy.maw...@sensis.com.au -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp Git some: http://github.com/dpp --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: why is the lift web framework scalable?
a few observations, since i've built such systems in the past for life-sciences: 1) rest is for performing crud ops on resources, not service invocations. 2) long running computational calculations may require you submit jobs asynchronously and obtain a job/transaction id. otherwise, you lose your calc if connection is lost or client goes down. 3) scaling by adding a new box for running/deploying services sounds much more aligned with ESB approach, than a web framework. 4) moving big datasets to non-local machines for calcs can kill performance, so you can't always rely on arbitray deployment of a service - some must live on machine with resource they depend upon. 5) there are complications when services requires resource(s) exclusively. 6) lift is probably an adequate front end for what you are doing, but your backend architecture will either be ESB, GRID, or look more like a system that asynchronously accepts work and forwards it to the machine perfoming the work. either way, you'll be managing lots of stuff like resultant sets, job states, machine states, resource management, and client notification. with lift, you'll at least be able to push status of work, rather than polling if you used an older web api. On Mon, Mar 16, 2009 at 6:39 PM, parag978978 parag978...@gmail.com wrote: Hi David, Thanks for the feedback. The goal I am trying to accomplish to create a web service framework written in scala that uses a rest api to communicate to the outside world. This web services framework would be the deployer for pojos/scala applications. It only reason for being is to process requests and return them. Now web services that could be created could be very processor intensive. The web services themselves might be communicating with a mulitude of web apps / applications that need its services. To be more specific these web services sits in the domain of healthcare. So I am trying to implement the web services framework in the stack below --- Applications - Electronic Medical Records, Patient Health Monitor, etcs Applications Frameworks - Ruby on Rail, Django, J2EE, Lift...etc ___ web services framework - can easily deploy new web services, rest api for communication with outside, very scalable, scaling is just as easy as adding a new server. automates deployment, scaling, and load- balancing. Web services are just pojo and scala classes. Uses Scala Actors and manages the actors similarly to Erlang OTP. Has properties for being fault tolerant (server dies no problem mon, another one takes it place right away). Needs to handle large number concurrent users since #concurrent_sessions = sum(applications(i)+users(i)). _ The DB it uses will be some sort of key/value or key/value/document db that is already an open source project like couchdb. So initially I thought of using Lift so it might already have some of the things, but now I feel that it might need to be done from scratch, unless you know any other open source framework that has the qualities I described. Thanks Parag On Mar 16, 12:54 pm, David Pollak feeder.of.the.be...@gmail.com wrote: On Sun, Mar 15, 2009 at 6:34 PM, parag978978 parag978...@gmail.com wrote: I want to know the technical reasons why the lift webframework has high performance and scalability? The JVM and not getting in its way. :-) The JVM is the best way to deploy high performance software. HotSpot does a better job of optimizing code than any static compiler and GC-based memory management is faster in aggregate than malloc/free. Yes, folks can find micro-benchmarks that demonstrate that C programs are faster, but those examples don't scale as the complexity of the systems grow. Scala's immutable data structures make scaling apps much easier. I know it uses scala, which has an actor library, but according to the install instructions it default configuration is with jetty. So does it use the actor library to scale? Actors and Jetty have nothing to do with each other. Lift takes advantage of Jetty and Servlet 3.0 continuations for long polling operations. Lift also use Actors for long polling so there are no threads consumed during the polling. Now is the scalability built right out of the box. Just add additional servers and nodes and it will automatically scale, is that how it works? Can t handle 50+ concurrent connections with supporting servers. Can you elaborate on this goal. There's no enterprise system that I know of that has this kind of requirement. Most enterprise systems need no support more than a few thousand open sessions. Even the largest companies don't have more than a few thousand people accessing the same app. Thanks, David I am trying to create a web
[Lift] Re: XML unescaping
To quote David from a previous thread on the mailing list: I've enhanced LiftRules as follows: /** * A partial function that determines content type based on an incoming * RequestState and Accept header */ var determineContentType: PartialFunction[(Can[RequestState], Can[String]), String] = { case (_, Full(accept)) if accept.toLowerCase.contains(application/xhtml+xml) = application/xhtml+xml case _ = text/html } You can change the determineContentType Partial Function in Boot.scala to accomplish your goals. So maybe you could add in Boot.scala determineContentType = { case (Full(req), _) if req.path match { case text :: only :: _ = true case _ = false} = text/html } orElse determineContentType which would set the return type of any page under and including /text/ only to text/html and if not under that would chain to the standard lift content type determine partial function... Obviously you could define your own function to check the path rather than in-line it... David: Would req.param(x) be the equivalent to S.param(x) ?? Regards, Marc On 17/03/2009, at 2:58 PM, David Pollak wrote: On Mon, Mar 16, 2009 at 8:51 PM, Jeremy Mawson jeremy.mawson.w...@gmail.com wrote: Thanks Marc. xml:group works nicely. For this exercise this is hypothetical, but it matches very closely a project I have enabled in the past using struts and JIBX... Say the data was sourced from an external party's service and there was a contractual agreement to not alter the data in any way? I.E. I'm stuck with the poorly formed HTML. Probably one could agree with the partner that the transformation to valid XHTML is appropriate, but I'll let the question stand anyway. Is poorly formed (but otherwise supported-by-browsers) HTML renderable via Lift at all? If it's supported by the browser, it will be rendered, but Firefox and Chrome will both complain about malformed XHTML. You could run the String through an HTML parser (there are a few floating around for Java that will parse poorly formed HTML) and then walk the nodes and build XML. I would argue that this would satisfy any contractual requirements, although I no longer practice law, so I can't argue it on your behalf. :-) Cheers Jeremy 2009/3/17 Marc Boschma marc+lift...@boschma.cx On 17/03/2009, at 12:36 PM, Jeremy Mawson wrote: If I change the line to description - span{Unparsed(result.description)}/span, it compiles but I have an unwanted span tag and worse ... if result.description is not well formed XML my page will fail to render! Firefox complains of an XML Parsing Error. The description field has an unmatched br tag (literally lt;brgt;) in the middle of it to force it onto two lines. Try description - xml:group{Unparsed(result.description)}/ xml:group That wraps the string in a scala XML group node... With respect to the br tag, it should be br/ or br/br to be well formed. If you want to support non-well formed XML fro the database wouldn't you need to parse it and convert it to well formed first or upon retrieval ? Regards, Marc -- Jeremy Mawson Senior Developer | Online Directories Sensis Pty Ltd 222 Lonsdale St Melbourne 3000 E: jeremy.maw...@sensis.com.au -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp Git some: http://github.com/dpp --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Where to continue after Getting Started?
Over the years I've written a fair amount of PHP code for in-house applications (enterprise ticket tracking system, network equipment management, etc) and the experience has generally not been great. I think PHP functions very well for compact, well-defined apps, but the lack of structure in the PHP libraries ends up being a burden to non-trivial projects IMHO. In particular, the library is inconsistent and often incoherent. As an example, compare database access (pretty common functionality) in PHP vs Java. One app I wrote in PHP started out running against MySQL and then later needed to change to SQL Server. What would have been a simple database URL change (and replacing a jar file) in Java was a non-trivial search and replace of code throughout the app. I seem to remember there also being some functions that didn't correlate between the two driver types. In short, it was a very painful experience. I know that Pear and some other facades have been developed to make this more transparent, but overall I still feel like the library doesn't have an overarching theme. It's more a whole lot of bits and pieces stitched together. Another advantage that Lift has, being built atop the JVM, is full access to all Java libs, and the simplicity of adding libraries as needed. If I need to add SNMP support to my Lift app (network equipment), I just drop the jar file in. To add SNMP to PHP I had to compile a whole slew of libraries and recompile the PHP module. On a similar vein, the ecosystem of Java libraries is (in my estimation) at least an order of magnitude larger and more mature than for what's out there for PHP. Finally, and most importantly, the view-first structure of Lift is huge. It's difficult to overstate how much this can help improve code organization and page structure. Essentially, you're writing a whole bunch of little components in Scala and then composing them using pure XML templates. Templates can embed other templates, and can embed themselves into other templates as well, so you have incredible flexibility in how you lay things out while keeping things fairly simple. The ability to keep your code and presentation layer stuff in small, easily digestible chunks is what will keep you and your team sane when you tackle big projects. Of course, you can do this in PHP as well, but with Lift the capability is an integral part of the overall design. You might want to take a look at our demo app for the book: http://github.com/tjweir/pocketchangeapp/tree/master It covers a lot of Liftisms (not all), and I'd be happy to answer any questions you have about it. Derek On Mon, Mar 16, 2009 at 7:29 PM, Charles F. Munat c...@munat.com wrote: PHP is a language that's easy to learn thus easy to get started with. But down the road, that ease comes with a steep price unless you are very disciplined about establishing protocols for coding and sticking to them. It is very easy to end up with unmaintainable spaghetti code. I speak from painful experience. PHP grew up by aggregation, thus it has an odd mixture of syntax and conventions, some from Perl, many from other languages. Very little is consistent. Not surprising from a language originally called personal home page -- though PHP coders don't like to be reminded of that. In short, PHP is fine for small sites and quick prototyping, or solving some minor problem, but I wouldn't recommend it for anything serious. Yes, I know that Facebook and many other big enterprise apps are written in PHP, but just because it's possible doesn't make it wise. Ruby and Python are dynamically-typed languages that typically run in an interpreter. Ruby in particular is very open, providing unwary coders with more than enough rope to hang themselves. They have very different styles. If I were doing it all over again and choosing between the two, I'd probably choose Python. I think it has more staying power (not least because of Google). And there are some very interesting frameworks available. Java is a powerful, statically-typed language that is compiled into byte-code and run in a virtual machine. (C# is Microsoft's rip of Java after they lost a lawsuit. In many ways it's a better language, but when you start later and can learn from the mistakes of your competition, then that helps.) Java is fine if you are doing enterprise work and you have a team of programmers and deep pockets. But the amount of configuration and boilerplate code is absurd (thought slowly improving). The sad thing is that the JVM rocks. It's solid and fast. Would that we could take advantage of this without all the Java boilerplate. Enter Scala. Scala does essentially what C# tried to do, but goes one better (thus F#). Not only does it compile into Java byte code, but it is a hybrid functional and objected-oriented language, so you get the best of both worlds (or the worst, depending on your viewpoint). And Scala learned from Java's mistakes. Boilerplate is