[Lift] Re: Testing snippets that depend on a user logged in

2009-10-01 Thread etorreborre

Hi all,

I added a specs version as well.

Eric.

On Oct 2, 2:37 pm, Bill Venners  wrote:
> Hi Ryan, David, Eric,
>
> I added a ScalaTest version to your wiki page:
>
> http://wiki.github.com/dpp/liftweb/how-to-unit-test-lift-snippets-wit...
>
> Eric you may want to add a specs version.
>
> Bill
>
>
>
>
>
> On Thu, Oct 1, 2009 at 3:03 PM, rstradling  wrote:
>
> > Awesome!!! Thanks guys for the help.  It now works.
>
> > I put a how-to wiki document up on github.  For me this was one of
> > those times where my google searches did not seem to turn up anything
> > fruitful, so I thought this how-to would be helpful.  If it is not
> > helpful, then no hard feelings if the page is deleted.  I just wanted
> > to give back.
>
> > Wiki page
> >http://wiki.github.com/dpp/liftweb/how-to-unit-test-lift-snippets-wit...
>
> > On Oct 1, 4:53 pm, David Pollak  wrote:
> >> Bill,
> >> Thanks for posting this.  I am, by experience (I started using it, I can 
> >> use
> >> it enough to write basic tests, I know no more) using Specs.  I would
> >> welcome and encourage some sample tests in Lift archetypes that use
> >> ScalaTest.  I want to make sure that folks who pick up Lift get to
> >> experience ScalaTest as well as Specs... that way, folks who have a better
> >> understanding of tests can make better choices.
>
> >> Thanks,
>
> >> David
>
> >> On Thu, Oct 1, 2009 at 1:27 PM, Bill Venners  wrote:
>
> >> > Hi Ryan,
>
> >> > It looks like you're currently using a JUnit TestCase. If you want an
> >> > easier port to something that would work you could use a ScalaTest
> >> > Suite like this:
>
> >> > import org.scalatest.Suite
>
> >> > class YourSuite extends Suite {
>
> >> >  val session = new LiftSession("", randomString(20), Empty)
> >> >  val stableTime = now
>
> >> >   override def withFixture(test: NoArgTest) {
>
> >> >    S.initIfUninitted(session) {
> >> >       val user = User.create
> >> >      user.firstName("XXX")
> >> >      user.lastName("YYY")
> >> >      user.save
> >> >      User.logUserIn(user)
> >> >       test()
> >> >     }
> >> >  }
>
> >> >  def testValue() {
> >> >   val xml =
> >> >       
> >> >         
> >> >             
> >> >                 My Name
> >> >             
> >> >             
> >> >                 Fighter Style
> >> >             
> >> >             
> >> >                 Weight
> >> >             
> >> >         
> >> >       
> >> >    val trainer = new Trainer()
> >> >    val output = trainer.showPeople(xml)
> >> >     // seems like you need an assertion here...
> >> >  }
> >> > }
>
> >> > A Suite considers methods that start with "test" as tests, like JUnit
> >> > 3, except they don't need to result in Unit so you don't need an extra
> >> > () at the end. The withFixture method is an alternative to
> >> > beforeEach/afterEach, which are like JUnit 3's setUp/tearDown methods.
> >> > Each test gets passed as a function to withFixture, which is
> >> > responsible for executing the test by invoking the function. In this
> >> > case, it is executed in the context created by S. initIfUninitted.
> >> > This is ScalaTest 1.0, which is available as a SNAPSHOT right now but
> >> > should be released proper a week from Monday.
>
> >> >http://www.artima.com/scalatest
>
> >> > Bill
>
> >> > On Thu, Oct 1, 2009 at 9:50 AM, David Pollak
> >> >  wrote:
> >> > > Using Specs 1.6:
>
> >> > > object HelloWorldTestSpecs extends Specification {
> >> > >   val session = new LiftSession("", randomString(20), Empty)
> >> > >   val stableTime = now
> >> > >   override def executeExpectations(ex: Examples, t: =>Any): Any = {
> >> > >     S.initIfUninitted(session) {
> >> > >       ... put your User init here.  The User.logUserIn will be within 
> >> > > the
> >> > > context of a session and thus session (and request) vars will be valid
> >> > >     }
> >> > >   }
> >> > >   "HelloWorld Snippet" should {
> >> > >     "Put the time in the node" in {
> >> > >       ... do testing here
> >> > >     }
> >> > >   }
> >> > > }
>
> >> > > Hope this helps.
> >> > > On Thu, Oct 1, 2009 at 8:55 AM, rstradling 
> >> > wrote:
>
> >> > >> I have a class called
> >> > >> class Trainer {
> >> > >>   def showPeople(xhtml : Group) : NodeSeq = {
> >> > >>      val user : User = User.currentUser.open_!
> >> > >>      ...
> >> > >>   }
> >> > >> }
>
> >> > >> I then want to write a unit test to test that returns proper xml.
>
> >> > >> The test is written as so
> >> > >>  def testValue() = {
> >> > >>    val xml =
> >> > >>        
> >> > >>          
> >> > >>              
> >> > >>                  My Name
> >> > >>              
> >> > >>              
> >> > >>                  Fighter Style
> >> > >>              
> >> > >>              
> >> > >>                  Weight
> >> > >>              
> >> > >>          
> >> > >>        
> >> > >>    val trainer = new Trainer()
> >> > >>    val output = trainer.showPeople(xml)
> >> > >>    ()
> >> > >>  }
>
> >> > >> The User object inherits from MegaProtoUser.
>
> >> > 

[Lift] Re: Testing snippets that depend on a user logged in

2009-10-01 Thread Bill Venners

Hi Ryan, David, Eric,

I added a ScalaTest version to your wiki page:

http://wiki.github.com/dpp/liftweb/how-to-unit-test-lift-snippets-with-a-logged-in-user

Eric you may want to add a specs version.

Bill

On Thu, Oct 1, 2009 at 3:03 PM, rstradling  wrote:
>
> Awesome!!! Thanks guys for the help.  It now works.
>
> I put a how-to wiki document up on github.  For me this was one of
> those times where my google searches did not seem to turn up anything
> fruitful, so I thought this how-to would be helpful.  If it is not
> helpful, then no hard feelings if the page is deleted.  I just wanted
> to give back.
>
> Wiki page
> http://wiki.github.com/dpp/liftweb/how-to-unit-test-lift-snippets-with-a-logged-in-user
>
>
>
>
> On Oct 1, 4:53 pm, David Pollak  wrote:
>> Bill,
>> Thanks for posting this.  I am, by experience (I started using it, I can use
>> it enough to write basic tests, I know no more) using Specs.  I would
>> welcome and encourage some sample tests in Lift archetypes that use
>> ScalaTest.  I want to make sure that folks who pick up Lift get to
>> experience ScalaTest as well as Specs... that way, folks who have a better
>> understanding of tests can make better choices.
>>
>> Thanks,
>>
>> David
>>
>>
>>
>> On Thu, Oct 1, 2009 at 1:27 PM, Bill Venners  wrote:
>>
>> > Hi Ryan,
>>
>> > It looks like you're currently using a JUnit TestCase. If you want an
>> > easier port to something that would work you could use a ScalaTest
>> > Suite like this:
>>
>> > import org.scalatest.Suite
>>
>> > class YourSuite extends Suite {
>>
>> >  val session = new LiftSession("", randomString(20), Empty)
>> >  val stableTime = now
>>
>> >   override def withFixture(test: NoArgTest) {
>>
>> >    S.initIfUninitted(session) {
>> >       val user = User.create
>> >      user.firstName("XXX")
>> >      user.lastName("YYY")
>> >      user.save
>> >      User.logUserIn(user)
>> >       test()
>> >     }
>> >  }
>>
>> >  def testValue() {
>> >   val xml =
>> >       
>> >         
>> >             
>> >                 My Name
>> >             
>> >             
>> >                 Fighter Style
>> >             
>> >             
>> >                 Weight
>> >             
>> >         
>> >       
>> >    val trainer = new Trainer()
>> >    val output = trainer.showPeople(xml)
>> >     // seems like you need an assertion here...
>> >  }
>> > }
>>
>> > A Suite considers methods that start with "test" as tests, like JUnit
>> > 3, except they don't need to result in Unit so you don't need an extra
>> > () at the end. The withFixture method is an alternative to
>> > beforeEach/afterEach, which are like JUnit 3's setUp/tearDown methods.
>> > Each test gets passed as a function to withFixture, which is
>> > responsible for executing the test by invoking the function. In this
>> > case, it is executed in the context created by S. initIfUninitted.
>> > This is ScalaTest 1.0, which is available as a SNAPSHOT right now but
>> > should be released proper a week from Monday.
>>
>> >http://www.artima.com/scalatest
>>
>> > Bill
>>
>> > On Thu, Oct 1, 2009 at 9:50 AM, David Pollak
>> >  wrote:
>> > > Using Specs 1.6:
>>
>> > > object HelloWorldTestSpecs extends Specification {
>> > >   val session = new LiftSession("", randomString(20), Empty)
>> > >   val stableTime = now
>> > >   override def executeExpectations(ex: Examples, t: =>Any): Any = {
>> > >     S.initIfUninitted(session) {
>> > >       ... put your User init here.  The User.logUserIn will be within the
>> > > context of a session and thus session (and request) vars will be valid
>> > >     }
>> > >   }
>> > >   "HelloWorld Snippet" should {
>> > >     "Put the time in the node" in {
>> > >       ... do testing here
>> > >     }
>> > >   }
>> > > }
>>
>> > > Hope this helps.
>> > > On Thu, Oct 1, 2009 at 8:55 AM, rstradling 
>> > wrote:
>>
>> > >> I have a class called
>> > >> class Trainer {
>> > >>   def showPeople(xhtml : Group) : NodeSeq = {
>> > >>      val user : User = User.currentUser.open_!
>> > >>      ...
>> > >>   }
>> > >> }
>>
>> > >> I then want to write a unit test to test that returns proper xml.
>>
>> > >> The test is written as so
>> > >>  def testValue() = {
>> > >>    val xml =
>> > >>        
>> > >>          
>> > >>              
>> > >>                  My Name
>> > >>              
>> > >>              
>> > >>                  Fighter Style
>> > >>              
>> > >>              
>> > >>                  Weight
>> > >>              
>> > >>          
>> > >>        
>> > >>    val trainer = new Trainer()
>> > >>    val output = trainer.showPeople(xml)
>> > >>    ()
>> > >>  }
>>
>> > >> The User object inherits from MegaProtoUser.
>>
>> > >> The problem is I am not sure how to create a mock user and sign them
>> > >> in.
>> > >> I have tried in my unit test
>> > >> override def setUp : Unit = {
>> > >>   val user = User.create
>> > >>   user.firstName("XXX")
>> > >>   user.lastName("YYY")
>> > >>   user.save
>> > >>   User.logUserIn(user

[Lift] Re: Javascript Commands

2009-10-01 Thread Derek Chen-Becker
Oops, sorry about that. Also, can you show a little more of your code? I'm
not sure what you're trying to do with the assignment to x.

Derek

On Thu, Oct 1, 2009 at 10:18 PM, Indrajit Raychaudhuri
wrote:

>
> That should read JsCmds.JsCrVar(...)
>
> Cheers, Indrajit
>
>
> On 02/10/09 4:39 AM, sunanda wrote:
> >
> >
> > Thanks Derek.
> > But I get the following errors:
> > found : net.liftweb.http.js.JE.Call
> > required: java.lang.String
> > x= JE.Call("foo",2)
> > ^
> > C:\J\BrandNET\eclipse_workspace\GridXml_Lift2.0\src\main\scala\net
> > \irisinteractive\lift\grid\snippet\CreateGridConfigTable.scala:47:
> > error: value CrVar is not a member of object
> > net.liftweb.http.js.JsCmds
> > JsCmds.CrVar("myVar", JE.Call("foo", 2))
> >
> >
> > On Oct 2, 12:07 am, Derek Chen-Becker  wrote:
> >> If you have a javascript function "foo(a, b)" where "a" is a String and
> "b"
> >> is an integer then you can call that with
> >>
> >> JE.Call("foo", "one", 2)
> >>
> >> for example. If you wanted to set some variable to the result of the
> >> function, you could do:
> >>
> >> JsCmds.CrVar("myVar", JE.Call("foo", "one", 2))
> >>
> >> Derek
> >>
> >>
> >>
> >> On Wed, Sep 30, 2009 at 6:17 PM, sunanda
>  wrote:
> >>
> >>> Hi David,
> >>> Thanks for your prompt reply.
> >>> As a beginner I have started reading the book "Exploring Lift".
> >>
> >>> It says
> >>
> >>> "If you need to write large portions of JavaScript code for your
> >>> pages, we recommend writing that code in
> >>> pure JavaScript in an external file and then including that file in
> >>> your pages. In particular, if you write your code as JavaScript
> >>> functions, you can use the JE.Call class to execute those functions
> >>> from your Lift code."
> >>
> >>> I just want to know how can I use JE.Call function fro my external
> >>> javascript file and also how to use JE abstractions like (JsFunc,
> >>> ValById etc..)
> >>
> >>> Could you please provide a simple example so that my understanding
> >>> will be clear.
> >>
> >>> Thanks
> >>> Sunanda
> >>
> >>> On Oct 1, 9:56 am, David Pollak  wrote:
>  Seehttp://demo.liftweb.net/ajax
>  Specifically:
> >>
>  var cnt = 0def doClicker(text: NodeSeq) =
>   a(() =>  {cnt = cnt + 1; SetHtml(spanName, Text( cnt.toString))},
> >>> text)
> >>
>  It increments a counter.
> >>
>  On Wed, Sep 30, 2009 at 4:50 PM, sunanda
> >>> wrote:
> >>
> > Hi,
> > I am totally new to lift framework.
> > Can any one give me a simple example of how to call a function form a
> > javascript file and store the results
> > in  scala variable.
> >>
> > Thanks.
> >>
>  --
>  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- Hide quoted text -
> >>
> >> - Show quoted text -
> >
> > >
>
> >
>

--~--~-~--~~~---~--~~
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: Javascript Commands

2009-10-01 Thread Indrajit Raychaudhuri

That should read JsCmds.JsCrVar(...)

Cheers, Indrajit


On 02/10/09 4:39 AM, sunanda wrote:
>
>
> Thanks Derek.
> But I get the following errors:
> found : net.liftweb.http.js.JE.Call
> required: java.lang.String
> x= JE.Call("foo",2)
> ^
> C:\J\BrandNET\eclipse_workspace\GridXml_Lift2.0\src\main\scala\net
> \irisinteractive\lift\grid\snippet\CreateGridConfigTable.scala:47:
> error: value CrVar is not a member of object
> net.liftweb.http.js.JsCmds
> JsCmds.CrVar("myVar", JE.Call("foo", 2))
>
>
> On Oct 2, 12:07 am, Derek Chen-Becker  wrote:
>> If you have a javascript function "foo(a, b)" where "a" is a String and "b"
>> is an integer then you can call that with
>>
>> JE.Call("foo", "one", 2)
>>
>> for example. If you wanted to set some variable to the result of the
>> function, you could do:
>>
>> JsCmds.CrVar("myVar", JE.Call("foo", "one", 2))
>>
>> Derek
>>
>>
>>
>> On Wed, Sep 30, 2009 at 6:17 PM, sunanda  wrote:
>>
>>> Hi David,
>>> Thanks for your prompt reply.
>>> As a beginner I have started reading the book "Exploring Lift".
>>
>>> It says
>>
>>> "If you need to write large portions of JavaScript code for your
>>> pages, we recommend writing that code in
>>> pure JavaScript in an external file and then including that file in
>>> your pages. In particular, if you write your code as JavaScript
>>> functions, you can use the JE.Call class to execute those functions
>>> from your Lift code."
>>
>>> I just want to know how can I use JE.Call function fro my external
>>> javascript file and also how to use JE abstractions like (JsFunc,
>>> ValById etc..)
>>
>>> Could you please provide a simple example so that my understanding
>>> will be clear.
>>
>>> Thanks
>>> Sunanda
>>
>>> On Oct 1, 9:56 am, David Pollak  wrote:
 Seehttp://demo.liftweb.net/ajax
 Specifically:
>>
 var cnt = 0def doClicker(text: NodeSeq) =
  a(() =>  {cnt = cnt + 1; SetHtml(spanName, Text( cnt.toString))},
>>> text)
>>
 It increments a counter.
>>
 On Wed, Sep 30, 2009 at 4:50 PM, sunanda
>>> wrote:
>>
> Hi,
> I am totally new to lift framework.
> Can any one give me a simple example of how to call a function form a
> javascript file and store the results
> in  scala variable.
>>
> Thanks.
>>
 --
 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- Hide quoted text -
>>
>> - Show quoted text -
>
> >

--~--~-~--~~~---~--~~
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: Concurrent Web Service Requests?

2009-10-01 Thread Naftoli Gugenheim

Have we been misunderstanding each other? The lift prefix can be a snippet 
invocation as an attribute too. Thus the fact that it's an attribute does not 
separate "reserved names" from "user space snippet names."

-
marius d. wrote:


David,

Thank you very much for your kind words. Personally I don't see any
reason why the lift prefix can not also have the semantic for
enriching the context you described  "this thing will be changed based
on evaluating some code.". These are after all attributes and
attributes to me are about about meta-data on how lift will change
markup.

I will do what you suggested hopefully by next Monday ... and this
time using the proper process ;)

Br's,
Marius

On Oct 1, 7:03 pm, David Pollak  wrote:
> Marius,
> I have a ton of respect for your opinion and I appreciate your analysis.
>
> I have been following this thread and thinking, "what does the lift: prefix
> mean?"  In my mind, it means "this thing will be changed based on evaluating
> some code."  So, using the lift: prefix for something that also means "this
> modifies the meaning of this snippet invocation" presents
> something discordant to me.
>
> With that being said, I'm going to hand the decision to you.  I trust your
> decisions and have concerns about my own instincts when it comes to naming.
>
> Please update the code to reflect what you think it should be and merge it
> into master.
>
> Thanks,
>
> David
>
> On Thu, Oct 1, 2009 at 5:58 AM, marius d.  wrote:
>
> > Well I said what I had to say. My problem is not really the prefix
> > name but the existence of other prefixes then lift, that are
> > interpreted by lift. It's just how I see things now and nothing on
> > this thread provided sufficient arguments to convince me
> > otherwise ...
>
> > not much else for me to do if majority and especially DPP thinks
> > otherwise. It is what it is I guess.
>
> > Br's,
> > Marius
>
> > On Oct 1, 4:18 am, Naftoli Gugenheim  wrote:
> > > I think everyone agrees in concept, that an arbitrary prefix sets a bad
> > precendent, which is why it is no longer do:par. But on the other hand, if
> > the part after "lift:" is either a reserved word or a "user" word--a snippet
> > name--then the more reserved words, the more you limit snippet names.
> > (Should S.mapSnippet("parallel", ...) throw an exception?)
> > > So we have these two considerations on either end of the spectrum.
> > Arguably, "liftx" as a prefix satisfies both--it is sufficiently generic to
> > include almost any "special" attribute that may be added, it clearly spells
> > out "extended lift attribute," and on the other hand it keeps reserved lift
> > attributes separate from the user's snippet namespace.
> > > Now let's bear in mind that this is all only relevant in the future, when
> > lift: attributes indeed will be interpreted as lift:snippet="..." is now. At
> > that point it might make sense for the explicit :snippet format to be moved
> > to the liftx prefix-- liftx:snippet="..." --for the same reason, not to
> > encroach on the snippet namespace.
>
> > > -
>
> > > marius d. wrote:
>
> > > It has been debated many times in slightly different contexts. To me
> > > it is more about clarity. We add a new prefix now, tomorrow add
> > > another one and so on. People would have to remember what goes where
> > > and  mix things up. To me lift prefix is enough and quite clear. It is
> > > more than just s snippet thingy. It tells the user "hey this thing is
> > > telling the framework something and the framework is doing something
> > > with it". It is separating framework xml markup from the actual xhtml
> > > markup. Having a single reserved prefix promotes clarity and keeps
> > > things simple and rather intuitive.
>
> > > I'm not in favor of using unprefixed attributes like
> > > par="something" (btw I really don't like par naming :) ...) because
> > > unprefixed attributes should be only standard xhtml ones or the ones
> > > that user explicitly specifies it. So lift:parallel="true" or
> > > lift:async="true" should be just fine.
>
> > > Br's,
> > > Marius
>
> > > On Sep 30, 8:05 pm, Naftoli Gugenheim  wrote:
>
> > > > Could you elaborate on why adding a new prefix may not be a good idea?
> > And is it better or worse than having it unprefixed?
>
> > > > -
>
> > > > marius d. wrote:
>
> > > > On Sep 30, 8:23 am, Kevin Wright 
> > > > wrote:
>
> > > > > I thought there were issues here because anything starting lift: gets
> > > > > executed as a snippet.
>
> > > > Correct BUT lift:par or lift:parallel attributes are also applicable
> > > > to snippets context. They determine the snippet's execution semantics.
> > > > So I'm still questioning the need for a new prefix.
>
> > > > > I'm still for an eval: prefix, as these proposals all relate to how a
> > > > > page is evaluated.
>
> > > > > On Wed, Sep 30, 2009 at 5:34 AM, marius d. 
> > wrote:
>
> > > >

[Lift] Using plain usernames for authentication

2009-10-01 Thread tommycli

Looking through the book and source for MegaProtoUser, it looks like
the email address is used as the primary identifier for users in the
built-in user system.

What if you want to use plain usernames instead of emails? What do
other people do - do they write their own user system from scratch?

--~--~-~--~~~---~--~~
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: Concurrent Web Service Requests?

2009-10-01 Thread marius d.

David,

Thank you very much for your kind words. Personally I don't see any
reason why the lift prefix can not also have the semantic for
enriching the context you described  "this thing will be changed based
on evaluating some code.". These are after all attributes and
attributes to me are about about meta-data on how lift will change
markup.

I will do what you suggested hopefully by next Monday ... and this
time using the proper process ;)

Br's,
Marius

On Oct 1, 7:03 pm, David Pollak  wrote:
> Marius,
> I have a ton of respect for your opinion and I appreciate your analysis.
>
> I have been following this thread and thinking, "what does the lift: prefix
> mean?"  In my mind, it means "this thing will be changed based on evaluating
> some code."  So, using the lift: prefix for something that also means "this
> modifies the meaning of this snippet invocation" presents
> something discordant to me.
>
> With that being said, I'm going to hand the decision to you.  I trust your
> decisions and have concerns about my own instincts when it comes to naming.
>
> Please update the code to reflect what you think it should be and merge it
> into master.
>
> Thanks,
>
> David
>
> On Thu, Oct 1, 2009 at 5:58 AM, marius d.  wrote:
>
> > Well I said what I had to say. My problem is not really the prefix
> > name but the existence of other prefixes then lift, that are
> > interpreted by lift. It's just how I see things now and nothing on
> > this thread provided sufficient arguments to convince me
> > otherwise ...
>
> > not much else for me to do if majority and especially DPP thinks
> > otherwise. It is what it is I guess.
>
> > Br's,
> > Marius
>
> > On Oct 1, 4:18 am, Naftoli Gugenheim  wrote:
> > > I think everyone agrees in concept, that an arbitrary prefix sets a bad
> > precendent, which is why it is no longer do:par. But on the other hand, if
> > the part after "lift:" is either a reserved word or a "user" word--a snippet
> > name--then the more reserved words, the more you limit snippet names.
> > (Should S.mapSnippet("parallel", ...) throw an exception?)
> > > So we have these two considerations on either end of the spectrum.
> > Arguably, "liftx" as a prefix satisfies both--it is sufficiently generic to
> > include almost any "special" attribute that may be added, it clearly spells
> > out "extended lift attribute," and on the other hand it keeps reserved lift
> > attributes separate from the user's snippet namespace.
> > > Now let's bear in mind that this is all only relevant in the future, when
> > lift: attributes indeed will be interpreted as lift:snippet="..." is now. At
> > that point it might make sense for the explicit :snippet format to be moved
> > to the liftx prefix-- liftx:snippet="..." --for the same reason, not to
> > encroach on the snippet namespace.
>
> > > -
>
> > > marius d. wrote:
>
> > > It has been debated many times in slightly different contexts. To me
> > > it is more about clarity. We add a new prefix now, tomorrow add
> > > another one and so on. People would have to remember what goes where
> > > and  mix things up. To me lift prefix is enough and quite clear. It is
> > > more than just s snippet thingy. It tells the user "hey this thing is
> > > telling the framework something and the framework is doing something
> > > with it". It is separating framework xml markup from the actual xhtml
> > > markup. Having a single reserved prefix promotes clarity and keeps
> > > things simple and rather intuitive.
>
> > > I'm not in favor of using unprefixed attributes like
> > > par="something" (btw I really don't like par naming :) ...) because
> > > unprefixed attributes should be only standard xhtml ones or the ones
> > > that user explicitly specifies it. So lift:parallel="true" or
> > > lift:async="true" should be just fine.
>
> > > Br's,
> > > Marius
>
> > > On Sep 30, 8:05 pm, Naftoli Gugenheim  wrote:
>
> > > > Could you elaborate on why adding a new prefix may not be a good idea?
> > And is it better or worse than having it unprefixed?
>
> > > > -
>
> > > > marius d. wrote:
>
> > > > On Sep 30, 8:23 am, Kevin Wright 
> > > > wrote:
>
> > > > > I thought there were issues here because anything starting lift: gets
> > > > > executed as a snippet.
>
> > > > Correct BUT lift:par or lift:parallel attributes are also applicable
> > > > to snippets context. They determine the snippet's execution semantics.
> > > > So I'm still questioning the need for a new prefix.
>
> > > > > I'm still for an eval: prefix, as these proposals all relate to how a
> > > > > page is evaluated.
>
> > > > > On Wed, Sep 30, 2009 at 5:34 AM, marius d. 
> > wrote:
>
> > > > > > lift is already a "reserved" prefix for snippets. So I'd stay with
> > > > > > simply lift prefix for these attributes as well.
>
> > > > > > Br's,
> > > > > > Marius
>
> > > > > > On Sep 29, 11:11 pm, Naftoli Gugenheim 
> > wrote:
> > > > > >> So what is your propos

[Lift] a question about host based url rewriting

2009-10-01 Thread harryh

I want http://m.harryh.org to visit a mobile version of my site so I
added the following rewrite rule:

case RewriteRequest(path, _, req) if
(req.serverName.toLowerCase.startsWith("m.")) => {
  RewriteResponse(ParsePath("mobile" :: path.partPath,
path.suffix, path.absolute, path.endSlash), emptyMap, true)
}

This also makes the mobile site appear at http://harryh.org/mobile/
which I don't really want.  Is there any way I can accomplish this
goal (other than putting the mobile site in a weird path like "/
someRandomGuid/"

-harryh

--~--~-~--~~~---~--~~
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: Testing snippets that depend on a user logged in

2009-10-01 Thread etorreborre

Hi,

I am working at the moment on a small lift demo app and I've added
some enhancements to specs in order to ease the testing inside a
session.
To use those functionalities, you need specs-1.6.1-SNAPSHOT (http://
www.scala-tools.org/repo-snapshots/org/scala-tools/testing/specs/1.6.1-SNAPSHOT).

Here are the specification and traits that I use to test the JPA
requests to save a User in the database:

// First I create Mocks for the lift session
import javax.servlet.http._
import net.liftweb.http.{ S, Req, LiftSession }
import org.specs.mock.Mockito

trait MockRequest extends Mockito { this: Specification =>
  var request = mock[Req]
  var httpRequest = mock[HttpServletRequest]
  var session = mock[LiftSession]

  def createMocks: Unit = {
 request = mock[Req]
 httpRequest = mock[HttpServletRequest]
 session = mock[LiftSession]
 request.request returns httpRequest
  }

   // this method can be used to executed any action inside a mocked
session
  def inSession(f: =>Any) {  S.init(request, session) { f }  }

   def unsetParameter(name: String) { request.param(name) returns
None }
   def setParameter(name: String, value: String)  { request.param
(name) returns Some(value) }
}

// Context creation for the specification
//
// This "Specification context" specifies the User table must be
cleaned up before each example.
//  It also makes sure that the example expectations are executed in a
mocked session
// see 
http://code.google.com/p/specs/wiki/DeclareSpecifications#Specification_context_(_from_1.6.1_)
for more information

object DatabaseContext extends Specification with Contexts with
MockRequest {
  val setup = new SpecContext {
beforeExample(inSession(Users.createQuery("delete
User").executeUpdate)) // delete the User table before each example
aroundExpectations(inSession(_))  // execute each example inside a
mocked session
  }
}

// and finally the specification itself

import org.specs._
import org.specs.specification._

class UserSpec extends SpecificationWithJUnit with MockRequest with
Contexts {

  DatabaseContext.setup(this) // set the specification context on this
specification

  "A Users repository" can {
"create a user" in {
   val eric = User("etorreborre", "password", "Eric")
   Users.mergeAndFlush(eric) // the Users object is a LocalEMF
with RequestVarEM so it needs a session
   Users.find(classOf[User], "etorreborre") must_== Some(eric)
}
  }
   "A Users repository" should {
 "throw an exception if the user name has a length < 5" in {
Users.merge(User("e", "password", "Eric")) must throwAn
[Exception]
 }
  }
}

I hope this helps too, please ask if you have any questions.

Eric.


--~--~-~--~~~---~--~~
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: Removing Scala Actors from Lift

2009-10-01 Thread David Pollak
Martin and Philipp,
My immediate problem is:
http://groups.google.com/group/liftweb/browse_thread/thread/b3783e24b8417521/f89548ba1fa70319?hl=en&lnk=gst&q=oome#

This has been a persistent problem with Scala Actors and I identified it
last year in November or December.

Philipp did the 2.7.4 release which did not address the issue.  The 2.7.5
release was supposed to address the issue, but the use of Lift Actors masked
the issue until the above issue was raised.  I left my 2.7.5 related
discussions with Philipp with the impression that the java.util.concurrent
library was being used for thread pooling rather than the FJ library.  On
this, I backed out the Lift Actor changes from powering Lift's CometActors
(Lift Actors power the long polling part of Lift).

On Wed, Sep 30, 2009 at 8:18 AM, martin  wrote:

>
> About actors in Scala 2.8:
>
>  . they have been refactored substantially compared to what's in the
>   2.7.x branch
>  . Philipp has sent mails about this to scala-internals (05/31)
>  . Philipp has invited DPP to look at the refactorings in 2.8 (07/21)
> to which
>   he responded positively.
>

I responded politely.  Granted this is not something I always do (note, I am
not being facetious), but I simply said something like "looks good to me."


>  . The ForkJoinPool in 2.8 is completely different from FJTask in
>   2.7.5; it's the version that's going into JDK7. It has been
>   battle-tested and should not suffer from any memory leaks.
>




>
> The reason why Scala actors use the FJ framework is performance, in
> particular on multi-core hardware. So we do not think it's a good idea
> to go back to java.util.concurrent, except maybe for applications with
> very specialized demands.
>

Do you have specific benchmarks that justify the tradeoff of baking in an
external library (that could be as buggy as the one that's currently baked
into Scala) versus java.util.concurrent?


>
> We think the main problem was that lift depends on Scala 2.7.x, and
> that the actor refactorings have not gone into the 2.7.x branch.


I did a code review of the 2.8 Actors.  I am not convinced that Erik's
meta-concerns were addressed.  I will be happy to be more descriptive
off-list.


> The
> result is that people have not noticed the changes. For example, most
> of the issues that Erik raises in his blog post no longer apply to
> Scala 2.8. Initially we wanted 2.8 to be out by now, but it's taken
> much longer than we have foreseen, because some of the problems were
> harder than initially thought. We are sorry to have left the 2.7
> branch relatively unattended for so long. It's difficult for us,
> though, to provide the resources to support two diverging branches in
> parallel. More community support with backports etc could help.
>

While this is a nice thought, given the choice between debating with EPFL as
to whether my changes are good enough or doing a Lift Actor implementation,
I will opt for continuing to develop and maintain the Lift Actor library.
 This gives Lift users the assurance that bugs will be fixed in a timely
manner, that we can add features based on community need, and that we can
work with other library authors to insure common interfaces.


>
> To fix the concrete issue at hand, we replaced FJTask with (a backport
> of) java.util.concurrent.ThreadPoolExecutor in the Scala 2.7.x branch,
> to be released as 2.7.7. That takes care of the memory leaks in
> FJTask.
>
> Now to the larger picture. We are not at all wedded to Scala actors
> here; after all it's just a library. If there are others which fulfill
> some needs better, great! But we have to be honest to avoid confusion.
> One of the main differences between Scala actors and lift actors and
> Akka seems to be that only Scala actors provide nested receives, so
> only Scala actors really let you avoid an inversion of control.


Lift Actors allow for changing (and nesting) the message handler on a
message-by-message basis and because the handler can be defined within a
given partial function, it can close over the variables visible in that
partial function.  Granted the syntax for doing so in Scala Actors is much
more pleasing, the functionality exists with Lift Actors.




> This
> is a feature which complicates the implementation considerably, and
> that's what all our main results are about. You might not care about
> this particular feature in your code, and consequently you might
> choose a different abstraction. But calling that abstraction simply
> `actors' causes unnecessary confusion, in our opinion.


Quoting from Wikipedia :

An actor is a computational entity that, in response to a message it
receives, can concurrently:


   - send a finite number of messages to other actors;
  - create a finite number of new actors;
  - designate the behavior to be used for the next message it receives.

Lift Actors do all of these things.

I think it's a great thing that Philipp and the EPFL team intr

[Lift] JSONParse.parse and List[Any]

2009-10-01 Thread Peter Robinett

Hi all,

Building off of a previous thread[1], I'm trying to parse a POST
request that contains JSON data. Specifically, I expect a JSON array
of JSON objects representing Packet model data and want to have a List
[Packet] at the end.

I am trying the following:
val packets = for {
JSONPackets <- req.param("packets")
packet <- JSONParser.parse(JSONPackets)
nodeId <- packet.param("node")
node <- nodeId.toLong
} yield {
val packet = Packet.create.node(node)
packet.save
packet
}

The problem is that JSONParser.parse returns a List[Any], so packet is
of type Any. I can try to convert packet to a Map with
packet.asInstanceOf[Map[String, String]], but this seems to just push
my type problems to the next line of code. I'm having a hard time
getting to the point where I have the Map[String, String] from which I
know I can extract values to create Packets, so I would appreciate
suggestions on how to do this.

This all seems quite complicated and I wonder if I'm missing an easier
way to do this. Is JSONParse the way to go, or should I switch to
Joni's lift-json stuff? I'm using 1.1-M5 but would be willing to
switch to 1.1-SNAPSHOT...

Thanks for your help.

Peter Robinett

[1] 
http://groups.google.com/group/liftweb/browse_thread/thread/5ffe64492b0c19f2/c65424467bc99bbb
[2] http://groups.google.com/group/liftweb/msg/c0103375623f788f
--~--~-~--~~~---~--~~
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: Javascript Commands

2009-10-01 Thread sunanda


Thanks Derek.
But I get the following errors:
found : net.liftweb.http.js.JE.Call
required: java.lang.String
x= JE.Call("foo",2)
^
C:\J\BrandNET\eclipse_workspace\GridXml_Lift2.0\src\main\scala\net
\irisinteractive\lift\grid\snippet\CreateGridConfigTable.scala:47:
error: value CrVar is not a member of object
net.liftweb.http.js.JsCmds
JsCmds.CrVar("myVar", JE.Call("foo", 2))


On Oct 2, 12:07 am, Derek Chen-Becker  wrote:
> If you have a javascript function "foo(a, b)" where "a" is a String and "b"
> is an integer then you can call that with
>
> JE.Call("foo", "one", 2)
>
> for example. If you wanted to set some variable to the result of the
> function, you could do:
>
> JsCmds.CrVar("myVar", JE.Call("foo", "one", 2))
>
> Derek
>
>
>
> On Wed, Sep 30, 2009 at 6:17 PM, sunanda  wrote:
>
> > Hi David,
> > Thanks for your prompt reply.
> > As a beginner I have started reading the book "Exploring Lift".
>
> > It says
>
> > "If you need to write large portions of JavaScript code for your
> > pages, we recommend writing that code in
> > pure JavaScript in an external file and then including that file in
> > your pages. In particular, if you write your code as JavaScript
> > functions, you can use the JE.Call class to execute those functions
> > from your Lift code."
>
> > I just want to know how can I use JE.Call function fro my external
> > javascript file and also how to use JE abstractions like (JsFunc,
> > ValById etc..)
>
> > Could you please provide a simple example so that my understanding
> > will be clear.
>
> > Thanks
> > Sunanda
>
> > On Oct 1, 9:56 am, David Pollak  wrote:
> > > Seehttp://demo.liftweb.net/ajax
> > > Specifically:
>
> > > var cnt = 0    def doClicker(text: NodeSeq) =
> > >     a(() => {cnt = cnt + 1; SetHtml(spanName, Text( cnt.toString))},
> > text)
>
> > > It increments a counter.
>
> > > On Wed, Sep 30, 2009 at 4:50 PM, sunanda 
> > wrote:
>
> > > > Hi,
> > > > I am totally new to lift framework.
> > > > Can any one give me a simple example of how to call a function form a
> > > > javascript file and store the results
> > > > in  scala variable.
>
> > > > Thanks.
>
> > > --
> > > 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- Hide quoted text -
>
> - Show quoted text -

--~--~-~--~~~---~--~~
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] JsonResponse and Constructing a JsArray

2009-10-01 Thread Peter Robinett

Hi all, I'm getting the following error and I think I'm missing
something very simple:
error: type mismatch;
 found   : List[net.liftweb.http.js.JsExp]
 required: net.liftweb.http.js.JsExp
JsonResponse(JsObj("results" -> JsArray(packets.map(_.asJs

I'm trying to transform packets, a List[mymodels.Packet], into a
simple object to be sent in a JsonResponse. As I understand it,
JsArray has a contructor that takes a List[JsExp] but the compile
error suggests that it doesn't. Is this constructor only in SNAPSHOT,
not 1.1-M5? In case it's relevant, here are my relevant package
imports:
import _root_.net.liftweb.http.js._
import JsCmds._
import JE._

I'm using Lift 1.1-M5 and Scala 2.7.5. Any help is appreciated.
Thanks!

Peter Robinett
--~--~-~--~~~---~--~~
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: Testing snippets that depend on a user logged in

2009-10-01 Thread David Pollak
On Thu, Oct 1, 2009 at 3:03 PM, rstradling  wrote:

>
> Awesome!!! Thanks guys for the help.  It now works.
>
> I put a how-to wiki document up on github.  For me this was one of
> those times where my google searches did not seem to turn up anything
> fruitful, so I thought this how-to would be helpful.  If it is not
> helpful, then no hard feelings if the page is deleted.  I just wanted
> to give back.
>

You did *the right thing*.  I owe you a beer (or other food or beverage of
your choice)!


>
> Wiki page
>
> http://wiki.github.com/dpp/liftweb/how-to-unit-test-lift-snippets-with-a-logged-in-user
>
>
>
>
> On Oct 1, 4:53 pm, David Pollak  wrote:
> > Bill,
> > Thanks for posting this.  I am, by experience (I started using it, I can
> use
> > it enough to write basic tests, I know no more) using Specs.  I would
> > welcome and encourage some sample tests in Lift archetypes that use
> > ScalaTest.  I want to make sure that folks who pick up Lift get to
> > experience ScalaTest as well as Specs... that way, folks who have a
> better
> > understanding of tests can make better choices.
> >
> > Thanks,
> >
> > David
> >
> >
> >
> > On Thu, Oct 1, 2009 at 1:27 PM, Bill Venners  wrote:
> >
> > > Hi Ryan,
> >
> > > It looks like you're currently using a JUnit TestCase. If you want an
> > > easier port to something that would work you could use a ScalaTest
> > > Suite like this:
> >
> > > import org.scalatest.Suite
> >
> > > class YourSuite extends Suite {
> >
> > >  val session = new LiftSession("", randomString(20), Empty)
> > >  val stableTime = now
> >
> > >   override def withFixture(test: NoArgTest) {
> >
> > >S.initIfUninitted(session) {
> > >   val user = User.create
> > >  user.firstName("XXX")
> > >  user.lastName("YYY")
> > >  user.save
> > >  User.logUserIn(user)
> > >   test()
> > > }
> > >  }
> >
> > >  def testValue() {
> > >   val xml =
> > >   
> > > 
> > > 
> > > My Name
> > > 
> > > 
> > > Fighter Style
> > > 
> > > 
> > > Weight
> > > 
> > > 
> > >   
> > >val trainer = new Trainer()
> > >val output = trainer.showPeople(xml)
> > > // seems like you need an assertion here...
> > >  }
> > > }
> >
> > > A Suite considers methods that start with "test" as tests, like JUnit
> > > 3, except they don't need to result in Unit so you don't need an extra
> > > () at the end. The withFixture method is an alternative to
> > > beforeEach/afterEach, which are like JUnit 3's setUp/tearDown methods.
> > > Each test gets passed as a function to withFixture, which is
> > > responsible for executing the test by invoking the function. In this
> > > case, it is executed in the context created by S. initIfUninitted.
> > > This is ScalaTest 1.0, which is available as a SNAPSHOT right now but
> > > should be released proper a week from Monday.
> >
> > >http://www.artima.com/scalatest
> >
> > > Bill
> >
> > > On Thu, Oct 1, 2009 at 9:50 AM, David Pollak
> > >  wrote:
> > > > Using Specs 1.6:
> >
> > > > object HelloWorldTestSpecs extends Specification {
> > > >   val session = new LiftSession("", randomString(20), Empty)
> > > >   val stableTime = now
> > > >   override def executeExpectations(ex: Examples, t: =>Any): Any = {
> > > > S.initIfUninitted(session) {
> > > >   ... put your User init here.  The User.logUserIn will be within
> the
> > > > context of a session and thus session (and request) vars will be
> valid
> > > > }
> > > >   }
> > > >   "HelloWorld Snippet" should {
> > > > "Put the time in the node" in {
> > > >   ... do testing here
> > > > }
> > > >   }
> > > > }
> >
> > > > Hope this helps.
> > > > On Thu, Oct 1, 2009 at 8:55 AM, rstradling 
> > > wrote:
> >
> > > >> I have a class called
> > > >> class Trainer {
> > > >>   def showPeople(xhtml : Group) : NodeSeq = {
> > > >>  val user : User = User.currentUser.open_!
> > > >>  ...
> > > >>   }
> > > >> }
> >
> > > >> I then want to write a unit test to test that returns proper xml.
> >
> > > >> The test is written as so
> > > >>  def testValue() = {
> > > >>val xml =
> > > >>
> > > >>  
> > > >>  
> > > >>  My Name
> > > >>  
> > > >>  
> > > >>  Fighter Style
> > > >>  
> > > >>  
> > > >>  Weight
> > > >>  
> > > >>  
> > > >>
> > > >>val trainer = new Trainer()
> > > >>val output = trainer.showPeople(xml)
> > > >>()
> > > >>  }
> >
> > > >> The User object inherits from MegaProtoUser.
> >
> > > >> The problem is I am not sure how to create a mock user and sign them
> > > >> in.
> > > >> I have tried in my unit test
> > > >> override def setUp : Unit = {
> > > >>   val user = User.create
> > > >>   user.firstName("XXX")
> > > >>   user.lastName("YYY")
> > > >>   use

[Lift] Re: Testing snippets that depend on a user logged in

2009-10-01 Thread rstradling

Awesome!!! Thanks guys for the help.  It now works.

I put a how-to wiki document up on github.  For me this was one of
those times where my google searches did not seem to turn up anything
fruitful, so I thought this how-to would be helpful.  If it is not
helpful, then no hard feelings if the page is deleted.  I just wanted
to give back.

Wiki page
http://wiki.github.com/dpp/liftweb/how-to-unit-test-lift-snippets-with-a-logged-in-user




On Oct 1, 4:53 pm, David Pollak  wrote:
> Bill,
> Thanks for posting this.  I am, by experience (I started using it, I can use
> it enough to write basic tests, I know no more) using Specs.  I would
> welcome and encourage some sample tests in Lift archetypes that use
> ScalaTest.  I want to make sure that folks who pick up Lift get to
> experience ScalaTest as well as Specs... that way, folks who have a better
> understanding of tests can make better choices.
>
> Thanks,
>
> David
>
>
>
> On Thu, Oct 1, 2009 at 1:27 PM, Bill Venners  wrote:
>
> > Hi Ryan,
>
> > It looks like you're currently using a JUnit TestCase. If you want an
> > easier port to something that would work you could use a ScalaTest
> > Suite like this:
>
> > import org.scalatest.Suite
>
> > class YourSuite extends Suite {
>
> >  val session = new LiftSession("", randomString(20), Empty)
> >  val stableTime = now
>
> >   override def withFixture(test: NoArgTest) {
>
> >    S.initIfUninitted(session) {
> >       val user = User.create
> >      user.firstName("XXX")
> >      user.lastName("YYY")
> >      user.save
> >      User.logUserIn(user)
> >       test()
> >     }
> >  }
>
> >  def testValue() {
> >   val xml =
> >       
> >         
> >             
> >                 My Name
> >             
> >             
> >                 Fighter Style
> >             
> >             
> >                 Weight
> >             
> >         
> >       
> >    val trainer = new Trainer()
> >    val output = trainer.showPeople(xml)
> >     // seems like you need an assertion here...
> >  }
> > }
>
> > A Suite considers methods that start with "test" as tests, like JUnit
> > 3, except they don't need to result in Unit so you don't need an extra
> > () at the end. The withFixture method is an alternative to
> > beforeEach/afterEach, which are like JUnit 3's setUp/tearDown methods.
> > Each test gets passed as a function to withFixture, which is
> > responsible for executing the test by invoking the function. In this
> > case, it is executed in the context created by S. initIfUninitted.
> > This is ScalaTest 1.0, which is available as a SNAPSHOT right now but
> > should be released proper a week from Monday.
>
> >http://www.artima.com/scalatest
>
> > Bill
>
> > On Thu, Oct 1, 2009 at 9:50 AM, David Pollak
> >  wrote:
> > > Using Specs 1.6:
>
> > > object HelloWorldTestSpecs extends Specification {
> > >   val session = new LiftSession("", randomString(20), Empty)
> > >   val stableTime = now
> > >   override def executeExpectations(ex: Examples, t: =>Any): Any = {
> > >     S.initIfUninitted(session) {
> > >       ... put your User init here.  The User.logUserIn will be within the
> > > context of a session and thus session (and request) vars will be valid
> > >     }
> > >   }
> > >   "HelloWorld Snippet" should {
> > >     "Put the time in the node" in {
> > >       ... do testing here
> > >     }
> > >   }
> > > }
>
> > > Hope this helps.
> > > On Thu, Oct 1, 2009 at 8:55 AM, rstradling 
> > wrote:
>
> > >> I have a class called
> > >> class Trainer {
> > >>   def showPeople(xhtml : Group) : NodeSeq = {
> > >>      val user : User = User.currentUser.open_!
> > >>      ...
> > >>   }
> > >> }
>
> > >> I then want to write a unit test to test that returns proper xml.
>
> > >> The test is written as so
> > >>  def testValue() = {
> > >>    val xml =
> > >>        
> > >>          
> > >>              
> > >>                  My Name
> > >>              
> > >>              
> > >>                  Fighter Style
> > >>              
> > >>              
> > >>                  Weight
> > >>              
> > >>          
> > >>        
> > >>    val trainer = new Trainer()
> > >>    val output = trainer.showPeople(xml)
> > >>    ()
> > >>  }
>
> > >> The User object inherits from MegaProtoUser.
>
> > >> The problem is I am not sure how to create a mock user and sign them
> > >> in.
> > >> I have tried in my unit test
> > >> override def setUp : Unit = {
> > >>   val user = User.create
> > >>   user.firstName("XXX")
> > >>   user.lastName("YYY")
> > >>   user.save
> > >>   User.logUserIn(user)
> > >> }
>
> > >> The mock user log-in *seems* to work fine but when
> > >> User.currentUser.open_! is called it throws an exception on trying to
> > >> open an empty box.
>
> > >> So either how do I do this or how do others do this type of testing.
> > >> I am sure I am missing something simple.
>
> > >> Thanks,
> > >> ryan
>
> > > --
> > > Lift, the simply functional web frameworkhttp://liftweb.net
> > > Beginning Scalah

[Lift] Re: Started integrating lift in a scala+spring project. Feedback?

2009-10-01 Thread rintcius

Hmm, isn't there a direct way to get the ServletContext? I mean now
that I think about it looks to me that it should be possible to obtain
the ServletContext no matter if there's a session or not.
--~--~-~--~~~---~--~~
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: Testing snippets that depend on a user logged in

2009-10-01 Thread David Pollak
Bill,
Cool.  If you're going to be at Silicon Valley Code Camp on Saturday, let's
talk more about any mechanics.

Thanks,

David

On Thu, Oct 1, 2009 at 2:26 PM, Bill Venners  wrote:

>
> Hi David,
>
> Thanks. I appreciate that. I was actually already planning to request
> getting some ScalaTest examples in the Lift archetypes right after
> ScalaTest 1.0 comes out (on Oct 12, if all goes as planned), and have
> already arranged with David Bernard to put ScalaTest examples into
> simple-archetype-simple.
>
> I think it is great that we have three decent Scala-specific testing
> tools already, specs, ScalaTest, and ScalaCheck, plus the trusty Java
> tools JUnit and TestNG. People have a lot of choice, so it is good
> that the archetypes would show some of the options. I would also
> suggest we include a ScalaCheck example in the archetypes as well. I
> can use ScalaCheck from one of the ScalaTest examples I submit if you
> like that idea. The downside is that it would add one more dependency,
> but really I think people should find out about ScalaCheck.
>
> Bill
>
>
> On Thu, Oct 1, 2009 at 1:53 PM, David Pollak
>  wrote:
> > Bill,
> > Thanks for posting this.  I am, by experience (I started using it, I can
> use
> > it enough to write basic tests, I know no more) using Specs.  I would
> > welcome and encourage some sample tests in Lift archetypes that use
> > ScalaTest.  I want to make sure that folks who pick up Lift get to
> > experience ScalaTest as well as Specs... that way, folks who have a
> better
> > understanding of tests can make better choices.
> > Thanks,
> > David
> >
> > On Thu, Oct 1, 2009 at 1:27 PM, Bill Venners  wrote:
> >>
> >> Hi Ryan,
> >>
> >> It looks like you're currently using a JUnit TestCase. If you want an
> >> easier port to something that would work you could use a ScalaTest
> >> Suite like this:
> >>
> >> import org.scalatest.Suite
> >>
> >> class YourSuite extends Suite {
> >>
> >>  val session = new LiftSession("", randomString(20), Empty)
> >>  val stableTime = now
> >>
> >>  override def withFixture(test: NoArgTest) {
> >>
> >>S.initIfUninitted(session) {
> >>  val user = User.create
> >>  user.firstName("XXX")
> >>  user.lastName("YYY")
> >>  user.save
> >>  User.logUserIn(user)
> >>  test()
> >>}
> >>  }
> >>
> >>  def testValue() {
> >>   val xml =
> >>   
> >> 
> >> 
> >> My Name
> >> 
> >> 
> >> Fighter Style
> >> 
> >> 
> >> Weight
> >> 
> >> 
> >>   
> >>val trainer = new Trainer()
> >>val output = trainer.showPeople(xml)
> >>// seems like you need an assertion here...
> >>  }
> >> }
> >>
> >> A Suite considers methods that start with "test" as tests, like JUnit
> >> 3, except they don't need to result in Unit so you don't need an extra
> >> () at the end. The withFixture method is an alternative to
> >> beforeEach/afterEach, which are like JUnit 3's setUp/tearDown methods.
> >> Each test gets passed as a function to withFixture, which is
> >> responsible for executing the test by invoking the function. In this
> >> case, it is executed in the context created by S. initIfUninitted.
> >> This is ScalaTest 1.0, which is available as a SNAPSHOT right now but
> >> should be released proper a week from Monday.
> >>
> >> http://www.artima.com/scalatest
> >>
> >> Bill
> >>
> >> On Thu, Oct 1, 2009 at 9:50 AM, David Pollak
> >>  wrote:
> >> > Using Specs 1.6:
> >> >
> >> > object HelloWorldTestSpecs extends Specification {
> >> >   val session = new LiftSession("", randomString(20), Empty)
> >> >   val stableTime = now
> >> >   override def executeExpectations(ex: Examples, t: =>Any): Any = {
> >> > S.initIfUninitted(session) {
> >> >   ... put your User init here.  The User.logUserIn will be within
> >> > the
> >> > context of a session and thus session (and request) vars will be valid
> >> > }
> >> >   }
> >> >   "HelloWorld Snippet" should {
> >> > "Put the time in the node" in {
> >> >   ... do testing here
> >> > }
> >> >   }
> >> > }
> >> >
> >> > Hope this helps.
> >> > On Thu, Oct 1, 2009 at 8:55 AM, rstradling 
> >> > wrote:
> >> >>
> >> >> I have a class called
> >> >> class Trainer {
> >> >>   def showPeople(xhtml : Group) : NodeSeq = {
> >> >>  val user : User = User.currentUser.open_!
> >> >>  ...
> >> >>   }
> >> >> }
> >> >>
> >> >> I then want to write a unit test to test that returns proper xml.
> >> >>
> >> >> The test is written as so
> >> >>  def testValue() = {
> >> >>val xml =
> >> >>
> >> >>  
> >> >>  
> >> >>  My Name
> >> >>  
> >> >>  
> >> >>  Fighter Style
> >> >>  
> >> >>  
> >> >>  Weight
> >> >>  
> >> >>  
> >> >>
> >> >>val trainer = new Trainer()
> >> >>val outp

[Lift] Re: Testing snippets that depend on a user logged in

2009-10-01 Thread Bill Venners

Hi David,

Thanks. I appreciate that. I was actually already planning to request
getting some ScalaTest examples in the Lift archetypes right after
ScalaTest 1.0 comes out (on Oct 12, if all goes as planned), and have
already arranged with David Bernard to put ScalaTest examples into
simple-archetype-simple.

I think it is great that we have three decent Scala-specific testing
tools already, specs, ScalaTest, and ScalaCheck, plus the trusty Java
tools JUnit and TestNG. People have a lot of choice, so it is good
that the archetypes would show some of the options. I would also
suggest we include a ScalaCheck example in the archetypes as well. I
can use ScalaCheck from one of the ScalaTest examples I submit if you
like that idea. The downside is that it would add one more dependency,
but really I think people should find out about ScalaCheck.

Bill


On Thu, Oct 1, 2009 at 1:53 PM, David Pollak
 wrote:
> Bill,
> Thanks for posting this.  I am, by experience (I started using it, I can use
> it enough to write basic tests, I know no more) using Specs.  I would
> welcome and encourage some sample tests in Lift archetypes that use
> ScalaTest.  I want to make sure that folks who pick up Lift get to
> experience ScalaTest as well as Specs... that way, folks who have a better
> understanding of tests can make better choices.
> Thanks,
> David
>
> On Thu, Oct 1, 2009 at 1:27 PM, Bill Venners  wrote:
>>
>> Hi Ryan,
>>
>> It looks like you're currently using a JUnit TestCase. If you want an
>> easier port to something that would work you could use a ScalaTest
>> Suite like this:
>>
>> import org.scalatest.Suite
>>
>> class YourSuite extends Suite {
>>
>>  val session = new LiftSession("", randomString(20), Empty)
>>  val stableTime = now
>>
>>  override def withFixture(test: NoArgTest) {
>>
>>    S.initIfUninitted(session) {
>>      val user = User.create
>>      user.firstName("XXX")
>>      user.lastName("YYY")
>>      user.save
>>      User.logUserIn(user)
>>      test()
>>    }
>>  }
>>
>>  def testValue() {
>>   val xml =
>>       
>>         
>>             
>>                 My Name
>>             
>>             
>>                 Fighter Style
>>             
>>             
>>                 Weight
>>             
>>         
>>       
>>    val trainer = new Trainer()
>>    val output = trainer.showPeople(xml)
>>    // seems like you need an assertion here...
>>  }
>> }
>>
>> A Suite considers methods that start with "test" as tests, like JUnit
>> 3, except they don't need to result in Unit so you don't need an extra
>> () at the end. The withFixture method is an alternative to
>> beforeEach/afterEach, which are like JUnit 3's setUp/tearDown methods.
>> Each test gets passed as a function to withFixture, which is
>> responsible for executing the test by invoking the function. In this
>> case, it is executed in the context created by S. initIfUninitted.
>> This is ScalaTest 1.0, which is available as a SNAPSHOT right now but
>> should be released proper a week from Monday.
>>
>> http://www.artima.com/scalatest
>>
>> Bill
>>
>> On Thu, Oct 1, 2009 at 9:50 AM, David Pollak
>>  wrote:
>> > Using Specs 1.6:
>> >
>> > object HelloWorldTestSpecs extends Specification {
>> >   val session = new LiftSession("", randomString(20), Empty)
>> >   val stableTime = now
>> >   override def executeExpectations(ex: Examples, t: =>Any): Any = {
>> >     S.initIfUninitted(session) {
>> >       ... put your User init here.  The User.logUserIn will be within
>> > the
>> > context of a session and thus session (and request) vars will be valid
>> >     }
>> >   }
>> >   "HelloWorld Snippet" should {
>> >     "Put the time in the node" in {
>> >       ... do testing here
>> >     }
>> >   }
>> > }
>> >
>> > Hope this helps.
>> > On Thu, Oct 1, 2009 at 8:55 AM, rstradling 
>> > wrote:
>> >>
>> >> I have a class called
>> >> class Trainer {
>> >>   def showPeople(xhtml : Group) : NodeSeq = {
>> >>      val user : User = User.currentUser.open_!
>> >>      ...
>> >>   }
>> >> }
>> >>
>> >> I then want to write a unit test to test that returns proper xml.
>> >>
>> >> The test is written as so
>> >>  def testValue() = {
>> >>    val xml =
>> >>        
>> >>          
>> >>              
>> >>                  My Name
>> >>              
>> >>              
>> >>                  Fighter Style
>> >>              
>> >>              
>> >>                  Weight
>> >>              
>> >>          
>> >>        
>> >>    val trainer = new Trainer()
>> >>    val output = trainer.showPeople(xml)
>> >>    ()
>> >>  }
>> >>
>> >> The User object inherits from MegaProtoUser.
>> >>
>> >> The problem is I am not sure how to create a mock user and sign them
>> >> in.
>> >> I have tried in my unit test
>> >> override def setUp : Unit = {
>> >>   val user = User.create
>> >>   user.firstName("XXX")
>> >>   user.lastName("YYY")
>> >>   user.save
>> >>   User.logUserIn(user)
>> >> }
>> >>
>> >> The mock user log-in *seems* to work fine but when
>

[Lift] Re: Testing snippets that depend on a user logged in

2009-10-01 Thread David Pollak
Bill,
Thanks for posting this.  I am, by experience (I started using it, I can use
it enough to write basic tests, I know no more) using Specs.  I would
welcome and encourage some sample tests in Lift archetypes that use
ScalaTest.  I want to make sure that folks who pick up Lift get to
experience ScalaTest as well as Specs... that way, folks who have a better
understanding of tests can make better choices.

Thanks,

David

On Thu, Oct 1, 2009 at 1:27 PM, Bill Venners  wrote:

>
> Hi Ryan,
>
> It looks like you're currently using a JUnit TestCase. If you want an
> easier port to something that would work you could use a ScalaTest
> Suite like this:
>
> import org.scalatest.Suite
>
> class YourSuite extends Suite {
>
>  val session = new LiftSession("", randomString(20), Empty)
>  val stableTime = now
>
>   override def withFixture(test: NoArgTest) {
>
>S.initIfUninitted(session) {
>   val user = User.create
>  user.firstName("XXX")
>  user.lastName("YYY")
>  user.save
>  User.logUserIn(user)
>   test()
> }
>  }
>
>  def testValue() {
>   val xml =
>   
> 
> 
> My Name
> 
> 
> Fighter Style
> 
> 
> Weight
> 
> 
>   
>val trainer = new Trainer()
>val output = trainer.showPeople(xml)
> // seems like you need an assertion here...
>  }
> }
>
> A Suite considers methods that start with "test" as tests, like JUnit
> 3, except they don't need to result in Unit so you don't need an extra
> () at the end. The withFixture method is an alternative to
> beforeEach/afterEach, which are like JUnit 3's setUp/tearDown methods.
> Each test gets passed as a function to withFixture, which is
> responsible for executing the test by invoking the function. In this
> case, it is executed in the context created by S. initIfUninitted.
> This is ScalaTest 1.0, which is available as a SNAPSHOT right now but
> should be released proper a week from Monday.
>
> http://www.artima.com/scalatest
>
> Bill
>
> On Thu, Oct 1, 2009 at 9:50 AM, David Pollak
>  wrote:
> > Using Specs 1.6:
> >
> > object HelloWorldTestSpecs extends Specification {
> >   val session = new LiftSession("", randomString(20), Empty)
> >   val stableTime = now
> >   override def executeExpectations(ex: Examples, t: =>Any): Any = {
> > S.initIfUninitted(session) {
> >   ... put your User init here.  The User.logUserIn will be within the
> > context of a session and thus session (and request) vars will be valid
> > }
> >   }
> >   "HelloWorld Snippet" should {
> > "Put the time in the node" in {
> >   ... do testing here
> > }
> >   }
> > }
> >
> > Hope this helps.
> > On Thu, Oct 1, 2009 at 8:55 AM, rstradling 
> wrote:
> >>
> >> I have a class called
> >> class Trainer {
> >>   def showPeople(xhtml : Group) : NodeSeq = {
> >>  val user : User = User.currentUser.open_!
> >>  ...
> >>   }
> >> }
> >>
> >> I then want to write a unit test to test that returns proper xml.
> >>
> >> The test is written as so
> >>  def testValue() = {
> >>val xml =
> >>
> >>  
> >>  
> >>  My Name
> >>  
> >>  
> >>  Fighter Style
> >>  
> >>  
> >>  Weight
> >>  
> >>  
> >>
> >>val trainer = new Trainer()
> >>val output = trainer.showPeople(xml)
> >>()
> >>  }
> >>
> >> The User object inherits from MegaProtoUser.
> >>
> >> The problem is I am not sure how to create a mock user and sign them
> >> in.
> >> I have tried in my unit test
> >> override def setUp : Unit = {
> >>   val user = User.create
> >>   user.firstName("XXX")
> >>   user.lastName("YYY")
> >>   user.save
> >>   User.logUserIn(user)
> >> }
> >>
> >> The mock user log-in *seems* to work fine but when
> >> User.currentUser.open_! is called it throws an exception on trying to
> >> open an empty box.
> >>
> >> So either how do I do this or how do others do this type of testing.
> >> I am sure I am missing something simple.
> >>
> >> Thanks,
> >> ryan
> >>
> >>
> >>
> >>
> >>
> >>
> >
> >
> >
> > --
> > Lift, the simply functional web framework http://liftweb.net
> > Beginning Scala http://www.apress.com/book/view/1430219890
> > Follow me: http://twitter.com/dpp
> > Surf the harmonics
> >
> > >
> >
>
>
>
> --
> Bill Venners
> Artima, Inc.
> http://www.artima.com
>
> >
>


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

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, v

[Lift] Re: Testing snippets that depend on a user logged in

2009-10-01 Thread Bill Venners

Hi Ryan,

It looks like you're currently using a JUnit TestCase. If you want an
easier port to something that would work you could use a ScalaTest
Suite like this:

import org.scalatest.Suite

class YourSuite extends Suite {

  val session = new LiftSession("", randomString(20), Empty)
  val stableTime = now

  override def withFixture(test: NoArgTest) {

S.initIfUninitted(session) {
  val user = User.create
  user.firstName("XXX")
  user.lastName("YYY")
  user.save
  User.logUserIn(user)
  test()
}
  }

 def testValue() {
   val xml =
   
 
 
 My Name
 
 
 Fighter Style
 
 
 Weight
 
 
   
val trainer = new Trainer()
val output = trainer.showPeople(xml)
// seems like you need an assertion here...
  }
}

A Suite considers methods that start with "test" as tests, like JUnit
3, except they don't need to result in Unit so you don't need an extra
() at the end. The withFixture method is an alternative to
beforeEach/afterEach, which are like JUnit 3's setUp/tearDown methods.
Each test gets passed as a function to withFixture, which is
responsible for executing the test by invoking the function. In this
case, it is executed in the context created by S. initIfUninitted.
This is ScalaTest 1.0, which is available as a SNAPSHOT right now but
should be released proper a week from Monday.

http://www.artima.com/scalatest

Bill

On Thu, Oct 1, 2009 at 9:50 AM, David Pollak
 wrote:
> Using Specs 1.6:
>
> object HelloWorldTestSpecs extends Specification {
>   val session = new LiftSession("", randomString(20), Empty)
>   val stableTime = now
>   override def executeExpectations(ex: Examples, t: =>Any): Any = {
>     S.initIfUninitted(session) {
>       ... put your User init here.  The User.logUserIn will be within the
> context of a session and thus session (and request) vars will be valid
>     }
>   }
>   "HelloWorld Snippet" should {
>     "Put the time in the node" in {
>       ... do testing here
>     }
>   }
> }
>
> Hope this helps.
> On Thu, Oct 1, 2009 at 8:55 AM, rstradling  wrote:
>>
>> I have a class called
>> class Trainer {
>>   def showPeople(xhtml : Group) : NodeSeq = {
>>      val user : User = User.currentUser.open_!
>>      ...
>>   }
>> }
>>
>> I then want to write a unit test to test that returns proper xml.
>>
>> The test is written as so
>>  def testValue() = {
>>    val xml =
>>        
>>          
>>              
>>                  My Name
>>              
>>              
>>                  Fighter Style
>>              
>>              
>>                  Weight
>>              
>>          
>>        
>>    val trainer = new Trainer()
>>    val output = trainer.showPeople(xml)
>>    ()
>>  }
>>
>> The User object inherits from MegaProtoUser.
>>
>> The problem is I am not sure how to create a mock user and sign them
>> in.
>> I have tried in my unit test
>> override def setUp : Unit = {
>>   val user = User.create
>>   user.firstName("XXX")
>>   user.lastName("YYY")
>>   user.save
>>   User.logUserIn(user)
>> }
>>
>> The mock user log-in *seems* to work fine but when
>> User.currentUser.open_! is called it throws an exception on trying to
>> open an empty box.
>>
>> So either how do I do this or how do others do this type of testing.
>> I am sure I am missing something simple.
>>
>> Thanks,
>> ryan
>>
>>
>>
>>
>>
>>
>
>
>
> --
> Lift, the simply functional web framework http://liftweb.net
> Beginning Scala http://www.apress.com/book/view/1430219890
> Follow me: http://twitter.com/dpp
> Surf the harmonics
>
> >
>



-- 
Bill Venners
Artima, Inc.
http://www.artima.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: Unwarranted dependencies in lift-record

2009-10-01 Thread David Pollak
On Tue, Sep 29, 2009 at 2:42 AM, Timothy Perrett wrote:

>
> Guys,
>
> I just noticed that lift-record depends on lift-webket because of some
> calls to S... IMHO, we need to remove this because thats simply too
> tight a coupling between the webkit and an abstract persistence
> interface like record.
>
> For instance, one record abstraction I wrote isn't even used in
> webapps...
>
> Thoughts?
>

One of my criteria for a Record class is that it must be able to translate
itself to/from HTML forms (as well as XML and JSON).  If you can find a way
for Record to play nicely with HTML form generation in with lift-webkit and
without it, cool.  I'm all for it.


>
> Cheers, Tim
> >
>


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

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to 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: Testing snippets that depend on a user logged in

2009-10-01 Thread David Pollak
Using Specs 1.6:

object HelloWorldTestSpecs extends Specification {  val session = new
LiftSession("", randomString(20), Empty)
  val stableTime = now

  override def executeExpectations(ex: Examples, t: =>Any): Any = {
S.initIfUninitted(session) {
  ... put your User init here.  The User.logUserIn will be within the
context of a session and thus session (and request) vars will be valid
}
  }

  "HelloWorld Snippet" should {
"Put the time in the node" in {
  ... do testing here
}
  }
}


Hope this helps.

On Thu, Oct 1, 2009 at 8:55 AM, rstradling  wrote:

>
> I have a class called
> class Trainer {
>   def showPeople(xhtml : Group) : NodeSeq = {
>  val user : User = User.currentUser.open_!
>  ...
>   }
> }
>
> I then want to write a unit test to test that returns proper xml.
>
> The test is written as so
>  def testValue() = {
>val xml =
>
>  
>  
>  My Name
>  
>  
>  Fighter Style
>  
>  
>  Weight
>  
>  
>
>val trainer = new Trainer()
>val output = trainer.showPeople(xml)
>()
>  }
>
> The User object inherits from MegaProtoUser.
>
> The problem is I am not sure how to create a mock user and sign them
> in.
> I have tried in my unit test
> override def setUp : Unit = {
>   val user = User.create
>   user.firstName("XXX")
>   user.lastName("YYY")
>   user.save
>   User.logUserIn(user)
> }
>
> The mock user log-in *seems* to work fine but when
> User.currentUser.open_! is called it throws an exception on trying to
> open an empty box.
>
> So either how do I do this or how do others do this type of testing.
> I am sure I am missing something simple.
>
> Thanks,
> ryan
>
>
>
>
>
> >
>


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

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to 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: Started integrating lift in a scala+spring project. Feedback?

2009-10-01 Thread David Pollak
On Thu, Oct 1, 2009 at 9:18 AM, rintcius  wrote:

>
> Ok thanks David. What is the recommended way to get the ServletContext
> from a lift snippet (in 1.0.2)?
>

Use the for comprehension to test if a Box is empty or not.

See
http://blog.lostlake.org/index.php?/archives/50-The-Scala-Option-class-and-how-lift-uses-it.html(for
the current purpose, Option and Box have the same purpose)


>
> Rintcius
>
> >
>


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

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to 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: Started integrating lift in a scala+spring project. Feedback?

2009-10-01 Thread rintcius

Ok thanks David. What is the recommended way to get the ServletContext
from a lift snippet (in 1.0.2)?

Rintcius

--~--~-~--~~~---~--~~
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: Concurrent Web Service Requests?

2009-10-01 Thread David Pollak
Marius,
I have a ton of respect for your opinion and I appreciate your analysis.

I have been following this thread and thinking, "what does the lift: prefix
mean?"  In my mind, it means "this thing will be changed based on evaluating
some code."  So, using the lift: prefix for something that also means "this
modifies the meaning of this snippet invocation" presents
something discordant to me.

With that being said, I'm going to hand the decision to you.  I trust your
decisions and have concerns about my own instincts when it comes to naming.

Please update the code to reflect what you think it should be and merge it
into master.

Thanks,

David

On Thu, Oct 1, 2009 at 5:58 AM, marius d.  wrote:

>
> Well I said what I had to say. My problem is not really the prefix
> name but the existence of other prefixes then lift, that are
> interpreted by lift. It's just how I see things now and nothing on
> this thread provided sufficient arguments to convince me
> otherwise ...
>
> not much else for me to do if majority and especially DPP thinks
> otherwise. It is what it is I guess.
>
> Br's,
> Marius
>
> On Oct 1, 4:18 am, Naftoli Gugenheim  wrote:
> > I think everyone agrees in concept, that an arbitrary prefix sets a bad
> precendent, which is why it is no longer do:par. But on the other hand, if
> the part after "lift:" is either a reserved word or a "user" word--a snippet
> name--then the more reserved words, the more you limit snippet names.
> (Should S.mapSnippet("parallel", ...) throw an exception?)
> > So we have these two considerations on either end of the spectrum.
> Arguably, "liftx" as a prefix satisfies both--it is sufficiently generic to
> include almost any "special" attribute that may be added, it clearly spells
> out "extended lift attribute," and on the other hand it keeps reserved lift
> attributes separate from the user's snippet namespace.
> > Now let's bear in mind that this is all only relevant in the future, when
> lift: attributes indeed will be interpreted as lift:snippet="..." is now. At
> that point it might make sense for the explicit :snippet format to be moved
> to the liftx prefix-- liftx:snippet="..." --for the same reason, not to
> encroach on the snippet namespace.
> >
> > -
> >
> > marius d. wrote:
> >
> > It has been debated many times in slightly different contexts. To me
> > it is more about clarity. We add a new prefix now, tomorrow add
> > another one and so on. People would have to remember what goes where
> > and  mix things up. To me lift prefix is enough and quite clear. It is
> > more than just s snippet thingy. It tells the user "hey this thing is
> > telling the framework something and the framework is doing something
> > with it". It is separating framework xml markup from the actual xhtml
> > markup. Having a single reserved prefix promotes clarity and keeps
> > things simple and rather intuitive.
> >
> > I'm not in favor of using unprefixed attributes like
> > par="something" (btw I really don't like par naming :) ...) because
> > unprefixed attributes should be only standard xhtml ones or the ones
> > that user explicitly specifies it. So lift:parallel="true" or
> > lift:async="true" should be just fine.
> >
> > Br's,
> > Marius
> >
> > On Sep 30, 8:05 pm, Naftoli Gugenheim  wrote:
> >
> > > Could you elaborate on why adding a new prefix may not be a good idea?
> And is it better or worse than having it unprefixed?
> >
> > > -
> >
> > > marius d. wrote:
> >
> > > On Sep 30, 8:23 am, Kevin Wright 
> > > wrote:
> >
> > > > I thought there were issues here because anything starting lift: gets
> > > > executed as a snippet.
> >
> > > Correct BUT lift:par or lift:parallel attributes are also applicable
> > > to snippets context. They determine the snippet's execution semantics.
> > > So I'm still questioning the need for a new prefix.
> >
> > > > I'm still for an eval: prefix, as these proposals all relate to how a
> > > > page is evaluated.
> >
> > > > On Wed, Sep 30, 2009 at 5:34 AM, marius d. 
> wrote:
> >
> > > > > lift is already a "reserved" prefix for snippets. So I'd stay with
> > > > > simply lift prefix for these attributes as well.
> >
> > > > > Br's,
> > > > > Marius
> >
> > > > > On Sep 29, 11:11 pm, Naftoli Gugenheim 
> wrote:
> > > > >> So what is your proposal? Am I interpreting you correctly that you
> are for a prefix of 'lift'? And it will be a reserved suffix?
> >
> > > > >> -
> >
> > > > >> marius d. wrote:
> >
> > > > >> I realize that I may be a little late here but I do have second
> > > > >> thoughts about liftx prefix. Yeah, I'm not a big fan of it. I
> > > > >> understand that these attributes are not really snippets or built
> is
> > > > >> snippets but is this an enough reason to introduce a new prefix?
> > > > >> Personally I don't think so. Historically lift reserved prefix
> names
> > > > >> were heavily debated and argued and t

[Lift] Testing snippets that depend on a user logged in

2009-10-01 Thread rstradling

I have a class called
class Trainer {
   def showPeople(xhtml : Group) : NodeSeq = {
  val user : User = User.currentUser.open_!
  ...
   }
}

I then want to write a unit test to test that returns proper xml.

The test is written as so
  def testValue() = {
val xml =

  
  
  My Name
  
  
  Fighter Style
  
  
  Weight
  
  

val trainer = new Trainer()
val output = trainer.showPeople(xml)
()
  }

The User object inherits from MegaProtoUser.

The problem is I am not sure how to create a mock user and sign them
in.
I have tried in my unit test
override def setUp : Unit = {
   val user = User.create
   user.firstName("XXX")
   user.lastName("YYY")
   user.save
   User.logUserIn(user)
}

The mock user log-in *seems* to work fine but when
User.currentUser.open_! is called it throws an exception on trying to
open an empty box.

So either how do I do this or how do others do this type of testing.
I am sure I am missing something simple.

Thanks,
ryan





--~--~-~--~~~---~--~~
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: Started integrating lift in a scala+spring project. Feedback?

2009-10-01 Thread rintcius

Hi Tim,

This project is meant as an example for people (like me) that maintain
existing Spring architectures and are interested in using Scala and
Lift.
What I want to do now is port the existing jsp's and spring
controllers to lift, so that people can compare jsp and lift-webkit
with each other (and probably favor lift :) ).
Currently I have just looked at the easiest way to integrate Lift and
Spring (that is using the LiftFilter and access Spring's
ApplicationContext), but I am also interested in other ways to
integrate them (at a later stage).

Rintcius

--~--~-~--~~~---~--~~
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: Help with using JSExp and JsCmd traits

2009-10-01 Thread glenn

David,

This is off topic, but you always are a help. Your
thoughtful assistance on this discussion group either directly
resolves issues I'm
having with Lift, or leads me to rethink my strategy and explore new
avenues
I haven't thought of. At the very least, you force me to reframe many
of my
questions, so they can be answered.

Many times, I've thought of abandoning Lift for "safer" harbors, but
the help
from you and all on this group brings me back to the fold. I've still
got lots to
learn.

Glenn

On Oct 1, 8:29 am, David Pollak  wrote:
> On Thu, Oct 1, 2009 at 8:25 AM, glenn  wrote:
>
> > David,
>
> > Excellent. This is exactly what I was looking for.
>
> Wow.  I think this is the first time I've actually helped you.  I'm sorry
> I'm bad at understanding what you ask for.
>
> More broadly, the JavaScript stuff in Lift is not magic.  It's just a bunch
> of simple JavaScript that I and some of the other committers have used over
> time.  I encourage the creation of your own JsCmd and JsExp components that
> suit your project... and maybe even share them with the community.
>
>
>
>
>
> > Thanks.
>
> > Glenn
>
> > On Sep 30, 4:54 pm, David Pollak 
> > wrote:
> > > JqHtml and JqEmptyAfter eagerly evaluate the NodeSeq on the server, so
> > > there's no way to get client-side JS execution in a NodeSeq.
> > > You can write something like:
>
> > > object MyJqText {
> > >     def apply(content: JsExp) = new JsExp with JQueryRight with
> > JQueryLeft {
> > >       def toJsCmd = "text("+content.toJsCmd+")"
> > >     }
> > >   }
>
> > > So:
>
> > > JqId("item-save") >> MyJqText(JsVar("this", "id") + " has changed")
>
> > > On Wed, Sep 30, 2009 at 2:05 PM, glenn  wrote:
>
> > > > As I mentioned, I was looking for a way to translate this JavaScript
>
> > > > $('#item-save').html(this.id + ' was toggled')
>
> > > > into a JsCmd so I could coded it my snipped as AnonFunc(some jsCmd).
>
> > > > I know I can just use JsRaw, but who in their right mind wants to
> > > > write JavaScript
> > > > if it can be avoided.
>
> > > > Glenn
>
> > > > On Sep 30, 1:20 pm, David Pollak 
> > > > wrote:
> > > > > On Wed, Sep 30, 2009 at 1:08 PM, glenn  wrote:
>
> > > > > > David,
>
> > > > > > The problem with writting the NodeSeq as {this.id} was
> > toggled > > > > > div>)
> > > > > > is that it generates the following JavaScript:
>
> > > > > > function() {jQuery('#'+"item-save").empty().after("-1 was
> > > > > > toggled");
>
> > > > > > that is, Lift evaluates {this.id} in relation to the snippet, then
> > > > > > outputs the value
> > > > > > in the JavaScript - not the result I'm after.
>
> > > > > What are you after?  What is "this" in the context?
>
> > > > > > Glenn...
>
> > > > > > On Sep 30, 11:41 am, David Pollak 
> > > > > > wrote:
> > > > > > > On Wed, Sep 30, 2009 at 11:36 AM, glenn 
> > wrote:
>
> > > > > > > > David,
>
> > > > > > > > I can't do this, AnonFunc(JqId("item-save") >> JqEmptyAfter
> > > > > > > > (this.id was
> > > > > > > > > toggled)) , if that's what you mean.
>
> > > > > > > That's not what I wrote.  Please look again at the curly braces
> > > > around
> > > > > > the
> > > > > > > this.id:
>
> > > > > > > AnonFunc(JqId("item-save") >> JqEmptyAfter({this.id}
> > > > > > > was toggled))
>
> > > > > > > > This generates the following JavaScript:
>
> > > > > > > > function()
> > {jQuery('#'+"item-save").empty().after("this.idwas
> > > > > > > > toggled");
>
> > > > > > > > and that won't do. What's needed is something more akin to:
>
> > > > > > > > function() {jQuery('#'+"item-save").empty().after("" +
> > > > this.id +
> > > > > > > > "was toggled");
>
> > > > > > > > So, I guess my question is how do I define a NodeSeq to
> > accomplish
> > > > > > > > this?
>
> > > > > > > > Glenn
>
> > > > > > > > On Sep 30, 10:40 am, David Pollak <
> > feeder.of.the.be...@gmail.com>
> > > > > > > > wrote:
> > > > > > > > > On Tue, Sep 29, 2009 at 1:22 PM, glenn 
> > wrote:
>
> > > > > > > > > > I'd like to converting the following
>
> > > > > > > > > > JsRaw("""function() $('#item-save').html(this.id + ' was
> > > > > > > > > > toggled')""")
>
> > > > > > > > > > into something more object-oriented, using JQuery support
> > > > functions
> > > > > > in
> > > > > > > > > > Lift.
>
> > > > > > > > > > I've tried various combiniations, including this
>
> > > > > > > > > > AnonFunc(JqId("item-save") >> JqEmptyAfter({JsRaw(
> > this.id
> > > > )}
> > > > > > was
> > > > > > > > > > toggled))
>
> > > > > > > > > AnonFunc(JqId("item-save") >> JqEmptyAfter({this.id}
> > was
> > > > > > > > > toggled))
>
> > > > > > > > > No reason to promote this.id into some JavaScript thing.
> >  It's
> > > > part
> > > > > > of
> > > > > > > > the
> > > > > > > > > XML literal.  The XML literal is generated server-side as
> > part of
> > > > the
> > > > > > > > > JavaScript function.
>
> > > > > > > > > > but nothing seems to work. It just treats this.id as
> > ordinary
> > > > > > text,
> > > > > > > > > > not as a Javascript variable.

[Lift] Re: JE Abstractions

2009-10-01 Thread Derek Chen-Becker
See my reply to your other post. If that's not clear, please let me know.

Derek

On Wed, Sep 30, 2009 at 7:57 PM, sunanda  wrote:

>
> Hi,
> Can any one provide a simple example to explain how to use JE
> abstractions (Call,JsFunc) in lift code . I am new to  Lift Framework
>
> 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: Started integrating lift in a scala+spring project. Feedback?

2009-10-01 Thread David Pollak
A quick look at the code... you use open_!  That's considered very bad
practice.  Any time you use open_!, you are saying "I know this thing
contains a value."  It's like not doing null testing when the method you are
calling is expected to return a null under certain circumstance.
Put another way, the "!" is in the name for a reason.  It's dangerous...
think before using.

On Thu, Oct 1, 2009 at 2:14 AM, rintcius  wrote:

>
> Hi,
>
> I have started integrating Lift in a Scala + Spring example project
> (see http://code.google.com/p/scala-spring). This first integration
> just has a single template and snippet for now but should give an idea
> how Lift can be integrated.
> Before I go further with this I would like some Lift experts to review
> the code I have written so far.
> Anybody? The changeset that adds lift integration is in
> http://code.google.com/p/scala-spring/source/detail?r=18
>
> Thanks, Rintcius
>
> >
>


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

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to 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: Help with using JSExp and JsCmd traits

2009-10-01 Thread David Pollak
On Thu, Oct 1, 2009 at 8:25 AM, glenn  wrote:

>
> David,
>
> Excellent. This is exactly what I was looking for.
>

Wow.  I think this is the first time I've actually helped you.  I'm sorry
I'm bad at understanding what you ask for.

More broadly, the JavaScript stuff in Lift is not magic.  It's just a bunch
of simple JavaScript that I and some of the other committers have used over
time.  I encourage the creation of your own JsCmd and JsExp components that
suit your project... and maybe even share them with the community.


>
> Thanks.
>
> Glenn
>
> On Sep 30, 4:54 pm, David Pollak 
> wrote:
> > JqHtml and JqEmptyAfter eagerly evaluate the NodeSeq on the server, so
> > there's no way to get client-side JS execution in a NodeSeq.
> > You can write something like:
> >
> > object MyJqText {
> > def apply(content: JsExp) = new JsExp with JQueryRight with
> JQueryLeft {
> >   def toJsCmd = "text("+content.toJsCmd+")"
> > }
> >   }
> >
> > So:
> >
> > JqId("item-save") >> MyJqText(JsVar("this", "id") + " has changed")
> >
> >
> >
> > On Wed, Sep 30, 2009 at 2:05 PM, glenn  wrote:
> >
> > > As I mentioned, I was looking for a way to translate this JavaScript
> >
> > > $('#item-save').html(this.id + ' was toggled')
> >
> > > into a JsCmd so I could coded it my snipped as AnonFunc(some jsCmd).
> >
> > > I know I can just use JsRaw, but who in their right mind wants to
> > > write JavaScript
> > > if it can be avoided.
> >
> > > Glenn
> >
> > > On Sep 30, 1:20 pm, David Pollak 
> > > wrote:
> > > > On Wed, Sep 30, 2009 at 1:08 PM, glenn  wrote:
> >
> > > > > David,
> >
> > > > > The problem with writting the NodeSeq as {this.id} was
> toggled > > > > div>)
> > > > > is that it generates the following JavaScript:
> >
> > > > > function() {jQuery('#'+"item-save").empty().after("-1 was
> > > > > toggled");
> >
> > > > > that is, Lift evaluates {this.id} in relation to the snippet, then
> > > > > outputs the value
> > > > > in the JavaScript - not the result I'm after.
> >
> > > > What are you after?  What is "this" in the context?
> >
> > > > > Glenn...
> >
> > > > > On Sep 30, 11:41 am, David Pollak 
> > > > > wrote:
> > > > > > On Wed, Sep 30, 2009 at 11:36 AM, glenn 
> wrote:
> >
> > > > > > > David,
> >
> > > > > > > I can't do this, AnonFunc(JqId("item-save") >> JqEmptyAfter
> > > > > > > (this.id was
> > > > > > > > toggled)) , if that's what you mean.
> >
> > > > > > That's not what I wrote.  Please look again at the curly braces
> > > around
> > > > > the
> > > > > > this.id:
> >
> > > > > > AnonFunc(JqId("item-save") >> JqEmptyAfter({this.id}
> > > > > > was toggled))
> >
> > > > > > > This generates the following JavaScript:
> >
> > > > > > > function()
> {jQuery('#'+"item-save").empty().after("this.idwas
> > > > > > > toggled");
> >
> > > > > > > and that won't do. What's needed is something more akin to:
> >
> > > > > > > function() {jQuery('#'+"item-save").empty().after("" +
> > > this.id +
> > > > > > > "was toggled");
> >
> > > > > > > So, I guess my question is how do I define a NodeSeq to
> accomplish
> > > > > > > this?
> >
> > > > > > > Glenn
> >
> > > > > > > On Sep 30, 10:40 am, David Pollak <
> feeder.of.the.be...@gmail.com>
> > > > > > > wrote:
> > > > > > > > On Tue, Sep 29, 2009 at 1:22 PM, glenn 
> wrote:
> >
> > > > > > > > > I'd like to converting the following
> >
> > > > > > > > > JsRaw("""function() $('#item-save').html(this.id + ' was
> > > > > > > > > toggled')""")
> >
> > > > > > > > > into something more object-oriented, using JQuery support
> > > functions
> > > > > in
> > > > > > > > > Lift.
> >
> > > > > > > > > I've tried various combiniations, including this
> >
> > > > > > > > > AnonFunc(JqId("item-save") >> JqEmptyAfter({JsRaw(
> this.id
> > > )}
> > > > > was
> > > > > > > > > toggled))
> >
> > > > > > > > AnonFunc(JqId("item-save") >> JqEmptyAfter({this.id}
> was
> > > > > > > > toggled))
> >
> > > > > > > > No reason to promote this.id into some JavaScript thing.
>  It's
> > > part
> > > > > of
> > > > > > > the
> > > > > > > > XML literal.  The XML literal is generated server-side as
> part of
> > > the
> > > > > > > > JavaScript function.
> >
> > > > > > > > > but nothing seems to work. It just treats this.id as
> ordinary
> > > > > text,
> > > > > > > > > not as a Javascript variable.
> >
> > > > > > > > > Any ideas would be appreciated.
> >
> > > > > > > > > Glenn
> >
> > > > > > > > --
> > > > > > > > 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
> >
> > > > > > --
> > > > > > 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
> >
> > > > --
> > > > Lift, the simply functional web frameworkhttp://liftweb.net
> > > > Beginning Scalahttp:

[Lift] Re: Help with using JSExp and JsCmd traits

2009-10-01 Thread glenn

David,

Excellent. This is exactly what I was looking for.

Thanks.

Glenn

On Sep 30, 4:54 pm, David Pollak 
wrote:
> JqHtml and JqEmptyAfter eagerly evaluate the NodeSeq on the server, so
> there's no way to get client-side JS execution in a NodeSeq.
> You can write something like:
>
> object MyJqText {
>     def apply(content: JsExp) = new JsExp with JQueryRight with JQueryLeft {
>       def toJsCmd = "text("+content.toJsCmd+")"
>     }
>   }
>
> So:
>
> JqId("item-save") >> MyJqText(JsVar("this", "id") + " has changed")
>
>
>
> On Wed, Sep 30, 2009 at 2:05 PM, glenn  wrote:
>
> > As I mentioned, I was looking for a way to translate this JavaScript
>
> > $('#item-save').html(this.id + ' was toggled')
>
> > into a JsCmd so I could coded it my snipped as AnonFunc(some jsCmd).
>
> > I know I can just use JsRaw, but who in their right mind wants to
> > write JavaScript
> > if it can be avoided.
>
> > Glenn
>
> > On Sep 30, 1:20 pm, David Pollak 
> > wrote:
> > > On Wed, Sep 30, 2009 at 1:08 PM, glenn  wrote:
>
> > > > David,
>
> > > > The problem with writting the NodeSeq as {this.id} was toggled > > > div>)
> > > > is that it generates the following JavaScript:
>
> > > > function() {jQuery('#'+"item-save").empty().after("-1 was
> > > > toggled");
>
> > > > that is, Lift evaluates {this.id} in relation to the snippet, then
> > > > outputs the value
> > > > in the JavaScript - not the result I'm after.
>
> > > What are you after?  What is "this" in the context?
>
> > > > Glenn...
>
> > > > On Sep 30, 11:41 am, David Pollak 
> > > > wrote:
> > > > > On Wed, Sep 30, 2009 at 11:36 AM, glenn  wrote:
>
> > > > > > David,
>
> > > > > > I can't do this, AnonFunc(JqId("item-save") >> JqEmptyAfter
> > > > > > (this.id was
> > > > > > > toggled)) , if that's what you mean.
>
> > > > > That's not what I wrote.  Please look again at the curly braces
> > around
> > > > the
> > > > > this.id:
>
> > > > > AnonFunc(JqId("item-save") >> JqEmptyAfter({this.id}
> > > > > was toggled))
>
> > > > > > This generates the following JavaScript:
>
> > > > > > function() {jQuery('#'+"item-save").empty().after("this.idwas
> > > > > > toggled");
>
> > > > > > and that won't do. What's needed is something more akin to:
>
> > > > > > function() {jQuery('#'+"item-save").empty().after("" +
> > this.id +
> > > > > > "was toggled");
>
> > > > > > So, I guess my question is how do I define a NodeSeq to accomplish
> > > > > > this?
>
> > > > > > Glenn
>
> > > > > > On Sep 30, 10:40 am, David Pollak 
> > > > > > wrote:
> > > > > > > On Tue, Sep 29, 2009 at 1:22 PM, glenn  wrote:
>
> > > > > > > > I'd like to converting the following
>
> > > > > > > > JsRaw("""function() $('#item-save').html(this.id + ' was
> > > > > > > > toggled')""")
>
> > > > > > > > into something more object-oriented, using JQuery support
> > functions
> > > > in
> > > > > > > > Lift.
>
> > > > > > > > I've tried various combiniations, including this
>
> > > > > > > > AnonFunc(JqId("item-save") >> JqEmptyAfter({JsRaw(this.id
> > )}
> > > > was
> > > > > > > > toggled))
>
> > > > > > > AnonFunc(JqId("item-save") >> JqEmptyAfter({this.id} was
> > > > > > > toggled))
>
> > > > > > > No reason to promote this.id into some JavaScript thing.  It's
> > part
> > > > of
> > > > > > the
> > > > > > > XML literal.  The XML literal is generated server-side as part of
> > the
> > > > > > > JavaScript function.
>
> > > > > > > > but nothing seems to work. It just treats this.id as ordinary
> > > > text,
> > > > > > > > not as a Javascript variable.
>
> > > > > > > > Any ideas would be appreciated.
>
> > > > > > > > Glenn
>
> > > > > > > --
> > > > > > > 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
>
> > > > > --
> > > > > 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
>
> > > --
> > > 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
>
> --
> 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: CometActor timeout problem

2009-10-01 Thread David Pollak
Thanks!

On Thu, Oct 1, 2009 at 1:11 AM, Atsuhiko Yamanaka <
atsuhiko.yaman...@gmail.com> wrote:

> Hi,
>
> On Thu, Oct 1, 2009 at 1:11 PM, Jack Widman  wrote:
> > David,
> > I have attached a (non) working example. It compiles and runs and does a
> > part of what I want it to do but not completely. It first displays a
> couple
> > of links and the link body for both links is just 0. It then spawns a
> couple
> > of threads each of which generates a random number and then   puts two
> Page
> > objects on a PageQueue. The comet page is supposed to reRender the screen
> > whenever a new page object is added to the Queue. Before it does this it
> > calls a method called insertRandomNumber which changes the zero to some
> > random value.
> > There is not much code and i think its pretty self-explanatory. The html
> > page is test.html.
> > I really do appreciate your help and understand if you can't go through
> the
> > whole thing.
>
> Frankly to say, I could not understand the internal logic, and it
> seems it has be broken,
> but attached modified src.zip will work as the demonstration of
> CometActor at least.
>  * JoopComet implements CometListenee
>  * TSGetterLauncer has been rewritten, and will start TSGetters in
> every 3 seconds.
>The previous version has really short life.
>  * TSCatcher implements ListenerManager.
>  * url links on the web page will be updated in every 3 seconds.
>
>
> 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
> Skype callto://jcraft/
>
> >
>


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

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to 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: CometActor timeout problem

2009-10-01 Thread Jack Widman
Thanks so much Atsuhiko. You are very kind.

On Thu, Oct 1, 2009 at 11:01 AM, Atsuhiko Yamanaka <
atsuhiko.yaman...@gmail.com> wrote:

> Hi,
>
> On Thu, Oct 1, 2009 at 9:42 PM, Jack Widman  wrote:
> > Atsuhiko,
> > How would I make one small change? I would like each link to refresh only
> > once and I would like that to happen as soon as the TSCatcher objects
> catch
> > a package. Thanks in advance.
>
> How about the attached src.zip?
> It will refresh each links only "once".
> A package will be sent from JoopComet#localSetup and
> that method will be invoked only once during the life of JoopComet.
> This means that even if you leave test.html page and re-vist there,
> that method will not be invoked again.
>
>
> 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
> 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: Javascript Commands

2009-10-01 Thread Derek Chen-Becker
If you have a javascript function "foo(a, b)" where "a" is a String and "b"
is an integer then you can call that with

JE.Call("foo", "one", 2)

for example. If you wanted to set some variable to the result of the
function, you could do:

JsCmds.CrVar("myVar", JE.Call("foo", "one", 2))



Derek

On Wed, Sep 30, 2009 at 6:17 PM, sunanda  wrote:

>
> Hi David,
> Thanks for your prompt reply.
> As a beginner I have started reading the book "Exploring Lift".
>
> It says
>
> "If you need to write large portions of JavaScript code for your
> pages, we recommend writing that code in
> pure JavaScript in an external file and then including that file in
> your pages. In particular, if you write your code as JavaScript
> functions, you can use the JE.Call class to execute those functions
> from your Lift code."
>
> I just want to know how can I use JE.Call function fro my external
> javascript file and also how to use JE abstractions like (JsFunc,
> ValById etc..)
>
> Could you please provide a simple example so that my understanding
> will be clear.
>
> Thanks
> Sunanda
>
> On Oct 1, 9:56 am, David Pollak  wrote:
> > Seehttp://demo.liftweb.net/ajax
> > Specifically:
> >
> > var cnt = 0def doClicker(text: NodeSeq) =
> > a(() => {cnt = cnt + 1; SetHtml(spanName, Text( cnt.toString))},
> text)
> >
> > It increments a counter.
> >
> > On Wed, Sep 30, 2009 at 4:50 PM, sunanda 
> wrote:
> >
> > > Hi,
> > > I am totally new to lift framework.
> > > Can any one give me a simple example of how to call a function form a
> > > javascript file and store the results
> > > in  scala variable.
> >
> > > Thanks.
> >
> > --
> > 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: Started integrating lift in a scala+spring project. Feedback?

2009-10-01 Thread Timothy Perrett

Rintcius,

Whilst I applaud the effort, what is your goal with integrating the  
two frameworks? What problem are you looking to solve?

Cheers, Tim

On 1 Oct 2009, at 10:14, rintcius wrote:

>
> Hi,
>
> I have started integrating Lift in a Scala + Spring example project
> (see http://code.google.com/p/scala-spring). This first integration
> just has a single template and snippet for now but should give an idea
> how Lift can be integrated.
> Before I go further with this I would like some Lift experts to review
> the code I have written so far.
> Anybody? The changeset that adds lift integration is in
> http://code.google.com/p/scala-spring/source/detail?r=18
>
> Thanks, Rintcius
>
> >
>


--~--~-~--~~~---~--~~
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: Concurrent Web Service Requests?

2009-10-01 Thread marius d.

Well I said what I had to say. My problem is not really the prefix
name but the existence of other prefixes then lift, that are
interpreted by lift. It's just how I see things now and nothing on
this thread provided sufficient arguments to convince me
otherwise ...

not much else for me to do if majority and especially DPP thinks
otherwise. It is what it is I guess.

Br's,
Marius

On Oct 1, 4:18 am, Naftoli Gugenheim  wrote:
> I think everyone agrees in concept, that an arbitrary prefix sets a bad 
> precendent, which is why it is no longer do:par. But on the other hand, if 
> the part after "lift:" is either a reserved word or a "user" word--a snippet 
> name--then the more reserved words, the more you limit snippet names. (Should 
> S.mapSnippet("parallel", ...) throw an exception?)
> So we have these two considerations on either end of the spectrum. Arguably, 
> "liftx" as a prefix satisfies both--it is sufficiently generic to include 
> almost any "special" attribute that may be added, it clearly spells out 
> "extended lift attribute," and on the other hand it keeps reserved lift 
> attributes separate from the user's snippet namespace.
> Now let's bear in mind that this is all only relevant in the future, when 
> lift: attributes indeed will be interpreted as lift:snippet="..." is now. At 
> that point it might make sense for the explicit :snippet format to be moved 
> to the liftx prefix-- liftx:snippet="..." --for the same reason, not to 
> encroach on the snippet namespace.
>
> -
>
> marius d. wrote:
>
> It has been debated many times in slightly different contexts. To me
> it is more about clarity. We add a new prefix now, tomorrow add
> another one and so on. People would have to remember what goes where
> and  mix things up. To me lift prefix is enough and quite clear. It is
> more than just s snippet thingy. It tells the user "hey this thing is
> telling the framework something and the framework is doing something
> with it". It is separating framework xml markup from the actual xhtml
> markup. Having a single reserved prefix promotes clarity and keeps
> things simple and rather intuitive.
>
> I'm not in favor of using unprefixed attributes like
> par="something" (btw I really don't like par naming :) ...) because
> unprefixed attributes should be only standard xhtml ones or the ones
> that user explicitly specifies it. So lift:parallel="true" or
> lift:async="true" should be just fine.
>
> Br's,
> Marius
>
> On Sep 30, 8:05 pm, Naftoli Gugenheim  wrote:
>
> > Could you elaborate on why adding a new prefix may not be a good idea? And 
> > is it better or worse than having it unprefixed?
>
> > -
>
> > marius d. wrote:
>
> > On Sep 30, 8:23 am, Kevin Wright 
> > wrote:
>
> > > I thought there were issues here because anything starting lift: gets
> > > executed as a snippet.
>
> > Correct BUT lift:par or lift:parallel attributes are also applicable
> > to snippets context. They determine the snippet's execution semantics.
> > So I'm still questioning the need for a new prefix.
>
> > > I'm still for an eval: prefix, as these proposals all relate to how a
> > > page is evaluated.
>
> > > On Wed, Sep 30, 2009 at 5:34 AM, marius d.  
> > > wrote:
>
> > > > lift is already a "reserved" prefix for snippets. So I'd stay with
> > > > simply lift prefix for these attributes as well.
>
> > > > Br's,
> > > > Marius
>
> > > > On Sep 29, 11:11 pm, Naftoli Gugenheim  wrote:
> > > >> So what is your proposal? Am I interpreting you correctly that you are 
> > > >> for a prefix of 'lift'? And it will be a reserved suffix?
>
> > > >> -
>
> > > >> marius d. wrote:
>
> > > >> I realize that I may be a little late here but I do have second
> > > >> thoughts about liftx prefix. Yeah, I'm not a big fan of it. I
> > > >> understand that these attributes are not really snippets or built is
> > > >> snippets but is this an enough reason to introduce a new prefix?
> > > >> Personally I don't think so. Historically lift reserved prefix names
> > > >> were heavily debated and argued and this is a little sensitive area.
>
> > > >> But the good news is that I may be the only one feeling this way about
> > > >> this and everyone else likes it so I'm just a negligible minority.
>
> > > >> Br's,
> > > >> Marius
>
> > > >> On Sep 25, 12:02 pm, David Pollak 
> > > >> wrote:
>
> > > >> > On Thu, Sep 24, 2009 at 11:33 AM, Naftoli Gugenheim 
> > > >> > wrote:
>
> > > >> > > If you like the idea of having them all as attributes but don't 
> > > >> > > like the
> > > >> > > idea of using a single attribute ('xx:eager_eval="true" 
> > > >> > > xx:parallel="true"'
> > > >> > > rather than 'xx:eval="eager parallel"' as I suggested, where xx is 
> > > >> > > the
> > > >> > > prefix to be chosen) then maybe the prefix should be 'eval'.
>
> > > >> > I've changed the code to:
> > > >> > liftx:eager_eval="true"
> > > >> > liftx:par="true

[Lift] Started integrating lift in a scala+spring project. Feedback?

2009-10-01 Thread rintcius

Hi,

I have started integrating Lift in a Scala + Spring example project
(see http://code.google.com/p/scala-spring). This first integration
just has a single template and snippet for now but should give an idea
how Lift can be integrated.
Before I go further with this I would like some Lift experts to review
the code I have written so far.
Anybody? The changeset that adds lift integration is in
http://code.google.com/p/scala-spring/source/detail?r=18

Thanks, Rintcius

--~--~-~--~~~---~--~~
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: CometActor timeout problem

2009-10-01 Thread Jack Widman
Atsuhiko,
How would I make one small change? I would like each link to refresh only
once and I would like that to happen as soon as the TSCatcher objects catch
a package. Thanks in advance.

Jack

On Thu, Oct 1, 2009 at 4:11 AM, Atsuhiko Yamanaka <
atsuhiko.yaman...@gmail.com> wrote:

> Hi,
>
> On Thu, Oct 1, 2009 at 1:11 PM, Jack Widman  wrote:
> > David,
> > I have attached a (non) working example. It compiles and runs and does a
> > part of what I want it to do but not completely. It first displays a
> couple
> > of links and the link body for both links is just 0. It then spawns a
> couple
> > of threads each of which generates a random number and then   puts two
> Page
> > objects on a PageQueue. The comet page is supposed to reRender the screen
> > whenever a new page object is added to the Queue. Before it does this it
> > calls a method called insertRandomNumber which changes the zero to some
> > random value.
> > There is not much code and i think its pretty self-explanatory. The html
> > page is test.html.
> > I really do appreciate your help and understand if you can't go through
> the
> > whole thing.
>
> Frankly to say, I could not understand the internal logic, and it
> seems it has be broken,
> but attached modified src.zip will work as the demonstration of
> CometActor at least.
>  * JoopComet implements CometListenee
>  * TSGetterLauncer has been rewritten, and will start TSGetters in
> every 3 seconds.
>The previous version has really short life.
>  * TSCatcher implements ListenerManager.
>  * url links on the web page will be updated in every 3 seconds.
>
>
> 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
> 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: json extraction problem

2009-10-01 Thread Lincoln
Cool, thanks Joni.  I'll give it a try.

On Thu, Oct 1, 2009 at 2:36 AM, Joni Freeman  wrote:

>
> Hi,
>
> I pasted this to scala console and it worked. I am pretty sure that
> the problem is that your case classes are inner classes. Inner classes
> get one extra implicit constructor parameter, a reference to the outer
> class (same way as in Java). You need to move those case classes away
> from enclosing class (to an object or package etc.).
>
> The error message is very bad in this case. I will fix it.
>
> Cheers Joni
>
> On Oct 1, 7:49 am, Lincoln  wrote:
> > Hi, I've been playing around with lift-json and I keep running into basic
> > problems.  I'm hoping someone can point out my mistake.
> > I'm using "net.liftweb" % "lift-json" % "1.1-M5"
> >
> > Here's the code I'm trying to run:
> >
> > implicit val formats = net.liftweb.json.DefaultFormats
> > case class Name(first: String, last: String)
> > case class User(name: Name, email: String)
> > import net.liftweb.json.JsonParser._
> > val u = {
> > import JsonDSL._
> > ("name" ->
> > ("first" -> "Lincoln") ~
> > ("last" -> "Hochberg")
> > ) ~
> > ("email" -> "linxbet...@gmail.com")}
> >
> > val json = JsonDSL.pretty(JsonAST.render(u))
> > val jsonAST = JsonParser.parse(json)
> > val user = jsonAST.extract[User]
> >
> > This blows up with the following exception:
> >
> > net.liftweb.json.MappingException: Parsed JSON values do not match with
> > class constructor
> > args=
> > arg types=
> > constructor=public
> > pkg.TestSpec$$anonfun$1$$anonfun$apply$1(pkg.TestSpec$$anonfun$1)
> > at
> >
> net.liftweb.json.Extraction$.net$liftweb$json$Extraction$$fail(Extraction.scala:151)
> > at net.liftweb.json.Extraction$.newInstance$1(Extraction.scala:72)
> > at net.liftweb.json.Extraction$.build$1(Extraction.scala:84)
> > at net.liftweb.json.Extraction$$anonfun$1.apply(Extraction.scala:84)
> > at net.liftweb.json.Extraction$$anonfun$1.apply(Extraction.scala:84)
> > at scala.List.flatMap(List.scala:1132)
> > at net.liftweb.json.Extraction$.build$1(Extraction.scala:84)
> > at net.liftweb.json.Extraction$$anonfun$1.apply(Extraction.scala:84)
> > at net.liftweb.json.Extraction$$anonfun$1.apply(Extraction.scala:84)
> > at scala.List.flatMap(List.scala:1132)
> > at net.liftweb.json.Extraction$.build$1(Extraction.scala:84)
> > at net.liftweb.json.Extraction$.extract0(Extraction.scala:109)
> > at net.liftweb.json.Extraction$.extract(Extraction.scala:60)
> > at net.liftweb.json.JsonAST$JValue.extract(Json.scala:109)
> > at
> >
> com.hotpotato.core.ops.TestSpec$$anonfun$1$$anonfun$apply$1.apply(TestSpec.scala:48)
> > at
> >
> com.hotpotato.core.ops.TestSpec$$anonfun$1$$anonfun$apply$1.apply(TestSpec.scala:14)
> > at
> >
> org.specs.specification.ExampleExecution$$anonfun$3$$anonfun$apply$1.apply(Example.scala:207)
> > at org.specs.specification.Example.execute(Example.scala:121)
> > at
> >
> org.specs.specification.ExampleLifeCycle$class.executeTest(ExampleLifeCycle.scala:20)
> > at org.specs.Specification.executeTest(Specification.scala:28)
> > at org.specs.specification.Sus.executeTest(Sus.scala:147)
> > at
> >
> org.specs.specification.ExampleExecution$$anonfun$3.apply(Example.scala:207)
> > at
> >
> org.specs.specification.ExampleExecution$$anonfun$3.apply(Example.scala:194)
> > at
> >
> org.specs.specification.ExampleExecution$$anonfun$2.apply(Example.scala:185)
> > at org.specs.specification.ExampleExecution.execute(Example.scala:227)
> > at org.specs.specification.Example.execute(Example.scala:117)
> > at org.specs.specification.Example.errors(Example.scala:143)
> > at org.specs.specification.Sus$$anonfun$successes$1.apply(Sus.scala:122)
> > at org.specs.specification.Sus$$anonfun$successes$1.apply(Sus.scala:122)
> > at scala.List.filter(List.scala:859)
> > at org.specs.specification.Sus.successes(Sus.scala:122)
> > at
> >
> org.specs.Specification$$anonfun$successes$1.apply(Specification.scala:84)
> > at
> >
> org.specs.Specification$$anonfun$successes$1.apply(Specification.scala:84)
> > at scala.List.flatMap(List.scala:1132)
> > at org.specs.Specification.successes(Specification.scala:84)
> > at
> >
> sbt.impl.SpecsRunner.sbt$impl$SpecsRunner$$reportSpecification(TestFrameworkImpl.scala:140)
> > at sbt.impl.SpecsRunner.runTest(TestFrameworkImpl.scala:123)
> > at sbt.BasicTestRunner.run(TestFramework.scala:38)
> > at
> >
> sbt.TestFramework$$anonfun$7$$anonfun$apply$8.runTest$1(TestFramework.scala:136)
> > at
> >
> sbt.TestFramework$$anonfun$7$$anonfun$apply$8$$anonfun$apply$9.apply(TestFramework.scala:147)
> > at
> >
> sbt.TestFramework$$anonfun$7$$anonfun$apply$8$$anonfun$apply$9.apply(TestFramework.scala:147)
> > at sbt.NamedTestTask.run(TestFramework.scala:57)
> > at
> >
> sbt.ScalaProject$$anonfun$sbt$ScalaProject$$toTask$1.apply(ScalaProject.scala:167)
> > at
> >
> sbt.ScalaProject$$anonfun$sbt$ScalaProject$$toTask$1.apply(ScalaProject.scala:167)
> > at sbt.TaskManager$Task.invoke(TaskManager.scala:62)
> > at sbt.impl.RunTask.runTask(RunTask.scala:78)

[Lift] Re: CometActor timeout problem

2009-10-01 Thread Jack Widman
Thanks Atsuhiko very much. I really appreciate your effort and this helps
alot.
Jack

On Thu, Oct 1, 2009 at 4:11 AM, Atsuhiko Yamanaka <
atsuhiko.yaman...@gmail.com> wrote:

> Hi,
>
> On Thu, Oct 1, 2009 at 1:11 PM, Jack Widman  wrote:
> > David,
> > I have attached a (non) working example. It compiles and runs and does a
> > part of what I want it to do but not completely. It first displays a
> couple
> > of links and the link body for both links is just 0. It then spawns a
> couple
> > of threads each of which generates a random number and then   puts two
> Page
> > objects on a PageQueue. The comet page is supposed to reRender the screen
> > whenever a new page object is added to the Queue. Before it does this it
> > calls a method called insertRandomNumber which changes the zero to some
> > random value.
> > There is not much code and i think its pretty self-explanatory. The html
> > page is test.html.
> > I really do appreciate your help and understand if you can't go through
> the
> > whole thing.
>
> Frankly to say, I could not understand the internal logic, and it
> seems it has be broken,
> but attached modified src.zip will work as the demonstration of
> CometActor at least.
>  * JoopComet implements CometListenee
>  * TSGetterLauncer has been rewritten, and will start TSGetters in
> every 3 seconds.
>The previous version has really short life.
>  * TSCatcher implements ListenerManager.
>  * url links on the web page will be updated in every 3 seconds.
>
>
> 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
> 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
-~--~~~~--~~--~--~---