[Lift] Re: TemplateCache

2009-04-13 Thread marius d.
Yes by using read/write locks. Didn't use ConcurrentHashMap after all due to lack of LRU in it. Br's, marius On Apr 12, 9:07 pm, Timothy Perrett timo...@getintheloop.eu wrote: Interesting marius - I havent checked out the code yet, but did you manage to work around the thread safe issues?

[Lift] Re: XML Creation

2009-04-13 Thread Charles F. Munat
I do it like this: Let's say it's a list of companies in which the name of the company links to the company's website. So you have a snippet that handles these Companies. Let's call it CompanyOps.scala. In the snippet, you have a method which we'll call list. In the method, you get the list

[Lift] Re: XML Creation

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

[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? lift:MyTable.foo table tb:entries tr tdentry:name //td tdentry:name //td tdentry:name //td tdentry:name //td tdentry:name //td /tr /tb:entries /table /lift:MyTable.foo

[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

[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 sailormoo...@gmail.com wrote: 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. marius.dan...@gmail.com wrote: Yes by using

[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 = {

[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 dchenbec...@gmail.comwrote: At this point you would

[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

[Lift] Re: stateful vs stateless snippet

2009-04-13 Thread Oliver Lambert
On Mon, Apr 13, 2009 at 4:35 AM, David Pollak feeder.of.the.be...@gmail.com wrote: On Sun, Apr 12, 2009 at 7:30 AM, Oliver Lambert olambo...@gmail.comwrote: 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

[Lift] label tag for generated input

2009-04-13 Thread João Pereira
Hello, I have the following snippet: HTML: div id=loginlift:login.login form=post login:username / login:password / login:submit / /lift:login.login/div Scala: bind(login, xhtml, username-SHtml.text(username,username(_)),

[Lift] Simple config for Log4J

2009-04-13 Thread João Pereira
hi, I have this log4j.xml file under resources dir: !DOCTYPE log4j:configuration SYSTEM log4j.dtd log4j:configuration xmlns:log4j=http://jakarta.apache.org/log4j/; appender name=appender class=org.apache.log4j.ConsoleAppender layout class=org.apache.log4j.SimpleLayout / /appender

[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

[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

[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

[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 hannes.flo...@gmx.li 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

[Lift] Re: Attribute as MappedField efficiency concerns

2009-04-13 Thread David Pollak
On Sun, Apr 12, 2009 at 11:39 PM, Giuseppe Fogliazza g.foglia...@mcmspa.itwrote: 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

[Lift] Re: label tag for generated input

2009-04-13 Thread David Pollak
def label(in: Elem): NodeSeq = label for={in \ @name} / ++ in bind(login, xhtml, username - label(SHtml.text(username, username(_))) How does that look? 2009/4/13 João Pereira joaomiguel.pere...@gmail.com Hello, I have the following snippet: HTML: div

[Lift] Re: label tag for generated input

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 feeder.of.the.be...@gmail.com wrote: def label(in: Elem): NodeSeq = label for={in \ @name} / ++ in bind(login, xhtml, username - label(SHtml.text(username, username(_))) How does that

[Lift] Re: label tag for generated input

2009-04-13 Thread João Pereira
I just missed that I really wanted something like: def label(in: Elem, labeltext: String): NodeSeq = label for={in \ @name}{labeltext}/label ++ in bind(login, xhtml, username - label(SHtml.text(username, username(_)),User Name) Great :) 2009/4/13 João Pereira

[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

[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 joaomiguel.pere...@gmail.com Where can I find the source for http://demo.liftweb.net/ ? joão -- Lift, the simply functional web framework http://liftweb.net Beginning Scala

[Lift] Re: XML Creation

2009-04-13 Thread David Pollak
From the ToDo sample code... the view code: lift:TD.list all_id=all_todos div id=all_todos divExclude done todo:exclude//div ul todo:list li todo:checkinput type=checkbox//todo:check

[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 joaomiguel.pere...@gmail.com 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

[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

[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 feeder.of.the.be...@gmail.com wrote: http://github.com/dpp/liftweb/tree/master/sites/example 2009/4/13 João Pereira joaomiguel.pere...@gmail.com Where can I find the source for http://demo.liftweb.net/ ? joão

[Lift] Re: label tag for generated input

2009-04-13 Thread Charles F. Munat
The for attribute in the label element points at the input 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,

[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 david.bernard...@gmail.com wrote: may  be sites directory should be renamed examples ? 2009/4/13 João Pereira joaomiguel.pere...@gmail.com How did i miss that one :)

[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: applicationConfig languages supportedLanguage

[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 joaomiguel.pere...@gmail.com One more newbie question: How do I make available a list of

[Lift] Re: label tag for generated input

2009-04-13 Thread Dmitry Lipovoi
... or You can set element's id manually in template: lift:someSnippet form=post p label for=usernameUsername/label br/ f:username f:id=usernameinput id=username type=text name=username value=username//f:url /p p f:submitinput type=submit value=Do It!//f:submit /p

[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

[Lift] Re: label tag for generated input

2009-04-13 Thread Timothy Perrett
Errrmm, I think your mistaken in your example. I think you mean: lift:someSnippet form=post p label for=usernameUsername/label br/ f:username f:id=username / /p pf:submit //p /lift:someSnippet You don't need to manually populate content inside the bind placeholders - its

[Lift] Re: label tag for generated input

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: lift:someSnippet form=post p label for=usernameUsername/label br/ f:username f:id=usernameinput

[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

[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 dchenbec...@gmail.com 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

[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 timo...@getintheloop.eu wrote: Awesome work Derek! On 13/04/2009 23:24, Derek Chen-Becker dchenbec...@gmail.com wrote: OK, I just checked in two more archetypes for JPA:

[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

[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 feeder.of.the.be...@gmail.com wrote: Folks, I'm pleased to announce the second Scala Lift Off user conference to be held in San Francisco

[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

[Lift] Re: label tag for generated input

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 c...@munat.com 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