[Lift] Re: A Critique On Lift
i believe that one of the best ways to learn a new programming language is to read software written in it when reading Scala code, I rarely say "i don't understand how that works" and when I do, there's usually a good explanation of it somewhere on the web. usually I find myself asking "where is that defined?" or "what part of the language is that?" Scala is not like, for example, BASIC, where you can look up FOR, IF/ THEN/ELSE. there's lots of individual and compound punctuation marks that are very difficult to search for online and in PDFs (try searching for "!"). a lot of scala also relies on syntactic sugar, such as omitted types (no ": T" after a val/var/def); the dreaded underbar; operator overloading; and implicit conversions. you can hate on Java's verbosity (i know i have), but brevity has its own difficulties. On Oct 22, 11:44 pm, Naftoli Gugenheim wrote: > The last use of _, as in empty_?, is not a special scala meaning. As on Java, > underscores can be part of an identifier. Scala takes advantage of this to > combine letters and symbols in one name. These names, like empty_?, are a > Lift convention, as well as ..._! for use-with-care methods. The scala > library uses isEmpty. David, is it your original convention?. > > - > > tiro wrote: > > override def validations = validPriority _ :: super.validations > > funny, I had stumbled on exactly the same line of code when beginning. > Took me more than a day to understand what's going on. Especially > because when you copied code from the PDF version of the Liftbook/Lift > getting started guide, it would mess up spaces, so I would keep > loooking for a "_::" operator. > The Scala guys have really pushed it a bit hard on the use of the > underscore. At least four different uses: > - "it" for defining anonymous functions like above > - default value > - matching placeholder whose value is ignored > - use for constructing setter method names boolean functions (empty_?) --~--~-~--~~~---~--~~ 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: A Critique On Lift
>I'll repeat: there are no operators in scala s/operators/methods-with-operator-like-names/ anywhere, here's a typical case: import some.library.package.foo._ val a = bar 42 val b = a ~!~ 3.14159 you can't easily tell that bar is being imported via foo._ . what is bar's return type? what does ~!~ do? i'm not saying its not possible to track all this down, but you can't just print out a listing of a class and take it on the subway. you have to have access to the scaladocs and possibly even the sources. --b --~--~-~--~~~---~--~~ 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: A Critique On Lift
why, it reformats your hard drive On Oct 23, 6:17 pm, Viktor Klang wrote: > But if you name your method: "ashiuahsdyasdasd" what does it do? > > > > > > On Fri, Oct 23, 2009 at 9:47 PM, bob wrote: > > > >I'll repeat: there are no operators in scala > > > s/operators/methods-with-operator-like-names/ > > > anywhere, here's a typical case: > > > import some.library.package.foo._ > > > val a = bar 42 > > val b = a ~!~ 3.14159 > > > you can't easily tell that bar is being imported via foo._ . > > what is bar's return type? > > what does ~!~ do? > > > i'm not saying its not possible to track all this down, but you can't > > just print out a listing of a class and take it on the subway. you > > have to have access to the scaladocs and possibly even the sources. > > > --b > > -- > Viktor Klang > | "A complex system that works is invariably > | found to have evolved from a simple system > | that worked." - John Gall > > Blog: klangism.blogspot.com > Twttr: viktorklang > Code: github.com/viktorklang --~--~-~--~~~---~--~~ 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] confusing error on missing bind
the following error was the result of a bug in my app: i had an element () in the template which I had forgotten to bind in the snippet >This page contains the following errors: >error on line 18 at column 48: Namespace prefix queries on service is not >defined in a big red box first, there is no "line 18" in the template, and "line 18" in my source code is a blank line, so I couldn't tell which line (let alone which column column) it was referring to. and since the error appeared in the webpage (rather than, say Console), i expected it referred to line 18 in the template, but in fact my error was in the code. second, the error would be more informative if it said something along the lines of: >. : Namespace prefix 'queries' on 'service' in template "index.html" was >not bound or even >. : in template "index.html' was not bound thanks, bob --~--~-~--~~~---~--~~ 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: A Critique On Lift
seriously, if you're suggesting that since function/method names don't have to have any relationship to the algorithm therein, so using punctuation should be fine, then why not just use single letters, followed by an optional digit, and be done. `When I use a word,' Humpty Dumpty said, in rather a scornful tone, `it means just what I choose it to mean -- neither more nor less.' On Oct 24, 2:44 pm, Viktor Klang wrote: > On Sat, Oct 24, 2009 at 8:18 PM, bob wrote: > > > why, it reformats your hard drive > > oh snap > > > > > > > > > On Oct 23, 6:17 pm, Viktor Klang wrote: > > > But if you name your method: "ashiuahsdyasdasd" what does it do? > > > > On Fri, Oct 23, 2009 at 9:47 PM, bob wrote: > > > > > >I'll repeat: there are no operators in scala > > > > > s/operators/methods-with-operator-like-names/ > > > > > anywhere, here's a typical case: > > > > > import some.library.package.foo._ > > > > > val a = bar 42 > > > > val b = a ~!~ 3.14159 > > > > > you can't easily tell that bar is being imported via foo._ . > > > > what is bar's return type? > > > > what does ~!~ do? > > > > > i'm not saying its not possible to track all this down, but you can't > > > > just print out a listing of a class and take it on the subway. you > > > > have to have access to the scaladocs and possibly even the sources. > > > > > --b > > > > -- > > > Viktor Klang > > > | "A complex system that works is invariably > > > | found to have evolved from a simple system > > > | that worked." - John Gall > > > > Blog: klangism.blogspot.com > > > Twttr: viktorklang > > > Code: github.com/viktorklang > > -- > Viktor Klang > | "A complex system that works is invariably > | found to have evolved from a simple system > | that worked." - John Gall > > Blog: klangism.blogspot.com > Twttr: viktorklang > Code: github.com/viktorklang --~--~-~--~~~---~--~~ 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: A Critique On Lift
is that for Scala or Perl? :) On Oct 24, 4:49 pm, Randinn wrote: > This may not be it, but you can at least print out this list :) > > http://jim-mcbeath.blogspot.com/2008/12/scala-operator-cheat-sheet.html > > On Oct 24, 6:47 am, bob wrote: > > > > > >I'll repeat: there are no operators in scala > > > s/operators/methods-with-operator-like-names/ > > > anywhere, here's a typical case: > > > import some.library.package.foo._ > > > val a = bar 42 > > val b = a ~!~ 3.14159 > > > you can't easily tell that bar is being imported via foo._ . > > what is bar's return type? > > what does ~!~ do? > > > i'm not saying its not possible to track all this down, but you can't > > just print out a listing of a class and take it on the subway. you > > have to have access to the scaladocs and possibly even the sources. > > > --b --~--~-~--~~~---~--~~ 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: confusing error on missing bind
indeed, you are correct. i thought the message was coming from Lift! On Oct 24, 8:11 pm, Kris Nuttycombe wrote: > You'll notice if you look at the page source that the error you saw is > actually generously provided by Firefox, not by Lift. There is an > overload of bind that you could use that allow you to provide a > default for any unbound value, although of course this can obscure > errors. For a while there was also some code that gave more > informative error messages if you were running the app in development > mode, but for some reason I don't think I've seen those recently. > > Hmm. Perhaps I need to make sure I'm not doing development in > production mode myself. :) > > Kris > > > > On Sat, Oct 24, 2009 at 5:39 PM, bob wrote: > > > the following error was the result of a bug in my app: i had an > > element () in the template which I had forgotten to > > bind in the snippet > > >>This page contains the following errors: > >>error on line 18 at column 48: Namespace prefix queries on service is not > >>defined > > > in a big red box > > > first, there is no "line 18" in the template, and "line 18" in my > > source code is a blank line, so I couldn't tell which line (let alone > > which column column) it was referring to. and since the error appeared > > in the webpage (rather than, say Console), i expected it referred to > > line 18 in the template, but in fact my error was in the code. > > > second, the error would be more informative if it said something along > > the lines of: > > >>. : Namespace prefix 'queries' on 'service' in template "index.html" > >>was not bound > > or even > > >>. : in template "index.html' was not bound > > > thanks, bob --~--~-~--~~~---~--~~ 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] compatible versions
is there a list of Lift-compatible versions of software? i'm still struggling with actual (from maven) or rumored (from private conversations) incompatibilities among scala, lift, IntelliJ, IntelliJ scala plugin, Databinder Dispatch. and the best the maven plug-in seems to be able do is tell me about that it has detected multiple versions of scala. --~--~-~--~~~---~--~~ 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: compatible versions
Dispatch requires 2.7.6, but Josh Suereth told me not to use 2.7.6 with Lift http://groups.google.com/group/maven-and-scala/msg/0f0574b08d72 this is why i'm suggesting there needs to be a single voice for Lift for version compatibility On Oct 26, 11:55 am, David Pollak wrote: > Lift 1.0.2, 1.1-M6 and 1.1-SNAPSHOT are all Scala 2.7.5. 2.7.5 is the > latest stable release of Scala. If you want to use a 2.7.4 or 2.7.6 > compiled library, it should work (the changes across 2.7.4-2.7.6 do not > trigger any of the trait inheritance problems.) > > You can consult your library for what version of Scala it uses. > > IntelliJ 8.1.x uses a 2.7.4-2.7.6 compatible version of Scala and will work > (as will NetBeans) for Lift-related development. > > On Mon, Oct 26, 2009 at 8:14 AM, bob wrote: > > > is there a list of Lift-compatible versions of software? i'm still > > struggling with actual (from maven) or rumored (from private > > conversations) incompatibilities among scala, lift, IntelliJ, IntelliJ > > scala plugin, Databinder Dispatch. and the best the maven plug-in > > seems to be able do is tell me about that it has detected multiple > > versions of scala. > > -- > Lift, the simply functional web frameworkhttp://liftweb.net > Beginning Scalahttp://www.apress.com/book/view/1430219890 > Follow me:http://twitter.com/dpp > Surf the harmonics --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: compatible versions
from http://www.scala-lang.org/downloads/ Current Stable Release: "The current version of Scala is 2.7.6" if Lift doesnt support 2.7.6, then maybe the Lift POM needs to say so. or at least the Downloads page should warn. On Oct 26, 12:12 pm, David Pollak wrote: >Lift is always on the most recent stable version of Scala. Currently that's >2.7.5. You can look through the Scala mailing list archives for further >discussion of why 2.7.6 is not stable --~--~-~--~~~---~--~~ 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: compatible versions
my bad, i missed it. thanks On Oct 26, 12:12 pm, Timothy Perrett wrote: > Further to my last email, checkout the numerous versions of dispatch > latest: > > http://scala-tools.org/repo-releases/net/databinder/ > > n8han makes sure that he is 2.7.5 compatible. > > Cheers, Tim > > On 26 Oct 2009, at 16:05, bob wrote: > > > > > > > Dispatch requires 2.7.6, but Josh Suereth told me not to use 2.7.6 > > with Lifthttp://groups.google.com/group/maven-and-scala/msg/0f0574b08d72 > > > this is why i'm suggesting there needs to be a single voice for Lift > > for version compatibility > > > On Oct 26, 11:55 am, David Pollak > > wrote: > >> Lift 1.0.2, 1.1-M6 and 1.1-SNAPSHOT are all Scala 2.7.5. 2.7.5 is > >> the > >> latest stable release of Scala. If you want to use a 2.7.4 or 2.7.6 > >> compiled library, it should work (the changes across 2.7.4-2.7.6 do > >> not > >> trigger any of the trait inheritance problems.) > > >> You can consult your library for what version of Scala it uses. > > >> IntelliJ 8.1.x uses a 2.7.4-2.7.6 compatible version of Scala and > >> will work > >> (as will NetBeans) for Lift-related development. > > >> On Mon, Oct 26, 2009 at 8:14 AM, bob wrote: > > >>> is there a list of Lift-compatible versions of software? i'm still > >>> struggling with actual (from maven) or rumored (from private > >>> conversations) incompatibilities among scala, lift, IntelliJ, > >>> IntelliJ > >>> scala plugin, Databinder Dispatch. and the best the maven plug-in > >>> seems to be able do is tell me about that it has detected multiple > >>> versions of scala. > > >> -- > >> Lift, the simply functional web frameworkhttp://liftweb.net > >> Beginning Scalahttp://www.apress.com/book/view/1430219890 > >> Follow me:http://twitter.com/dpp > >> Surf the harmonics --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] generating columns
"Listing 2.7: The Embedded Expense Table" in the LiftBook.pdf, page 19, has a great example of generating individual rows of a table. But lets say you wanted to generate the columns in the table, as well as the rows. is there a good example of how to do this in a template+snippet? TIA, bob --~--~-~--~~~---~--~~ 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: generating columns
PS: I know I can generate the TABLE, THEAD, TBODY, TR and TD elements directly in my snippet (although SHtml doesnt seems to be geared towards FORMs, rather than HTML generation like htmlKona) On Oct 26, 4:30 pm, bob wrote: > "Listing 2.7: The Embedded Expense Table" in the LiftBook.pdf, page > 19, has a great example of generating individual rows of a table. > > But lets say you wanted to generate the columns in the table, as well > as the rows. > > is there a good example of how to do this in a template+snippet? > > TIA, bob --~--~-~--~~~---~--~~ 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: generating columns
Thanks, Naftoli -- so are you suggesting a separate template for the TD and for the TR? bind the TD template, and then concatenate them up for each row? nevertheless, I started out with this: var columns : Set def buildHeader : NodeSeq = { {columns.map{{_}}.reduceLeft(_+_)) } } but i couldn't figure out the right incantation, and went for the easy way out def buildHeader : NodeSeq = { val result="" + (if (columns.isEmpty) "" else columns.map {"" + _ + ""}.reduceLeft(_+_)) + "" XML.loadString(result) } On Oct 26, 4:47 pm, Naftoli Gugenheim wrote: > Sorry I can't give you code, but the key here is the the BindParam can take a > function from a NodeSeq to a NodeSeq. Say each column represents a field. > "eachfield" -> bindIndividualFields > where bindIndividalField is a function that takes and returns a NodeSeq. Its > input will be the contents of . Inside the function do a > flatMap on your list of fields, and pass it another call to bind, passing > bind the input to bindIndividualFields. Thus you are calling bind on the > contents of eachfield repetitiously for each field, and concatenating (via > flatMap) the outputs of bind. > > - > > bob wrote: > > PS: I know I can generate the TABLE, THEAD, TBODY, TR and TD elements > directly in my snippet (although SHtml doesnt seems to be geared > towards FORMs, rather than HTML generation like htmlKona) > > On Oct 26, 4:30 pm, bob wrote: > > > > > "Listing 2.7: The Embedded Expense Table" in the LiftBook.pdf, page > > 19, has a great example of generating individual rows of a table. > > > But lets say you wanted to generate the columns in the table, as well > > as the rows. > > > is there a good example of how to do this in a template+snippet? > > > TIA, bob --~--~-~--~~~---~--~~ 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: generating columns
that's nice. thank you On Oct 26, 6:04 pm, Jeppe Nejsum Madsen wrote: > bob writes: > > "Listing 2.7: The Embedded Expense Table" in the LiftBook.pdf, page > > 19, has a great example of generating individual rows of a table. > > > But lets say you wanted to generate the columns in the table, as well > > as the rows. > > > is there a good example of how to do this in a template+snippet? > > > TIA, bob > > Here's some sample (based on, tada, CRUDify :-). There's some extra > stuff in there, but you should be able see the idea. If not, ask away... > > /Jeppe > > Template: > > > {_showAllHeader} > > > > > crud:style=""> > > > > > > {itemListActionsTemplate} > nowrap="nowrap"> > > > > > > > Snippet: > > def doCrudAll(in: NodeSeq): NodeSeq = { > val list = findAll(findForListParams : _*) > > def doHeaderItems(in: NodeSeq): NodeSeq = > listFields(list.head).flatMap(f => bind("crud", in, "name" -> f.displayHtml, > > AttrBindParam("style",Text(columnStyle(f.dbColumnName)), "style"))) > > def doRows(in: NodeSeq): NodeSeq = > list.flatMap{ > c => > def doRowItem(in: NodeSeq): NodeSeq = listFields(c).flatMap(f => > bind("crud", in, "value" -> f.asHtml)) > itemListActions(c,bind("crud", in , "row_item" -> doRowItem _)) > } > > if (list.isEmpty) > _showAllHeader ++ Der er ingen data. > else > bind("crud", in, "header_item" -> doHeaderItems _, > "row" -> doRows _) > } --~--~-~--~~~---~--~~ 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: RSS Library
i don't know if there's a specific RSS library for scala, but you can get pretty far with the builtin XML parsing stuff. this is the best resource I have found. http://burak.emir.googlepages.com/scalaxbook.docbk.html for the HTTP client, I am using DataBinder Dispatch: http://databinder.net/dispatch/About if you want real RSS code, you can use the Java ROME library, which i have used very successfully in java projects: https://rome.dev.java.net/ brgds, bob On Oct 30, 10:26 am, GA wrote: > Hello guys, > > is there any standard RSS Library to parse RSS and Atom feeds from a > scala client? > > Thanks in advance, > > GA --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Error with the SHtml.select method ?
interesting! have you tried /* Log.infoF _ */ ? On Oct 30, 10:31 am, "Neil.Lv" wrote: > Hi all, > > There is a question that about the SHtml.select method. > > ### This code will be error ? > def handleBook(id: String) { > book.type_id(id.toLong) > //Log.infoF _ > } > > bind("book", xhtml, > "type" -> select(Book.getBooks, Empty, handleBook _) > ... > ) > ### > > If i call the Log.infoF _ in the end of the hadleBook method, and it > will be work correctly. > ### > def handleBook(id: String) { > book.type_id(id.toLong) > Log.infoF _ > } > ### > > I don't know why comment the last statement the app will be error, > and the error message will > be like this, and somethings the erorr message will not clear, and > can't find where the error occurs. > ---> Error message: > ((scala.xml.Node) => Boolean)scala.xml.NodeSeq (and) (Int) > scala.xml.Node not be > applied to Long. > Or > [ERROR] BUILD ERROR > [INFO] > > [INFO] wrap: org.apache.commons.exec.ExecuteException: Process exited > with an er > ror: -2147483648(Exit value: -2147483648) > > Thanks for any suggestion! > > Cheers, > Neil --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Get the subfolders and all the files in the Directory in the Lift ?
i had call to do something similar, and here's the code. i'm sure someone smarter could replace the for comprehension with filter().map () def getPaths(prefix : String) : Set[String] = { // Resource Paths as an Array[Object] var jpaths = S.servletSession.open_!.getServletContext.getResourcePaths (prefix).toArray // convert to a Set[String] var paths = Set() ++ jpaths.map(_.asInstanceOf[String]) // append children for (path <- paths if path.endsWith("/")) { paths = paths ++ getPaths(path) } paths } here's what my app gets back: Set(/index.html, /WEB-INF/web.xml, /templates-hidden/, /WEB-INF/, / templates-hidden/default.html) what I still don't understand is why it doesn't return the XML configuration file that is found by getResourceAsStream() :( --~--~-~--~~~---~--~~ 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: Get the subfolders and all the files in the Directory in the Lift ?
when moved the file from /resources/foo.xml to /foo.xml (in the same path as index.html), it now finds it. i guess getResourcePaths() and getResourceAsStream() don't necessarily look in the same place. On Oct 30, 1:58 pm, bob wrote: > i had call to do something similar, and here's the code. i'm sure > someone smarter could replace the for comprehension with filter().map > () > > def getPaths(prefix : String) : Set[String] = { > > // Resource Paths as an Array[Object] > var jpaths = > S.servletSession.open_!.getServletContext.getResourcePaths > (prefix).toArray > > // convert to a Set[String] > var paths = Set() ++ jpaths.map(_.asInstanceOf[String]) > > // append children > for (path <- paths if path.endsWith("/")) { > paths = paths ++ getPaths(path) > } > paths > } > > here's what my app gets back: > > Set(/index.html, /WEB-INF/web.xml, /templates-hidden/, /WEB-INF/, / > templates-hidden/default.html) > > what I still don't understand is why it doesn't return the XML > configuration file that is found by getResourceAsStream() :( --~--~-~--~~~---~--~~ 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] directives versus snippets
if I see , it could mean one of two things: a directive, e.g., or or shorthand for a snippet, eg represents i guess I would like to see these disambiguated a shorthand for snippets that doesn't overlap with the directive namespace. some possible solutions: 1. would be the directive and would be the snippet. please don't get hung up on my use of dot. it is only an example, and not an actual suggestion. 2. maps to a real class, not some internal code, much the way maps to net.liftweb.builtin.snippets.Msgs (thanks Jorge) 3. is the directive, and is the snippet comments? thanks, bob --~--~-~--~~~---~--~~ 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: directives versus snippets
ok, Jorge told me on IRC that bind and surround are hard-coded 11:16 bobinator so,if maps to Class HelloWorld#howdy,i assume and map to Class Bind and Class Msgs, with some special sauce for the method? 11:15 jorgeortiz85 actually, all the directives could be implemented as snippets 11:16 jorgeortiz85 the fact that they aren't is just legacy cruft 11:16 jorgeortiz85 lift:msgs does 11:16 jorgeortiz85 lift:bind is hard-coded On Apr 10, 11:26 am, David Pollak wrote: > Bob, > They are actually the same thing. Lift's processing directives are simply > built-in snippets. You can, if you dare, override their functionality. :-) > > Thanks, > > David > > > > On Fri, Apr 10, 2009 at 11:23 AM, bob wrote: > > > if I see , it could mean one of two things: a directive, > > e.g., or or shorthand for a snippet, eg > > represents > > > i guess I would like to see these disambiguated a shorthand for > > snippets that doesn't overlap with the directive namespace. > > > some possible solutions: > > > 1. would be the directive and would be the > > snippet. please don't get hung up on my use of dot. it is only an > > example, and not an actual suggestion. > > > 2. maps to a real class, not some internal code, much the > > way maps to net.liftweb.builtin.snippets.Msgs (thanks > > Jorge) > > > 3. is the directive, and is the snippet > > > comments? > > > thanks, bob > > -- > 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: directives versus snippets
done. thanks guys On Apr 10, 11:36 am, David Pollak wrote: > On Fri, Apr 10, 2009 at 11:31 AM, Jorge Ortiz wrote: > > Huh? > > > lift: snippet, surround, embed, ignore, comet, children, a, form, loc, and > > with-param are all built-in in liftTagProcessing. Yes, they're overrideable, > > but imo it'd be nicer if they were Just A Snippet, like, say, lift:msgs. > > It's on my to-do list to do a little house cleaning in this area. http://liftweb.lighthouseapp.com/projects/26102/tickets/34-lift-processing-directives-should-be-implemented-as-snippets > > lift:bind is just bad naming. it's not actually a directive, it's just what > > lift:surround looks for to bind at. should probably be called surround:bind > > or something with a different namespace. > > Yeah... we should deprecate because it's not the same thing. > Please open a defect on this for me. http://liftweb.lighthouseapp.com/projects/26102/tickets/33-deprecate-liftbind > > > > > > > --j > > > On Fri, Apr 10, 2009 at 1:26 PM, David Pollak < > > feeder.of.the.be...@gmail.com> wrote: > > >> Bob, > >> They are actually the same thing. Lift's processing directives are simply > >> built-in snippets. You can, if you dare, override their functionality. :-) > > >> Thanks, > > >> David > > >> On Fri, Apr 10, 2009 at 11:23 AM, bob wrote: > > >>> if I see , it could mean one of two things: a directive, > >>> e.g., or or shorthand for a snippet, eg > >>> represents > > >>> i guess I would like to see these disambiguated a shorthand for > >>> snippets that doesn't overlap with the directive namespace. > > >>> some possible solutions: > > >>> 1. would be the directive and would be the > >>> snippet. please don't get hung up on my use of dot. it is only an > >>> example, and not an actual suggestion. > > >>> 2. maps to a real class, not some internal code, much the > >>> way maps to net.liftweb.builtin.snippets.Msgs (thanks > >>> Jorge) > > >>> 3. is the directive, and is the snippet > > >>> comments? > > >>> thanks, bob > > >> -- > >> Lift, the simply functional web frameworkhttp://liftweb.net > >> Beginning Scalahttp://www.apress.com/book/view/1430219890 > >> Follow me:http://twitter.com/dpp > >> Git some:http://github.com/dpp > > -- > Lift, the simply functional web 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] Does memcache fit in here somewhere?
I'm keeping my eye on Lift, but I'm primarily a PHP guy as far as paying the bills goes. I've got a slightly better high-level understanding of things now versus a month or so ago, but I'm not sure where caching fits into the picture. In the LAMP world, it's standard practice to put memcache in front of your database server. It's pretty much a "cache everything" philosophy. Is this not encouraged with Lift? I assume there are more caching choices in the Java world such as ehcache, but I don't see them mentioned on the list. Bob --~--~-~--~~~---~--~~ 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: Does memcache fit in here somewhere?
I've read most of what you guys have up there so far. Before I knew about it, I was pretty much lost. Very much looking forward to the final product. My favorite thing about Lift is the use of Snippets. I work in PHP primarily without a framework, and I don't mind writing SQL but it's always a struggle adding new features as consumer tastes change. Component-based development gets me excited. The one thing I can't quite grasp yet is how I can move away from memcache and use Actors. Thanks for that presentation though, David. Is this the general strategy: http://scala-blogs.org/2007/12/i-love-scala-actors.html ? There seems to have been talk of Terracotta integration at one point. Is that still in the works? Or, would we just rely on the load balancer to step in because an Actors cache wouldn't be clustered? Having a clear solution of how to scale would be pretty interesting to most PHP developers I know. Most of our conversations deal less with PHP and more with memcache and MySQL replication. Bob On Jan 7, 5:22 am, TylerWeir wrote: > Hey Bob, less about memcached and more about Lift in general, take a > look at the book, Marius, Derek and I are > writing:http://github.com/tjweir/liftbook/tree/master > > We'd love to get your feedback as a PHP guy. > > Thanks, > Tyler --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] How do I add sitemap.xml and robots.txt
I'm trying to add robots.txt and a sitemap.xml to a web site. My Boot.scala has a snippet that looks like val entries = Menu(Loc("Home", List("index"), "Home")) :: galleryMenu :: servingYouMenu :: socialSitesMenu :: aboutUsMenu :: Menu(Loc("ContactUs", List("ContactUs"), "Contact Us")) :: Menu(Loc("robots", List("robots.txt"), "robots.txt", Hidden)) :: Menu(Loc("sitemap", List("sitemap.xml"), "sitemap.xml", Hidden)) ::Nil The robots.txt file shows up right away, but I get a 404 when I try to access /sitemap.xml . I have a static sitemap.xml that I want to include. I tried this as a static xml file in the webapp directory. I also tried it without the explicit '.xml', but I had the same results. I tried to make it look more like my html, so I added a sitemap-tempate.xml in templates-hidden and had the sitemap.xml reference that. Eventually, I would like to generate the sitemap.xml from the SiteMap assuming that the user has not logged into the application. I would also assume that for most users, a default robots.txt would be easy to generate. This seems like something of general utility that would be a good chance to learn more about Lift. Can anyone explain how to display the simple, static sitemap.xml. I'm sure this is a newbie mistake, but I'm not seeing it on my own. -- 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: How do I add sitemap.xml and robots.txt
Marius, thanks for the reply. This is exactly what I needed & I'm off and running. Thanks again :) -- 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] @Req for PermRedirectResponse after a site redesign
I am switching my wife's hosted photography site to Liftweb, largely as a reason to learn Lift. Part of the conversion is moving the old directory structure to a cleaner structure. I wanted to redirect all of the old URI's to the modern equivalent. I read Chapter 13 of the Lift book and got the following to work: LiftRules.dispatch.prepend{ case r @Req("Portraits"::"High-School"::"Seniors"::_::Nil, _,_) => () =>Full(PermRedirectResponse("/Galleries/HighSchoolSeniors", r)) } LiftRules.dispatch.prepend{ case r @Req("Portraits"::"High-School"::"Seniors"::_::_::Nil, _,_) => () =>Full(PermRedirectResponse("/Galleries/HighSchoolSeniors", r)) } LiftRules.dispatch.prepend{ case r @Req("Portraits"::"High- School"::"Seniors"::_::_::_::Nil, _,_) => () =>Full(PermRedirectResponse("/Galleries/HighSchoolSeniors", r)) } This gives me a beautiful 301 redirect, so the world is good. Google will transfer any page rank and any old links will work. But it seem like there should be a nicer way to do this for arbitrary depth. I know that doesn't make much sense for an API, but it would be nice for me if there was an equivalent of "/Portraits/High-School/ **" for arbitrary depth matching. This seems to work for errors, but for a PermRedirectResponse, I need the r for the request input parameter, so I need I'm not complainin', I'm just learnin' There is certainly nothing wrong with an extra line or three for each dispatch. -- 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.