[Lift] Re: XML Creation

2009-04-13 Thread Atsuhiko Yamanaka
Hi, On Mon, Apr 13, 2009 at 1:03 PM, sailormoo...@gmail.com wrote: > >  <% for (int i = 0; i < data.size(); i++) { %> >    <%= data.name %> >  <% } %> > > >  I cannot find an example like this, and I don't know if it should be > done by a single snippet with all the rows, or some list/array t

[Lift] Re: XML Creation

2009-04-13 Thread sailormoo...@gmail.com
I See...Thanks... and if I want 5 items a line does it work as follows? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to li

[Lift] Re: Attribute as MappedField efficiency concerns

2009-04-13 Thread Giuseppe Fogliazza
I am astonished! Quality and reactivity of the forum is a perfect match with the brilliant ideas you put in the project. I am looking forward to become proficient in Lift and Scala and to provide some contribution to this excellent framework. Thanks beppe --~--~-~--~~~--

[Lift] Re: XML Creation

2009-04-13 Thread Charles F. Munat
No. That will get you the same name five times per line, with one line per name. For example, Bob Bob Bob Bob Bob Sam Sam Sam Sam Sam etc. I can't think of anything but complicated ways to do this right now because I'm exhausted, but if someone else doesn't give you one by tomorrow, I'll try

[Lift] Re: XML Creation

2009-04-13 Thread Timothy Perrett
If you want 5 items a line, you can use nested binds - checkout the chooseTemplate(...) method. Any pagination or limiting you need to do, just do that in your snippet however you want to page your result set :-) On Apr 13, 7:18 am, "sailormoo...@gmail.com" wrote: > I See...Thanks... > and if I

[Lift] Re: TemplateCache

2009-04-13 Thread Timothy Perrett
Just checked out the code Marius... this is good stuff! So one could use the SoftReferenceCache generically as a thread safe replacement for KeyedCache right? The template cache is pretty sweet also. Cheers, Tim On Apr 13, 7:20 am, "marius d." wrote: > Yes by using read/write locks. Didn't use

[Lift] Re: Object typecast to Mapper

2009-04-13 Thread Amit Kumar Verma
Hi David, Thanks for ur replies, I just want to make a generic function which will take an object of mapper and returns the json string of the same. I have written only two function 1. This will be called by ajax call : def getJSONString(xhtml: Group):NodeSeq = { getJSONStringGeneric

[Lift] Re: Override Menu HTML

2009-04-13 Thread João Pereira
Modifying the CSS is an option indeed, however I would like to have more flexibility on this. I'll look at the Menu.builder impl to check if it's worth implementing my own version. thank you On Mon, Apr 13, 2009 at 6:25 AM, Derek Chen-Becker wrote: > At this point you would have to write your ow

[Lift] convention how to name classes in snippet package

2009-04-13 Thread Tobias Daub
Hi There, Is there any convention about how to name classes in the snippet package. In the ToDo example the snippet that corresponds to the ToDo Model was named TD which is maybe not the best name. Would it be possible to prefix the class name with something, e.g. ToDoFactory? Factory is prob

[Lift] Re: stateful vs stateless snippet

2009-04-13 Thread Oliver Lambert
On Mon, Apr 13, 2009 at 4:35 AM, David Pollak wrote: > > > On Sun, Apr 12, 2009 at 7:30 AM, Oliver Lambert wrote: > >> >> >> On Sun, Apr 12, 2009 at 11:04 PM, David Pollak < >> feeder.of.the.be...@gmail.com> wrote: >> >>> >>> >>> On Sun, Apr 12, 2009 at 5:29 AM, Oliver Lambert wrote: >>> >>>

[Lift] tag for generated

2009-04-13 Thread João Pereira
Hello, I have the following snippet: HTML: Scala: bind("login", xhtml, "username"->SHtml.text(username,username(_)), "password"->SHtml.text(password, password(_)), "submit" ->SHtml.submit("login", authenticate)) Rendered HTML is

[Lift] Simple config for Log4J

2009-04-13 Thread João Pereira
hi, I have this log4j.xml file under resources dir: http://jakarta.apache.org/log4j/";> If I have the call: Log.debug("Calling authenticate") Was expected to have the log in Jetty console? if not, what Am I missing here? I need a simple logg

[Lift] Re: Simple config for Log4J

2009-04-13 Thread Timothy Perrett
You can set different run mode logging configurations, try calling the file ³default.log4j.xml². For more information, see here: http://github.com/dpp/liftweb/blob/29f44b91e28eaceaa784322eaad8f2bb909fa9aa/ lift-util/src/main/scala/net/liftweb/util/Log.scala#L85 Thanks Tim On 13/04/2009 15:25,

[Lift] JPA: putting persistence Id into trait

2009-04-13 Thread Tim P
For info, you can take the book sample jpa application and split out the hibernate Id stuff as follows: import common.JPAId ... /** This class represents a book that we might want to read. */ @Entity class Book extends Title with JPAId { where JPAId was declared trait JPAId { @Id @Gener

[Lift] Re: Simple config for Log4J

2009-04-13 Thread João Pereira
Great. Thank you. On Mon, Apr 13, 2009 at 4:24 PM, Timothy Perrett wrote: > > You can set different run mode logging configurations, try calling the file > “default.log4j.xml”. > > For more information, see here: > > > http://github.com/dpp/liftweb/blob/29f44b91e28eaceaa784322eaad8f2bb909fa9aa/li

[Lift] Re: convention how to name classes in snippet package

2009-04-13 Thread Timothy Perrett
Tobias, There is no need to have a direct relation between snippets and model classes - why would you need to have a relationship? Snippets usually encompass a small element of functionality that might be related to one or more models - mapper or otherwise. Personally, I like that fact there is

[Lift] Re: convention how to name classes in snippet package

2009-04-13 Thread David Pollak
On Mon, Apr 13, 2009 at 3:04 AM, Tobias Daub wrote: > > Hi There, > > Is there any convention about how to name classes in the snippet package. > > In the ToDo example the snippet that corresponds to the ToDo Model was > named TD which is maybe not the best name. > > Would it be possible to prefi

[Lift] Re: Attribute as MappedField efficiency concerns

2009-04-13 Thread David Pollak
On Sun, Apr 12, 2009 at 11:39 PM, Giuseppe Fogliazza wrote: > > I am astonished! Quality and reactivity of the forum is a perfect > match with the brilliant ideas you put in the project. Flattery will get you very far. :-) > > I am looking forward to become proficient in Lift and Scala and to

[Lift] Re: tag for generated

2009-04-13 Thread David Pollak
def label(in: Elem): NodeSeq = ++ in bind("login", xhtml, "username" -> label(SHtml.text(username, username(_))) How does that look? 2009/4/13 João Pereira > Hello, > > I have the following snippet: > > HTML: > > > > > > > > Scala: > > bind("login"

[Lift] Re: tag for generated

2009-04-13 Thread João Pereira
it's looks great and works great too. :) thank you On Mon, Apr 13, 2009 at 5:18 PM, David Pollak wrote: > def label(in: Elem): NodeSeq = ++ in > > bind("login", xhtml, > "username" -> label(SHtml.text(username, username(_))) > > How does that look? > > 2009/4/13 João Pereira > > Hello

[Lift] Re: tag for generated

2009-04-13 Thread João Pereira
I just missed that I really wanted something like: def label(in: Elem, labeltext: String): NodeSeq = {labeltext} ++ in bind("login", xhtml, "username" -> label(SHtml.text(username, username(_)),"User Name") Great :) 2009/4/13 João Pereira > it's looks great and works great too. :) >

[Lift] Re: Object typecast to Mapper

2009-04-13 Thread David Pollak
I think it's best to use the built-in JSON creation code and keep the code as JsCmd as long as possible. Here's a snippet that will place the JSON for all the Users in the page. I'm including the whole project as well: class HelloWorld { def json: NodeSeq = Script(jsonForAll(User)) private d

[Lift] http://demo.liftweb.net/ Source

2009-04-13 Thread João Pereira
Where can I find the source for http://demo.liftweb.net/ ? joão --~--~-~--~~~---~--~~ 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 gro

[Lift] Re: http://demo.liftweb.net/ Source

2009-04-13 Thread David Pollak
http://github.com/dpp/liftweb/tree/master/sites/example 2009/4/13 João Pereira > Where can I find the source for http://demo.liftweb.net/ ? > > joão > > > > -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: ht

[Lift] Re: XML Creation

2009-04-13 Thread David Pollak
>From the ToDo sample code... the view code: Exclude done 1 To Do So, you want the body of for each element. Here's the Snippet code: def list(html: NodeSeq) = {

[Lift] Re: http://demo.liftweb.net/ Source

2009-04-13 Thread David Bernard
may be "sites" directory should be renamed "examples" ? 2009/4/13 João Pereira > How did i miss that one :) > > On Mon, Apr 13, 2009 at 6:13 PM, David Pollak < > feeder.of.the.be...@gmail.com> wrote: > >> http://github.com/dpp/liftweb/tree/master/sites/example >> >> 2009/4/13 João Pereira >> >

[Lift] Automatically change Language (Locale)

2009-04-13 Thread João Pereira
Just one more newbie question: How do I, inside a snippet, change the language programatically? I have two resource bundles, one en_GB and other pt_PT, for example. I have in Boot.scala: //resource bundles     LiftRules.resourceNames = "loginMessages" :: Nil Now, inside my snippet:  val lan

[Lift] Re: http://demo.liftweb.net/ Source

2009-04-13 Thread João Pereira
How did i miss that one :) On Mon, Apr 13, 2009 at 6:13 PM, David Pollak wrote: > http://github.com/dpp/liftweb/tree/master/sites/example > > 2009/4/13 João Pereira > >> Where can I find the source for http://demo.liftweb.net/ ? >> >> joão >> >> >> > > > -- > Lift, the simply functional web fra

[Lift] Re: tag for generated

2009-04-13 Thread Charles F. Munat
The "for" attribute in the element points at the element's *id*, not it's name. Also, where is the label? You've got an element, but no label (unless I'm still asleep). http://www.w3.org/TR/html401/interact/forms.html#h-17.9.1 So this is actually quite easy: bind("login", xhtml, "usernam

[Lift] Re: http://demo.liftweb.net/ Source

2009-04-13 Thread João Pereira
And rename the examples project to other name like SiteDemo, for example? On Mon, Apr 13, 2009 at 8:30 PM, David Bernard wrote: > may  be "sites" directory should be renamed "examples" ? > > 2009/4/13 João Pereira >> >> How did i miss that one :) >> >> On Mon, Apr 13, 2009 at 6:13 PM, David Po

[Lift] Custom Application Settings from XML

2009-04-13 Thread João Pereira
One more newbie question: How do I make available a list of global config values read from a XML file? I have the file /src/main/resources/default.application.config.xml with the following contents: pt_PT Portugês

[Lift] Re: Automatically change Language (Locale)

2009-04-13 Thread David Pollak
In LiftRules: var localeCalculator: Box[HttpServletRequest] => Locale = defaultLocaleCalculator _ def defaultLocaleCalculator(request: Box[HttpServletRequest]) = request.flatMap(_.getLocale() match {case null => Empty case l: Locale => Full(l)}).openOr(Locale.getDefault()) You can change the

[Lift] Re: Custom Application Settings from XML

2009-04-13 Thread David Pollak
package com.myapp.lib object MyLanguages { lazy val languages: List[(String, String)] = { // code to read the XML file } } >From your app: MyLanguages.languages.map(...) 2009/4/13 João Pereira > > One more newbie question: > How do I make available a list of global config values read

[Lift] Re: tag for generated

2009-04-13 Thread Dmitry Lipovoi
... or You can set element's id manually in template: Username On Mon, Apr 13, 2009 at 11:58 PM, Charles F. Munat wrote: > > The "for" attribute in the element points at the > element's *id*, not it's name. Also, where is the label? You've got an > element, b

[Lift] Re: Automatically change Language (Locale)

2009-04-13 Thread Timothy Perrett
FYI - if you want an example, check this out: http://github.com/dpp/liftweb/blob/29f44b91e28eaceaa784322eaad8f2bb909fa9aa/ sites/JPADemo/JPADemo-web/src/main/scala/bootstrap/liftweb/Boot.scala#L67 Cheers, Tim --~--~-~--~~~---~--~~ You received this message beca

[Lift] Re: tag for generated

2009-04-13 Thread Timothy Perrett
Errrmm, I think your mistaken in your example. I think you mean: Username You don't need to manually populate content inside the bind placeholders - its removed anyway so your not really gaining anything by doing this. The key is understanding that attributes with the a

[Lift] Re: tag for generated

2009-04-13 Thread Charles F. Munat
Good point. You could do all the label stuff in the template, which is probably easier. Chas. Dmitry Lipovoi wrote: > ... or You can set element's id manually in template: > > > > Username > > name="username" value="username"/> > > > > > > > > On Mon, Apr 13,

[Lift] Re: Need for lightweight JPA archetype

2009-04-13 Thread Derek Chen-Becker
OK, I just checked in two more archetypes for JPA: lift-archetype-jpa-blank - same as the basic one, but with only the bare minimum set of files for a JPA project with separate Persistence and Web modules lift-archetype-jpa-blank-single - same as blank, but set up to all be in a single project ins

[Lift] Re: Need for lightweight JPA archetype

2009-04-13 Thread Timothy Perrett
Awesome work Derek! On 13/04/2009 23:24, "Derek Chen-Becker" wrote: > OK, I just checked in two more archetypes for JPA: > > lift-archetype-jpa-blank - same as the basic one, but with only the bare > minimum set of files for a JPA project with separate Persistence and Web > modules > lift-arch

[Lift] Re: Need for lightweight JPA archetype

2009-04-13 Thread Bryan.
Great! I can't wait to check these out. Thanks, Bryan On Apr 13, 6:32 pm, Timothy Perrett wrote: > Awesome work Derek! > > On 13/04/2009 23:24, "Derek Chen-Becker" wrote: > > > > > OK, I just checked in two more archetypes for JPA: > > > lift-archetype-jpa-blank - same as the basic one, but w

[Lift] [ANN] Scala Lift Off, San Francisco 09

2009-04-13 Thread David Pollak
Folks, I'm pleased to announce the second Scala Lift Off user conference to be held in San Francisco on Saturday June 6th (the day after JavaOne.) The Scala Lift Off is the open spaces user conference for people interested in the Scala programming language and the Lift web framework. Last year,

[Lift] Blog post about lifts binding system

2009-04-13 Thread Tim Perrett
Hey guys, There has been a bunch of questions lately about bind(..) and how to use it etc, so i thought id just write a blog post about it discussing ways to use it and cover some of the other funky stuff it can do. Check it out here: http://is.gd/sfyT Cheers, Tim --~--~-~--~~--

[Lift] JPA Run Modes

2009-04-13 Thread Bryan
Is it possible to use mvn -Drun.mode with JPA in lift? For example, "mvn -Drun.mode=production" would use persistence-prod.xml. This will allow me to keep my test data separate from my development data. Thanks, Bryan --~--~-~--~~~---~--~~ You received this messa

[Lift] Re: [ANN] Scala Lift Off, San Francisco 09

2009-04-13 Thread David Pollak
Folks, The registration page is http://scalaliftoff.com (Sorry for forgetting the link.) Thanks, David On Mon, Apr 13, 2009 at 4:13 PM, David Pollak wrote: > Folks, > > I'm pleased to announce the second Scala Lift Off user conference to be > held in San Francisco on Saturday June 6th (the d

[Lift] Re: JPA: putting persistence Id into trait

2009-04-13 Thread Derek Chen-Becker
I'll add it to my TODO list. I'm also looking at including the Enum types from the demo, although those are tied directly to Hibernate until JPA supports user types directly. Derek On Mon, Apr 13, 2009 at 6:14 AM, Tim P wrote: > > For info, you can take the book sample jpa application and split

[Lift] In-built services & documentation.

2009-04-13 Thread jc
Hi All! As I'm exploring this new (for me) web framework, I have the followings questions: a) Whick kind of in-built services the framework brings? As an example: has it permissions management (no user login, but permissions over objects, as for example the items of a to-do list, where each item

[Lift] Re: tag for generated

2009-04-13 Thread João Pereira
Thank you. it's a lot easier, yeah :) On Mon, Apr 13, 2009 at 10:51 PM, Charles F. Munat wrote: > > Good point. You could do all the label stuff in the template, which is > probably easier. > > Chas. > > Dmitry Lipovoi wrote: >> ... or You can set element's id manually in template: >> >> >>  

[Lift] Re: XML Creation

2009-04-13 Thread sailormoo...@gmail.com
I wrote a zip function to group the list as follows: scala> def zipListBySize[T](size: Int)(list: List[T]) : List[List[T]] = { | var (first, second) = list.splitAt(size) | if (second == Nil) | List(first) | else | List(first) ++ zipListBySize(size)(second)

[Lift] Re: Need Help with the RuntimeException

2009-04-13 Thread sailormoo...@gmail.com
Thanks but the mvn test still gives ambigulous exceptions. A filename and a line number would help more. java.util.NoSuchElementException at scala.RandomAccessSeq$$anon$13.next(RandomAccessSeq.scala:165) at scala.xml.parsing.MarkupParser$class.normalizeAttributeValue (MarkupP