[Lift] Re: Error processing SHtml functions withing nested NodeSeq/Scala code
Well so you're using it from your own actor. I would not recommend this due to state preservation. I mean S context is very likely lost because your LiftActor is running on a different thread. What you need is to pass the LiftSession instance to your LiftActor say using some distinct message like: case class Init(session: LiftSession) then in your messageHandler protected def messageHandler = { case FileManagerMsg(someMsg) = { S.initIfNotInitted(session) { var fileList = listFilesInDir(/Users/soumik/Movies/) Log.info(OUTPUT: + fileList) } } } But I'm not sure from your code wht you do with the output of your listFilesInDir since that never gets to be rendered. I strongly recommend using CometActor whenever you want to render something asynchronously. It does a lots of good things for you. Br's, Marius On Feb 16, 9:33 am, soumik soum...@gmail.com wrote: Hi Marius, Thanks for your response. I'm sorry for mis-communicating my problem earlier. As you pointed out the problem doesn't occur when the call to the function is made from a CometActor. In my case too, it was not a CometActor. Rather, it was the LiftActor. (Sometime back we had different CometActors for different feature threads, now we have 1 single CometActor which takes care of the display and different LiftActor threads which do the feature related stuff. Hence the confusion on my part). Anyways, here's the relevant code: - object TheVideoPlayerThread extends LiftActor { val threadName = FileManager def listFilesInDir(dirName:String): NodeSeq = { Log.info(Recursing for: + dirName) val files = (new java.io.File(dirName)).listFiles def showFile1() = AAA li class=fileElem id=dir{dirName}/li ul {files.flatMap(f = { if (f.isDirectory()) { Log.info(Directory: + f.toString) listFilesInDir(f.toString) } else { Log.info(Regular file: + f.getName) li class=fileElem id=regfile {SHtml.link(, () = showFile1, Text(f.getName)) } //This is the line causing the issue /li } } )} /ul } protected def messageHandler = { case FileManagerMsg(someMsg) = { var fileList = listFilesInDir(/Users/soumik/Movies/) Log.info(OUTPUT: + fileList) } } - (I've omitted some of code in this thread which are not related to the file listing functionality.) The problem I see is as soon as I encounter the first file in the directory specified, it prints - Regular file: filename, but after that I don't see the log - OUTPUT - The function never returns. Same function works perfectly in a CometActor and I see the nodeseq of files in li tags to be rendered. Also in the same method in my LiftActor object, if I replace the line: {SHtml.link(, () = showFile1, Text(f.getName)) } with just {f.getName} I see the function return and print the log OUTPUT - .. with the list of all the files as li entries. I'm sorry I couldn't give a more concrete example which you could run and reproduce the issue. I'll appreciate if you could just give this function a try from any LiftActor object and check the output on console. Also, I'm still on 1.1-SNAPSHOT. I've a fairly big codebase, so not sure if migrating to 2.0-SNAPSHOT will cause any other issues, particularly with jquery(i'm using lot of jquery plugins dependent on 1.3.2, not sure if all of them works nicely with 1.4). Thanks, Soumik On Feb 15, 11:22 pm, Marius marius.dan...@gmail.com wrote: I don't think the cause is in SHtml. I tried your code from a snippet and from a Comet actor and there was no lock whatsoever. But I did use lift 2.0-SNAPSHOT. can you try with 2.0-SNAPSHOT ? Br's, Marius On 15 feb., 15:20, soumik soum...@gmail.com wrote: Hi, I'm using 1.1-SNAPSHOT lift release and am experiencing strange behaviour when trying to output a NodeSeq formed from nested NodeSeq Scala code. To highlight the problem let me show you the code I'm trying to execute: --- def listFilesInDir(dirName:String): NodeSeq = { Log.info(Recursing for: + dirName) val files = (new java.io.File(dirName)).listFiles def playFile1() = AAA li class=fileElem id=dir{dirName}/li ul {files.flatMap(f = { if (f.isDirectory()) { Log.info(Directory: + f.toString) listFilesInDir(f.toString) span/span } else {
[Lift] Re: [lift] presentation only equivalent of toForm
thats fine for individual fields of a mapper, dates etc., but not for a object with mapped fields. This is what I get for my 'deal' object: Deal={ Name=Big Deal bank=1 Issue Type=Manufacturing Deal Type=MTN Currency=EUR Size/Coupon=1 Term=1 Rating=BBB created=15/02/10 creator=4 } to generate a read-only view I need to do this: deal.formFields.map(f = trtd{f.displayName}/tdtd{f.asHtml}/td/tr) It seems unbalanced that you can generate a form for editing purposes but not a view - unless I'm mistaken about that. Naftoli Gugenheim wrote: asHtml? 2010/2/14 Channing Walton channingwal...@mac.com Hi, I am using toForm to create forms for crud operations on my mappers, but I cannot see an equivalent method for presentation purposes. That is, no form elements, just text presented in the same tabular format as the form. Is there one ? Channing -- View this message in context: http://old.nabble.com/presentation-only-equivalent-of-toForm-tp27586473p27586473.html Sent from the liftweb mailing list archive at Nabble.com. -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/liftweb?hl=en. -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en. -- View this message in context: http://old.nabble.com/presentation-only-equivalent-of-toForm-tp27586473p27605101.html Sent from the liftweb mailing list archive at Nabble.com. -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
[Lift] Re: Error processing SHtml functions withing nested NodeSeq/Scala code
Hi Marius, Thanks for the quick update. The xhtml returned from the listFilesInDir() is actually sent as a message to a display CometActor which renders the xhtml it receives within a specific div tag. So in essence we have these multiple feature threads running(the one in question is intended to be a local file manager feature) which generates xhtml for different functions which are then sent to this one display CometActor which displays it. So we intend to handle multi-feature tasking by running just the one CometActor and not multiples of them which obviously is a problem for lift(since the max no. of CometActors in a page is 2). But back to your explanation of the S context getting lost, I think I understand what you mean regarding the session context. But does it also apply for SHtml generator methods?? I mean, does SHtml generator methods depend on the state of the session?? Another question I have is - even if SHtml generator methods fail to co-relate the session, shouldn't SHtml generator methods return?? or throw an exception? I don't know if you happened to use the exact same function in a LiftActor object or not, but if you do that you'll see that the function just doesn't return. Also, I don't intend to maintain state preservation. I just want to create a list of a href tags for all files which when clicked should make an Ajax call to a specific function in the LiftActor thread which processes the selection. Could you suggest some alternative way I could go about this with the current architecture(1 comet actor for display and individual feature-specific LiftActors sending xhtml to CometActor for rendering)?? Thanks, Soumik On Feb 16, 1:16 pm, Marius marius.dan...@gmail.com wrote: Well so you're using it from your own actor. I would not recommend this due to state preservation. I mean S context is very likely lost because your LiftActor is running on a different thread. What you need is to pass the LiftSession instance to your LiftActor say using some distinct message like: case class Init(session: LiftSession) then in your messageHandler protected def messageHandler = { case FileManagerMsg(someMsg) = { S.initIfNotInitted(session) { var fileList = listFilesInDir(/Users/soumik/Movies/) Log.info(OUTPUT: + fileList) } } } But I'm not sure from your code wht you do with the output of your listFilesInDir since that never gets to be rendered. I strongly recommend using CometActor whenever you want to render something asynchronously. It does a lots of good things for you. Br's, Marius On Feb 16, 9:33 am, soumik soum...@gmail.com wrote: Hi Marius, Thanks for your response. I'm sorry for mis-communicating my problem earlier. As you pointed out the problem doesn't occur when the call to the function is made from a CometActor. In my case too, it was not a CometActor. Rather, it was the LiftActor. (Sometime back we had different CometActors for different feature threads, now we have 1 single CometActor which takes care of the display and different LiftActor threads which do the feature related stuff. Hence the confusion on my part). Anyways, here's the relevant code: - object TheVideoPlayerThread extends LiftActor { val threadName = FileManager def listFilesInDir(dirName:String): NodeSeq = { Log.info(Recursing for: + dirName) val files = (new java.io.File(dirName)).listFiles def showFile1() = AAA li class=fileElem id=dir{dirName}/li ul {files.flatMap(f = { if (f.isDirectory()) { Log.info(Directory: + f.toString) listFilesInDir(f.toString) } else { Log.info(Regular file: + f.getName) li class=fileElem id=regfile {SHtml.link(, () = showFile1, Text(f.getName)) } //This is the line causing the issue /li } } )} /ul } protected def messageHandler = { case FileManagerMsg(someMsg) = { var fileList = listFilesInDir(/Users/soumik/Movies/) Log.info(OUTPUT: + fileList) } } - (I've omitted some of code in this thread which are not related to the file listing functionality.) The problem I see is as soon as I encounter the first file in the directory specified, it prints - Regular file: filename, but after that I don't see the log - OUTPUT - The function never returns. Same function works perfectly in a CometActor and I see the nodeseq of files in li tags to be rendered. Also in the same method in my LiftActor object, if I replace the line: {SHtml.link(, () = showFile1, Text(f.getName)) }
[Lift] Context path, proxies Lift
Hi, I want to setup a single nginx in front of two independent lift apps (see previous thread) but haven't succeeded. What I wan't is this: External url foo.com/index.html goes to jetty: localhost:8080/foo/index.html External url bar.com/index.html goes to jetty: localhost:8080/bar/index.html So, I'm trying to see if I can get the basic jetty setup going before throwing nginx in the mix. Here are my findings: With LiftRules.calculateContextPath = () = Empty: Deploying lift app foo in context foo works fine: ie localhost:8080/foo/index.html gives me the app and the app works with the localhost:8080/foo prefix Not surprisingly, setting LiftRules.calculateContextPath = () = Full(/foo) gives same result as above. Ok, Fine so far. But when nginx is added, a redirect to /index.html should not go to /foo/index.html but to /index.html So I tried: LiftRules.calculateContextPath = () = Full(/) But now, hitting localhost:8080/foo/index.html (simulating a request from nginx), I just get my raw index.html template without any Lift processing as if Lift has ignored the request. Am I misunderstanding the purpose of calculateContextPath? How can I make lift run in a non-root context but at the same time, when generating URLs, not prepend the context path? /Jeppe -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
[Lift] Can I test Lift 2.0-M2 with Scala 2.0 Beta 1 now?
Hi, Question - Can I test Lift 2.0-M2 with Scala 2.0 Beta 1 now? My environment is OSX 10.6, Java 1.6.0_17-b04-248-10M3025. Project created using - mvn archetype:generate -U - DarchetypeGroupId=net.liftweb -DarchetypeArtifactId=lift-archetype- blank -DarchetypeVersion=2.0-M2 -DremoteRepositories=http://scala- tools.org/repo-releases -DgroupId=demo.helloworld - DartifactId=helloworld -Dversion=1.0-SNAPSHOT I tried creating a project using liftweb 2.0-M and I noticed that it is still having a scala 2.7.7 dependency. I tried changing the Scala compiler dependency to 2.8.0.Beta 1 and after issuing following maven command - mvn clean jetty:run, I received the error below. After some googling around, i gathered the error is the result of using scala 2.8 compiler. [ERROR] error: error while loading MainGenericRunner, Scala signature MainGenericRunner has wrong version [INFO] expected: 4.1 [INFO] found: 5.0 [ERROR] one error found I am hoping to do some explorations using Lift 2.0 + Scala 2.8 + Eclipse 3.5.1. Any help is greatly appreciated. Regards chung-onn -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
Re: [Lift] Can I test Lift 2.0-M2 with Scala 2.0 Beta 1 now?
Hello, Question - Can I test Lift 2.0-M2 with Scala 2.0 Beta 1 now? you need to use code from the 280_port_refresh branch (http://github.com/dpp/liftweb). The milestones are for 2.7.7 still. -- Adam Warski http://www.warski.org http://www.softwaremill.eu -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
[Lift] Re: Context path, proxies Lift
I've been digging through some code and, at least to me, it seems like this is not possible, since the same contextPath string is used both to parse incoming requests and create outgoing responses in updateWithContextPath. So how do people deploy multiple lift apps for several domains on the same server? One thing (unrelated) looked odd: Compare case class PermRedirectResponse(uri: String, request: Req, cookies: HTTPCookie*) extends LiftResponse { def toResponse = InMemoryResponse(Array(), List(Location - request.updateWithContextPath(uri)), cookies.toList, 301) } with case class RedirectResponse(uri: String, cookies: HTTPCookie*) extends LiftResponse { // The Location URI is not resolved here, instead it is resolved with context path prior of sending the actual response def toResponse = InMemoryResponse(Array(0), List(Location - uri), cookies toList, 302) } Note that 301 calls updateWithContextPath on the uri. Is this intentional? /Jeppe -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
[Lift] Re: Can I test Lift 2.0-M2 with Scala 2.0 Beta 1 now?
Hi Adam, Thanks for the tip. Cheers! chung-onn On Feb 16, 7:06 pm, Adam Warski a...@warski.org wrote: Hello, Question - Can I test Lift 2.0-M2 with Scala 2.0 Beta 1 now? you need to use code from the 280_port_refresh branch (http://github.com/dpp/liftweb). The milestones are for 2.7.7 still. -- Adam Warskihttp://www.warski.orghttp://www.softwaremill.eu -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
Re: [Lift] Context path, proxies Lift
Contact me privatly with your IM adress and lets chat about it Jeppe - I'm doing something similar with helicon (windows proxy) and it's working fine. I'm traveling now but will be about later Cheers, Tim Sent from my iPhone On 16 Feb 2010, at 10:01, Jeppe Nejsum Madsen je...@ingolfs.dk wrote: Hi, I want to setup a single nginx in front of two independent lift apps (see previous thread) but haven't succeeded. What I wan't is this: External url foo.com/index.html goes to jetty: localhost:8080/foo/ index.html External url bar.com/index.html goes to jetty: localhost:8080/bar/ index.html So, I'm trying to see if I can get the basic jetty setup going before throwing nginx in the mix. Here are my findings: With LiftRules.calculateContextPath = () = Empty: Deploying lift app foo in context foo works fine: ie localhost:8080/foo/index.html gives me the app and the app works with the localhost:8080/foo prefix Not surprisingly, setting LiftRules.calculateContextPath = () = Full(/foo) gives same result as above. Ok, Fine so far. But when nginx is added, a redirect to /index.html should not go to /foo/index.html but to /index.html So I tried: LiftRules.calculateContextPath = () = Full(/) But now, hitting localhost:8080/foo/index.html (simulating a request from nginx), I just get my raw index.html template without any Lift processing as if Lift has ignored the request. Am I misunderstanding the purpose of calculateContextPath? How can I make lift run in a non-root context but at the same time, when generating URLs, not prepend the context path? /Jeppe -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/liftweb?hl=en . -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
[Lift] Re: Cached CSS (and Javascript?) issue
calculating an md5 of a file would induce additional computation time and we'd need to maintain hashes for each resource file. The prototype that I have now is a function in LiftRules that by default returns a random value generated on startup. Applications that needs MD5 per file could calculate that and maintain them. Hi Marius, what does the proposed token represent? It looks to me like it represents a given resource (css file) per running instance of Jetty. By using MD5 it instead represents the file itself. Problems with using a token that represents a given resource per running instance of jetty: - if the server restarts you use a new token, so all clients are forced to re-get the 'new' resource - if you run more than one server, then each server has different tokens, so clients think there are different resources I also like the suggestion that a solution to the consolidation problem be kept separate from the problem of generating unique urls for cachable resources (such as CSS, javascript, etc). 2. Consolidation of CSS files on a given page for performance firstly, and secondly for caching. Would there be times when people would not want the behaviour of 2? Im generally not a huge fan of things that mess with user code or could provide uneasy behaviour; im thinking specifically when people build there templates where CSS values are overridden by values loaded after initial value ad unless its munged together right, it might damage the expected behaviour (think blueprint)...? Can I suggest we solve the caching problem using the known hack of random strings, then deal with this proposal of resource consolidation? What I'm playing with is lift:css.combine res:css name=abc.css/ res:css name=def.css/ /lift:css.combine under the hood this would be a function that return a Stream Response that concatenates the streams of files in questions serving them sequentially in the corresponding order. So from Lift's perspective there is no additional computation involved comparing with current situation except we serve desired resources in one response. To sum up the random string is what I think we should start with. IMO it is a fairly good solution that can evolve in time towards something else. Cheers Tim On 13 Feb 2010, at 08:45, Marius wrote: On 12 feb., 23:04, Alex Black a...@alexblack.ca wrote: Yes, that's how it should work if everything was configured correctly (which I think it wasn't for the OP) Heh, I'm the OP. I'll have to dig into why its not working as expected I guess. But what we were discussing (at least I was :-) was more that Lift should serve resources with an Expires date in the far future. That way the browser will only make a single request for a resource (as long as the file is cached). This works well for returning visitors. But of course an updated resource should be fetched, hence the unique filenames. There are some things I like about that solution, but the unique filenames just seems wrong. So I see that a far in the future expires works, but the reason you need the unique filenames is because it doesn't really work. The far in the future expires says you can cache this for a long time cause it won't change. The other option is say you can cache this for like the next hour but every time you fetch it, you can tell me when you last got it (conditional GET), and I won't send it to you if it hasn't changed (304 not modified). This results in more requests, but no need for unique filenames or anything, instead if the file changes then the server will serve it up to whoever needs it. It doesn't sound like today this solution is consistent on all major browsers. Can you confirm that it does? I used the query string solution in the past (like many others) and this works reasonably well. It is not a perfect solution but better then today. Besides if we want to adopt a different solution that would be pretty easy because this knowledge will be built in the snippet and the user code wont really change. Combining individual files will improve load times for first time visitors by reducing the number of requests. That sounds like a great idea.. would like the same thing for JS. Does the YUI compressor tool that lift uses with maven have this type of feature? I Thought I read that it did. /Jeppe -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/liftweb?hl=en. -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To
[Lift] Re: Can I test Lift 2.0-M2 with Scala 2.0 Beta 1 now?
Hi, I believe the main branch is still built with scala 2.7.7 (as you pointed out in your post). However there is a snapshot build for scala 2.8 named 2.0-scala280-SNAPSHOT. mvn archetype:generate -U \ -DarchetypeGroupId=net.liftweb \ -DarchetypeArtifactId=lift-archetype-basic \ -DarchetypeVersion=2.0-scala280-SNAPSHOT \ -DarchetypeRepository=http://scala-tools.org/repo-snapshots \ -DremoteRepositories=http://scala-tools.org/repo-snapshots \ -DgroupId=$1 -DartifactId=$2 Please see the following discussion for more details: http://groups.google.com/group/liftweb/browse_thread/thread/768c6798017b5b6b/9961710446c7dd20 Best regards Trond On 16 Feb, 11:55, chungonn chung...@gmail.com wrote: Hi, Question - Can I test Lift 2.0-M2 with Scala 2.0 Beta 1 now? My environment is OSX 10.6, Java 1.6.0_17-b04-248-10M3025. Project created using - mvn archetype:generate -U - DarchetypeGroupId=net.liftweb -DarchetypeArtifactId=lift-archetype- blank -DarchetypeVersion=2.0-M2 -DremoteRepositories=http://scala- tools.org/repo-releases -DgroupId=demo.helloworld - DartifactId=helloworld -Dversion=1.0-SNAPSHOT I tried creating a project using liftweb 2.0-M and I noticed that it is still having a scala 2.7.7 dependency. I tried changing the Scala compiler dependency to 2.8.0.Beta 1 and after issuing following maven command - mvn clean jetty:run, I received the error below. After some googling around, i gathered the error is the result of using scala 2.8 compiler. [ERROR] error: error while loading MainGenericRunner, Scala signature MainGenericRunner has wrong version [INFO] expected: 4.1 [INFO] found: 5.0 [ERROR] one error found I am hoping to do some explorations using Lift 2.0 + Scala 2.8 + Eclipse 3.5.1. Any help is greatly appreciated. Regards chung-onn -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
[Lift] Re: thread [Image upload and serving example]
Thanks Ross! This was helpful. - Luke p.s. Anyone know why the following thread: http://groups.google.com/group/liftweb/browse_thread/thread/b0509263e18c9a66/f36535bbe15273d6 only has Reply to author links and no Reply links? Is it its age ? (e.g., last year) Just trying to avoid another inadvertent email to author rather than the list. On Feb 15, 5:16 pm, Ross Mellgren dri...@gmail.com wrote: I have a mild derivative of this code in another test repo I built for someone else: http://github.com/Dridus/test-image Maybe that'll help. -Ross On Feb 15, 2010, at 5:19 PM, David Pollak wrote: On Mon, Feb 15, 2010 at 5:54 AM, Luke Nezda lne...@gmail.com wrote: Hello - I attempted to reply to the thread with subject Image upload and serving example initiated by David Pollack on Nov. 30, 2009 via the Google Groups UI and inadvertently sent mail directly to David because there was only a Reply to author link, no plain Reply link -- oops. (He politely replied Please post all questions to the list.) Please forgive my ignorance, but why didn't that thread have Reply links after each message ? (I see other threads do) Anyway, my real question: Is the code referenced in that original thread --http://github.com/dpp/imagine/ -- code still floating around somewhere ? Sorry... I did a purge of my un-used GitHub projects and my hard drive a week or so back and deleted it. Sorry. :-( Thanks, - Luke -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/liftweb?hl=en. -- Lift, the simply functional web frameworkhttp://liftweb.net Beginning Scalahttp://www.apress.com/book/view/1430219890 Follow me:http://twitter.com/dpp Surf the harmonics -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/liftweb?hl=en. -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
Re: [Lift] Context path, proxies Lift
Any chance you could have this discussion on-list to increase the general knowledge about it? -Ross On Feb 16, 2010, at 8:50 AM, Timothy Perrett wrote: Contact me privatly with your IM adress and lets chat about it Jeppe - I'm doing something similar with helicon (windows proxy) and it's working fine. I'm traveling now but will be about later Cheers, Tim Sent from my iPhone On 16 Feb 2010, at 10:01, Jeppe Nejsum Madsen je...@ingolfs.dk wrote: Hi, I want to setup a single nginx in front of two independent lift apps (see previous thread) but haven't succeeded. What I wan't is this: External url foo.com/index.html goes to jetty: localhost:8080/foo/index.html External url bar.com/index.html goes to jetty: localhost:8080/bar/index.html So, I'm trying to see if I can get the basic jetty setup going before throwing nginx in the mix. Here are my findings: With LiftRules.calculateContextPath = () = Empty: Deploying lift app foo in context foo works fine: ie localhost:8080/foo/index.html gives me the app and the app works with the localhost:8080/foo prefix Not surprisingly, setting LiftRules.calculateContextPath = () = Full(/foo) gives same result as above. Ok, Fine so far. But when nginx is added, a redirect to /index.html should not go to /foo/index.html but to /index.html So I tried: LiftRules.calculateContextPath = () = Full(/) But now, hitting localhost:8080/foo/index.html (simulating a request from nginx), I just get my raw index.html template without any Lift processing as if Lift has ignored the request. Am I misunderstanding the purpose of calculateContextPath? How can I make lift run in a non-root context but at the same time, when generating URLs, not prepend the context path? /Jeppe -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en. -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en. -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
[Lift] Re: Cached CSS (and Javascript?) issue
On Feb 16, 3:55 pm, Alex Black a...@alexblack.ca wrote: calculating an md5 of a file would induce additional computation time and we'd need to maintain hashes for each resource file. The prototype that I have now is a function in LiftRules that by default returns a random value generated on startup. Applications that needs MD5 per file could calculate that and maintain them. Hi Marius, what does the proposed token represent? It looks to me like it represents a given resource (css file) per running instance of Jetty. In my prototype it is a random string generated once at startup. So this is the same for all css/js references. But this is imposed just by the default implementation of the LiftRules.attachResourceId function. A different implementation can generate unique MD5 sequences based on each individual file. But I'm not convinced that this should be on the framework side. By using MD5 it instead represents the file itself. Problems with using a token that represents a given resource per running instance of jetty: - if the server restarts you use a new token, so all clients are forced to re-get the 'new' resource Correct. - if you run more than one server, then each server has different tokens, so clients think there are different resources Correct again. I also like the suggestion that a solution to the consolidation problem be kept separate from the problem of generating unique urls for cachable resources (such as CSS, javascript, etc). The MD5 generation if we want it to reflect the file content would take some time to generate. It would indeed happen once if that resource was not seen yet. But along with this there will be other logic: 1. Detect when files changes ... for that we'd need a polling mechanism as we wouldn't want hash calculation on each page rendering. 2. Maintain the hash cache Personally I do not think this is an imperative thing for the framework. I think it is more important for Lift to allow the flexibility to apply this type of logic and this is what I'm aiming to. I agree with you that MD5 approach is more consistent but this random token applied per server instance is not that bad as it's main purpose is not to optimize the resource loading but to have a minimal mechanism to force browsers to refresh the resources if we change css/ js on server side (as the original issue was). Other people may not prefer the MD5 approach but rely more on expiration headers and so on. Your two cases described would be solved by using the MD5 approach but I don't think it is a disaster if we restart the servers clients will fetch again the CSS as they think that the resource changed. Furthermore if one of the committers wants to add this MD5 logic after this support is in, he can certainly do it. To me the proper abstraction in allowing that is more important right now. 2. Consolidation of CSS files on a given page for performance firstly, and secondly for caching. Would there be times when people would not want the behaviour of 2? Im generally not a huge fan of things that mess with user code or could provide uneasy behaviour; im thinking specifically when people build there templates where CSS values are overridden by values loaded after initial value ad unless its munged together right, it might damage the expected behaviour (think blueprint)...? Can I suggest we solve the caching problem using the known hack of random strings, then deal with this proposal of resource consolidation? What I'm playing with is lift:css.combine res:css name=abc.css/ res:css name=def.css/ /lift:css.combine under the hood this would be a function that return a Stream Response that concatenates the streams of files in questions serving them sequentially in the corresponding order. So from Lift's perspective there is no additional computation involved comparing with current situation except we serve desired resources in one response. To sum up the random string is what I think we should start with. IMO it is a fairly good solution that can evolve in time towards something else. Cheers Tim On 13 Feb 2010, at 08:45, Marius wrote: On 12 feb., 23:04, Alex Black a...@alexblack.ca wrote: Yes, that's how it should work if everything was configured correctly (which I think it wasn't for the OP) Heh, I'm the OP. I'll have to dig into why its not working as expected I guess. But what we were discussing (at least I was :-) was more that Lift should serve resources with an Expires date in the far future. That way the browser will only make a single request for a resource (as long as the file is cached). This works well for returning visitors. But of course an updated resource should be fetched, hence the unique filenames. There are some things I like about that solution, but the unique filenames just seems wrong. So I see that a far in
[Lift] Re: Can I test Lift 2.0-M2 with Scala 2.0 Beta 1 now?
Hi Trond, Thank you! This will help to get me going in the shortest time :) Cheers! chung-onn On Feb 16, 7:20 pm, tbje trond.bjerkestr...@gmail.com wrote: Hi, I believe the main branch is still built with scala 2.7.7 (as you pointed out in your post). However there is a snapshot build for scala 2.8 named 2.0-scala280-SNAPSHOT. mvn archetype:generate -U \ -DarchetypeGroupId=net.liftweb \ -DarchetypeArtifactId=lift-archetype-basic \ -DarchetypeVersion=2.0-scala280-SNAPSHOT \ -DarchetypeRepository=http://scala-tools.org/repo-snapshots\ -DremoteRepositories=http://scala-tools.org/repo-snapshots\ -DgroupId=$1 -DartifactId=$2 Please see the following discussion for more details:http://groups.google.com/group/liftweb/browse_thread/thread/768c67980... Best regards Trond On 16 Feb, 11:55, chungonn chung...@gmail.com wrote: Hi, Question - Can I test Lift 2.0-M2 with Scala 2.0 Beta 1 now? My environment is OSX 10.6, Java 1.6.0_17-b04-248-10M3025. Project created using - mvn archetype:generate -U - DarchetypeGroupId=net.liftweb -DarchetypeArtifactId=lift-archetype- blank -DarchetypeVersion=2.0-M2 -DremoteRepositories=http://scala- tools.org/repo-releases -DgroupId=demo.helloworld - DartifactId=helloworld -Dversion=1.0-SNAPSHOT I tried creating a project using liftweb 2.0-M and I noticed that it is still having a scala 2.7.7 dependency. I tried changing the Scala compiler dependency to 2.8.0.Beta 1 and after issuing following maven command - mvn clean jetty:run, I received the error below. After some googling around, i gathered the error is the result of using scala 2.8 compiler. [ERROR] error: error while loading MainGenericRunner, Scala signature MainGenericRunner has wrong version [INFO] expected: 4.1 [INFO] found: 5.0 [ERROR] one error found I am hoping to do some explorations using Lift 2.0 + Scala 2.8 + Eclipse 3.5.1. Any help is greatly appreciated. Regards chung-onn -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
Re: [Lift] Re: Cached CSS (and Javascript?) issue
In my prototype it is a random string generated once at startup. So this is the same for all css/js references. But this is imposed just by the default implementation of the LiftRules.attachResourceId function. A different implementation can generate unique MD5 sequences based on each individual file. But I'm not convinced that this should be on the framework side. From a high level perspective, I think a framework should (in order) 1) Provide flexibilty to do what users want 2) Provide the best defaults possible, with the least surprises and best performance such that all users don't have to reinvent the same wheel. [...] 1. Detect when files changes ... for that we'd need a polling mechanism as we wouldn't want hash calculation on each page rendering. 2. Maintain the hash cache I think it should be sufficient to do this once per app restart. Personally I do not think this is an imperative thing for the framework. I think it is more important for Lift to allow the flexibility to apply this type of logic and this is what I'm aiming to. Agreed cf. the above. Furthermore if one of the committers wants to add this MD5 logic after this support is in, he can certainly do it. If no one beats me to it, I'll have a look at some point, but really busy now with other stuff To me the proper abstraction in allowing that is more important right now. Yep /Jeppe -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
[Lift] Lift 2.0 RequestMatcher
I'm trying to use Lift 2.0-scala280-SNAPSHOT with Scala 2.8.0.Beta1. I'm looking to create a RESTful service. I looked at the routing examples available and they all seem to utilize something like... val apiDispatcher: LiftRules.DispatchPf = { case RequestMatcher(r @ RequestState(api :: _ :: Nil, _) ,_) = api(r, index) } LiftRules.statelessDispatchTable = apiDispatcher orElse LiftRules.statelessDispatchTable First, the DisipatchPf was renamed to DisipatchPF, this was an easy fix, at least it was still there and nested in LiftRules... But I don't see RequestMatcher anywhere and compiler complains error: not found: value RequestMatcher What has RequestMatcher been replaced with, or am I missing something else? Ilya -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
Re: [Lift] Context path, proxies Lift
Seeing as I don't know what the solution is yet, no. Lol. I'd rather just have a 15 min conversation than waste time with a million emails ( I'm very busy right now ) Will get jeppe to post working solution when one exists... Cheers, Tim Sent from my iPhone On 16 Feb 2010, at 15:15, Ross Mellgren dri...@gmail.com wrote: Any chance you could have this discussion on-list to increase the general knowledge about it? -Ross On Feb 16, 2010, at 8:50 AM, Timothy Perrett wrote: Contact me privatly with your IM adress and lets chat about it Jeppe - I'm doing something similar with helicon (windows proxy) and it's working fine. I'm traveling now but will be about later Cheers, Tim Sent from my iPhone On 16 Feb 2010, at 10:01, Jeppe Nejsum Madsen je...@ingolfs.dk wrote: Hi, I want to setup a single nginx in front of two independent lift apps (see previous thread) but haven't succeeded. What I wan't is this: External url foo.com/index.html goes to jetty: localhost:8080/foo/ index.html External url bar.com/index.html goes to jetty: localhost:8080/bar/ index.html So, I'm trying to see if I can get the basic jetty setup going before throwing nginx in the mix. Here are my findings: With LiftRules.calculateContextPath = () = Empty: Deploying lift app foo in context foo works fine: ie localhost:8080/foo/index.html gives me the app and the app works with the localhost:8080/foo prefix Not surprisingly, setting LiftRules.calculateContextPath = () = Full(/foo) gives same result as above. Ok, Fine so far. But when nginx is added, a redirect to / index.html should not go to /foo/index.html but to /index.html So I tried: LiftRules.calculateContextPath = () = Full(/) But now, hitting localhost:8080/foo/index.html (simulating a request from nginx), I just get my raw index.html template without any Lift processing as if Lift has ignored the request. Am I misunderstanding the purpose of calculateContextPath? How can I make lift run in a non-root context but at the same time, when generating URLs, not prepend the context path? /Jeppe -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/liftweb?hl=en . -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/liftweb?hl=en . -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/liftweb?hl=en . -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
Re: [Lift] Lift 2.0 RequestMatcher
As a word before giving you a direct answer, you should know that Scala 2.8.0 branch of Lift is not officially supported yet. We obviously invite bugs to fix and so on, but there are things that could be strangely broken and we won't be able to support you as well. You might consider switching to Scala 2.7.7 and Lift 2.0-SNAPSHOT if you want to be on the more stable branch. That said, DispatchPF is now PartialFunction[Req, () = Box[LiftResponse]], so you need: val apiDispatcher: LiftRules.DispatchPF = { case Req(api::_::Nil, _, _) = api(r, index) } (This uses Req.unapply, FYI) Hope that helps, -Ross On Feb 16, 2010, at 11:37 AM, Ilya Sterin wrote: I'm trying to use Lift 2.0-scala280-SNAPSHOT with Scala 2.8.0.Beta1. I'm looking to create a RESTful service. I looked at the routing examples available and they all seem to utilize something like... val apiDispatcher: LiftRules.DispatchPf = { case RequestMatcher(r @ RequestState(api :: _ :: Nil, _) ,_) = api(r, index) } LiftRules.statelessDispatchTable = apiDispatcher orElse LiftRules.statelessDispatchTable First, the DisipatchPf was renamed to DisipatchPF, this was an easy fix, at least it was still there and nested in LiftRules... But I don't see RequestMatcher anywhere and compiler complains error: not found: value RequestMatcher What has RequestMatcher been replaced with, or am I missing something else? Ilya -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en. -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
Re: [Lift] Context path, proxies Lift
Okay, cool. Figured it couldn't hurt to ask ;-) -Ross On Feb 16, 2010, at 11:48 AM, Timothy Perrett wrote: Seeing as I don't know what the solution is yet, no. Lol. I'd rather just have a 15 min conversation than waste time with a million emails ( I'm very busy right now ) Will get jeppe to post working solution when one exists... Cheers, Tim Sent from my iPhone On 16 Feb 2010, at 15:15, Ross Mellgren dri...@gmail.com wrote: Any chance you could have this discussion on-list to increase the general knowledge about it? -Ross On Feb 16, 2010, at 8:50 AM, Timothy Perrett wrote: Contact me privatly with your IM adress and lets chat about it Jeppe - I'm doing something similar with helicon (windows proxy) and it's working fine. I'm traveling now but will be about later Cheers, Tim Sent from my iPhone On 16 Feb 2010, at 10:01, Jeppe Nejsum Madsen je...@ingolfs.dk wrote: Hi, I want to setup a single nginx in front of two independent lift apps (see previous thread) but haven't succeeded. What I wan't is this: External url foo.com/index.html goes to jetty: localhost:8080/foo/index.html External url bar.com/index.html goes to jetty: localhost:8080/bar/index.html So, I'm trying to see if I can get the basic jetty setup going before throwing nginx in the mix. Here are my findings: With LiftRules.calculateContextPath = () = Empty: Deploying lift app foo in context foo works fine: ie localhost:8080/foo/index.html gives me the app and the app works with the localhost:8080/foo prefix Not surprisingly, setting LiftRules.calculateContextPath = () = Full(/foo) gives same result as above. Ok, Fine so far. But when nginx is added, a redirect to /index.html should not go to /foo/index.html but to /index.html So I tried: LiftRules.calculateContextPath = () = Full(/) But now, hitting localhost:8080/foo/index.html (simulating a request from nginx), I just get my raw index.html template without any Lift processing as if Lift has ignored the request. Am I misunderstanding the purpose of calculateContextPath? How can I make lift run in a non-root context but at the same time, when generating URLs, not prepend the context path? /Jeppe -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en. -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en. -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en. -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en. -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
Re: [Lift] Re: thread [Image upload and serving example]
Yes, it's the age. It's stops people dragging up mega old threads and i would imagine it's something archive related in google groups Cheers, Tim Sent from my iPhone On 16 Feb 2010, at 14:46, Luke Nezda lne...@gmail.com wrote: Thanks Ross! This was helpful. - Luke p.s. Anyone know why the following thread: http://groups.google.com/group/liftweb/browse_thread/thread/b0509263e18c9a66/f36535bbe15273d6 only has Reply to author links and no Reply links? Is it its age ? (e.g., last year) Just trying to avoid another inadvertent email to author rather than the list. On Feb 15, 5:16 pm, Ross Mellgren dri...@gmail.com wrote: I have a mild derivative of this code in another test repo I built for someone else: http://github.com/Dridus/test-image Maybe that'll help. -Ross On Feb 15, 2010, at 5:19 PM, David Pollak wrote: On Mon, Feb 15, 2010 at 5:54 AM, Luke Nezda lne...@gmail.com wrote: Hello - I attempted to reply to the thread with subject Image upload and serving example initiated by David Pollack on Nov. 30, 2009 via the Google Groups UI and inadvertently sent mail directly to David because there was only a Reply to author link, no plain Reply link -- oops. (He politely replied Please post all questions to the list.) Please forgive my ignorance, but why didn't that thread have Reply links after each message ? (I see other threads do) Anyway, my real question: Is the code referenced in that original thread --http://github.com/dpp/imagine/ -- code still floating around somewhere ? Sorry... I did a purge of my un-used GitHub projects and my hard drive a week or so back and deleted it. Sorry. :-( Thanks, - Luke -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com . For more options, visit this group athttp://groups.google.com/ group/liftweb?hl=en. -- Lift, the simply functional web frameworkhttp://liftweb.net Beginning Scalahttp://www.apress.com/book/view/1430219890 Follow me:http://twitter.com/dpp Surf the harmonics -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com . For more options, visit this group athttp://groups.google.com/ group/liftweb?hl=en. -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/liftweb?hl=en . -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
Re: [Lift] Re: Error processing SHtml functions withing nested NodeSeq/Scala code
On Tue, Feb 16, 2010 at 1:17 AM, soumik soum...@gmail.com wrote: Hi Marius, Thanks for the quick update. The xhtml returned from the listFilesInDir() is actually sent as a message to a display CometActor which renders the xhtml it receives within a specific div tag. So in essence we have these multiple feature threads running(the one in question is intended to be a local file manager feature) which generates xhtml for different functions which are then sent to this one display CometActor which displays it. So we intend to handle multi-feature tasking by running just the one CometActor and not multiples of them which obviously is a problem for lift(since the max no. of CometActors in a page is 2). But back to your explanation of the S context getting lost, I think I understand what you mean regarding the session context. But does it also apply for SHtml generator methods?? I mean, does SHtml generator methods depend on the state of the session?? Another question I have is - even if SHtml generator methods fail to co-relate the session, shouldn't SHtml generator methods return?? or throw an exception? I don't know if you happened to use the exact same function in a LiftActor object or not, but if you do that you'll see that the function just doesn't return. Also, I don't intend to maintain state preservation. I just want to create a list of a href tags for all files which when clicked should make an Ajax call to a specific function in the LiftActor thread which processes the selection. Could you suggest some alternative way I could go about this with the current architecture(1 comet actor for display and individual feature-specific LiftActors sending xhtml to CometActor for rendering)?? I would suggest having the separate threads do any I/O and pre-processing of information... basically build a model. The view generation (converting the Model to HTML with Ajax stuff) should happen in the CometActor. You're not going to get any better performance by doing the view generation in separate Actors. Thanks, Soumik On Feb 16, 1:16 pm, Marius marius.dan...@gmail.com wrote: Well so you're using it from your own actor. I would not recommend this due to state preservation. I mean S context is very likely lost because your LiftActor is running on a different thread. What you need is to pass the LiftSession instance to your LiftActor say using some distinct message like: case class Init(session: LiftSession) then in your messageHandler protected def messageHandler = { case FileManagerMsg(someMsg) = { S.initIfNotInitted(session) { var fileList = listFilesInDir(/Users/soumik/Movies/) Log.info(OUTPUT: + fileList) } } } But I'm not sure from your code wht you do with the output of your listFilesInDir since that never gets to be rendered. I strongly recommend using CometActor whenever you want to render something asynchronously. It does a lots of good things for you. Br's, Marius On Feb 16, 9:33 am, soumik soum...@gmail.com wrote: Hi Marius, Thanks for your response. I'm sorry for mis-communicating my problem earlier. As you pointed out the problem doesn't occur when the call to the function is made from a CometActor. In my case too, it was not a CometActor. Rather, it was the LiftActor. (Sometime back we had different CometActors for different feature threads, now we have 1 single CometActor which takes care of the display and different LiftActor threads which do the feature related stuff. Hence the confusion on my part). Anyways, here's the relevant code: - object TheVideoPlayerThread extends LiftActor { val threadName = FileManager def listFilesInDir(dirName:String): NodeSeq = { Log.info(Recursing for: + dirName) val files = (new java.io.File(dirName)).listFiles def showFile1() = AAA li class=fileElem id=dir{dirName}/li ul {files.flatMap(f = { if (f.isDirectory()) { Log.info(Directory: + f.toString) listFilesInDir(f.toString) } else { Log.info(Regular file: + f.getName) li class=fileElem id=regfile {SHtml.link(, () = showFile1, Text(f.getName)) } //This is the line causing the issue /li } } )} /ul } protected def messageHandler = { case FileManagerMsg(someMsg) = { var fileList = listFilesInDir(/Users/soumik/Movies/) Log.info(OUTPUT: + fileList) } } - (I've omitted some of code in this thread
[Lift] Re: Error processing SHtml functions withing nested NodeSeq/Scala code
On Feb 16, 11:17 am, soumik soum...@gmail.com wrote: Hi Marius, Thanks for the quick update. The xhtml returned from the listFilesInDir() is actually sent as a message to a display CometActor which renders the xhtml it receives within a specific div tag. So in essence we have these multiple feature threads running(the one in question is intended to be a local file manager feature) which generates xhtml for different functions which are then sent to this one display CometActor which displays it. So we intend to handle multi-feature tasking by running just the one CometActor and not multiples of them which obviously is a problem for lift(since the max no. of CometActors in a page is 2). But back to your explanation of the S context getting lost, I think I understand what you mean regarding the session context. But does it also apply for SHtml generator methods?? I mean, does SHtml generator methods depend on the state of the session?? Yes if you bind functions. Functions are kept per session. Another question I have is - even if SHtml generator methods fail to co-relate the session, shouldn't SHtml generator methods return?? or throw an exception? No as SHtml should be used in the proper S context. That's why it is called [S]html. I don't know if you happened to use the exact same function in a LiftActor object or not, but if you do that you'll see that the function just doesn't return. Also, I don't intend to maintain state preservation. You do not explicitly but as you are trying to bind functions (attach a scla function to a link, button etc) you need the proper context. I just want to create a list of a href tags for all files which when clicked should make an Ajax call to a specific function in the LiftActor thread which processes the selection. Could you suggest some alternative way I could go about this with the current architecture(1 comet actor for display and individual feature-specific LiftActors sending xhtml to CometActor for rendering)?? Take Dave's advice. It is very good and leads to cleaner separation of concern. Thanks, Soumik On Feb 16, 1:16 pm, Marius marius.dan...@gmail.com wrote: Well so you're using it from your own actor. I would not recommend this due to state preservation. I mean S context is very likely lost because your LiftActor is running on a different thread. What you need is to pass the LiftSession instance to your LiftActor say using some distinct message like: case class Init(session: LiftSession) then in your messageHandler protected def messageHandler = { case FileManagerMsg(someMsg) = { S.initIfNotInitted(session) { var fileList = listFilesInDir(/Users/soumik/Movies/) Log.info(OUTPUT: + fileList) } } } But I'm not sure from your code wht you do with the output of your listFilesInDir since that never gets to be rendered. I strongly recommend using CometActor whenever you want to render something asynchronously. It does a lots of good things for you. Br's, Marius On Feb 16, 9:33 am, soumik soum...@gmail.com wrote: Hi Marius, Thanks for your response. I'm sorry for mis-communicating my problem earlier. As you pointed out the problem doesn't occur when the call to the function is made from a CometActor. In my case too, it was not a CometActor. Rather, it was the LiftActor. (Sometime back we had different CometActors for different feature threads, now we have 1 single CometActor which takes care of the display and different LiftActor threads which do the feature related stuff. Hence the confusion on my part). Anyways, here's the relevant code: - object TheVideoPlayerThread extends LiftActor { val threadName = FileManager def listFilesInDir(dirName:String): NodeSeq = { Log.info(Recursing for: + dirName) val files = (new java.io.File(dirName)).listFiles def showFile1() = AAA li class=fileElem id=dir{dirName}/li ul {files.flatMap(f = { if (f.isDirectory()) { Log.info(Directory: + f.toString) listFilesInDir(f.toString) } else { Log.info(Regular file: + f.getName) li class=fileElem id=regfile {SHtml.link(, () = showFile1, Text(f.getName)) } //This is the line causing the issue /li } } )} /ul } protected def messageHandler = { case FileManagerMsg(someMsg) = { var fileList = listFilesInDir(/Users/soumik/Movies/) Log.info(OUTPUT: + fileList) } } - (I've
[Lift] Re: Error processing SHtml functions withing nested NodeSeq/Scala code
Thanks Marius and David for your suggestions. I'll try that out. As to the problem itself, don't you think there should some kind of exception generation to avoid the issue happening? On Feb 16, 10:35 pm, Marius marius.dan...@gmail.com wrote: On Feb 16, 11:17 am, soumik soum...@gmail.com wrote: Hi Marius, Thanks for the quick update. The xhtml returned from the listFilesInDir() is actually sent as a message to a display CometActor which renders the xhtml it receives within a specific div tag. So in essence we have these multiple feature threads running(the one in question is intended to be a local file manager feature) which generates xhtml for different functions which are then sent to this one display CometActor which displays it. So we intend to handle multi-feature tasking by running just the one CometActor and not multiples of them which obviously is a problem for lift(since the max no. of CometActors in a page is 2). But back to your explanation of the S context getting lost, I think I understand what you mean regarding the session context. But does it also apply for SHtml generator methods?? I mean, does SHtml generator methods depend on the state of the session?? Yes if you bind functions. Functions are kept per session. Another question I have is - even if SHtml generator methods fail to co-relate the session, shouldn't SHtml generator methods return?? or throw an exception? No as SHtml should be used in the proper S context. That's why it is called [S]html. I don't know if you happened to use the exact same function in a LiftActor object or not, but if you do that you'll see that the function just doesn't return. Also, I don't intend to maintain state preservation. You do not explicitly but as you are trying to bind functions (attach a scla function to a link, button etc) you need the proper context. I just want to create a list of a href tags for all files which when clicked should make an Ajax call to a specific function in the LiftActor thread which processes the selection. Could you suggest some alternative way I could go about this with the current architecture(1 comet actor for display and individual feature-specific LiftActors sending xhtml to CometActor for rendering)?? Take Dave's advice. It is very good and leads to cleaner separation of concern. Thanks, Soumik On Feb 16, 1:16 pm, Marius marius.dan...@gmail.com wrote: Well so you're using it from your own actor. I would not recommend this due to state preservation. I mean S context is very likely lost because your LiftActor is running on a different thread. What you need is to pass the LiftSession instance to your LiftActor say using some distinct message like: case class Init(session: LiftSession) then in your messageHandler protected def messageHandler = { case FileManagerMsg(someMsg) = { S.initIfNotInitted(session) { var fileList = listFilesInDir(/Users/soumik/Movies/) Log.info(OUTPUT: + fileList) } } } But I'm not sure from your code wht you do with the output of your listFilesInDir since that never gets to be rendered. I strongly recommend using CometActor whenever you want to render something asynchronously. It does a lots of good things for you. Br's, Marius On Feb 16, 9:33 am, soumik soum...@gmail.com wrote: Hi Marius, Thanks for your response. I'm sorry for mis-communicating my problem earlier. As you pointed out the problem doesn't occur when the call to the function is made from a CometActor. In my case too, it was not a CometActor. Rather, it was the LiftActor. (Sometime back we had different CometActors for different feature threads, now we have 1 single CometActor which takes care of the display and different LiftActor threads which do the feature related stuff. Hence the confusion on my part). Anyways, here's the relevant code: - object TheVideoPlayerThread extends LiftActor { val threadName = FileManager def listFilesInDir(dirName:String): NodeSeq = { Log.info(Recursing for: + dirName) val files = (new java.io.File(dirName)).listFiles def showFile1() = AAA li class=fileElem id=dir{dirName}/li ul {files.flatMap(f = { if (f.isDirectory()) { Log.info(Directory: + f.toString) listFilesInDir(f.toString) } else { Log.info(Regular file: + f.getName) li class=fileElem id=regfile {SHtml.link(, () = showFile1, Text(f.getName)) } //This is the line causing the issue /li
[Lift] Re: Error processing SHtml functions withing nested NodeSeq/Scala code
On Feb 16, 8:11 pm, soumik soum...@gmail.com wrote: Thanks Marius and David for your suggestions. I'll try that out. As to the problem itself, don't you think there should some kind of exception generation to avoid the issue happening? I still don't think there is a hang involved. Can you wrap your method call with a try/catch ? ... I have the feeling that a NPE (due to lack of proper S context) is thrown but because this is thrown on a different thread (as you'r inside a LiftActor) that is not shown anywhere. On Feb 16, 10:35 pm, Marius marius.dan...@gmail.com wrote: On Feb 16, 11:17 am, soumik soum...@gmail.com wrote: Hi Marius, Thanks for the quick update. The xhtml returned from the listFilesInDir() is actually sent as a message to a display CometActor which renders the xhtml it receives within a specific div tag. So in essence we have these multiple feature threads running(the one in question is intended to be a local file manager feature) which generates xhtml for different functions which are then sent to this one display CometActor which displays it. So we intend to handle multi-feature tasking by running just the one CometActor and not multiples of them which obviously is a problem for lift(since the max no. of CometActors in a page is 2). But back to your explanation of the S context getting lost, I think I understand what you mean regarding the session context. But does it also apply for SHtml generator methods?? I mean, does SHtml generator methods depend on the state of the session?? Yes if you bind functions. Functions are kept per session. Another question I have is - even if SHtml generator methods fail to co-relate the session, shouldn't SHtml generator methods return?? or throw an exception? No as SHtml should be used in the proper S context. That's why it is called [S]html. I don't know if you happened to use the exact same function in a LiftActor object or not, but if you do that you'll see that the function just doesn't return. Also, I don't intend to maintain state preservation. You do not explicitly but as you are trying to bind functions (attach a scla function to a link, button etc) you need the proper context. I just want to create a list of a href tags for all files which when clicked should make an Ajax call to a specific function in the LiftActor thread which processes the selection. Could you suggest some alternative way I could go about this with the current architecture(1 comet actor for display and individual feature-specific LiftActors sending xhtml to CometActor for rendering)?? Take Dave's advice. It is very good and leads to cleaner separation of concern. Thanks, Soumik On Feb 16, 1:16 pm, Marius marius.dan...@gmail.com wrote: Well so you're using it from your own actor. I would not recommend this due to state preservation. I mean S context is very likely lost because your LiftActor is running on a different thread. What you need is to pass the LiftSession instance to your LiftActor say using some distinct message like: case class Init(session: LiftSession) then in your messageHandler protected def messageHandler = { case FileManagerMsg(someMsg) = { S.initIfNotInitted(session) { var fileList = listFilesInDir(/Users/soumik/Movies/) Log.info(OUTPUT: + fileList) } } } But I'm not sure from your code wht you do with the output of your listFilesInDir since that never gets to be rendered. I strongly recommend using CometActor whenever you want to render something asynchronously. It does a lots of good things for you. Br's, Marius On Feb 16, 9:33 am, soumik soum...@gmail.com wrote: Hi Marius, Thanks for your response. I'm sorry for mis-communicating my problem earlier. As you pointed out the problem doesn't occur when the call to the function is made from a CometActor. In my case too, it was not a CometActor. Rather, it was the LiftActor. (Sometime back we had different CometActors for different feature threads, now we have 1 single CometActor which takes care of the display and different LiftActor threads which do the feature related stuff. Hence the confusion on my part). Anyways, here's the relevant code: - object TheVideoPlayerThread extends LiftActor { val threadName = FileManager def listFilesInDir(dirName:String): NodeSeq = { Log.info(Recursing for: + dirName) val files = (new java.io.File(dirName)).listFiles def showFile1() = AAA li class=fileElem id=dir{dirName}/li ul {files.flatMap(f = { if (f.isDirectory()) {
[Lift] Re: Re: [lift] presentation only equivalent of toForm
tis done: http://www.assembla.com/spaces/liftweb/tickets/350 bearfeeder wrote: On Tue, Feb 16, 2010 at 12:44 AM, Channing Walton channingwal...@mac.comwrote: thats fine for individual fields of a mapper, dates etc., but not for a object with mapped fields. This is what I get for my 'deal' object: Deal={ Name=Big Deal bank=1 Issue Type=Manufacturing Deal Type=MTN Currency=EUR Size/Coupon=1 Term=1 Rating=BBB created=15/02/10 creator=4 } to generate a read-only view I need to do this: deal.formFields.map(f = trtd{f.displayName}/tdtd{f.asHtml}/td/tr) It seems unbalanced that you can generate a form for editing purposes but not a view - unless I'm mistaken about that. Good feature. Please open a ticket and mark it as 2.0-M3. Naftoli Gugenheim wrote: asHtml? 2010/2/14 Channing Walton channingwal...@mac.com Hi, I am using toForm to create forms for crud operations on my mappers, but I cannot see an equivalent method for presentation purposes. That is, no form elements, just text presented in the same tabular format as the form. Is there one ? Channing -- View this message in context: http://old.nabble.com/presentation-only-equivalent-of-toForm-tp27586473p27586473.html Sent from the liftweb mailing list archive at Nabble.com. -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com liftweb%2bunsubscr...@googlegroups.comliftweb%252bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/liftweb?hl=en. -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/liftweb?hl=en. -- View this message in context: http://old.nabble.com/presentation-only-equivalent-of-toForm-tp27586473p27605101.html Sent from the liftweb mailing list archive at Nabble.com. -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/liftweb?hl=en. -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp Surf the harmonics -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en. -- View this message in context: http://old.nabble.com/presentation-only-equivalent-of-toForm-tp27586473p27614824.html Sent from the liftweb mailing list archive at Nabble.com. -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
Re: [Lift] Problematic Dependencies in lift-couchdb
Fix pushed to master: http://github.com/dpp/liftweb/commit/8e9e43dfd344256add50179f61524da4f07f47ec -Ross On Feb 15, 2010, at 5:40 PM, David Pollak wrote: On Mon, Feb 15, 2010 at 2:32 PM, Justin Reardon justin.rear...@gmail.com wrote: Hi folks, Using the lift-couchdb module, I noticed that the dispatch lift-json module lift-couchdb depends on has a dependency on the 1.1-M6 lift-json module. When using maven this isn't giving me any issues (the package is downloaded, but I guess the classpaths work out to my advantage) However, when I try to build my project in sbt, the compiler is picking up the 1.1-M6 lift-json module instead of 2.0-SNAPSHOT. This is causing compilation failures as I'm using some more recent additions to the lift-json module. I imagine there's something I can add in sbt to make my build work, but in general it seems wrong to have a Lift module that leads to a dependency with older versions of Lift. Yeah... this is a big problem. Please open a ticket and mark it as high priority. Thanks, Justin Reardon -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en. -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp Surf the harmonics -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en. -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
Re: [Lift] Problematic Dependencies in lift-couchdb
Tnx Connected by MOTOBLUR™ on T-Mobile -Original message- From: Ross Mellgren dri...@gmail.com To: liftweb@googlegroups.com Sent: Wed, Feb 17, 2010 04:22:05 GMT+00:00 Subject: Re: [Lift] Problematic Dependencies in lift-couchdb Fix pushed to master: http://github.com/dpp/liftweb/commit/8e9e43dfd344256add50179f61524da4f07f47ec -Ross On Feb 15, 2010, at 5:40 PM, David Pollak wrote: On Mon, Feb 15, 2010 at 2:32 PM, Justin Reardon justin.rear...@gmail.com wrote: Hi folks, Using the lift-couchdb module, I noticed that the dispatch lift-json module lift-couchdb depends on has a dependency on the 1.1-M6 lift-json module. When using maven this isn't giving me any issues (the package is downloaded, but I guess the classpaths work out to my advantage) However, when I try to build my project in sbt, the compiler is picking up the 1.1-M6 lift-json module instead of 2.0-SNAPSHOT. This is causing compilation failures as I'm using some more recent additions to the lift-json module. I imagine there's something I can add in sbt to make my build work, but in general it seems wrong to have a Lift module that leads to a dependency with older versions of Lift. Yeah... this is a big problem. Please open a ticket and mark it as high priority. Thanks, Justin Reardon -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en. -- -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
[Lift] NOT IN subqueries?
Hi, Is there a way to create NOT IN subqueries with lift-mapper? Heiko Work: weiglewilczek.com Blog: heikoseeberger.name Follow me: twitter.com/hseeberger OSGi on Scala: scalamodules.org Lift, the simply functional web framework: liftweb.net -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.