[Lift] Model methods in either Class or Object?

2009-05-16 Thread g-man

As I create the Models to define the real-world things of interest to
my webapp, I'm wondering what to put into either the class or the
object. Here is some pseudocode as I understand the Model table
definition pattern:

// first comes the class, which defines fields and creates the
singleton:
class Thing extends LongKeyedMapper[Thing] with IdPK {
  def getSingleton = Thing
  // define a field...
  object field extends mappedWhatever(this) {
// and define some constraints and validations for the field...
  }
 // global class methods here plus xml, json, etc output...
}
// then the object:
object Thing extends Thing with LongKeyedMetaMapper[Thing] {
  // define an instance method:
  def instanceMethod() = {
doSomething
  }
  // more instance methods, etc...
}

My question is: how do I know what kinds of methods and other goodies
should go into either the class or the object, that is, into each
'half' of the Model specification?

--~--~-~--~~~---~--~~
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: What's the xms and xmx setting in Jetty?

2009-05-16 Thread Andrew Scherpbier




Timothy Perrett wrote:

  oh. my. god. How did I miss this point completly - sorry i hadnt made
the link to JVM arguments in my mind!

You can also do it just on the command line if you dont want it for
all apps:

mvn jetty:run -Xmx -Xms
  

That didn't actually work for me (Ubuntu 9.04 x86_64, maven 2.0.9).  I
couldn't find any way to pass those JVM arguments other than via the
MAVEN_OPTS environment variable.

--Andrew


  
etc etc

Cheers, Tim

On May 16, 2:06 pm, Andrew Scherpbier  wrote:
  
  
You can pass JVM arguments like -Xmx and -Xms to Maven using the
MAVEN_OPTS environment variable.
Since jetty runs as (a?) thread(s?) under the maven process, increasing
maven's heap will increase jetty's heap.

Under Windows, simply define that environment variable (System
Properties | Advanced | Environment Variables) and restart any CMD you
are using.

Under linux/os x/etc. define it in your shell startup script (.bashrc
for bash, .cshrc for csh, etc.)

If you're running bash, you can also simply start maven like this:
"MAVEN_OPTS='-Xmx256m -Xms10m' mvn clean jetty:run"

You can verify by running this command and then in another terminal
window type "ps auxwww|grep java". Is should show the added arguments to
the java command. (For Windows, download and install procexp.exe from
microsoft and have it show the command line for the java process.)

Hope this helps!

--Andrew



Timothy Perrett wrote:


  Im not familiar with xms and xmx specifically - my suggestion was that if
its possible with jetty, then its probably configurable somehow with the
plugin as its all the same infrastructure just wrapped up in jetty.
  


  Perhaps you can explain what it is exactly you want to do?
  


  Cheers, Tim
  


  On 16/05/2009 00:49, "sailormoo...@gmail.com" 
wrote:
  


  
The jetty.xml sample doesn't seem to include xms and xmx
configuration.
http://confluence.atlassian.com/download/attachments/58294274/jetty.xml

  


  
On 5月16日, 上午12時08分, Timothy Perrett  wrote:

  


  

  There is a parameter called "jettyConfig" - pass the location of a jetty.xml
and you can configure it as per normal jetty server.
  

  


  

  Cheers, Tim
  

  


  

  On 15/05/2009 16:54, "sailormoo...@gmail.com" 
wrote:
  

  


  

  
I checked it and it doesn't seem to mention any Java setting though.

  

  


  

  
On 5月15日, 下午11時47分, Timothy Perrett  wrote:

  

  


  

  

  Checkout the jetty plugin docs:
  

  

  


  

  

  http://docs.codehaus.org/display/JETTY/Maven+Jetty+Plugin
  

  

  


  

  

  Cheers, Tim
  

  

  


  

  

  On 15/05/2009 16:32, "sailormoo...@gmail.com" 
wrote:
  

  

  


  

  

  
Hi :

  

  

  


  

  

  
  I would like to know what's the current setting of xms and xmx in
mvn jetty:run ?
And how to modify them?

  

  

  


  

  

  
  Thanks- 隱藏被引用文字 -

  

  

  


  

  

  - 顯示被引用文字 -- 隱藏被引用文字 -
  

  

  


  

  - 顯示被引用文字 -
  

  

  




--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Lift" group.  To post to this group, send email to liftweb@googlegroups.com  To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com  For more options, visit this group at http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---





[Lift] Re: ORM basics

2009-05-16 Thread Rob H

Thanks. That's helpful.

--~--~-~--~~~---~--~~
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: your first Lift application on GAE/J

2009-05-16 Thread Eric Daugherty

Thank you!  I redeployed it with the current SNAPSHOT version and the
base application now works fine.

Thanks,

Eric

On May 15, 11:23 pm, Atsuhiko Yamanaka 
wrote:
> Hi,
>
> Thank you for your feedback.
>
> On Sat, May 16, 2009 at 10:33 AM, Eric Daugherty  wrote:
>
> > I think I executed all the steps correctly, but when I deploy it to
> > GAE I get a Security Access Control Exception because the Actor class
> > is trying to create a thread I think.
>
> It seems the recent commit[1] has caused that exception.
> I have pushed the fix to the github repository.
> May I ask you to try it again?
>
> [1]http://github.com/dpp/liftweb/commit/9e39859be9b8f6f4fd7c17cf503b5bcf...
>
> Sincerely,
> --
> Atsuhiko Yamanaka
> JCraft,Inc.
> 1-14-20 HONCHO AOBA-KU,
> SENDAI, MIYAGI 980-0014 Japan.
> Tel +81-22-723-2150
>     +1-415-578-3454
> Fax +81-22-224-8773
> Skype callto://jcraft/

--~--~-~--~~~---~--~~
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: Another StatefulSnippet question...

2009-05-16 Thread marius d.

Could you please post the code ... which is most relevant to this
issue ?


Br's,
Marius

On May 16, 11:53 am, ivan  wrote:
> First I have to say sorry everyone for asking too many questions,
> asking a question is my last choice after i coludn't find an answer in
> a book or somewhere else.
>
> The question is: I am trying to use a StatefulSnippet. The snippet has
> a dispatch for three methods "list", "add", "pager".
>
> All three snippets are displayed on the same page. "List" is a list of
> db entities, "add" is a form for adding a new entity and "pager" are 4
> links for navigating the result set, defined by two variables "first"
> and "pageSize".
>
> The 4 links "first", "prev", "next" and "last" _work_, they update the
> value of the "first" variable so i can see that "pager" method is
> allways called with the same instance of my StatefulSnippet.
>
> But the problem is that the "list" snippet is always called on a new
> instance of my StatefulSnippet even though all these parts are
> displayed on the same page.
>
> I have a feeling that I am still missing something pretty fundamental
> here. Any ideas?
--~--~-~--~~~---~--~~
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: Lift-amqp diagram - sense check?

2009-05-16 Thread TylerWeir

Dig it!

Nice nice.

On May 16, 9:20 am, Timothy Perrett  wrote:
> Hey man,
>
> Wayy ahead of you ;-) already made a sample app! Going to be  
> publishing it on my blog with source code and an accompanying screen  
> cast :-)
>
> Cheers, Tim
>
> Sent from my iPhone
>
> On 16 May 2009, at 12:46, TylerWeir  wrote:
>
>
>
>
>
> > Timmy,
>
> > I'm being a bit selfish, but I'd love to see an example app with AMQP.
>
> > I'd be happy to help out however I can.
>
> > Ty
>
> > On May 15, 8:08 pm, Timothy Perrett  wrote:
> >> Sorry for answering my own question here, but just decided to jump
> >> right in and see if this was correct - finding that it is so im just
> >> writing up my findings and posting a sample application to github.
>
> >> Will share when I have more.
>
> >> Cheers, Tim
>
> >> On May 15, 7:04 pm, Timothy Perrett  wrote:
>
> >>> Guys,
>
> >>> Im just trying to make sense of Steve¹s lift-amqp implementation
> >>> . With a
> >>> view to improving the documentation, can someone who understands  
> >>> AMQP in
> >>> general just sense check the attached diagram before I start  
> >>> improving the
> >>> code documentation?
>
> >>> Thanks
>
> >>> Tim
>
> >>>  lift-amqp.pdf
> >>> 119KViewDownload
--~--~-~--~~~---~--~~
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: Tail merge?

2009-05-16 Thread marius d.

Done! ... very sorry about this.

On May 16, 8:23 pm, "marius d."  wrote:
> ooops .. checking it right now :(
>
> On May 16, 7:53 pm, David Pollak 
> wrote:
>
> > I think you missed a file during your checkin.  The Tail object is missing
> > :-(
>
> > On Sat, May 16, 2009 at 7:15 AM, marius d.  wrote:
>
> > > Folks,
>
> > > I just added  builtin snippet support. 

[Lift] Re: Tail merge?

2009-05-16 Thread marius d.

ooops .. checking it right now :(


On May 16, 7:53 pm, David Pollak 
wrote:
> I think you missed a file during your checkin.  The Tail object is missing
> :-(
>
>
>
> On Sat, May 16, 2009 at 7:15 AM, marius d.  wrote:
>
> > Folks,
>
> > I just added  builtin snippet support. 

[Lift] Re: Tail merge?

2009-05-16 Thread David Pollak
I think you missed a file during your checkin.  The Tail object is missing
:-(

On Sat, May 16, 2009 at 7:15 AM, marius d.  wrote:

>
> Folks,
>
> I just added  builtin snippet support. 

[Lift] Re: What's the xms and xmx setting in Jetty?

2009-05-16 Thread Timothy Perrett

oh. my. god. How did I miss this point completly - sorry i hadnt made
the link to JVM arguments in my mind!

You can also do it just on the command line if you dont want it for
all apps:

mvn jetty:run -Xmx -Xms

etc etc

Cheers, Tim

On May 16, 2:06 pm, Andrew Scherpbier  wrote:
> You can pass JVM arguments like -Xmx and -Xms to Maven using the
> MAVEN_OPTS environment variable.
> Since jetty runs as (a?) thread(s?) under the maven process, increasing
> maven's heap will increase jetty's heap.
>
> Under Windows, simply define that environment variable (System
> Properties | Advanced | Environment Variables) and restart any CMD you
> are using.
>
> Under linux/os x/etc. define it in your shell startup script (.bashrc
> for bash, .cshrc for csh, etc.)
>
> If you're running bash, you can also simply start maven like this:
> "MAVEN_OPTS='-Xmx256m -Xms10m' mvn clean jetty:run"
>
> You can verify by running this command and then in another terminal
> window type "ps auxwww|grep java". Is should show the added arguments to
> the java command. (For Windows, download and install procexp.exe from
> microsoft and have it show the command line for the java process.)
>
> Hope this helps!
>
> --Andrew
>
>
>
> Timothy Perrett wrote:
> > Im not familiar with xms and xmx specifically - my suggestion was that if
> > its possible with jetty, then its probably configurable somehow with the
> > plugin as its all the same infrastructure just wrapped up in jetty.
>
> > Perhaps you can explain what it is exactly you want to do?
>
> > Cheers, Tim
>
> > On 16/05/2009 00:49, "sailormoo...@gmail.com" 
> > wrote:
>
> >> The jetty.xml sample doesn't seem to include xms and xmx
> >> configuration.
> >>http://confluence.atlassian.com/download/attachments/58294274/jetty.xml
>
> >> On 5月16日, 上午12時08分, Timothy Perrett  wrote:
>
> >>> There is a parameter called "jettyConfig" - pass the location of a 
> >>> jetty.xml
> >>> and you can configure it as per normal jetty server.
>
> >>> Cheers, Tim
>
> >>> On 15/05/2009 16:54, "sailormoo...@gmail.com" 
> >>> wrote:
>
>  I checked it and it doesn't seem to mention any Java setting though.
>
>  On 5月15日, 下午11時47分, Timothy Perrett  wrote:
>
> > Checkout the jetty plugin docs:
>
> >http://docs.codehaus.org/display/JETTY/Maven+Jetty+Plugin
>
> > Cheers, Tim
>
> > On 15/05/2009 16:32, "sailormoo...@gmail.com" 
> > wrote:
>
> >> Hi :
>
> >>   I would like to know what's the current setting of xms and xmx in
> >> mvn jetty:run ?
> >> And how to modify them?
>
> >>   Thanks- 隱藏被引用文字 -
>
> > - 顯示被引用文字 -- 隱藏被引用文字 -
>
> >>> - 顯示被引用文字 -
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: ORM basics

2009-05-16 Thread Timothy Perrett

Rob, keep in mind that mapper (the approach you detail) is just one
route, we have several options with lift. If you wanted a quick easy
to use persistance mech, then Mapper is great. If you need something
more enterprise / sophisticated where you can indeed seperate all the
concerns a lot more - then just JPA. We have some great integration
with JPA right now - its detailed in "the definitive guide to lift"
book.

We also have Record, which is up and coming and will ultimately
replace Mapper, and offer a  lot more flexibility.

Cheers, Tim

On May 16, 5:10 pm, Rob H  wrote:
> Hi,
>
> I'm evaluating Scala and Lift for a new project and in reading through
> the "Getting Started" guide, I noticed that the ORM approach in Lift
> seems to involve weaving persistence code directly into the entity
> classes (LongKeyedMapper, MappedLongForeignKey, etc.) and companion
> objects. It's an interesting design choice because the trend in other
> frameworks is toward an intentional separation of concerns: POJOs as
> entities, DAOs for persistence. Spring and Seam with Hibernate/JPA
> come to mind. Could someone explain the reasoning behind Lift's take?
> I don't mean to pass judgment, just trying to understand the
> motivation.
>
> Thanks.
> -Rob
--~--~-~--~~~---~--~~
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: ORM basics

2009-05-16 Thread David Pollak
Please see
http://blog.lostlake.org/index.php?/archives/19-Keeping-the-meaning-with-the-bytes.html

On Sat, May 16, 2009 at 9:10 AM, Rob H  wrote:

>
> Hi,
>
> I'm evaluating Scala and Lift for a new project and in reading through
> the "Getting Started" guide, I noticed that the ORM approach in Lift
> seems to involve weaving persistence code directly into the entity
> classes (LongKeyedMapper, MappedLongForeignKey, etc.) and companion
> objects. It's an interesting design choice because the trend in other
> frameworks is toward an intentional separation of concerns: POJOs as
> entities, DAOs for persistence. Spring and Seam with Hibernate/JPA
> come to mind. Could someone explain the reasoning behind Lift's take?
> I don't mean to pass judgment, just trying to understand the
> motivation.
>
> Thanks.
> -Rob
>
> >
>


-- 
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Git some: http://github.com/dpp

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: your first Lift application on GAE/J

2009-05-16 Thread Atsuhiko Yamanaka

Hi,

Thank you for your feedback.

On Sat, May 16, 2009 at 10:33 AM, Eric Daugherty  wrote:
>
> I think I executed all the steps correctly, but when I deploy it to
> GAE I get a Security Access Control Exception because the Actor class
> is trying to create a thread I think.

It seems the recent commit[1] has caused that exception.
I have pushed the fix to the github repository.
May I ask you to try it again?

[1] 
http://github.com/dpp/liftweb/commit/9e39859be9b8f6f4fd7c17cf503b5bcfcd5e861a#diff-2


Sincerely,
--
Atsuhiko Yamanaka
JCraft,Inc.
1-14-20 HONCHO AOBA-KU,
SENDAI, MIYAGI 980-0014 Japan.
Tel +81-22-723-2150
+1-415-578-3454
Fax +81-22-224-8773
Skype callto://jcraft/

--~--~-~--~~~---~--~~
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] ORM basics

2009-05-16 Thread Rob H

Hi,

I'm evaluating Scala and Lift for a new project and in reading through
the "Getting Started" guide, I noticed that the ORM approach in Lift
seems to involve weaving persistence code directly into the entity
classes (LongKeyedMapper, MappedLongForeignKey, etc.) and companion
objects. It's an interesting design choice because the trend in other
frameworks is toward an intentional separation of concerns: POJOs as
entities, DAOs for persistence. Spring and Seam with Hibernate/JPA
come to mind. Could someone explain the reasoning behind Lift's take?
I don't mean to pass judgment, just trying to understand the
motivation.

Thanks.
-Rob

--~--~-~--~~~---~--~~
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: What's the xms and xmx setting in Jetty?

2009-05-16 Thread Andrew Scherpbier

You can pass JVM arguments like -Xmx and -Xms to Maven using the
MAVEN_OPTS environment variable.
Since jetty runs as (a?) thread(s?) under the maven process, increasing
maven's heap will increase jetty's heap.

Under Windows, simply define that environment variable (System
Properties | Advanced | Environment Variables) and restart any CMD you
are using.

Under linux/os x/etc. define it in your shell startup script (.bashrc
for bash, .cshrc for csh, etc.)

If you're running bash, you can also simply start maven like this:
"MAVEN_OPTS='-Xmx256m -Xms10m' mvn clean jetty:run"

You can verify by running this command and then in another terminal
window type "ps auxwww|grep java". Is should show the added arguments to
the java command. (For Windows, download and install procexp.exe from
microsoft and have it show the command line for the java process.)

Hope this helps!

--Andrew

Timothy Perrett wrote:
> Im not familiar with xms and xmx specifically - my suggestion was that if
> its possible with jetty, then its probably configurable somehow with the
> plugin as its all the same infrastructure just wrapped up in jetty.
>
> Perhaps you can explain what it is exactly you want to do?
>
> Cheers, Tim
>
> On 16/05/2009 00:49, "sailormoo...@gmail.com" 
> wrote:
>
>   
>> The jetty.xml sample doesn't seem to include xms and xmx
>> configuration.
>> http://confluence.atlassian.com/download/attachments/58294274/jetty.xml
>>
>> On 5月16日, 上午12時08分, Timothy Perrett  wrote:
>> 
>>> There is a parameter called "jettyConfig" - pass the location of a jetty.xml
>>> and you can configure it as per normal jetty server.
>>>
>>> Cheers, Tim
>>>
>>> On 15/05/2009 16:54, "sailormoo...@gmail.com" 
>>> wrote:
>>>
>>>
>>>
>>>
>>>
>>>   
 I checked it and it doesn't seem to mention any Java setting though.
 
 On 5月15日, 下午11時47分, Timothy Perrett  wrote:
 
> Checkout the jetty plugin docs:
>   
> http://docs.codehaus.org/display/JETTY/Maven+Jetty+Plugin
>   
> Cheers, Tim
>   
> On 15/05/2009 16:32, "sailormoo...@gmail.com" 
> wrote:
>   
>> Hi :
>> 
>>   I would like to know what's the current setting of xms and xmx in
>> mvn jetty:run ?
>> And how to modify them?
>> 
>>   Thanks- 隱藏被引用文字 -
>> 
> - 顯示被引用文字 -- 隱藏被引用文字 -
>   
>>> - 顯示被引用文字 -
>>>   
>
>
>
> >   


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Bindings and Validation request cycle

2009-05-16 Thread Scalanewbie

I narrowed the problem: I have to use my validation instance inside
the bind and inside my submit() method. but the stored validation
object will not be used by the bind. Is there done anything i must be
aware of when using variables inside of methods passed to the
S.submit?

On May 16, 1:49 am, Scalanewbie  wrote:
> In addtion to my problem, i found out that request vars live from the
> current request till the next request. And when i switch to simple
> vals i dont event have a value in my submit() form.
>
> On May 16, 12:06 am, Scalanewbie  wrote:
>
> > Hi Marius, thanks for your explanation but i have some trouble getting
> > the lifcycle right:
>
> > object name extends RequestVar("")
>
> > def dodo(form : NodeSeq) = {
>
> >     val myObject= new MyObject(name)
> >     val validation = Validator.prepare(myObject)
>
> >     def submit() {
> >       validation.validate()
> >       if(validation ok) //doStuff else {
> >           S.error("Invalid input")
> >           S.mapSnippet("Snippet.dodo", doBind)
> >       }
> >     }
>
> > def doBind(form : NodeSeq) = bind("myform", form,
> >   "name" -> SHtml.text(name.is, name(_),("class",validation css
> > "name")),
> >   "submit" -> SHtml.submit(S ? "send", submit))
>
> > doBind(form)
>
> > }
>
> > The problem is that the validation object inside the "submit()"
> > differs (other object reference) from the one used in the validation
> > css "name" method call.
> > The validation has a state that gets somehow lost/replaced.
>
> > Any suggestions on that?
>
> > On May 15, 11:00 pm, "marius d."  wrote:
>
> > > If you want to change CSS classes upon validation you can do:
>
> > > Non Ajax
>
> > > 1.
> > > .
> > > bind("myobject", xhtml,
> > >   "name" -> SHtml.text(name.is, name(_) % ("class" -> "read the value
> > > from you state"),
> > > ("class","dependsOnTheValidationResult"),
> > >   "submit" -> SHtml.submit("submit", submit)
> > > )
>
> > > Note that the rendering happens after you request functions have been
> > > invoked (obviously) so when rendering the text field you already know
> > > the class from your function logic.
>
> > > 2. On rendering use Snippet atrributes
>
> > > 
>
> > > Ajax
>
> > > 1. In the Ajax JavaScript response you can easily change classes.
>
> > > On May 15, 11:20 pm, Scalanewbie  wrote:
>
> > > > Hi Marius,
> > > > this is what i do at the moment, but i dont see a way to put the css
> > > > class information into my elements after the validation.
> > > > This seems not to be possible with the msgs class. Because it just
> > > > prints out the error with a specific css class and
> > > > does not do any special node manipulation (which is good, because its
> > > > not the right place).
>
> > > > On May 15, 9:37 pm, "marius d."  wrote:
>
> > > > > On May 15, 10:18 pm, Scalanewbie  wrote:
>
> > > > > > Hi,
> > > > > > as a lift-scala-newbie i am trying out various things with lift to 
> > > > > > see
> > > > > > advantages etc. to other frameworks (rails, grails,...)
>
> > > > > > I am now trying to integrate a third party java validation library 
> > > > > > and
> > > > > > i want to embed the results into my webapp. First i want to put all
> > > > > > localized error messages into the error object, which seems to be
> > > > > > straightforward and i am not expecting any problems there.
>
> > > > > > my second step would be a integration with the binding to visualize
> > > > > > input/textareas depending on their validation results. My problem is
> > > > > > now the lifecycle of my snippet.
>
> > > > > > object name extends RequestVar("")
>
> > > > > > //someCode
>
> > > > > > def submit() { //validation would happen here }
>
> > > > > > bind("myobject", xhtml, "name" ->
> > > > > >   SHtml.text(name.is, name(_),
> > > > > > ("class","dependsOnTheValidationResult"),
> > > > > >   "submit" -> SHtml.submit("submit", submit)
> > > > > > )
>
> > > > > > My problem is, that the binding to the form happens at the same time
> > > > > > as the binding to the request vars. So it seems like there is no
> > > > > > simple way to:
>
> > > > > > 1. read the vars
> > > > > > 2. bind them to an object
> > > > > > 3. validate the object
> > > > > > 4. bind the validation result to the css attributes of the elements
>
> > > > > > AND: This should only happen when the user submits. Because there is
> > > > > > no need to validate when the user hits the page the first time. 
> > > > > > Should
> > > > > > i create 2 pages (one for the first view, one for the validation
> > > > > > cycle, separate binding methods,...). This seems not to be a DRY 
> > > > > > way.
>
> > > > > In fact it is very easy to do this:
>
> > > > > 1. For the function bound to the form fields you onyl accumulate the
> > > > > data and put it in whatever structure you want
> > > > > 2. Do the validation in the submit function
> > > > > 3. You can easily use  built in snippet to show error
> > > > > message near by th fields that failed to validate.
>
> > > > > For Ajax forms yo

[Lift] Another StatefulSnippet question...

2009-05-16 Thread ivan

First I have to say sorry everyone for asking too many questions,
asking a question is my last choice after i coludn't find an answer in
a book or somewhere else.

The question is: I am trying to use a StatefulSnippet. The snippet has
a dispatch for three methods "list", "add", "pager".

All three snippets are displayed on the same page. "List" is a list of
db entities, "add" is a form for adding a new entity and "pager" are 4
links for navigating the result set, defined by two variables "first"
and "pageSize".

The 4 links "first", "prev", "next" and "last" _work_, they update the
value of the "first" variable so i can see that "pager" method is
allways called with the same instance of my StatefulSnippet.

But the problem is that the "list" snippet is always called on a new
instance of my StatefulSnippet even though all these parts are
displayed on the same page.

I have a feeling that I am still missing something pretty fundamental
here. Any ideas?

--~--~-~--~~~---~--~~
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: Bindings and Validation request cycle

2009-05-16 Thread marius d.

Well your MyObject reference is a new one for each invocation of dodo
function. The way I see it the validator should be stateless even an
Scala object. The flow I'm referring to is:


1. Your validation function takes an input and produces an output
2. "Store" your output (such as CSS class name or something else)  in
a RequestVar
3. On rendering just use your request var


I.E.

Assume:

class MyObject {
  var name :String = _
  var cssClass: String = _
}

object myObjectVar extends RequestVar[MyObject](new MyObject)

def dodo(form : NodeSeq) = {

 val validation = Validator.prepare(myObject)

 def submit() {
   validation.validate()
   if(validation ok) //doStuff else {
   myObjectVar.is.cssClass = "redBorderCssClass"
   S.error("Invalid input")
}
 }

 def doBind(form : NodeSeq) = bind("myform", form,
   "name" -> SHtml.text( myObjectVar.is.name, v => myObjectVar.is.name
= v ,("class" -> myObjectVar.is.cssClass)),
   "submit" -> SHtml.submit(S ? "send", submit))





If you want to avoid the RequestVar you can just use a StatefulSnippet
and "store" the validation output (the class name) in a local
variable.

class MySnippet extends StatefulSnippet {
var myObject = new MyObject  // set values from your bound
functions and read values when redering happens
...
}

Br's,
Marius

On May 16, 2:49 am, Scalanewbie  wrote:
> In addtion to my problem, i found out that request vars live from the
> current request till the next request. And when i switch to simple
> vals i dont event have a value in my submit() form.
>
> On May 16, 12:06 am, Scalanewbie  wrote:
>
> > Hi Marius, thanks for your explanation but i have some trouble getting
> > the lifcycle right:
>
> > object name extends RequestVar("")
>
> > def dodo(form : NodeSeq) = {
>
> >     val myObject= new MyObject(name)
> >     val validation = Validator.prepare(myObject)
>
> >     def submit() {
> >       validation.validate()
> >       if(validation ok) //doStuff else {
> >           S.error("Invalid input")
> >           S.mapSnippet("Snippet.dodo", doBind)
> >       }
> >     }
>
> > def doBind(form : NodeSeq) = bind("myform", form,
> >   "name" -> SHtml.text(name.is, name(_),("class",validation css
> > "name")),
> >   "submit" -> SHtml.submit(S ? "send", submit))
>
> > doBind(form)
>
> > }
>
> > The problem is that the validation object inside the "submit()"
> > differs (other object reference) from the one used in the validation
> > css "name" method call.
> > The validation has a state that gets somehow lost/replaced.
>
> > Any suggestions on that?
>
> > On May 15, 11:00 pm, "marius d."  wrote:
>
> > > If you want to change CSS classes upon validation you can do:
>
> > > Non Ajax
>
> > > 1.
> > > .
> > > bind("myobject", xhtml,
> > >   "name" -> SHtml.text(name.is, name(_) % ("class" -> "read the value
> > > from you state"),
> > > ("class","dependsOnTheValidationResult"),
> > >   "submit" -> SHtml.submit("submit", submit)
> > > )
>
> > > Note that the rendering happens after you request functions have been
> > > invoked (obviously) so when rendering the text field you already know
> > > the class from your function logic.
>
> > > 2. On rendering use Snippet atrributes
>
> > > 
>
> > > Ajax
>
> > > 1. In the Ajax JavaScript response you can easily change classes.
>
> > > On May 15, 11:20 pm, Scalanewbie  wrote:
>
> > > > Hi Marius,
> > > > this is what i do at the moment, but i dont see a way to put the css
> > > > class information into my elements after the validation.
> > > > This seems not to be possible with the msgs class. Because it just
> > > > prints out the error with a specific css class and
> > > > does not do any special node manipulation (which is good, because its
> > > > not the right place).
>
> > > > On May 15, 9:37 pm, "marius d."  wrote:
>
> > > > > On May 15, 10:18 pm, Scalanewbie  wrote:
>
> > > > > > Hi,
> > > > > > as a lift-scala-newbie i am trying out various things with lift to 
> > > > > > see
> > > > > > advantages etc. to other frameworks (rails, grails,...)
>
> > > > > > I am now trying to integrate a third party java validation library 
> > > > > > and
> > > > > > i want to embed the results into my webapp. First i want to put all
> > > > > > localized error messages into the error object, which seems to be
> > > > > > straightforward and i am not expecting any problems there.
>
> > > > > > my second step would be a integration with the binding to visualize
> > > > > > input/textareas depending on their validation results. My problem is
> > > > > > now the lifecycle of my snippet.
>
> > > > > > object name extends RequestVar("")
>
> > > > > > //someCode
>
> > > > > > def submit() { //validation would happen here }
>
> > > > > > bind("myobject", xhtml, "name" ->
> > > > > >   SHtml.text(name.is, name(_),
> > > > > > ("class","dependsOnTheValidationResult"),
> > > > > >   "submit" -> SHtml.submit("submit", submit)
> > > > > > )
>
> > > > > > My problem is, that the bind

[Lift] Re: rlambda lift project updated

2009-05-16 Thread Meredith Gregory
Tim,

Thanks for your generous offer. Code review would be great. My next steps
include

   - Wiring up BDBXML for a persistence layer
   - Wiring up ANTLR as the fallback parser generator

If you, or anyone, wants to take a swipe at a relational persistence as
well, that would be fantastic. The idea is to simply generate the subclasses
of the classes in Absyn that would provide the mapping to store. Since i've
got a functioning Java parser, i was going to attack the problem at that
level. This allows me to generate Scala classes with very little pain. It's
also possible to take the following approaches.

   - Hack the backend of BNFC
   - Use the visitor pattern stuff generated by BNFC

Of course, code review would be great. Also, i just got a note from someone
that the jlex/cup dependencies are being properly handled by maven. If you
could verify, that would be awesome.

Best wishes,

--greg

On Fri, May 15, 2009 at 4:40 AM, Timothy Perrett wrote:

>
> Greg, I find this very interesting.
>
> How can I help you out here? I can certainly review your lift code,
> not so sure about some of the crazy conceptual stuff though!
>
> Cheers, Tim
>
> On May 14, 8:41 pm, Meredith Gregory  wrote:
> > Lifted,
> >
> > i've added support to the rlambda lift
> > projecttaking it within range of
> > being a candidate DSL-archetype. At this point it
> > is possible simply to supply a .cf file in the src/main/bnfc directory
> and
> > it will generate everything from that. i've still got to conditionally
> > include the Eval and Compile functionality for DSL that have/don't have
> this
> > capability.
> >
> > i've two remaining questions for this leg of the work.
> >
> >- Does anyone know how to reference maven dependencies within some
> flavor
> >of maven-antrun-plugin? The original version does not appear to have
> this
> >functionality and Sun's maven-antrun-extended-plugin (which is
> supposed to
> >supply this functionality) has so little documentation (that i could
> find)
> >that i couldn't get it to work after an hour our so.
> >- This version requires that BNFC, as an executable, be available on
> the
> >path. Is there a blessed way to handle this sort of dependency?
> >   - i've got a hare-brained scheme that will fix this -- a
> >   meta-compiler-compiler from BNFC's input format to ANTLR's. i
> > could include
> >   such a transform as a part of the project or a dependency and
> > test for the
> >   availability of BNFC and fall back to ANTLR if it's not available.
> >
> > If anybody wanted to give this round of updates a whirl, even give me a
> code
> > review, i would be very grateful.
> >
> > Best wishes,
> >
> > --greg
> >
> > --
> > L.G. Meredith
> > Managing Partner
> > Biosimilarity LLC
> > 1219 NW 83rd St
> > Seattle, WA 98117
> >
> > +1 206.650.3740
> >
> > http://biosimilarity.blogspot.com
> >
>


-- 
L.G. Meredith
Managing Partner
Biosimilarity LLC
1219 NW 83rd St
Seattle, WA 98117

+1 206.650.3740

http://biosimilarity.blogspot.com

--~--~-~--~~~---~--~~
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: Tail merge?

2009-05-16 Thread marius d.

Folks,

I just added  builtin snippet support. 

[Lift] Re: Lift-amqp diagram - sense check?

2009-05-16 Thread Timothy Perrett

Hey man,

Wayy ahead of you ;-) already made a sample app! Going to be  
publishing it on my blog with source code and an accompanying screen  
cast :-)

Cheers, Tim

Sent from my iPhone

On 16 May 2009, at 12:46, TylerWeir  wrote:

>
> Timmy,
>
> I'm being a bit selfish, but I'd love to see an example app with AMQP.
>
> I'd be happy to help out however I can.
>
> Ty
>
> On May 15, 8:08 pm, Timothy Perrett  wrote:
>> Sorry for answering my own question here, but just decided to jump
>> right in and see if this was correct - finding that it is so im just
>> writing up my findings and posting a sample application to github.
>>
>> Will share when I have more.
>>
>> Cheers, Tim
>>
>> On May 15, 7:04 pm, Timothy Perrett  wrote:
>>
>>
>>
>>> Guys,
>>
>>> Im just trying to make sense of Steve¹s lift-amqp implementation 
>>> . With a
>>> view to improving the documentation, can someone who understands  
>>> AMQP in
>>> general just sense check the attached diagram before I start  
>>> improving the
>>> code documentation?
>>
>>> Thanks
>>
>>> Tim
>>
>>>  lift-amqp.pdf
>>> 119KViewDownload
> >
>

--~--~-~--~~~---~--~~
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: Lift-amqp diagram - sense check?

2009-05-16 Thread TylerWeir

Timmy,

I'm being a bit selfish, but I'd love to see an example app with AMQP.

I'd be happy to help out however I can.

Ty

On May 15, 8:08 pm, Timothy Perrett  wrote:
> Sorry for answering my own question here, but just decided to jump
> right in and see if this was correct - finding that it is so im just
> writing up my findings and posting a sample application to github.
>
> Will share when I have more.
>
> Cheers, Tim
>
> On May 15, 7:04 pm, Timothy Perrett  wrote:
>
>
>
> > Guys,
>
> > Im just trying to make sense of Steve¹s lift-amqp implementation. With a
> > view to improving the documentation, can someone who understands AMQP in
> > general just sense check the attached diagram before I start improving the
> > code documentation?
>
> > Thanks
>
> > Tim
>
> >  lift-amqp.pdf
> > 119KViewDownload
--~--~-~--~~~---~--~~
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: immutable bindings

2009-05-16 Thread Oliver Lambert
On Sat, May 16, 2009 at 4:32 AM, David Pollak  wrote:

>
>
> On Thu, May 14, 2009 at 7:43 PM, Oliver Lambert wrote:
>
>> I've started integrating my immutable bindings, but have some questions
>>
>> On my build, I've placed the main immutable binding classes in module lift
>> webkit under package net.liftweb.http.immu.
>> Is that location/name OK?
>
>
> If there's stuff that does not reference other stuff in the http classes,
> please put it in net.liftweb.util.  How many classes do you have?  Can we
> put it in net.liftweb.record instead?  I'm thinking your work might form the
> basis for some of the record stuff.
>
>
I'll put what I can in net.liftweb.util. I guess there are about 10 classes,
but I'll probably put these in a few files. I like the idea of using
net.liftweb.record - I'll start to study the record methodology, also.


>>
>> I would like to introduce a new set of currency classes, roughly based on
>> Martin et al's Currency Zone example in their book. Derek, is using an
>> earlier version of it in his JPA example, Ive simplified it a little and
>> extended it to include a few different currencies. Is this OK? - I know
>> there is a simple currency class already.
>
>
> Sure.  I'm pretty sure the existing currency class in net.liftweb.util is
> unused, so if you want to "break" that class, that might be a good place to
> put your code.
>

cool, will do


>
>> I'm not sure what to do about the mixin binding that I use for html, that
>> extends/modifies BindHelpers.
>
>
> Put it in BindHelpers... as long as it doesn't break any of the existing
> APIs.
>
>
ok, I might go slowly on this bit.


>
>> Potentially I could modify BindHelpers, but, should I leave it out for now
>> or include it as an optional and separate class in net.liftweb.html.immu?
>>
>> cheers
>> Oliver
>>
>>
>>
>>
>
>
> --
> Lift, the simply functional web framework http://liftweb.net
> Beginning Scala http://www.apress.com/book/view/1430219890
> Follow me: http://twitter.com/dpp
> Git some: http://github.com/dpp
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---