[Lift] Re: Serious widget action

2010-03-10 Thread Marius
Please see here
http://groups.google.com/group/liftweb/browse_thread/thread/5e4f5e424d33db40/32cfb6752954?lnk=gstq=ExtJs#32cfb6752954

I'd strongly encourage you to integrate ExtJs with Lift and
potentially other frameworks. Depending on JS library licence we'd be
happy to have integrations with other JS frameworks.

JsArtifacts should provide you the necessary abstractions for such
integrations but if you run into problems, please let us know.

On Mar 10, 8:27 am, Jim Barrows jim.barr...@gmail.com wrote:
 On Tue, Mar 9, 2010 at 8:45 PM, aw anth...@whitford.com wrote:
  It is time for me to add some serious widgets to my lift app.

  So far, I am most enamored by ExtJS.
  Another alternative could possibly be ZK.

  Does anybody have any experience with these frameworks?  Can you
  comment on why integrating them with Scala/Lift would be a bad idea
  (or not work)?

  I searched for some historical posts on ExtJS and discovered some
  threads about it's license and how it impacts inclusion in the lift
  framework.  Would a commercial license prohibit it from being a lift-
  widget submodule candidate?

  Does anybody have a better suggestion that you think can compete with
  ExtJS?

 I'm using ExtJS in anger at 0rk.  3.1.1 is nice.  3.0.0 is weird.  Some odd
 bugs being reported.  We're also getting some weird interactions with some
 other js libraries ( I won't mention it, it's not available anymore, and if
 it was it just leave you scarred) and CSS.  However, that's the other
 libraries fault more then ExtJS's.

 If you want something that looks and feels as close to a desktop app as you
 can get.. ExtJS can do the job well.  With Lift providing the JSON, it would
 be hard to go wrong.  That said.. ExtJS is not an easy beast to learn.  It's
 even worse to try and L10N it easily.  I would not try and use just pieces
 of it, it's really not designed to do that.  It seems to me to be an all or
 nothing approach.  That's not say you can't use it piecemeal, I think you
 lose a lot of flexibility (especially in layout) that way.

 I wouldn't use it if left to my own devices though, unless I had a
 requirement for a desktop app on the web.  It's serious overkill.

 --
 James A Barrows

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



Re: [Lift] Serious widget action

2010-03-10 Thread Timothy Perrett
Personally, I would say forget ExtJS, compared to Cappuccino its streets behind:

http://cappuccino.org/

Easily the most exciting UI framework out there right now 

Cheers, Tim

On 10 Mar 2010, at 03:45, aw wrote:

 It is time for me to add some serious widgets to my lift app.
 
 So far, I am most enamored by ExtJS.
 Another alternative could possibly be ZK.
 
 Does anybody have any experience with these frameworks?  Can you
 comment on why integrating them with Scala/Lift would be a bad idea
 (or not work)?
 
 I searched for some historical posts on ExtJS and discovered some
 threads about it's license and how it impacts inclusion in the lift
 framework.  Would a commercial license prohibit it from being a lift-
 widget submodule candidate?
 
 Does anybody have a better suggestion that you think can compete with
 ExtJS?
 
 -- 
 You received this message because you are subscribed to the Google Groups 
 Lift group.
 To post to this group, send email to lift...@googlegroups.com.
 To unsubscribe from this group, send email to 
 liftweb+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/liftweb?hl=en.
 
 

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



Re: [Lift] Re: Serious widget action

2010-03-10 Thread Indrajit Raychaudhuri
ExtCore is MIT Licensed and a candidate for JSArtifacts impl [1].
I started dabbling with an implementation of ExtCoreArtifacts sometime
back, but didn't have enough bandwidth to carry it forward.

In case somebody is willing to run with this, there is a ticket for
this already [2]

Non ExtCore are GPLed and doesn't mix conveniently. Although there are
some exceptions, I am not sure how practically that works license wise
[3].

Cheers, Indrajit

[1] http://www.extjs.com/products/extcore/
[2] http://www.assembla.com/spaces/liftweb/tickets/132
[3] http://www.extjs.com/products/floss-exception.php


On Wed, Mar 10, 2010 at 1:55 PM, Marius marius.dan...@gmail.com wrote:

 Please see here
 http://groups.google.com/group/liftweb/browse_thread/thread/5e4f5e424d33db40/32cfb6752954?lnk=gstq=ExtJs#32cfb6752954

 I'd strongly encourage you to integrate ExtJs with Lift and
 potentially other frameworks. Depending on JS library licence we'd be
 happy to have integrations with other JS frameworks.

 JsArtifacts should provide you the necessary abstractions for such
 integrations but if you run into problems, please let us know.

 On Mar 10, 8:27 am, Jim Barrows jim.barr...@gmail.com wrote:
  On Tue, Mar 9, 2010 at 8:45 PM, aw anth...@whitford.com wrote:
   It is time for me to add some serious widgets to my lift app.
 
   So far, I am most enamored by ExtJS.
   Another alternative could possibly be ZK.
 
   Does anybody have any experience with these frameworks?  Can you
   comment on why integrating them with Scala/Lift would be a bad idea
   (or not work)?
 
   I searched for some historical posts on ExtJS and discovered some
   threads about it's license and how it impacts inclusion in the lift
   framework.  Would a commercial license prohibit it from being a lift-
   widget submodule candidate?
 
   Does anybody have a better suggestion that you think can compete with
   ExtJS?
 
  I'm using ExtJS in anger at 0rk.  3.1.1 is nice.  3.0.0 is weird.  Some odd
  bugs being reported.  We're also getting some weird interactions with some
  other js libraries ( I won't mention it, it's not available anymore, and if
  it was it just leave you scarred) and CSS.  However, that's the other
  libraries fault more then ExtJS's.
 
  If you want something that looks and feels as close to a desktop app as you
  can get.. ExtJS can do the job well.  With Lift providing the JSON, it would
  be hard to go wrong.  That said.. ExtJS is not an easy beast to learn.  It's
  even worse to try and L10N it easily.  I would not try and use just pieces
  of it, it's really not designed to do that.  It seems to me to be an all or
  nothing approach.  That's not say you can't use it piecemeal, I think you
  lose a lot of flexibility (especially in layout) that way.
 
  I wouldn't use it if left to my own devices though, unless I had a
  requirement for a desktop app on the web.  It's serious overkill.
 
  --
  James A Barrows

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


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



Re: [Lift] Re: Serious widget action

2010-03-10 Thread Mads Hartmann Jensen
+1 for cappuccino 

Played around with it a while back - it's pretty amazing. 

What kind of intergration are we talking about? I wouldn't mind taking a look 
at intergrating cappuccino.

On 10/03/2010, at 10.37, Indrajit Raychaudhuri wrote:

 ExtCore is MIT Licensed and a candidate for JSArtifacts impl [1].
 I started dabbling with an implementation of ExtCoreArtifacts sometime
 back, but didn't have enough bandwidth to carry it forward.
 
 In case somebody is willing to run with this, there is a ticket for
 this already [2]
 
 Non ExtCore are GPLed and doesn't mix conveniently. Although there are
 some exceptions, I am not sure how practically that works license wise
 [3].
 
 Cheers, Indrajit
 
 [1] http://www.extjs.com/products/extcore/
 [2] http://www.assembla.com/spaces/liftweb/tickets/132
 [3] http://www.extjs.com/products/floss-exception.php
 
 
 On Wed, Mar 10, 2010 at 1:55 PM, Marius marius.dan...@gmail.com wrote:
 
 Please see here
 http://groups.google.com/group/liftweb/browse_thread/thread/5e4f5e424d33db40/32cfb6752954?lnk=gstq=ExtJs#32cfb6752954
 
 I'd strongly encourage you to integrate ExtJs with Lift and
 potentially other frameworks. Depending on JS library licence we'd be
 happy to have integrations with other JS frameworks.
 
 JsArtifacts should provide you the necessary abstractions for such
 integrations but if you run into problems, please let us know.
 
 On Mar 10, 8:27 am, Jim Barrows jim.barr...@gmail.com wrote:
 On Tue, Mar 9, 2010 at 8:45 PM, aw anth...@whitford.com wrote:
 It is time for me to add some serious widgets to my lift app.
 
 So far, I am most enamored by ExtJS.
 Another alternative could possibly be ZK.
 
 Does anybody have any experience with these frameworks?  Can you
 comment on why integrating them with Scala/Lift would be a bad idea
 (or not work)?
 
 I searched for some historical posts on ExtJS and discovered some
 threads about it's license and how it impacts inclusion in the lift
 framework.  Would a commercial license prohibit it from being a lift-
 widget submodule candidate?
 
 Does anybody have a better suggestion that you think can compete with
 ExtJS?
 
 I'm using ExtJS in anger at 0rk.  3.1.1 is nice.  3.0.0 is weird.  Some odd
 bugs being reported.  We're also getting some weird interactions with some
 other js libraries ( I won't mention it, it's not available anymore, and if
 it was it just leave you scarred) and CSS.  However, that's the other
 libraries fault more then ExtJS's.
 
 If you want something that looks and feels as close to a desktop app as you
 can get.. ExtJS can do the job well.  With Lift providing the JSON, it would
 be hard to go wrong.  That said.. ExtJS is not an easy beast to learn.  It's
 even worse to try and L10N it easily.  I would not try and use just pieces
 of it, it's really not designed to do that.  It seems to me to be an all or
 nothing approach.  That's not say you can't use it piecemeal, I think you
 lose a lot of flexibility (especially in layout) that way.
 
 I wouldn't use it if left to my own devices though, unless I had a
 requirement for a desktop app on the web.  It's serious overkill.
 
 --
 James A Barrows
 
 --
 You received this message because you are subscribed to the Google Groups 
 Lift group.
 To post to this group, send email to lift...@googlegroups.com.
 To unsubscribe from this group, send email to 
 liftweb+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/liftweb?hl=en.
 
 
 -- 
 You received this message because you are subscribed to the Google Groups 
 Lift group.
 To post to this group, send email to lift...@googlegroups.com.
 To unsubscribe from this group, send email to 
 liftweb+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/liftweb?hl=en.
 

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



Re: [Lift] Serious widget action

2010-03-10 Thread Indrajit Raychaudhuri
Most certainly, yes! Quite like what Anthony is looking for. But (a)
this is different from JSArtifacts implementation for ExtCore that we
talked about couple of times and (b) Cappuccino isn't license
compatible either (for the purpose of integration within Lift).

Anthony, fwiw, David did some stuff on this last year that could be of
some interest to you :) [1]

Cheers, Indrajit

[1] http://github.com/dpp/Frothy

On Wed, Mar 10, 2010 at 2:45 PM, Timothy Perrett
timo...@getintheloop.eu wrote:
 Personally, I would say forget ExtJS, compared to Cappuccino its streets 
 behind:

 http://cappuccino.org/

 Easily the most exciting UI framework out there right now

 Cheers, Tim

 On 10 Mar 2010, at 03:45, aw wrote:

 It is time for me to add some serious widgets to my lift app.

 So far, I am most enamored by ExtJS.
 Another alternative could possibly be ZK.

 Does anybody have any experience with these frameworks?  Can you
 comment on why integrating them with Scala/Lift would be a bad idea
 (or not work)?

 I searched for some historical posts on ExtJS and discovered some
 threads about it's license and how it impacts inclusion in the lift
 framework.  Would a commercial license prohibit it from being a lift-
 widget submodule candidate?

 Does anybody have a better suggestion that you think can compete with
 ExtJS?

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



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



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



Re: [Lift] Re: Serious widget action

2010-03-10 Thread Timothy Perrett
The only possible thing that one could do would need two aspects:

1. The lift side to produce particular JSON
2. The capp side to consume said JSON

Without a full package, there aren't really any integration points as we have 
already got comet working with capp so the only thing remaining is overall user 
implementation experience. 

Cheers, Tim

On 10 Mar 2010, at 09:40, Mads Hartmann Jensen wrote:

 +1 for cappuccino 
 
 Played around with it a while back - it's pretty amazing. 
 
 What kind of intergration are we talking about? I wouldn't mind taking a look 
 at intergrating cappuccino.
 
 On 10/03/2010, at 10.37, Indrajit Raychaudhuri wrote:
 
 ExtCore is MIT Licensed and a candidate for JSArtifacts impl [1].
 I started dabbling with an implementation of ExtCoreArtifacts sometime
 back, but didn't have enough bandwidth to carry it forward.
 
 In case somebody is willing to run with this, there is a ticket for
 this already [2]
 
 Non ExtCore are GPLed and doesn't mix conveniently. Although there are
 some exceptions, I am not sure how practically that works license wise
 [3].
 
 Cheers, Indrajit
 
 [1] http://www.extjs.com/products/extcore/
 [2] http://www.assembla.com/spaces/liftweb/tickets/132
 [3] http://www.extjs.com/products/floss-exception.php
 
 
 On Wed, Mar 10, 2010 at 1:55 PM, Marius marius.dan...@gmail.com wrote:
 
 Please see here
 http://groups.google.com/group/liftweb/browse_thread/thread/5e4f5e424d33db40/32cfb6752954?lnk=gstq=ExtJs#32cfb6752954
 
 I'd strongly encourage you to integrate ExtJs with Lift and
 potentially other frameworks. Depending on JS library licence we'd be
 happy to have integrations with other JS frameworks.
 
 JsArtifacts should provide you the necessary abstractions for such
 integrations but if you run into problems, please let us know.
 
 On Mar 10, 8:27 am, Jim Barrows jim.barr...@gmail.com wrote:
 On Tue, Mar 9, 2010 at 8:45 PM, aw anth...@whitford.com wrote:
 It is time for me to add some serious widgets to my lift app.
 
 So far, I am most enamored by ExtJS.
 Another alternative could possibly be ZK.
 
 Does anybody have any experience with these frameworks?  Can you
 comment on why integrating them with Scala/Lift would be a bad idea
 (or not work)?
 
 I searched for some historical posts on ExtJS and discovered some
 threads about it's license and how it impacts inclusion in the lift
 framework.  Would a commercial license prohibit it from being a lift-
 widget submodule candidate?
 
 Does anybody have a better suggestion that you think can compete with
 ExtJS?
 
 I'm using ExtJS in anger at 0rk.  3.1.1 is nice.  3.0.0 is weird.  Some odd
 bugs being reported.  We're also getting some weird interactions with some
 other js libraries ( I won't mention it, it's not available anymore, and if
 it was it just leave you scarred) and CSS.  However, that's the other
 libraries fault more then ExtJS's.
 
 If you want something that looks and feels as close to a desktop app as you
 can get.. ExtJS can do the job well.  With Lift providing the JSON, it 
 would
 be hard to go wrong.  That said.. ExtJS is not an easy beast to learn.  
 It's
 even worse to try and L10N it easily.  I would not try and use just pieces
 of it, it's really not designed to do that.  It seems to me to be an all or
 nothing approach.  That's not say you can't use it piecemeal, I think you
 lose a lot of flexibility (especially in layout) that way.
 
 I wouldn't use it if left to my own devices though, unless I had a
 requirement for a desktop app on the web.  It's serious overkill.
 
 --
 James A Barrows
 
 --
 You received this message because you are subscribed to the Google Groups 
 Lift group.
 To post to this group, send email to lift...@googlegroups.com.
 To unsubscribe from this group, send email to 
 liftweb+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/liftweb?hl=en.
 
 
 -- 
 You received this message because you are subscribed to the Google Groups 
 Lift group.
 To post to this group, send email to lift...@googlegroups.com.
 To unsubscribe from this group, send email to 
 liftweb+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/liftweb?hl=en.
 
 
 -- 
 You received this message because you are subscribed to the Google Groups 
 Lift group.
 To post to this group, send email to lift...@googlegroups.com.
 To unsubscribe from this group, send email to 
 liftweb+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/liftweb?hl=en.
 
 

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



Re: [Lift] Re: Serious widget action

2010-03-10 Thread Indrajit Raychaudhuri



On 10/03/10 3:21 PM, Timothy Perrett wrote:

The only possible thing that one could do would need two aspects:

1. The lift side to produce particular JSON
2. The capp side to consume said JSON

Without a full package, there aren't really any integration points as we have 
already got comet working with capp so the only thing remaining is overall user 
implementation experience.


+1 And some docs, may be.

The previous discussion thread on this: 
http://groups.google.com/group/liftweb/browse_thread/thread/41839eee55ab8e2b/de6ed5b83242ab16


Cheers, Indrajit



Cheers, Tim

On 10 Mar 2010, at 09:40, Mads Hartmann Jensen wrote:


+1 for cappuccino

Played around with it a while back - it's pretty amazing.

What kind of intergration are we talking about? I wouldn't mind taking a look 
at intergrating cappuccino.

On 10/03/2010, at 10.37, Indrajit Raychaudhuri wrote:


ExtCore is MIT Licensed and a candidate for JSArtifacts impl [1].
I started dabbling with an implementation of ExtCoreArtifacts sometime
back, but didn't have enough bandwidth to carry it forward.

In case somebody is willing to run with this, there is a ticket for
this already [2]

Non ExtCore are GPLed and doesn't mix conveniently. Although there are
some exceptions, I am not sure how practically that works license wise
[3].

Cheers, Indrajit

[1] http://www.extjs.com/products/extcore/
[2] http://www.assembla.com/spaces/liftweb/tickets/132
[3] http://www.extjs.com/products/floss-exception.php


On Wed, Mar 10, 2010 at 1:55 PM, Mariusmarius.dan...@gmail.com  wrote:


Please see here
http://groups.google.com/group/liftweb/browse_thread/thread/5e4f5e424d33db40/32cfb6752954?lnk=gstq=ExtJs#32cfb6752954

I'd strongly encourage you to integrate ExtJs with Lift and
potentially other frameworks. Depending on JS library licence we'd be
happy to have integrations with other JS frameworks.

JsArtifacts should provide you the necessary abstractions for such
integrations but if you run into problems, please let us know.

On Mar 10, 8:27 am, Jim Barrowsjim.barr...@gmail.com  wrote:

On Tue, Mar 9, 2010 at 8:45 PM, awanth...@whitford.com  wrote:

It is time for me to add some serious widgets to my lift app.



So far, I am most enamored by ExtJS.
Another alternative could possibly be ZK.



Does anybody have any experience with these frameworks?  Can you
comment on why integrating them with Scala/Lift would be a bad idea
(or not work)?



I searched for some historical posts on ExtJS and discovered some
threads about it's license and how it impacts inclusion in the lift
framework.  Would a commercial license prohibit it from being a lift-
widget submodule candidate?



Does anybody have a better suggestion that you think can compete with
ExtJS?


I'm using ExtJS in anger at 0rk.  3.1.1 is nice.  3.0.0 is weird.  Some odd
bugs being reported.  We're also getting some weird interactions with some
other js libraries ( I won't mention it, it's not available anymore, and if
it was it just leave you scarred) and CSS.  However, that's the other
libraries fault more then ExtJS's.

If you want something that looks and feels as close to a desktop app as you
can get.. ExtJS can do the job well.  With Lift providing the JSON, it would
be hard to go wrong.  That said.. ExtJS is not an easy beast to learn.  It's
even worse to try and L10N it easily.  I would not try and use just pieces
of it, it's really not designed to do that.  It seems to me to be an all or
nothing approach.  That's not say you can't use it piecemeal, I think you
lose a lot of flexibility (especially in layout) that way.

I wouldn't use it if left to my own devices though, unless I had a
requirement for a desktop app on the web.  It's serious overkill.

--
James A Barrows


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



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



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






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

[Lift] lift-core would be removed from repository shortly

2010-03-10 Thread Indrajit Raychaudhuri

Folks,

As discussed earlier, lift-core would be removed from repository 
sometime soon. For the deprecation notice and the rationale, please take 
a look at the announcement posted earlier [1].


If your application is still using lift-core, make the changes NOW! Soon 
it would stop working with 2.0-SNAPSHOT. The upcoming 2.0-M4 would not 
have it either.


Cheers, Indrajit

[1] 
http://groups.google.com/group/lift-announce/browse_thread/thread/28e9149425d8e6f3


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



[Lift] non-Lazy evaluation of bind FuncBindParam functions?

2010-03-10 Thread Stuart Roebuck
I've been trying to figure why some binding is giving me a stack
overflow and I've discovered that if you use the BindHelpers.bind
method with a set of function BindParams, all the functions are
evaluated regardless of whether a match is found.

So, for example, if you bind to an empty NodeSeq and have a BindParam
which will never match like:
  you won't find me here - { print(Got here!);
NodeSeq.Empty }
…you find that the print statement is called.

This really surprised me.  Is this intentional behaviour as it seems
to be a potential source of significant redundant processing?

Stuart.

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



Re: [Lift] Enable -Xcheckinit in 2.8 port?

2010-03-10 Thread Indrajit Raychaudhuri



On 08/03/10 11:48 PM, David Pollak wrote:



On Mon, Mar 8, 2010 at 10:01 AM, Jeppe Nejsum Madsen je...@ingolfs.dk
mailto:je...@ingolfs.dk wrote:

Hi,

Just found out why the Logging stuff doesn't work on the 2.8 branch.
Details here:
http://permalink.gmane.org/gmane.comp.lang.scala.user/24469

Is it somehow possible to enable the -Xcheckinit flag for the 2.8
branch? Don't know how common that issue is, but it may help trap some
subtle errors.  Don't know what the performance penalty is though.


Let's enable the flag for the 2.8 branch along with the deprecation flag
(Indrajit, can you do this?)


Use the profile -Dlift-debug for the purpose. It has the deprecation 
flag, I'll add the checkinit flag.


- Indrajit




/Jeppe

--
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
mailto:liftweb@googlegroups.com.
To unsubscribe from this group, send email to
liftweb+unsubscr...@googlegroups.com
mailto:liftweb%2bunsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/liftweb?hl=en.




--
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 lift...@googlegroups.com.
To unsubscribe from this group, send email to
liftweb+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/liftweb?hl=en.


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



Re: [Lift] Multiple stateful snippets in a page , keeping the common state?

2010-03-10 Thread David Pollak
The short answer is no.

The slightly longer answer is Can you put both into a single snippet?

The even longer answer is Have you tried using Ajax forms so you don't even
leave the page?

On Tue, Mar 9, 2010 at 10:19 PM, hexa hex...@gmail.com wrote:

 Hi,
   I have 2 Stateful snippets in a page :

 1. a InvoiceList snippet that

  1. If no client RequestVar is present lists all the invoices in the
 system
  2. If a client RequestVar is present lists the invoices for that
 client

 2. a AddInvoice snippet that displays a form and adds an invoice
 binded on the Client RequestVar..

 Now these 2 can share the same RequestVar.. and that's fine for one
 request

 And at least in the case of 1 stateful snippet since I set the request
 var to a class var , it persists after a submit on the AddInvoice...
 the client persists

 But for the other snippet .. the state is lost...

 So is there a way to manage the common states of multiple snippets in
 a page ? Should I use a SessionVar ?  I kinda would prefer not to
 since It's really not a var that should be persistent over the
 session

 The best would be that they both keep their state .. as an action is
 performed on one of them...

 Thanks a lot

 hexa

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




-- 
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 lift...@googlegroups.com.
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en.



[Lift] Re: non-Lazy evaluation of bind FuncBindParam functions?

2010-03-10 Thread Stuart Roebuck
Okay, so I now understand what is happening a little better.

When I saw a construct like:

  bind(example,xhtml,
first_name - SHtml.text(user.first_name, user.first_name(_)),
last_name - SHtml.text(user.last_name, user.last_name(_))

it reminded me of a match with cases and my assumption was that each
match would only be called if and when the match was found. In reality
what appears to happen is that the item on the right hand side of the
- is usually evaluated and then placed into a Map with the String
like first_name being the key.

So, if every binding is used in every case there is no big issue here,
but if you have bindings that aren't all used they will none-the-less
be evaluated every time you try to bind.

Also every time the bind function is called a new Map appears to be
generated and indexed in memory which doesn't seem as efficient as it
could be.

I can't help but wonder whether this could be converted to a form of
match which would then be built at compile time and re-used and would
only evaluate those matches that matched.

In the meantime I see that you can convert the code above to:

  bind(example,xhtml,
FuncBindParam(first_name, () = SHtml.text(user.first_name,
user.first_name(_)),
FuncBindParam(last_name, () = SHtml.text(user.last_name,
user.last_name(_))

to get a form of lazy evaluation.


On Mar 10, 11:01 am, Stuart Roebuck stuart.roeb...@gmail.com wrote:
 I've been trying to figure why some binding is giving me a stack
 overflow and I've discovered that if you use the BindHelpers.bind
 method with a set of function BindParams, all the functions are
 evaluated regardless of whether a match is found.

 So, for example, if you bind to an empty NodeSeq and have a BindParam
 which will never match like:
       you won't find me here - { print(Got here!);
 NodeSeq.Empty }
 …you find that the print statement is called.

 This really surprised me.  Is this intentional behaviour as it seems
 to be a potential source of significant redundant processing?

 Stuart.

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



[Lift] Re: Serious widget action

2010-03-10 Thread aw

On Mar 10, 1:15 am, Timothy Perrett timo...@getintheloop.eu wrote:
 Personally, I would say forget ExtJS, compared to Cappuccino its streets 
 behind:

 http://cappuccino.org/

 Easily the most exciting UI framework out there right now

Perhaps I should add that I need sophisticated grids:
  http://www.extjs.com/deploy/dev/examples/#sample-3

A bunch of options like JQuery UI, YUI, and from what I see from
Cappuccino don't seam to come close to the kind of widget
sophistication that I am seeing in ExtJS.  Hence, ExtJS is my front
runner.  (Flex is ultimately competition, but I don't like dealing
with Flash.)

I have a sprinkling of JQuery usage in my app already, and my initial
thought was to simply use the JQuery adapter for ExtJS.
Alternatively, I could probably just rewrite my JQuery code in ExtJS
-- assuming then I would take the route to provide a jsArtifact for
ExtJS.

My real concern is factors like security and leveraging things like
SHtml.link -- I don't want an oil and water scenario.  I still need to
deep dive into ExtJS, but wanted to float the idea in case someone was
aware of a red flag before I wasted too much time.

It doesn't sound like anybody is using ZK [1], eh?

[1] http://zkoss.org/

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



[Lift] Re: Multiple stateful snippets in a page , keeping the common state?

2010-03-10 Thread hexa
ok,,

I don't want to put them in a single snippet since I want to be able
to use them independently ..

  I could call one snippet from the other I guess this would work but
just doesn't feel right... I would end up
having to do one snippet per page to control the subsnippets...

  In fact i'm not sure how I can compose independent even non
stateful snippets... without having an enclosing
controler snippet

  Best would be if non-stateful snippets could find each other for
example could I have something like

 lift::SnippetA
 lift:SnippetB
 /lift:SnippetB
 /lift::SnippetA

And have snippet B find the snippet A instance ? and modify it's
rendering based on it ? or something similar?
  This way my list Invoice could know what it's in a AddInvoice
snippet and get the Client it must show the invoices for ..
  And otherwise just render all invoices...
  Having it in another context could make it render different
things...

Or would I really have to  bind SnippetB inside SnippetA  with
chooseTemplate and directly call it's functions with the arguments I
need ? and do this all top-down... rather then down-top...

So basically I guess the question is how do you manage multiple
snippets (non-stateful) so that they are the most independent from
each other and that code can reused and scoped properly if they have
any effect on each other and or that they can enclose each other...

Maybe Im way off too ,, sorry , Help is much apreciated...

I will try the ajax way too, and I guess I could repost the
RequestVar.. need to try that too..

Thanks,

hexa


On Mar 10, 9:33 am, David Pollak feeder.of.the.be...@gmail.com
wrote:
 The short answer is no.

 The slightly longer answer is Can you put both into a single snippet?

 The even longer answer is Have you tried using Ajax forms so you don't even
 leave the page?



 On Tue, Mar 9, 2010 at 10:19 PM, hexa hex...@gmail.com wrote:
  Hi,
    I have 2 Stateful snippets in a page :

  1. a InvoiceList snippet that

   1. If no client RequestVar is present lists all the invoices in the
  system
   2. If a client RequestVar is present lists the invoices for that
  client

  2. a AddInvoice snippet that displays a form and adds an invoice
  binded on the Client RequestVar..

  Now these 2 can share the same RequestVar.. and that's fine for one
  request

  And at least in the case of 1 stateful snippet since I set the request
  var to a class var , it persists after a submit on the AddInvoice...
  the client persists

  But for the other snippet .. the state is lost...

  So is there a way to manage the common states of multiple snippets in
  a page ? Should I use a SessionVar ?  I kinda would prefer not to
  since It's really not a var that should be persistent over the
  session

  The best would be that they both keep their state .. as an action is
  performed on one of them...

  Thanks a lot

  hexa

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

 --
 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 lift...@googlegroups.com.
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en.



[Lift] Re: Serious widget action

2010-03-10 Thread Timothy Perrett
If you've already decided on ExtJS, why don't you just go use it? Dirk
from Ext was originally going to do ExtJS integration, but he has
disappeared into the ether never to be seen again.

You could always start an integration module on github and go from
there...

Cheers, Tim

On Mar 10, 3:29 pm, aw anth...@whitford.com wrote:
 On Mar 10, 1:15 am, Timothy Perrett timo...@getintheloop.eu wrote:

  Personally, I would say forget ExtJS, compared to Cappuccino its streets 
  behind:

 http://cappuccino.org/

  Easily the most exciting UI framework out there right now

 Perhaps I should add that I need sophisticated grids:
  http://www.extjs.com/deploy/dev/examples/#sample-3

 A bunch of options like JQuery UI, YUI, and from what I see from
 Cappuccino don't seam to come close to the kind of widget
 sophistication that I am seeing in ExtJS.  Hence, ExtJS is my front
 runner.  (Flex is ultimately competition, but I don't like dealing
 with Flash.)

 I have a sprinkling of JQuery usage in my app already, and my initial
 thought was to simply use the JQuery adapter for ExtJS.
 Alternatively, I could probably just rewrite my JQuery code in ExtJS
 -- assuming then I would take the route to provide a jsArtifact for
 ExtJS.

 My real concern is factors like security and leveraging things like
 SHtml.link -- I don't want an oil and water scenario.  I still need to
 deep dive into ExtJS, but wanted to float the idea in case someone was
 aware of a red flag before I wasted too much time.

 It doesn't sound like anybody is using ZK [1], eh?

 [1]http://zkoss.org/

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



Re: [Lift] Re: non-Lazy evaluation of bind FuncBindParam functions?

2010-03-10 Thread Ross Mellgren
The simple way of using FuncBindParam is:

first_name - { (ns: NodeSeq) = SHtml.text(...) }

That will only generate the text if the tag first_name appears.

-Ross

On Mar 10, 2010, at 10:22 AM, Stuart Roebuck wrote:

 Okay, so I now understand what is happening a little better.
 
 When I saw a construct like:
 
  bind(example,xhtml,
first_name - SHtml.text(user.first_name, user.first_name(_)),
last_name - SHtml.text(user.last_name, user.last_name(_))
 
 it reminded me of a match with cases and my assumption was that each
 match would only be called if and when the match was found. In reality
 what appears to happen is that the item on the right hand side of the
 - is usually evaluated and then placed into a Map with the String
 like first_name being the key.
 
 So, if every binding is used in every case there is no big issue here,
 but if you have bindings that aren't all used they will none-the-less
 be evaluated every time you try to bind.
 
 Also every time the bind function is called a new Map appears to be
 generated and indexed in memory which doesn't seem as efficient as it
 could be.
 
 I can't help but wonder whether this could be converted to a form of
 match which would then be built at compile time and re-used and would
 only evaluate those matches that matched.
 
 In the meantime I see that you can convert the code above to:
 
  bind(example,xhtml,
FuncBindParam(first_name, () = SHtml.text(user.first_name,
 user.first_name(_)),
FuncBindParam(last_name, () = SHtml.text(user.last_name,
 user.last_name(_))
 
 to get a form of lazy evaluation.
 
 
 On Mar 10, 11:01 am, Stuart Roebuck stuart.roeb...@gmail.com wrote:
 I've been trying to figure why some binding is giving me a stack
 overflow and I've discovered that if you use the BindHelpers.bind
 method with a set of function BindParams, all the functions are
 evaluated regardless of whether a match is found.
 
 So, for example, if you bind to an empty NodeSeq and have a BindParam
 which will never match like:
   you won't find me here - { print(Got here!);
 NodeSeq.Empty }
 …you find that the print statement is called.
 
 This really surprised me.  Is this intentional behaviour as it seems
 to be a potential source of significant redundant processing?
 
 Stuart.
 
 -- 
 You received this message because you are subscribed to the Google Groups 
 Lift group.
 To post to this group, send email to lift...@googlegroups.com.
 To unsubscribe from this group, send email to 
 liftweb+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/liftweb?hl=en.
 

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



Re: [Lift] Re: non-Lazy evaluation of bind FuncBindParam functions?

2010-03-10 Thread David Pollak
On Wed, Mar 10, 2010 at 7:22 AM, Stuart Roebuck stuart.roeb...@gmail.comwrote:

 Okay, so I now understand what is happening a little better.

 When I saw a construct like:

  bind(example,xhtml,
first_name - SHtml.text(user.first_name, user.first_name(_)),
last_name - SHtml.text(user.last_name, user.last_name(_))

 it reminded me of a match with cases and my assumption was that each
 match would only be called if and when the match was found. In reality
 what appears to happen is that the item on the right hand side of the
 - is usually evaluated and then placed into a Map with the String
 like first_name being the key.


You're welcome to take up laziness vs. strictness with the EPFL team.
 There's only so much we can do to be lazy and it does take extra syntax
(see Ross's reply).


 So, if every binding is used in every case there is no big issue here,
 but if you have bindings that aren't all used they will none-the-less
 be evaluated every time you try to bind.

 Also every time the bind function is called a new Map appears to be
 generated and indexed in memory which doesn't seem as efficient as it
 could be.


There's a sign over a urinal in a mens room at Google that reads Premature
Optimization is the root of all evil.  Now, I think that's an
overstatement, but in this case, it's applicable.

Is there an *actual* problem with building a Map()?  Can you measure the
problem?  Do you have a more efficient solution?

Now, when I wrote that particular code, I was very cognizant of the
performance implications.

The cost of producing the Map() (backed by a HashMap) in the normal case (no
hash collisions) is O(n).  Worst case is O(n log n).

For each element we're binding, we have look up the tag of the node to bind.
 If we are using our Map(), the look-up time is O(1) (or worst case O(log
n)).  If we have n elements that we're binding, the expected cost is O(n)
and worst case is O(n log n).

So, we have an algorithm that normally executes in 2xO(n) and worst case
2xO(n log n).

Now, if we didn't create the Map, we'd have to cycle through the possible
binds and we'd wind up with O(n ^ 2).  Even if you have a PartialFunction
(pattern matching) against strings, it's O(n) to match the pattern.

So, would you rather have an O(n) algorithm that can degrade to O(n log n)
and uses marginally more memory or would you rather have an O(n ^ 2)
algorithm that uses marginally less memory?

And if you're worried about the memory used by the Map(), on pre 1.6 build
16 JVMs, the Map will not likely escape the Eden memory pool (which means
very quick GC).  On the most recent JVMs, the escape analysis should kick in
and the Map and its elements will be allocated on the heap and never be
subject to GC.



 I can't help but wonder whether this could be converted to a form of
 match which would then be built at compile time and re-used and would
 only evaluate those matches that matched.


In the event that you can create a benchmark and a real-world situation that
actually needs this, please open a ticket.  But, I suspect that even if you
pre-created a Map and passed it into bind(), that the performance would be
nearly identical, but we'd have more public APIs to document which seems to
be something that also annoys you.



 In the meantime I see that you can convert the code above to:

  bind(example,xhtml,
FuncBindParam(first_name, () = SHtml.text(user.first_name,
 user.first_name(_)),
FuncBindParam(last_name, () = SHtml.text(user.last_name,
 user.last_name(_))

 to get a form of lazy evaluation.


 On Mar 10, 11:01 am, Stuart Roebuck stuart.roeb...@gmail.com wrote:
  I've been trying to figure why some binding is giving me a stack
  overflow and I've discovered that if you use the BindHelpers.bind
  method with a set of function BindParams, all the functions are
  evaluated regardless of whether a match is found.
 
  So, for example, if you bind to an empty NodeSeq and have a BindParam
  which will never match like:
you won't find me here - { print(Got here!);
  NodeSeq.Empty }
  …you find that the print statement is called.
 
  This really surprised me.  Is this intentional behaviour as it seems
  to be a potential source of significant redundant processing?
 
  Stuart.

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




-- 
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 lift...@googlegroups.com.
To unsubscribe from this group

Re: [Lift] Re: Serious widget action

2010-03-10 Thread David Pollak
On Wed, Mar 10, 2010 at 7:29 AM, aw anth...@whitford.com wrote:


 On Mar 10, 1:15 am, Timothy Perrett timo...@getintheloop.eu wrote:
  Personally, I would say forget ExtJS, compared to Cappuccino its streets
 behind:
 
  http://cappuccino.org/
 
  Easily the most exciting UI framework out there right now

 Perhaps I should add that I need sophisticated grids:
  http://www.extjs.com/deploy/dev/examples/#sample-3


Hmmm... Cappuccino is the Apple AppKit, except it runs in the browser.
 Here's a cool example of a pure Cappuccino app:
http://280slides.com/Editor/

Further, with Atlas ( http://280atlas.com/ ) you can take the output from
NIB (Next Interface Builder, AKA OS X Interface Builder) files and literally
run them in the browser.  You have the full power of OS X's UI running in
the browser.  There's nothing in my experience that even comes close.


 A bunch of options like JQuery UI, YUI, and from what I see from
 Cappuccino don't seam to come close to the kind of widget
 sophistication that I am seeing in ExtJS.  Hence, ExtJS is my front
 runner.  (Flex is ultimately competition, but I don't like dealing
 with Flash.)


I actually think that Cappuccino with Atlas is more powerful than Flash.



 I have a sprinkling of JQuery usage in my app already, and my initial
 thought was to simply use the JQuery adapter for ExtJS.
 Alternatively, I could probably just rewrite my JQuery code in ExtJS
 -- assuming then I would take the route to provide a jsArtifact for
 ExtJS.

 My real concern is factors like security and leveraging things like
 SHtml.link -- I don't want an oil and water scenario.  I still need to
 deep dive into ExtJS, but wanted to float the idea in case someone was
 aware of a red flag before I wasted too much time.


There are lots of things that can be done to integrate Lift's statefulness
(server-side functions closing over state mapped to GUIDs sent to the client
side) via JSON and Ajax/Comet.  It will take a little thinking to get things
right, but I have a high degree of confidence that it can be made right.



 It doesn't sound like anybody is using ZK [1], eh?

 [1] http://zkoss.org/

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




-- 
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 lift...@googlegroups.com.
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en.



Re: [Lift] Re: Serious widget action

2010-03-10 Thread David Pollak
On Wed, Mar 10, 2010 at 1:40 AM, Mads Hartmann Jensen mads...@gmail.comwrote:

 +1 for cappuccino

 Played around with it a while back - it's pretty amazing.

 What kind of intergration are we talking about? I wouldn't mind taking a
 look at intergrating cappuccino.


This would be a heck of an amazing GSoC project (although I'm not sure it's
more important than the SBT stuff.)

But, if you need any help from the 280 North guys, they have an ongoing
interest in Lift integration.  We hang out once a quarter or so and always
walk away intending to do something, but never actually doing it.

With this said, supporting both ExtJs (the MIT licensed part) and Cap would
be awesome.



 On 10/03/2010, at 10.37, Indrajit Raychaudhuri wrote:

  ExtCore is MIT Licensed and a candidate for JSArtifacts impl [1].
  I started dabbling with an implementation of ExtCoreArtifacts sometime
  back, but didn't have enough bandwidth to carry it forward.
 
  In case somebody is willing to run with this, there is a ticket for
  this already [2]
 
  Non ExtCore are GPLed and doesn't mix conveniently. Although there are
  some exceptions, I am not sure how practically that works license wise
  [3].
 
  Cheers, Indrajit
 
  [1] http://www.extjs.com/products/extcore/
  [2] http://www.assembla.com/spaces/liftweb/tickets/132
  [3] http://www.extjs.com/products/floss-exception.php
 
 
  On Wed, Mar 10, 2010 at 1:55 PM, Marius marius.dan...@gmail.com wrote:
 
  Please see here
 
 http://groups.google.com/group/liftweb/browse_thread/thread/5e4f5e424d33db40/32cfb6752954?lnk=gstq=ExtJs#32cfb6752954
 
  I'd strongly encourage you to integrate ExtJs with Lift and
  potentially other frameworks. Depending on JS library licence we'd be
  happy to have integrations with other JS frameworks.
 
  JsArtifacts should provide you the necessary abstractions for such
  integrations but if you run into problems, please let us know.
 
  On Mar 10, 8:27 am, Jim Barrows jim.barr...@gmail.com wrote:
  On Tue, Mar 9, 2010 at 8:45 PM, aw anth...@whitford.com wrote:
  It is time for me to add some serious widgets to my lift app.
 
  So far, I am most enamored by ExtJS.
  Another alternative could possibly be ZK.
 
  Does anybody have any experience with these frameworks?  Can you
  comment on why integrating them with Scala/Lift would be a bad idea
  (or not work)?
 
  I searched for some historical posts on ExtJS and discovered some
  threads about it's license and how it impacts inclusion in the lift
  framework.  Would a commercial license prohibit it from being a lift-
  widget submodule candidate?
 
  Does anybody have a better suggestion that you think can compete with
  ExtJS?
 
  I'm using ExtJS in anger at 0rk.  3.1.1 is nice.  3.0.0 is weird.  Some
 odd
  bugs being reported.  We're also getting some weird interactions with
 some
  other js libraries ( I won't mention it, it's not available anymore,
 and if
  it was it just leave you scarred) and CSS.  However, that's the other
  libraries fault more then ExtJS's.
 
  If you want something that looks and feels as close to a desktop app as
 you
  can get.. ExtJS can do the job well.  With Lift providing the JSON, it
 would
  be hard to go wrong.  That said.. ExtJS is not an easy beast to learn.
  It's
  even worse to try and L10N it easily.  I would not try and use just
 pieces
  of it, it's really not designed to do that.  It seems to me to be an
 all or
  nothing approach.  That's not say you can't use it piecemeal, I think
 you
  lose a lot of flexibility (especially in layout) that way.
 
  I wouldn't use it if left to my own devices though, unless I had a
  requirement for a desktop app on the web.  It's serious overkill.
 
  --
  James A Barrows
 
  --
  You received this message because you are subscribed to the Google
 Groups Lift group.
  To post to this group, send email to lift...@googlegroups.com.
  To unsubscribe from this group, send email to
 liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com
 .
  For more options, visit this group at
 http://groups.google.com/group/liftweb?hl=en.
 
 
  --
  You received this message because you are subscribed to the Google Groups
 Lift group.
  To post to this group, send email to lift...@googlegroups.com.
  To unsubscribe from this group, send email to
 liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com
 .
  For more options, visit this group at
 http://groups.google.com/group/liftweb?hl=en.
 

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




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

Re: [Lift] Re: Serious widget action

2010-03-10 Thread David Pollak
On Wed, Mar 10, 2010 at 1:51 AM, Timothy Perrett timo...@getintheloop.euwrote:

 The only possible thing that one could do would need two aspects:

 1. The lift side to produce particular JSON
 2. The capp side to consume said JSON

 Without a full package, there aren't really any integration points as we
 have already got comet working with capp so the only thing remaining is
 overall user implementation experience.


Oh, I disagree.  I think there are a lot of interesting potential ways to
write model (not RDBMS models, but more general models) that emit Obj-J such
that they feel natural to Cap and fully integrate with Cap (and Atlas) but
are strongly typed and play well in Scala/Lift/Akka/Goat Rodeo land.



 Cheers, Tim

 On 10 Mar 2010, at 09:40, Mads Hartmann Jensen wrote:

  +1 for cappuccino
 
  Played around with it a while back - it's pretty amazing.
 
  What kind of intergration are we talking about? I wouldn't mind taking a
 look at intergrating cappuccino.
 
  On 10/03/2010, at 10.37, Indrajit Raychaudhuri wrote:
 
  ExtCore is MIT Licensed and a candidate for JSArtifacts impl [1].
  I started dabbling with an implementation of ExtCoreArtifacts sometime
  back, but didn't have enough bandwidth to carry it forward.
 
  In case somebody is willing to run with this, there is a ticket for
  this already [2]
 
  Non ExtCore are GPLed and doesn't mix conveniently. Although there are
  some exceptions, I am not sure how practically that works license wise
  [3].
 
  Cheers, Indrajit
 
  [1] http://www.extjs.com/products/extcore/
  [2] http://www.assembla.com/spaces/liftweb/tickets/132
  [3] http://www.extjs.com/products/floss-exception.php
 
 
  On Wed, Mar 10, 2010 at 1:55 PM, Marius marius.dan...@gmail.com
 wrote:
 
  Please see here
 
 http://groups.google.com/group/liftweb/browse_thread/thread/5e4f5e424d33db40/32cfb6752954?lnk=gstq=ExtJs#32cfb6752954
 
  I'd strongly encourage you to integrate ExtJs with Lift and
  potentially other frameworks. Depending on JS library licence we'd be
  happy to have integrations with other JS frameworks.
 
  JsArtifacts should provide you the necessary abstractions for such
  integrations but if you run into problems, please let us know.
 
  On Mar 10, 8:27 am, Jim Barrows jim.barr...@gmail.com wrote:
  On Tue, Mar 9, 2010 at 8:45 PM, aw anth...@whitford.com wrote:
  It is time for me to add some serious widgets to my lift app.
 
  So far, I am most enamored by ExtJS.
  Another alternative could possibly be ZK.
 
  Does anybody have any experience with these frameworks?  Can you
  comment on why integrating them with Scala/Lift would be a bad idea
  (or not work)?
 
  I searched for some historical posts on ExtJS and discovered some
  threads about it's license and how it impacts inclusion in the lift
  framework.  Would a commercial license prohibit it from being a lift-
  widget submodule candidate?
 
  Does anybody have a better suggestion that you think can compete with
  ExtJS?
 
  I'm using ExtJS in anger at 0rk.  3.1.1 is nice.  3.0.0 is weird.
  Some odd
  bugs being reported.  We're also getting some weird interactions with
 some
  other js libraries ( I won't mention it, it's not available anymore,
 and if
  it was it just leave you scarred) and CSS.  However, that's the other
  libraries fault more then ExtJS's.
 
  If you want something that looks and feels as close to a desktop app
 as you
  can get.. ExtJS can do the job well.  With Lift providing the JSON, it
 would
  be hard to go wrong.  That said.. ExtJS is not an easy beast to learn.
  It's
  even worse to try and L10N it easily.  I would not try and use just
 pieces
  of it, it's really not designed to do that.  It seems to me to be an
 all or
  nothing approach.  That's not say you can't use it piecemeal, I think
 you
  lose a lot of flexibility (especially in layout) that way.
 
  I wouldn't use it if left to my own devices though, unless I had a
  requirement for a desktop app on the web.  It's serious overkill.
 
  --
  James A Barrows
 
  --
  You received this message because you are subscribed to the Google
 Groups Lift group.
  To post to this group, send email to lift...@googlegroups.com.
  To unsubscribe from this group, send email to
 liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com
 .
  For more options, visit this group at
 http://groups.google.com/group/liftweb?hl=en.
 
 
  --
  You received this message because you are subscribed to the Google
 Groups Lift group.
  To post to this group, send email to lift...@googlegroups.com.
  To unsubscribe from this group, send email to
 liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com
 .
  For more options, visit this group at
 http://groups.google.com/group/liftweb?hl=en.
 
 
  --
  You received this message because you are subscribed to the Google Groups
 Lift group.
  To post to this group, send email to lift...@googlegroups.com.
  To unsubscribe from this group, send email

Re: [Lift] Re: Serious widget action

2010-03-10 Thread David Pollak
On Wed, Mar 10, 2010 at 8:02 AM, Timothy Perrett timo...@getintheloop.euwrote:

 If you've already decided on ExtJS, why don't you just go use it? Dirk
 from Ext was originally going to do ExtJS integration, but he has
 disappeared into the ether never to be seen again.


Yeah... I gotta ping him.  He's also got some translation tickets open.



 You could always start an integration module on github and go from
 there...

 Cheers, Tim

 On Mar 10, 3:29 pm, aw anth...@whitford.com wrote:
  On Mar 10, 1:15 am, Timothy Perrett timo...@getintheloop.eu wrote:
 
   Personally, I would say forget ExtJS, compared to Cappuccino its
 streets behind:
 
  http://cappuccino.org/
 
   Easily the most exciting UI framework out there right now
 
  Perhaps I should add that I need sophisticated grids:
   http://www.extjs.com/deploy/dev/examples/#sample-3
 
  A bunch of options like JQuery UI, YUI, and from what I see from
  Cappuccino don't seam to come close to the kind of widget
  sophistication that I am seeing in ExtJS.  Hence, ExtJS is my front
  runner.  (Flex is ultimately competition, but I don't like dealing
  with Flash.)
 
  I have a sprinkling of JQuery usage in my app already, and my initial
  thought was to simply use the JQuery adapter for ExtJS.
  Alternatively, I could probably just rewrite my JQuery code in ExtJS
  -- assuming then I would take the route to provide a jsArtifact for
  ExtJS.
 
  My real concern is factors like security and leveraging things like
  SHtml.link -- I don't want an oil and water scenario.  I still need to
  deep dive into ExtJS, but wanted to float the idea in case someone was
  aware of a red flag before I wasted too much time.
 
  It doesn't sound like anybody is using ZK [1], eh?
 
  [1]http://zkoss.org/

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




-- 
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 lift...@googlegroups.com.
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en.



[Lift] Re: non-Lazy evaluation of bind FuncBindParam functions?

2010-03-10 Thread Stuart Roebuck
Thanks for the feedback.  I'm not trying to be awkward here, just
trying to get my head around everything.

Oh, and I completely agree with the risks of premature optimisation.

Thanks,

Stuart

On Mar 10, 5:03 pm, David Pollak feeder.of.the.be...@gmail.com
wrote:
 On Wed, Mar 10, 2010 at 7:22 AM, Stuart Roebuck 
 stuart.roeb...@gmail.comwrote:

  Okay, so I now understand what is happening a little better.

  When I saw a construct like:

   bind(example,xhtml,
     first_name - SHtml.text(user.first_name, user.first_name(_)),
     last_name - SHtml.text(user.last_name, user.last_name(_))

  it reminded me of a match with cases and my assumption was that each
  match would only be called if and when the match was found. In reality
  what appears to happen is that the item on the right hand side of the
  - is usually evaluated and then placed into a Map with the String
  like first_name being the key.

 You're welcome to take up laziness vs. strictness with the EPFL team.
  There's only so much we can do to be lazy and it does take extra syntax
 (see Ross's reply).

  So, if every binding is used in every case there is no big issue here,
  but if you have bindings that aren't all used they will none-the-less
  be evaluated every time you try to bind.

  Also every time the bind function is called a new Map appears to be
  generated and indexed in memory which doesn't seem as efficient as it
  could be.

 There's a sign over a urinal in a mens room at Google that reads Premature
 Optimization is the root of all evil.  Now, I think that's an
 overstatement, but in this case, it's applicable.

 Is there an *actual* problem with building a Map()?  Can you measure the
 problem?  Do you have a more efficient solution?

 Now, when I wrote that particular code, I was very cognizant of the
 performance implications.

 The cost of producing the Map() (backed by a HashMap) in the normal case (no
 hash collisions) is O(n).  Worst case is O(n log n).

 For each element we're binding, we have look up the tag of the node to bind.
  If we are using our Map(), the look-up time is O(1) (or worst case O(log
 n)).  If we have n elements that we're binding, the expected cost is O(n)
 and worst case is O(n log n).

 So, we have an algorithm that normally executes in 2xO(n) and worst case
 2xO(n log n).

 Now, if we didn't create the Map, we'd have to cycle through the possible
 binds and we'd wind up with O(n ^ 2).  Even if you have a PartialFunction
 (pattern matching) against strings, it's O(n) to match the pattern.

 So, would you rather have an O(n) algorithm that can degrade to O(n log n)
 and uses marginally more memory or would you rather have an O(n ^ 2)
 algorithm that uses marginally less memory?

 And if you're worried about the memory used by the Map(), on pre 1.6 build
 16 JVMs, the Map will not likely escape the Eden memory pool (which means
 very quick GC).  On the most recent JVMs, the escape analysis should kick in
 and the Map and its elements will be allocated on the heap and never be
 subject to GC.



  I can't help but wonder whether this could be converted to a form of
  match which would then be built at compile time and re-used and would
  only evaluate those matches that matched.

 In the event that you can create a benchmark and a real-world situation that
 actually needs this, please open a ticket.  But, I suspect that even if you
 pre-created a Map and passed it into bind(), that the performance would be
 nearly identical, but we'd have more public APIs to document which seems to
 be something that also annoys you.







  In the meantime I see that you can convert the code above to:

   bind(example,xhtml,
     FuncBindParam(first_name, () = SHtml.text(user.first_name,
  user.first_name(_)),
     FuncBindParam(last_name, () = SHtml.text(user.last_name,
  user.last_name(_))

  to get a form of lazy evaluation.

  On Mar 10, 11:01 am, Stuart Roebuck stuart.roeb...@gmail.com wrote:
   I've been trying to figure why some binding is giving me a stack
   overflow and I've discovered that if you use the BindHelpers.bind
   method with a set of function BindParams, all the functions are
   evaluated regardless of whether a match is found.

   So, for example, if you bind to an empty NodeSeq and have a BindParam
   which will never match like:
         you won't find me here - { print(Got here!);
   NodeSeq.Empty }
   …you find that the print statement is called.

   This really surprised me.  Is this intentional behaviour as it seems
   to be a potential source of significant redundant processing?

   Stuart.

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

 --
 Lift

Re: [Lift] Re: Multiple stateful snippets in a page , keeping the common state?

2010-03-10 Thread David Pollak
The simplest answer is to use traits to define logic and when you have a
page that's going to have multiple logic pieces that need to keep track of
each other's state, mix the traits into a larger stateful snippet.

I'm sorry that I've been giving you half-answers to a lot of your
questions...  I know you've stated parts of your problem in a number of
different posts, but if I could trouble you to put together a more complete
description of the pages, components and interactions, I can try to work up
a complete example that might help.

On Wed, Mar 10, 2010 at 8:02 AM, hexa hex...@gmail.com wrote:

 ok,,

 I don't want to put them in a single snippet since I want to be able
 to use them independently ..

  I could call one snippet from the other I guess this would work but
 just doesn't feel right... I would end up
 having to do one snippet per page to control the subsnippets...

  In fact i'm not sure how I can compose independent even non
 stateful snippets... without having an enclosing
 controler snippet

  Best would be if non-stateful snippets could find each other for
 example could I have something like

  lift::SnippetA
 lift:SnippetB
 /lift:SnippetB
  /lift::SnippetA

 And have snippet B find the snippet A instance ? and modify it's
 rendering based on it ? or something similar?
  This way my list Invoice could know what it's in a AddInvoice
 snippet and get the Client it must show the invoices for ..
  And otherwise just render all invoices...
  Having it in another context could make it render different
 things...

 Or would I really have to  bind SnippetB inside SnippetA  with
 chooseTemplate and directly call it's functions with the arguments I
 need ? and do this all top-down... rather then down-top...

 So basically I guess the question is how do you manage multiple
 snippets (non-stateful) so that they are the most independent from
 each other and that code can reused and scoped properly if they have
 any effect on each other and or that they can enclose each other...

 Maybe Im way off too ,, sorry , Help is much apreciated...

 I will try the ajax way too, and I guess I could repost the
 RequestVar.. need to try that too..

 Thanks,

 hexa


 On Mar 10, 9:33 am, David Pollak feeder.of.the.be...@gmail.com
 wrote:
  The short answer is no.
 
  The slightly longer answer is Can you put both into a single snippet?
 
  The even longer answer is Have you tried using Ajax forms so you don't
 even
  leave the page?
 
 
 
  On Tue, Mar 9, 2010 at 10:19 PM, hexa hex...@gmail.com wrote:
   Hi,
 I have 2 Stateful snippets in a page :
 
   1. a InvoiceList snippet that
 
1. If no client RequestVar is present lists all the invoices in the
   system
2. If a client RequestVar is present lists the invoices for that
   client
 
   2. a AddInvoice snippet that displays a form and adds an invoice
   binded on the Client RequestVar..
 
   Now these 2 can share the same RequestVar.. and that's fine for one
   request
 
   And at least in the case of 1 stateful snippet since I set the request
   var to a class var , it persists after a submit on the AddInvoice...
   the client persists
 
   But for the other snippet .. the state is lost...
 
   So is there a way to manage the common states of multiple snippets in
   a page ? Should I use a SessionVar ?  I kinda would prefer not to
   since It's really not a var that should be persistent over the
   session
 
   The best would be that they both keep their state .. as an action is
   performed on one of them...
 
   Thanks a lot
 
   hexa
 
   --
   You received this message because you are subscribed to the Google
 Groups
   Lift group.
   To post to this group, send email to lift...@googlegroups.com.
   To unsubscribe from this group, send email to
   liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com
 liftweb%2bunsubscr...@googlegroups.comliftweb%252bunsubscr...@googlegroups.com
 
   .
   For more options, visit this group at
  http://groups.google.com/group/liftweb?hl=en.
 
  --
  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 lift...@googlegroups.com.
 To unsubscribe from this group, send email to
 liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/liftweb?hl=en.




-- 
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 lift...@googlegroups.com.
To unsubscribe from this group, send email to 
liftweb+unsubscr

[Lift] Re: BSON support in lift-json

2010-03-10 Thread Joni Freeman
Hi,

Here's another idea which might work. It is a bit hackish and needs
further analysis, but small experiments I did were promising.

What if we change JsonAST just a little by adding a new abstract node
called JLiteral to represent simple nonstructural types (note, it is
sealed).

object JsonAST {
  sealed abstract class JValue
  sealed abstract class JLiteral extends JValue
  case class JInt(value: BigInt) extends JLiteral
  ...
}

Then in a same source file extend that by adding BSON extensions.

object BsonAST {
  abstract class JObjectId(val id: Long) extends JsonAST.JLiteral
  ...

  object JObjectId {
def apply(id: Long) = new JObjectId(id) {}
def unapply(x: JObjectId): Option[Long] = Some(x.millis)
  }
}

Note, BsonAST extension literals are not case classes but abstract
classes + manually coded extractors and factories. Now users of basic
JSON processing would not need to care about BSON extensions. For them
the pattern matcher would work as it works now. For instance
exhaustiveness checking still emits warnings if cases are incomplete.
BSON users can import BSON extensions and use extractors:

import JsonAST._
import BsonAST._

bson map {
  case JInt(x) = ...
  case JDate(t) = ...
  ...
}

Cheers Joni


On Mar 8, 8:38 pm, Ross Mellgren dri...@gmail.com wrote:
 I personally think hybrid approaches make sense for certain designs even if 
 they are a little odd.

 My thought originally was having a new member of the ADT which is not final 
 which represents extensions, e.g.

 JValue
   \_ JExtension
        \_ JDate

 where JExtensions could be ignored or passed through unchanged by most of the 
 stuff, and only special readers/writers would know what to do with them.

 -Ross

 On Mar 8, 2010, at 12:45 PM, David Pollak wrote:



  On Mon, Mar 8, 2010 at 12:50 AM, Joni Freeman freeman.j...@gmail.com 
  wrote:
  This is a tricky one. The problem with extending the AST is that the
  AST is implemented as an algebraic data type. And by definition it is
  not possible to extend such a type.

  Just throwing an idea out and it's likely a bad one.

  I ran into a similar issue with Box and chose to do a hybrid (aka 
  Frankenstein) ADT/OO paradigm.

  Perhaps it's possible to provide subclasses of certain ADT items (e.g., 
  JDate extends JInt) such that if you pattern match on a JInt, you get the 
  millis as long, but if you pattern match against JDate, you get a date 
  extracted if it's the JDate subclass.

  Once again, it's likely to be a bad idea as it caused a lot of angst in Box 
  and I'm not sure if the paradigm is one that's worth perpetuating.

  One way to add BSON support is to create a new AST for it which
  includes all extended literals. Then add a few core functions for that
  ADT (map, etc.) and maybe a function which can encode BSON as JSON
  (bvalue.toJson). Encoding BSON as JSON would give some features for
  free, for instance toXml. Anyway, this approach would probably cause
  some code duplication between lift-json and lift-bson.

  Converting the JSON AST to an object oriented design would be another
  approach. Then adding new AST nodes would not be a problem. But that
  would be a huge change to the lib. Probably too big at this phase.

  Since BSON is a superset of JSON we could refactor current lift-json
  to be lift-bson and then implement lift-json on top of it. On a
  cursory look this feels cleanest but there might be some performance
  penalties for normal JSON processing due to conversions.

  To be honest, I'm not yet sure what would be the best approach.

  Cheers Joni

  On Mar 5, 10:08 pm, Ross Mellgren dri...@gmail.com wrote:
   The JSON stuff is mostly just an AST and encoding/decoding from the JSON 
   wire format is almost just an addon. Then, it would be a matter of adding 
   AST objects for those new things. Could be a use for phantom types ;-)

   I'd be interested to hear Joni's view on how it might fit, since he's the 
   most familiar.

   -Ross

   On Mar 5, 2010, at 1:26 PM, Tim Nelson wrote:

I definitely agree with keeping the BSON code separate or possibly
having a strict JSON mode.

Tim

On Fri, Mar 5, 2010 at 12:13 PM, Timothy Perrett
timo...@getintheloop.eu wrote:
Probably a sub-ordinate module would be preferable... one  that builds 
on the lift-json stuff and doesn't pollute the normal JSON usage.

Joni, what are your thoughts?

Cheers, Tim

On 5 Mar 2010, at 17:59, Tim Nelson wrote:

I finally had the opportunity to look into the couchdb code and I must
say it is rather impressive.

I would like to utilize the code in JSONRecord.scala in scamongo [1].
However, MongoDB uses a variation of JSON they call BSON, which they
actually just published a spec [2] for, due to interest outside of
MongoDB. Basically, it adds support for date, ObjectId [3], binary
data, regular expressions, and code (JavaScript) data types.

My question is, what would it take to add support

[Lift] Not Sure How to Arrange Mapper Classes or QueryParams to Handle My Data Model.

2010-03-10 Thread Matyjas

My entities are like Programmers and Projects. There is a many to many
relationship between Programmers and Projects, but the relationship
has an attribute for type. Examples of relationship types are
Develops, Manages, Maintains, Tests, etc. In a traditional relational
db there would be a join table containing the type of relationship as
well as foreign keys to both Programmer and Project. I would like to
run queries such as what projects does this programmer develop?
which loosely translates to the following SQL:

SELECT * FROM projects WHERE programmer.id ==
programmer_project.programmer_id  programmer_project.project_id ==
project.id  programmer_project.type == Develops  programmer.id
== thisProgrammerId;

So far, I gave up on the ManyToMany Mapper because I could not figure
out how to add an attribute to the join table. The join table seemed
to be hidden away.

What I have now is both Programmer and Project extending OneToMany,
where the many side is a ProgrammerProject class. Something like:

...
class Programmer extends LongKeyedMapper[Programmer] with
OneToMany[Long, Programmer] {
...
object programmerProjects extends MappedOneToMany(ProgrammerProject,
ProgrammerProject.programmer) with Owned[ProgrammerProject] with
Cascade[ProgrammerProject]
...
}

...
class Project extends LongKeyedMapper[Project] with OneToMany[Long,
Project] {
...
object programmerProjects extends MappedOneToMany(ProgrammerProject,
ProgrammerProject.project) with Owned[ProgrammerProject] with
Cascade[ProgrammerProject]
...
}

object RelationshipType extends Enumeration {
val Develops = new Val(1, Develops)
val Manages = new Val(2, Manages)
}
...
class ProgrammerProject extends LongKeyedMapper[ProgrammerProject] {
...
object relationshipType extends MappedEnum(this, RelationshipType)

object programmer extends LongMappedMapper(this, Programmmer)

object project extends LongMappedMapper(this, Project)
}


This arrangement isnt terrific, but it would be okay if I could
construct valid QueryParams. I would expect something like the
following to work:

Project.findAll(In(Project.id, ProgrammerProject.project,
  In(ProgrammerProject.programmer,
Programmer.id,
 By(ProgrammerProject.relationshipType,
RelationshipType.Develops

But it doesnt. Any advice would be most appreciated

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



[Lift] Re: Multiple stateful snippets in a page , keeping the common state?

2010-03-10 Thread hexa
You've been very helpful really!

I need to make my part now and read both the scala  lift book ,
properly

And experiment but at least now I have solution tails to follow :)

Thanks again

hexa

On Mar 10, 12:22 pm, David Pollak feeder.of.the.be...@gmail.com
wrote:
 The simplest answer is to use traits to define logic and when you have a
 page that's going to have multiple logic pieces that need to keep track of
 each other's state, mix the traits into a larger stateful snippet.

 I'm sorry that I've been giving you half-answers to a lot of your
 questions...  I know you've stated parts of your problem in a number of
 different posts, but if I could trouble you to put together a more complete
 description of the pages, components and interactions, I can try to work up
 a complete example that might help.



 On Wed, Mar 10, 2010 at 8:02 AM, hexa hex...@gmail.com wrote:
  ok,,

  I don't want to put them in a single snippet since I want to be able
  to use them independently ..

   I could call one snippet from the other I guess this would work but
  just doesn't feel right... I would end up
  having to do one snippet per page to control the subsnippets...

   In fact i'm not sure how I can compose independent even non
  stateful snippets... without having an enclosing
  controler snippet

   Best would be if non-stateful snippets could find each other for
  example could I have something like

   lift::SnippetA
      lift:SnippetB
      /lift:SnippetB
   /lift::SnippetA

  And have snippet B find the snippet A instance ? and modify it's
  rendering based on it ? or something similar?
   This way my list Invoice could know what it's in a AddInvoice
  snippet and get the Client it must show the invoices for ..
   And otherwise just render all invoices...
   Having it in another context could make it render different
  things...

  Or would I really have to  bind SnippetB inside SnippetA  with
  chooseTemplate and directly call it's functions with the arguments I
  need ? and do this all top-down... rather then down-top...

  So basically I guess the question is how do you manage multiple
  snippets (non-stateful) so that they are the most independent from
  each other and that code can reused and scoped properly if they have
  any effect on each other and or that they can enclose each other...

  Maybe Im way off too ,, sorry , Help is much apreciated...

  I will try the ajax way too, and I guess I could repost the
  RequestVar.. need to try that too..

  Thanks,

  hexa

  On Mar 10, 9:33 am, David Pollak feeder.of.the.be...@gmail.com
  wrote:
   The short answer is no.

   The slightly longer answer is Can you put both into a single snippet?

   The even longer answer is Have you tried using Ajax forms so you don't
  even
   leave the page?

   On Tue, Mar 9, 2010 at 10:19 PM, hexa hex...@gmail.com wrote:
Hi,
  I have 2 Stateful snippets in a page :

1. a InvoiceList snippet that

 1. If no client RequestVar is present lists all the invoices in the
system
 2. If a client RequestVar is present lists the invoices for that
client

2. a AddInvoice snippet that displays a form and adds an invoice
binded on the Client RequestVar..

Now these 2 can share the same RequestVar.. and that's fine for one
request

And at least in the case of 1 stateful snippet since I set the request
var to a class var , it persists after a submit on the AddInvoice...
the client persists

But for the other snippet .. the state is lost...

So is there a way to manage the common states of multiple snippets in
a page ? Should I use a SessionVar ?  I kinda would prefer not to
since It's really not a var that should be persistent over the
session

The best would be that they both keep their state .. as an action is
performed on one of them...

Thanks a lot

hexa

--
You received this message because you are subscribed to the Google
  Groups
Lift group.
To post to this group, send email to lift...@googlegroups.com.
To unsubscribe from this group, send email to
liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com
  liftweb%2bunsubscr...@googlegroups.comliftweb%252bunsubscr...@googlegroups.com

.
For more options, visit this group at
   http://groups.google.com/group/liftweb?hl=en.

   --
   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 lift...@googlegroups.com.
  To unsubscribe from this group, send email to
  liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com
  .
  For more options, visit this group at
 http://groups.google.com/group/liftweb?hl=en.

 --
 Lift, the simply functional web frameworkhttp

Re: [Lift] Not Sure How to Arrange Mapper Classes or QueryParams to Handle My Data Model.

2010-03-10 Thread Naftoli Gugenheim
With ManyToMany the join table is defined by you, manually as a regular mapper. 
You have to tell MappedManyToMany about it and its foreign keys.
I will try to find time to make the wiki entry more clear.
Also, if the scaladocs are lacking let me know how they could be improved.

-
Matyjasmaty...@gmail.com wrote:


My entities are like Programmers and Projects. There is a many to many
relationship between Programmers and Projects, but the relationship
has an attribute for type. Examples of relationship types are
Develops, Manages, Maintains, Tests, etc. In a traditional relational
db there would be a join table containing the type of relationship as
well as foreign keys to both Programmer and Project. I would like to
run queries such as what projects does this programmer develop?
which loosely translates to the following SQL:

SELECT * FROM projects WHERE programmer.id ==
programmer_project.programmer_id  programmer_project.project_id ==
project.id  programmer_project.type == Develops  programmer.id
== thisProgrammerId;

So far, I gave up on the ManyToMany Mapper because I could not figure
out how to add an attribute to the join table. The join table seemed
to be hidden away.

What I have now is both Programmer and Project extending OneToMany,
where the many side is a ProgrammerProject class. Something like:

...
class Programmer extends LongKeyedMapper[Programmer] with
OneToMany[Long, Programmer] {
...
object programmerProjects extends MappedOneToMany(ProgrammerProject,
ProgrammerProject.programmer) with Owned[ProgrammerProject] with
Cascade[ProgrammerProject]
...
}

...
class Project extends LongKeyedMapper[Project] with OneToMany[Long,
Project] {
...
object programmerProjects extends MappedOneToMany(ProgrammerProject,
ProgrammerProject.project) with Owned[ProgrammerProject] with
Cascade[ProgrammerProject]
...
}

object RelationshipType extends Enumeration {
val Develops = new Val(1, Develops)
val Manages = new Val(2, Manages)
}
...
class ProgrammerProject extends LongKeyedMapper[ProgrammerProject] {
...
object relationshipType extends MappedEnum(this, RelationshipType)

object programmer extends LongMappedMapper(this, Programmmer)

object project extends LongMappedMapper(this, Project)
}


This arrangement isnt terrific, but it would be okay if I could
construct valid QueryParams. I would expect something like the
following to work:

Project.findAll(In(Project.id, ProgrammerProject.project,
  In(ProgrammerProject.programmer,
Programmer.id,
 By(ProgrammerProject.relationshipType,
RelationshipType.Develops

But it doesnt. Any advice would be most appreciated

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

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



[Lift] How do I add unique id to radio inputs for labels?

2010-03-10 Thread Strom
I'd like to add in an id attribute to my radio button inputs so I
can add labels.

Something like:
SHtml.radio(
  Opinons.elements.toList.map(_.toString),
opinion.map(_.toString),
selected = opinion( Box(Opinions.valueOf(selected)) ),
(id, /*I want a unique id here...preferably the key or
hashcode*/)
)

Thanks,
Strom

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



Re: [Lift] More dynamic Lift

2010-03-09 Thread Jeppe Nejsum Madsen
David Pollak feeder.of.the.be...@gmail.com writes:

 Folks,

 I spent today cracking the code on how to implement a more dynamic Lift
 development cycle.

Awesome!

 Specifically, I figured out how to support (during development mode)
 having changes in compiled code reflected in the running application.
 The change to your Lift app will be a change in how you do things in
 Boot.scala.  Basically, anything that could change between page loads
 will be wrapped as such in Boot:

 LiftRules.dynamicDevelopmentMode(List(com.liftcode.model,
 com.liftcode.lib))(() = {
   LiftRules.dispatch.append {...}

   LiftRules.setSiteMap()
 })

 The list is a list of packages to exclude from the dynamic reloading.
 Because schemification isn't going to happen on every page reload, it's best
 not to reload the models.

 The dynamic mode will impose the following limitations:

- Lift will only service one request at once in development mode

I think I can live with that

- Page loads in development mode will be 10x-50x slower than in
non-development mode

Is this always or just when code has changed? If always, this may be a
bit dramatic increase :-)
  
- Comet objects will not change once they've been instantiated -
There will cases where classes created in one classloader are not
recognized as the same class for casting and/or pattern matching
purposes if the classes are created across calls - There may be
problems related to running out of PermGen space because each page
reload will cause all the applications classes to be reloaded...
and this may happen faster than the classes are GCed.

 With those limitations, do you guys thing the feature would be
 valuable?

As the one who probably initiated this, yes :-) I'm still unsure about
how well it works in practice. Only time will tell. It looks like it
doesn't need JRebel, which I think many consider really useful for doing
rapid development. I wonder if page/loads etc can be improved if JRebel
was used?

I think the important part now is to get the ball rolling an try it out
in real life. If the model is sound, the implementation can be
improved


 Should it be part of development mode or should there be another demarcation
 of the dynamic reload mode?

On first look, it seems if one doesn't use dynamicDevelopmentMode there
are no drawbacks? If that's the case, I don't see the need for another
demarcation.

/Jeppe

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



[Lift] Re: RequestVar copy /clone ?

2010-03-09 Thread Marius
Is this currentClient(Full (c)), Text (Ajouter Facture)) called on
page X and ViewClient.add snippet on page Y?

If you want to preserve state between pages than you should use
SessionVars.

I don't know what Destination Post snippet means.

On Mar 9, 8:13 am, hexa hex...@gmail.com wrote:
 Hi,
   I have a RequestVar that I send to a snippet which will then do a
 post...

 But I would like the RequestVar to persist between the moment it it
 received in the post snippet and the post itself...

 The only way I found of doing it right now is like :

 Source Snippet :

 object ViewClient extends ViewClient

 class ViewClient
 {
   object currentClient extends RequestVar [Box [Client]] (Empty)

 bind  (...
   addInvoice - SHtml.link (/invoice/create, () = currentClient
 (Full (c)), Text (Ajouter Facture)))

 Destination Post Snippet :

 def add (inhtml: NodeSeq) : NodeSeq = {

     val inInvoice = Invoice.create
     val clientBox = ViewClient.currentClient

     val client_id = clientBox map (_.id.toLong)

     def processEntry () {
       Client.findByKey (client_id openOr 0) map (inInvoice.client (_))
       inInvoice.save
       S.notice (Entre : Description  + inInvoice.description + 
 Montant :  + inInvoice.amount)
     }

 bind (e, inhtml,
           description - inInvoice.description.toForm,
           amount - inInvoice.amount.toForm,
           submit - SHtml.submit (Ajouter Facture,  processEntry))

 If I try to access the clientBox in processEntry, even with the
 closure it should generate.. I get an empty box...

 Is there any way to copy / ref or anything or make a new RequestVar
 with a copy of the preceding one ?

 Would have been nice not to be obligated to do the client_id toLong
 code...
 And juste do inInvoice.client (client)  , inInvoice.save

 Thanks a lot

 hexa

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



Re: [Lift] More dynamic Lift

2010-03-09 Thread Francois Armand

Le 09/03/2010 01:51, David Pollak a écrit :

Folks,


[...]


With those limitations, do you guys thing the feature would be
valuable?  Should it be part of development mode or should there be
another demarcation of the dynamic reload mode?


There will always be limitation, and I think that everything allowing to 
move development cycle (especially at the beginning of a site or page) 
closer to change code - reload page in browser - view result is good.


Limitation have to be known and written down in some doc somewhere so 
that people why they get OOM erros, but as long as that is done, they 
are ok with me.


On the other hand, others spoke about JRebel. Perhaps it would be less 
impacting performance wise to write a Lift plugin for it ?


--
Francois Armand
http://fanf42.blogspot.com

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



Re: [Lift] Re: More dynamic Lift

2010-03-09 Thread Timothy Perrett
I'm afraid I agree with Marius... I'm just not sure on the benefit  
here over JRebel?


Cheers, Tim

Sent from my iPhone

On 9 Mar 2010, at 08:05, Marius marius.dan...@gmail.com wrote:


I'm having seconds thoughts about this. Development mode can mean
slightly different things depending on the nature of the application.
The things you enlisted are for me only PROS for not including this
feature.

Sorry but personally I don't see much value in this approach ... but
this doesn't mean other people wont. Yes JavaRebel is not perfect but
it does its job quite good and it is really helpful in most cases.

On Mar 9, 2:51 am, David Pollak feeder.of.the.be...@gmail.com wrote:

Folks,

I spent today cracking the code on how to implement a more  
dynamic Lift
development cycle.  Specifically, I figured out how to support  
(during
development mode) having changes in compiled code reflected in the  
running
application.  The change to your Lift app will be a change in how  
you do
things in Boot.scala.  Basically, anything that could change  
between page

loads will be wrapped as such in Boot:

LiftRules.dynamicDevelopmentMode(List(com.liftcode.model,
com.liftcode.lib))(() = {
  LiftRules.dispatch.append {...}

  LiftRules.setSiteMap()

})

The list is a list of packages to exclude from the dynamic reloading.
Because schemification isn't going to happen on every page reload,  
it's best

not to reload the models.

The dynamic mode will impose the following limitations:

   - Lift will only service one request at once in development mode
   - Page loads in development mode will be 10x-50x slower than in
   non-development mode
   - Comet objects will not change once they've been instantiated
   - There will cases where classes created in one classloader are  
not
   recognized as the same class for casting and/or pattern matching  
purposes if

   the classes are created across calls
   - There may be problems related to running out of PermGen space  
because
   each page reload will cause all the applications classes to be  
reloaded...

   and this may happen faster than the classes are GCed.

With those limitations, do you guys thing the feature would be  
valuable?
Should it be part of development mode or should there be another  
demarcation

of the dynamic reload mode?

Thanks,

David

--
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 lift...@googlegroups.com.
To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com 
.
For more options, visit this group at http://groups.google.com/group/liftweb?hl=en 
.





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



Re: [Lift] Re: More dynamic Lift

2010-03-09 Thread Jeppe Nejsum Madsen
On Tue, Mar 9, 2010 at 9:33 AM, Timothy Perrett timo...@getintheloop.eu wrote:
 I'm afraid I agree with Marius... I'm just not sure on the benefit here over
 JRebel?

My main pain point was changes to Sitemap. JRebel doesn't help you
here as it's fixed once Lift is booted...

/Jeppe

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



[Lift] field without mapper and Form validation

2010-03-09 Thread Francois

Hello guys,


I'm often using forms without anything to do persistence and RDBMS 
related, but I would like to be able to use Fields (StringField, 
EmailField, my owns, etc), validation, error management, etc. without 
having everything to manage by hand.


Actually, I would like to be able to use fields without backend but with 
all the domain - client part. Is it possible ?


I thought that wizards may have been the answer, but it seems that they 
use mappers.



In a second point, I would like to know if there is a way to have 
standard hooks defined along a form processing request, like onPrepare 
(init fields), onValidate (field cross validation), 
onFormSuccess/Error (clean error, field from session, save), etc, and 
with something to store validation errors.


How does Lift handle that ?  Perhaps it's just some convention to follow 
like prepare=snippet instanciation, validation=when the submit closure 
is called, onerror=if the error tracker object has registered errors, 
etc. If so what are the one you are following ?



Form handling, with validation, is a part that is still a little fuzzy 
for me, and I would love to have a more systematic way to handle it than 
in a case by case basis.


Thanks !

--
Francois ARMAND
http://fanf42.blogspot.com

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



Re: [Lift] Re: More dynamic Lift

2010-03-09 Thread Timothy Perrett

BTW, with SBT, don't forget you can do:

jetty-run
(make changes to your code)
prepare-webapp

That will redeploy chnaged files / classses to the running jetty  
instance so development with SBT can still be slick without  
javarebel :-)


Lift is really elegant - some how, this approach feels pretty ugly. I  
haven't looked at it, but no doubt it's using some classloader trickery?


Cheers, Tim

Sent from my iPhone


On 9 Mar 2010, at 10:45, Lukasz Kuczera kuk...@gmail.com wrote:


But on the other hand it happens not too often. I'm personally very
very happy with current productiveness using Lift + Jetty + JRebel.
But what happens when Zeroturnaround will turn back to Scala ? It is
quite possible that Scala will go mainstream. It might be viable
solution then.

Simple solution would be putting Menu building just before page
rendering in development mode. But i can live perfectly without that
as well (using JRebel).

On Mar 9, 9:37 am, Jeppe Nejsum Madsen je...@ingolfs.dk wrote:
On Tue, Mar 9, 2010 at 9:33 AM, Timothy Perrett  
timo...@getintheloop.eu wrote:
I'm afraid I agree with Marius... I'm just not sure on the benefit  
here over

JRebel?


My main pain point was changes to Sitemap. JRebel doesn't help you
here as it's fixed once Lift is booted...
/Jeppe


--
You received this message because you are subscribed to the Google  
Groups Lift group.

To post to this group, send email to lift...@googlegroups.com.
To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com 
.
For more options, visit this group at http://groups.google.com/group/liftweb?hl=en 
.





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



[Lift] Re: How to use lazy-load?

2010-03-09 Thread Marius
I assume you are using Lift from master ...

lazy-load should be able to wrap anything. I'll try to put in some
ajaxSelects to see if I can repro.

On Mar 8, 10:54 pm, Jeppe Nejsum Madsen je...@ingolfs.dk wrote:
 On Mon, Mar 8, 2010 at 5:42 PM, Marius marius.dan...@gmail.com wrote:
  Can you please send me a minimalistic example ? .. The comet actor
  shutdown looks correct to me as after the lazy content is rendered
  that comet is not needed anymore.

 Not easily. When I get some time I'll see if I can reproduce it in a sample.

  Can you check with firebug if you get any asynchronous javascript back
  from the comet request?

 It looks a bit strange. The normal request (with not lazy load) is
 about 3s. With the lazy load the comet request is almost 60s before
 anything (not the correct content) is returned (timed out?)

 Hold on! I did some more digging :-) Since this was just a naive
 application of lazy-load around an existing snippet, it contained bind
 with a few ajaxSelects inside. It seems this is what caused the
 problems. If I remove the ajaxSelects it seems to work.

 Not sure if this is a supported scenario or not, but if not we should
 probably emit some notification when running in dev mode.or at
 least document what can be put inside lazy-load

 /Jeppe

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



[Lift] Re: RequestVar copy /clone ?

2010-03-09 Thread Lukasz Kuczera
IMHO you have three options:
1. Use statefull snippet
2. Use SessionVar.
3. User RequestVar.

I went for third option. Because I don't need to retain this value
between multiple requests.

In my code i use something like:
object Index {
object postidVar extends RequestVar(S.param(postid).map(_.toLong)
openOr 0L)
def postid: Long = postidVar.is
}

This gives me global access to RequestVar. Then i use it with
something like:
/**
 * Renders post in details.
 * @param in
 * @return
 */
def show(in: NodeSeq): NodeSeq = {
Post.find(Index.postid) match {
case Full(post) = bind(post,in,
title-post.title,
text - post.text,
date - (new SimpleDateFormat(Const.format) 
format
post.date.get))

case Empty = Text(No such post)
case Failure(_,_,_) = S.redirectTo(/failure.html)
}
}

I set it with:

if(User.loggedIn_?) SHtml.link(/edit, ()= Index.postidVar(post.id),
Text(Edit))  else Text()

Or with:

SHtml.link(/details.html,()=Index.postidVar(post.id),Text(Read
more))

And in another snipped I use it like:

def edit(in: NodeSeq): NodeSeq = {
var title = 
var text = 
var tags = 
var post = Post.find(Index.postid)

def submit() = {
if(title==) S.error(Title musn't be empty)
else {
post.open_!.title(title).text(text).save
S.redirectTo(/index)
}
}
post match {
case Full(p) = bind(post,in,
title - SHtml.text(p.title, parm = 
title=parm,
(size,55)),
tags - SHtml.text(, parm = 
tags=parm),
text - SHtml.textarea(p.text, parm 
= text=parm),
submit - SHtml.submit(Save, submit)
)
case Empty = S.error(Post to edit not found); 
S.redirectTo(/
index)
}

You can check the code here:
http://github.com/kukems/lift-blog


What i would suggest to change clientBox definition from
object currentClient extends RequestVar [Box [Client]] (Empty)
to:
object currentClient extends
RequestVar(S.param(client_id).map(_.toLong) openOr -1L)

I assume that you don't have anything in database that match Client.id
== -1

Then you can use currentClient as:
Client findByKey currentClient.is map inInvoice.client (_)

On Mar 9, 7:13 am, hexa hex...@gmail.com wrote:
 Hi,
   I have a RequestVar that I send to a snippet which will then do a
 post...

 But I would like the RequestVar to persist between the moment it it
 received in the post snippet and the post itself...

 The only way I found of doing it right now is like :

 Source Snippet :

 object ViewClient extends ViewClient

 class ViewClient
 {
   object currentClient extends RequestVar [Box [Client]] (Empty)

 bind  (...
   addInvoice - SHtml.link (/invoice/create, () = currentClient
 (Full (c)), Text (Ajouter Facture)))

 Destination Post Snippet :

 def add (inhtml: NodeSeq) : NodeSeq = {

     val inInvoice = Invoice.create
     val clientBox = ViewClient.currentClient

     val client_id = clientBox map (_.id.toLong)

     def processEntry () {
       Client.findByKey (client_id openOr 0) map (inInvoice.client (_))
       inInvoice.save
       S.notice (Entre : Description  + inInvoice.description + 
 Montant :  + inInvoice.amount)
     }

 bind (e, inhtml,
           description - inInvoice.description.toForm,
           amount - inInvoice.amount.toForm,
           submit - SHtml.submit (Ajouter Facture,  processEntry))

 If I try to access the clientBox in processEntry, even with the
 closure it should generate.. I get an empty box...

 Is there any way to copy / ref or anything or make a new RequestVar
 with a copy of the preceding one ?

 Would have been nice not to be obligated to do the client_id toLong
 code...
 And juste do inInvoice.client (client)  , inInvoice.save

You have to check it because it might be null/empty. Lift can't figure
out what to do when there is no value inside the Box. In Java typical
idiom is to return null which impose getting NullPointerException at
some point OR checking explicitly for null value which you do exactly
with openOr method.

 Thanks a lot

 hexa

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



Re: [Lift] Re: More dynamic Lift

2010-03-09 Thread Jeppe Nejsum Madsen
On Tue, Mar 9, 2010 at 12:08 PM, Timothy Perrett
timo...@getintheloop.eu wrote:
 BTW, with SBT, don't forget you can do:

 jetty-run
 (make changes to your code)
 prepare-webapp

 That will redeploy chnaged files / classses to the running jetty instance so
 development with SBT can still be slick without javarebel :-)

But still this doesn't address the problem (I think?) of changing
things in Boot. Maybe I code differently from everybody else, but when
iterating new features, I always end up making lots of changes to
Sitemap. And afaik everyone of those changes requires a restart

For the rest I agree JRebel fits quite nicely (it does have it's
problems as David points out)

/Jeppe

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



[Lift] Re: More dynamic Lift

2010-03-09 Thread Lukasz Kuczera
But on the other hand it happens not too often. I'm personally very
very happy with current productiveness using Lift + Jetty + JRebel.
But what happens when Zeroturnaround will turn back to Scala ? It is
quite possible that Scala will go mainstream. It might be viable
solution then.

Simple solution would be putting Menu building just before page
rendering in development mode. But i can live perfectly without that
as well (using JRebel).

On Mar 9, 9:37 am, Jeppe Nejsum Madsen je...@ingolfs.dk wrote:
 On Tue, Mar 9, 2010 at 9:33 AM, Timothy Perrett timo...@getintheloop.eu 
 wrote:
  I'm afraid I agree with Marius... I'm just not sure on the benefit here over
  JRebel?

 My main pain point was changes to Sitemap. JRebel doesn't help you
 here as it's fixed once Lift is booted...
 /Jeppe

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



[Lift] Re: Issue, The URL params can't contains ? ****

2010-03-09 Thread Neil.Lv

 I want get the these strings ( http://test.com/file.zip12345678 )
from the
 URL (http://localhost:8080/download.html?link=http://test.com/
file.zip12345678)



 Thanks very much!

Cheers,
  Neil





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



[Lift] Issue, The URL params can't contains ? ****

2010-03-09 Thread Neil.Lv
Hi all,

  I have a silly question about the URL rewrite .

  How to let the URL params can contains the  character.

  Here is the code:

###  The url rewrite.
case RewriteRequest(
   ParsePath(List(download,  link), html, _, _),
 GetRequest, _) =
   RewriteResponse(List(download),
 Map(link - link))
###

  When i input this link and get these value that the link param can't
contains the  char.
http://localhost:8080/download.html?link=http://test.com/file.zip12345678

  The link param is:  (that doesn't contains the  char  in the param)
  S.param(link)
  = http://test.com/file.zip

  So how can i get the 12345678 value from the link param ?

  Maybe the URL rewrite is not correctly ?

  Thanks for any help!

Cheers,
  Neil

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



Re: [Lift] Re: RequestVar copy /clone ?

2010-03-09 Thread Naftoli Gugenheim
Redirect means the destination will execute in another request.
However, redirectTo takes, as an optional second parameter, a function to 
execute in that new request. So try setting the RequestVar there.

-
Lukasz Kuczerakuk...@gmail.com wrote:

IMHO you have three options:
1. Use statefull snippet
2. Use SessionVar.
3. User RequestVar.

I went for third option. Because I don't need to retain this value
between multiple requests.

In my code i use something like:
object Index {
object postidVar extends RequestVar(S.param(postid).map(_.toLong)
openOr 0L)
def postid: Long = postidVar.is
}

This gives me global access to RequestVar. Then i use it with
something like:
/**
 * Renders post in details.
 * @param in
 * @return
 */
def show(in: NodeSeq): NodeSeq = {
Post.find(Index.postid) match {
case Full(post) = bind(post,in,
title-post.title,
text - post.text,
date - (new SimpleDateFormat(Const.format) 
format
post.date.get))

case Empty = Text(No such post)
case Failure(_,_,_) = S.redirectTo(/failure.html)
}
}

I set it with:

if(User.loggedIn_?) SHtml.link(/edit, ()= Index.postidVar(post.id),
Text(Edit))  else Text()

Or with:

SHtml.link(/details.html,()=Index.postidVar(post.id),Text(Read
more))

And in another snipped I use it like:

def edit(in: NodeSeq): NodeSeq = {
var title = 
var text = 
var tags = 
var post = Post.find(Index.postid)

def submit() = {
if(title==) S.error(Title musn't be empty)
else {
post.open_!.title(title).text(text).save
S.redirectTo(/index)
}
}
post match {
case Full(p) = bind(post,in,
title - SHtml.text(p.title, parm = 
title=parm,
(size,55)),
tags - SHtml.text(, parm = 
tags=parm),
text - SHtml.textarea(p.text, parm 
= text=parm),
submit - SHtml.submit(Save, submit)
)
case Empty = S.error(Post to edit not found); 
S.redirectTo(/
index)
}

You can check the code here:
http://github.com/kukems/lift-blog


What i would suggest to change clientBox definition from
object currentClient extends RequestVar [Box [Client]] (Empty)
to:
object currentClient extends
RequestVar(S.param(client_id).map(_.toLong) openOr -1L)

I assume that you don't have anything in database that match Client.id
== -1

Then you can use currentClient as:
Client findByKey currentClient.is map inInvoice.client (_)

On Mar 9, 7:13 am, hexa hex...@gmail.com wrote:
 Hi,
   I have a RequestVar that I send to a snippet which will then do a
 post...

 But I would like the RequestVar to persist between the moment it it
 received in the post snippet and the post itself...

 The only way I found of doing it right now is like :

 Source Snippet :

 object ViewClient extends ViewClient

 class ViewClient
 {
   object currentClient extends RequestVar [Box [Client]] (Empty)

 bind  (...
   addInvoice - SHtml.link (/invoice/create, () = currentClient
 (Full (c)), Text (Ajouter Facture)))

 Destination Post Snippet :

 def add (inhtml: NodeSeq) : NodeSeq = {

     val inInvoice = Invoice.create
     val clientBox = ViewClient.currentClient

     val client_id = clientBox map (_.id.toLong)

     def processEntry () {
       Client.findByKey (client_id openOr 0) map (inInvoice.client (_))
       inInvoice.save
       S.notice (Entre : Description  + inInvoice.description + 
 Montant :  + inInvoice.amount)
     }

 bind (e, inhtml,
           description - inInvoice.description.toForm,
           amount - inInvoice.amount.toForm,
           submit - SHtml.submit (Ajouter Facture,  processEntry))

 If I try to access the clientBox in processEntry, even with the
 closure it should generate.. I get an empty box...

 Is there any way to copy / ref or anything or make a new RequestVar
 with a copy of the preceding one ?

 Would have been nice not to be obligated to do the client_id toLong
 code...
 And juste do inInvoice.client (client)  , inInvoice.save

You have to check it because it might be null/empty. Lift can't figure
out what to do when there is no value inside the Box. In Java typical
idiom is to return null which impose getting NullPointerException at
some point OR checking explicitly for null value which you do exactly
with openOr method.

 Thanks a lot

 hexa

-- 
You received this message because you

Re: [Lift] Re: More dynamic Lift

2010-03-09 Thread Naftoli Gugenheim
If the sitemap could be specified as a function JRebel could reload it.
One approach is along the lines that setSiteMap could be passed a function e.g. 
()=List[Menu]. In production mode the return value may or may not be cached.
Another approach is to have an optional method in Boot called say buildSiteMap. 
If it's not defined you can build it imperatively in def boot. Or you can 
define buildSiteMap. In development mode it would be called on every page load. 
In production mode it could either be called once, or it could be called every 
time.
Personally I see value in a dynamic, functional sitemap even in production, but 
it may impact performance (or not).


-
Jeppe Nejsum Madsenje...@ingolfs.dk wrote:

On Tue, Mar 9, 2010 at 12:08 PM, Timothy Perrett
timo...@getintheloop.eu wrote:
 BTW, with SBT, don't forget you can do:

 jetty-run
 (make changes to your code)
 prepare-webapp

 That will redeploy chnaged files / classses to the running jetty instance so
 development with SBT can still be slick without javarebel :-)

But still this doesn't address the problem (I think?) of changing
things in Boot. Maybe I code differently from everybody else, but when
iterating new features, I always end up making lots of changes to
Sitemap. And afaik everyone of those changes requires a restart

For the rest I agree JRebel fits quite nicely (it does have it's
problems as David points out)

/Jeppe

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

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



[Lift] Re: Issue, The URL params can't contains ? ****

2010-03-09 Thread Neil.Lv


On Mar 9, 9:56 pm, Marius marius.dan...@gmail.com wrote:
 You need to do URL encoding first. Helpers.urlEcnode(str) does this.


  case RewriteRequest(
   ParsePath(List(download,  link), html, _, _),
 GetRequest, _) =
   RewriteResponse(List(download),
 Map(link -  Helpers.urlEncode(link) ))

   I add this code in here, but it doesn't work too.

   S.param(link)
  = Full(http://test.com/file.zip)

  Thanks!


Cheers,
  Neil

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



Re: [Lift] Converting a null String to an empty String

2010-03-09 Thread Naftoli Gugenheim
There was one in MappedString, but I think DPP's recent refactoring of common 
utilities for mapper etc. put it somewhere else (additionally, I assume).

-
Heiko Seebergerheiko.seeber...@googlemail.com wrote:

Hi,

I am pretty sure there is a method somewhere converting a null String to an
empty String. But I have not found it yet ...

Thanks,

Heiko

Company: weiglewilczek.com
Blog: heikoseeberger.name
Follow me: twitter.com/hseeberger
OSGi on Scala: scalamodules.org
Lift, the simply functional web framework: liftweb.net

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

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



Re: [Lift] Converting a null String to an empty String

2010-03-09 Thread David Pollak
Can you be a little more specific?  Are you saying that if you have a variable 
of type String that is a null reference that in certain cases, when that 
variable is in an xml literal, it becomes a zero length item, a Text(), or 
something else?

Sorry for being pedantic, but I'm trying to understand both how to reproduce 
the issue and what you expect to happen.  Thanks

Connected by MOTOBLUR™ on T-Mobile

-Original message-
From: Heiko Seeberger heiko.seeber...@googlemail.com
To: liftweb liftweb@googlegroups.com
Sent: Tue, Mar 9, 2010 15:26:53 GMT+00:00
Subject: [Lift] Converting a null String to an empty String

Hi,

I am pretty sure there is a method somewhere converting a null String to an
empty String. But I have not found it yet ...

Thanks,

Heiko

Company: weiglewilczek.com
Blog: heikoseeberger.name
Follow me: twitter.com/hseeberger
OSGi on Scala: scalamodules.org
Lift, the simply functional web framework: liftweb.net

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

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



Re: [Lift] Trouble with lift-couchdb

2010-03-09 Thread Craig Blake
That took care of the compile issues.  Thanks, Ross.

Craig

On Mar 8, 2010, at 11:05 PM, Ross Mellgren wrote:

 So I looked into this as best I could and it seems to be a type inference 
 error where the compiler is inferring a too-loose type binding for EnumType 
 and therefore rejecting the assignment to a (supposedly) more specific 
 Box[TestEnum.Value].
 
 I have no idea how to fix the code so it deduces the correct type or if I've 
 diagnosed the problem incorrectly; however, you can force the type:
 
 object testEnum extends JSONEnumNameField[Settings, TestEnum.type](this, 
 TestEnum)
 
 and that seems to make it happy. I tried this with 2.8.0.Beta1 also and it 
 appears that it also rejects it.
 
 -Ross
 
 
 On Mar 8, 2010, at 11:05 AM, Craig Blake wrote:
 
 Writing into the database with the new field type works fine, but I'm 
 running into a little hitch trying to access the value.  Given the test code 
 (again this is in the Github test project, 
 g...@github.com:craigwblake/lift-couchdb-test.git):
 
  object TestEnum extends Enumeration { val One = Value( One)}
 
  object Settings extends Settings with CouchMetaRecord[ Settings]
  class Settings extends CouchRecord[ Settings] {
  def meta = Settings
  object testEnum extends JSONEnumNameField( this, TestEnum)
  }
 
  val settings = Settings.fetch( id).open_!
  val testEnum: TestEnum.Value = settings.testEnum.valueBox.open_!
 
 
 Results in a compilation error:
 
  [ERROR] /lift-couchdb-test/src/main/scala/test/Testing.scala:24: error: 
 type mismatch;
  [INFO]  found   : settings.testEnum.MyType
  [INFO]  required: test.TestEnum.Value
  [INFO]  val testEnum: TestEnum.Value = 
 settings.testEnum.valueBox.open_!
 
 Any ideas?
 
 Thanks,
 Craig
 
 On Mar 3, 2010, at 8:39 PM, Ross Mellgren wrote:
 
 Try this:
 
 /** Enum data field for JSON records. Encodes as JString */
 class JSONEnumNameField[OwnerType : JSONRecord[OwnerType], EnumType : 
 Enumeration]
 (rec: OwnerType, enum: EnumType)(implicit 
 enumValueType: Manifest[EnumType#Value])
 extends EnumField[OwnerType, EnumType](rec, enum) with JSONField
 {
 def this(rec: OwnerType, enum: EnumType, value: EnumType#Value)(implicit 
 enumValueType: Manifest[EnumType#Value]) = {
this(rec, enum)
set(value)
 }
 
 def this(rec: OwnerType, enum: EnumType, value: 
 Box[EnumType#Value])(implicit enumValueType: Manifest[EnumType#Value]) = {
this(rec, enum)
setBox(value)
 }
 
 def asJValue: JValue = valueBox.map(v = JString(v.toString)) openOr 
 (JNothing: JValue)
 def fromJValue(jvalue: JValue): Box[EnumType#Value] = jvalue match {
  case JNothing|JNull if optional_? = setBox(Empty)
  case JString(s)   = setBox(enum.valueOf(s) ?~ (Unknown 
 value \ + s + \))
  case other= setBox(expectedA(JString, other))
 }
 }
 
 Let me know if it works for you. If so, I'll start the process of getting 
 it into master as soon as I can.
 
 -Ross
 
 On Mar 3, 2010, at 8:12 PM, Craig Blake wrote:
 
 Sure, will do.  The only thing I think I'll need to figure out is how to 
 persist an enumeration by name rather than ordinal value, but I imagine 
 that it should be pretty straight-forward to add a new field type in my 
 app to handle it.
 
 Thanks,
 Craig
 
 On Mar 3, 2010, at 7:45 PM, Ross Mellgren wrote:
 
 It's no problem, as I mentioned the compiler error is practically useless.
 
 Hope you get along well, let me know if you have any other issues.
 
 -Ross
 
 On Mar 3, 2010, at 7:29 PM, Craig Blake wrote:
 
 Yep, that seems to be better.  Sorry for the noise, I don't know why I 
 didn't think to check that.
 
 Thanks for the quick answer.
 
 Craig
 
 On Mar 3, 2010, at 4:44 PM, Ross Mellgren wrote:
 
 Unfortunately the compiler error is bizarre (due to some of the type 
 shuffling involved), but the underlying problem you're experiencing is 
 that DateTimeFields (and therefore JSONDateTimeFields) have a storage 
 type of Calendar, and you're trying to assign a Date to them. Try 
 Calendar.getInstance instead of new Date() and see if that resolves it 
 for you?
 
 -Ross
 
 On Mar 3, 2010, at 4:32 PM, Craig Blake wrote:
 
 Hi,
 
 I am getting familiar with the lift-couchdb module, and trying to put 
 together a sample based on the tests in the module.  Trying to create 
 a record, based on this test code:
 
 def testRec1: Person = Person.createRecord.name(Alice).age(25)
 
 this is what I have:
 
 class Account extends CouchRecord[Account] {
def meta = Account
object created extends JSONDateTimeField(this)
 }
 object Account extends Account with CouchMetaRecord[Account]
 
 ...
 
 val account = Account.createRecord.created(new Date())
 
 
 I get a compilation error:
 
 [WARNING] Test.scala:44: error: overloaded method value apply with 
 alternatives ((net.liftweb.common.Box[_12.MyType])test.Account) 
 forSome { val _12: object test.Account#created } and 
 ((_13

Re: [Lift] Re: More dynamic Lift

2010-03-09 Thread Timothy Perrett
No it doesn't work for sitemap... as thats loaded at boot only ;-) My point was 
that it can still be a good experience without JR for our users.

Interesting what you were saying about your dev style... i'm usually the other 
way around and implement sitemap last as I see it as a concrete setting of my 
content.

Cheers, Tim


On 9 Mar 2010, at 11:20, Jeppe Nejsum Madsen wrote:

 On Tue, Mar 9, 2010 at 12:08 PM, Timothy Perrett
 timo...@getintheloop.eu wrote:
 BTW, with SBT, don't forget you can do:
 
 jetty-run
 (make changes to your code)
 prepare-webapp
 
 That will redeploy chnaged files / classses to the running jetty instance so
 development with SBT can still be slick without javarebel :-)
 
 But still this doesn't address the problem (I think?) of changing
 things in Boot. Maybe I code differently from everybody else, but when
 iterating new features, I always end up making lots of changes to
 Sitemap. And afaik everyone of those changes requires a restart
 
 For the rest I agree JRebel fits quite nicely (it does have it's
 problems as David points out)
 
 /Jeppe
 
 -- 
 You received this message because you are subscribed to the Google Groups 
 Lift group.
 To post to this group, send email to lift...@googlegroups.com.
 To unsubscribe from this group, send email to 
 liftweb+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/liftweb?hl=en.
 
 

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



Re: [Lift] Re: Issue, The URL params can't contains ? ****

2010-03-09 Thread Naftoli Gugenheim
I think he means he wants to access query parameters.

-
Mariusmarius.dan...@gmail.com wrote:

You need to do URL encoding first. Helpers.urlEcnode(str) does this.

On Mar 9, 3:47 pm, Neil.Lv anim...@gmail.com wrote:
 Hi all,

   I have a silly question about the URL rewrite .

   How to let the URL params can contains the  character.

   Here is the code:

 ###  The url rewrite.
             case RewriteRequest(
                    ParsePath(List(download,  link), html, _, _),
                      GetRequest, _) =
                    RewriteResponse(List(download),
                      Map(link - link))
 ###

   When i input this link and get these value that the link param can't
 contains the  
 char.http://localhost:8080/download.html?link=http://test.com/file.zip123...

   The link param is:  (that doesn't contains the  char  in the param)
   S.param(link)
   =http://test.com/file.zip

   So how can i get the 12345678 value from the link param ?

   Maybe the URL rewrite is not correctly ?

   Thanks for any help!

 Cheers,
   Neil

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

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



[Lift] Re: Issue, The URL params can't contains ? ****

2010-03-09 Thread Marius
You need to do URL encoding first. Helpers.urlEcnode(str) does this.

On Mar 9, 3:47 pm, Neil.Lv anim...@gmail.com wrote:
 Hi all,

   I have a silly question about the URL rewrite .

   How to let the URL params can contains the  character.

   Here is the code:

 ###  The url rewrite.
             case RewriteRequest(
                    ParsePath(List(download,  link), html, _, _),
                      GetRequest, _) =
                    RewriteResponse(List(download),
                      Map(link - link))
 ###

   When i input this link and get these value that the link param can't
 contains the  
 char.http://localhost:8080/download.html?link=http://test.com/file.zip123...

   The link param is:  (that doesn't contains the  char  in the param)
   S.param(link)
   =http://test.com/file.zip

   So how can i get the 12345678 value from the link param ?

   Maybe the URL rewrite is not correctly ?

   Thanks for any help!

 Cheers,
   Neil

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



Re: [Lift] Re: field without mapper and Form validation

2010-03-09 Thread Jeppe Nejsum Madsen
On Tue, Mar 9, 2010 at 3:17 PM, Francois fan...@gmail.com wrote:
 Le 09/03/2010 10:12, Francois a écrit :

 Hello guys,


 I'm often using forms without anything to do persistence and RDBMS
 related, but I would like to be able to use Fields (StringField,
 EmailField, my owns, etc), validation, error management, etc. without
 having everything to manage by hand.


 After searching more carefully on the mailing list archive, it seems that
 what I'm looking for is something like a mix of one-page wizard with
 Record/Mapper fields integration (or fields that are currently in
 Record/Mapper/Wizard may live in there own package and only manage the
 domain/client part ?)

 Relevant threads:
 - http://old.nabble.com/Multipage-wizards-td26504293.html (especially Jeppe
 answer)
 -
 http://old.nabble.com/Lift-Wizard-Fields-incompatible-with-lift-record-fields-tc27230782.html


 So, I'm going to see how wizards are working,

Cool, let me know how it works. As you noted, I basically have the
same needs, but haven't started to  look into this yet :-)

I saw the Lift example now includes a one page form (based on
wizards): http://demo.liftweb.net/simple_screen

/Jeppe

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



[Lift] Re: More dynamic Lift

2010-03-09 Thread Marius


On Mar 9, 1:08 pm, Timothy Perrett timo...@getintheloop.eu wrote:
 BTW, with SBT, don't forget you can do:

 jetty-run
 (make changes to your code)
 prepare-webapp

 That will redeploy chnaged files / classses to the running jetty  
 instance so development with SBT can still be slick without  
 javarebel :-)

 Lift is really elegant - some how, this approach feels pretty ugly. I  
 haven't looked at it, but no doubt it's using some classloader trickery?

Of course this is why one can get into cast failures as
ProtectionDomain may change. I haven't seen Dave's code so he can
provide more details of what he did.


 Cheers, Tim

 Sent from my iPhone

 On 9 Mar 2010, at 10:45, Lukasz Kuczera kuk...@gmail.com wrote:



  But on the other hand it happens not too often. I'm personally very
  very happy with current productiveness using Lift + Jetty + JRebel.
  But what happens when Zeroturnaround will turn back to Scala ? It is
  quite possible that Scala will go mainstream. It might be viable
  solution then.

  Simple solution would be putting Menu building just before page
  rendering in development mode. But i can live perfectly without that
  as well (using JRebel).

  On Mar 9, 9:37 am, Jeppe Nejsum Madsen je...@ingolfs.dk wrote:
  On Tue, Mar 9, 2010 at 9:33 AM, Timothy Perrett  
  timo...@getintheloop.eu wrote:
  I'm afraid I agree with Marius... I'm just not sure on the benefit  
  here over
  JRebel?

  My main pain point was changes to Sitemap. JRebel doesn't help you
  here as it's fixed once Lift is booted...
  /Jeppe

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

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



[Lift] Re: field without mapper and Form validation

2010-03-09 Thread Francois

Le 09/03/2010 10:12, Francois a écrit :

Hello guys,


I'm often using forms without anything to do persistence and RDBMS
related, but I would like to be able to use Fields (StringField,
EmailField, my owns, etc), validation, error management, etc. without
having everything to manage by hand.



After searching more carefully on the mailing list archive, it seems 
that what I'm looking for is something like a mix of one-page wizard 
with Record/Mapper fields integration (or fields that are currently in 
Record/Mapper/Wizard may live in there own package and only manage the 
domain/client part ?)


Relevant threads:
- http://old.nabble.com/Multipage-wizards-td26504293.html (especially 
Jeppe answer)
- 
http://old.nabble.com/Lift-Wizard-Fields-incompatible-with-lift-record-fields-tc27230782.html



So, I'm going to see how wizards are working,

Thanks,
--
Francois ARMAND
http://fanf42.blogspot.com

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



[Lift] Converting a null String to an empty String

2010-03-09 Thread Heiko Seeberger
Hi,

I am pretty sure there is a method somewhere converting a null String to an
empty String. But I have not found it yet ...

Thanks,

Heiko

Company: weiglewilczek.com
Blog: heikoseeberger.name
Follow me: twitter.com/hseeberger
OSGi on Scala: scalamodules.org
Lift, the simply functional web framework: liftweb.net

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



[Lift] Re: How to use lazy-load?

2010-03-09 Thread Marius
Dear Jeppe,

I spent some time today in looking to your issue. I was able to
reproduce. The problem was that a NPE was thrown as the S,functionsMap
was not initialized as I was doing a light S init to capture original
request state. I have a fix for it but I need to do some more testing
on it first.

I'll open a ticket for this.

Br's,
Marius

On Mar 9, 1:21 pm, Marius marius.dan...@gmail.com wrote:
 I assume you are using Lift from master ...

 lazy-load should be able to wrap anything. I'll try to put in some
 ajaxSelects to see if I can repro.

 On Mar 8, 10:54 pm, Jeppe Nejsum Madsen je...@ingolfs.dk wrote:



  On Mon, Mar 8, 2010 at 5:42 PM, Marius marius.dan...@gmail.com wrote:
   Can you please send me a minimalistic example ? .. The comet actor
   shutdown looks correct to me as after the lazy content is rendered
   that comet is not needed anymore.

  Not easily. When I get some time I'll see if I can reproduce it in a sample.

   Can you check with firebug if you get any asynchronous javascript back
   from the comet request?

  It looks a bit strange. The normal request (with not lazy load) is
  about 3s. With the lazy load the comet request is almost 60s before
  anything (not the correct content) is returned (timed out?)

  Hold on! I did some more digging :-) Since this was just a naive
  application of lazy-load around an existing snippet, it contained bind
  with a few ajaxSelects inside. It seems this is what caused the
  problems. If I remove the ajaxSelects it seems to work.

  Not sure if this is a supported scenario or not, but if not we should
  probably emit some notification when running in dev mode.or at
  least document what can be put inside lazy-load

  /Jeppe

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



[Lift] Re: RequestVar copy /clone ?

2010-03-09 Thread Lukasz Kuczera
Ok i think I see the bug. It is the magic which i don't understand
yet that if you change your client_id from val to var it will be auto
promoted into Heap and live out Snippet. Try this out.

Change:
val client_id = clientBox map (_.id.toLong)
To:
var client_id = clientBox map (_.id.toLong)

On Mar 9, 3:34 pm, hexa hex...@gmail.com wrote:
 Hi, thanks for the suggestions I like that match  {} code.. will try
 that..

 But what you suggest but the post_id is similar to what I'm doing
 now.. since this id is a long it will be copied by value
 and I can pass it to multiple requests using a closure...

 I'll try to clarify a bit :

 A have  a ViewClient snippet and an AddInvoice snippet

 In the ViewClient I add the action AddInvoice  which must be bound to
 a client..

 Now passing the client to the AddInvoice form is ok .. I can send the
 whole client object to the form snippet using a RequestVar..
 which I find kinda neet not having to go trough thoses ids... (maybe
 i'm wrong thinking that)

 But the trick is now that i'm in the AddInvoice snipped and that I
 have my RequestVar...

 I would like to form a closure on it.. an keep it for the post request
 so that it gets to ProcesssEntry and I do just :

 inInvoice.client (client)
 inInvoice.save

 As so no ids are involved...

 I would need to make a new RequestVar for the post submit with a copy
 of the input RequestVar I got in the AddInvoice from the ViewClient
 snippet

 But a SessionVar is out it's way overkill and a statefull snippet
 might be an idea ... would the RequestVar persist in the statefull
 snippet?

 Also I'm having trouble understanding how that scoping is done for the
 RequestVar if anyone could shed some light on it... like why a closure
 won't ref it... (I'm new to scala)

 Thanks

 hexa


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



[Lift] Re: RequestVar copy /clone ?

2010-03-09 Thread hexa
Hi, thanks for the suggestions I like that match  {} code.. will try
that..

But what you suggest but the post_id is similar to what I'm doing
now.. since this id is a long it will be copied by value
and I can pass it to multiple requests using a closure...

I'll try to clarify a bit :

A have  a ViewClient snippet and an AddInvoice snippet

In the ViewClient I add the action AddInvoice  which must be bound to
a client..

Now passing the client to the AddInvoice form is ok .. I can send the
whole client object to the form snippet using a RequestVar..
which I find kinda neet not having to go trough thoses ids... (maybe
i'm wrong thinking that)

But the trick is now that i'm in the AddInvoice snipped and that I
have my RequestVar...

I would like to form a closure on it.. an keep it for the post request
so that it gets to ProcesssEntry and I do just :

inInvoice.client (client)
inInvoice.save

As so no ids are involved...

I would need to make a new RequestVar for the post submit with a copy
of the input RequestVar I got in the AddInvoice from the ViewClient
snippet

But a SessionVar is out it's way overkill and a statefull snippet
might be an idea ... would the RequestVar persist in the statefull
snippet?

Also I'm having trouble understanding how that scoping is done for the
RequestVar if anyone could shed some light on it... like why a closure
won't ref it... (I'm new to scala)

Thanks

hexa


On Mar 9, 6:21 am, Lukasz Kuczera kuk...@gmail.com wrote:
 IMHO you have three options:
 1. Use statefull snippet
 2. Use SessionVar.
 3. User RequestVar.

 I went for third option. Because I don't need to retain this value
 between multiple requests.

 In my code i use something like:
 object Index {
         object postidVar extends RequestVar(S.param(postid).map(_.toLong)
 openOr 0L)
         def postid: Long = postidVar.is

 }

 This gives me global access to RequestVar. Then i use it with
 something like:
         /**
          * Renders post in details.
          * @param in
          * @return
          */
         def show(in: NodeSeq): NodeSeq = {
                 Post.find(Index.postid) match {
                         case Full(post) = bind(post,in,
                                 title-post.title,
                                 text - post.text,
                                 date - (new SimpleDateFormat(Const.format) 
 format
 post.date.get))

                         case Empty = Text(No such post)
                         case Failure(_,_,_) = S.redirectTo(/failure.html)
                 }
         }

 I set it with:

 if(User.loggedIn_?) SHtml.link(/edit, ()= Index.postidVar(post.id),
 Text(Edit))  else Text()

 Or with:

 SHtml.link(/details.html,()=Index.postidVar(post.id),Text(Read
 more))

 And in another snipped I use it like:

         def edit(in: NodeSeq): NodeSeq = {
                 var title = 
                 var text = 
                 var tags = 
                 var post = Post.find(Index.postid)

                 def submit() = {
                         if(title==) S.error(Title musn't be empty)
                         else {
                                 post.open_!.title(title).text(text).save
                                 S.redirectTo(/index)
                         }
                 }
                 post match {
                         case Full(p) = bind(post,in,
                                         title - SHtml.text(p.title, parm 
 = title=parm,
 (size,55)),
                                         tags - SHtml.text(, parm = 
 tags=parm),
                                         text - SHtml.textarea(p.text, parm 
 = text=parm),
                                         submit - SHtml.submit(Save, 
 submit)
                                         )
                         case Empty = S.error(Post to edit not found); 
 S.redirectTo(/
 index)
                 }

 You can check the code here:http://github.com/kukems/lift-blog

 What i would suggest to change clientBox definition from
 object currentClient extends RequestVar [Box [Client]] (Empty)
 to:
 object currentClient extends
 RequestVar(S.param(client_id).map(_.toLong) openOr -1L)

 I assume that you don't have anything in database that match Client.id
 == -1

 Then you can use currentClient as:
 Client findByKey currentClient.is map inInvoice.client (_)

 On Mar 9, 7:13 am, hexa hex...@gmail.com wrote:



  Hi,
    I have a RequestVar that I send to a snippet which will then do a
  post...

  But I would like the RequestVar to persist between the moment it it
  received in the post snippet and the post itself...

  The only way I found of doing it right now is like :

  Source Snippet :

  object ViewClient extends ViewClient

  class ViewClient
  {
    object currentClient extends RequestVar [Box [Client]] (Empty)

  bind  (...
    addInvoice - SHtml.link (/invoice/create, () = currentClient
  (Full (c)), Text (Ajouter Facture)))

  Destination Post Snippet :

  def add (inhtml: NodeSeq

Re: [Lift] Re: field without mapper and Form validation

2010-03-09 Thread Ross Mellgren
I think you could use plain Record and MetaRecord to do this.

-Ross

On Mar 9, 2010, at 9:27 AM, Jeppe Nejsum Madsen wrote:

 On Tue, Mar 9, 2010 at 3:17 PM, Francois fan...@gmail.com wrote:
 Le 09/03/2010 10:12, Francois a écrit :
 
 Hello guys,
 
 
 I'm often using forms without anything to do persistence and RDBMS
 related, but I would like to be able to use Fields (StringField,
 EmailField, my owns, etc), validation, error management, etc. without
 having everything to manage by hand.
 
 
 After searching more carefully on the mailing list archive, it seems that
 what I'm looking for is something like a mix of one-page wizard with
 Record/Mapper fields integration (or fields that are currently in
 Record/Mapper/Wizard may live in there own package and only manage the
 domain/client part ?)
 
 Relevant threads:
 - http://old.nabble.com/Multipage-wizards-td26504293.html (especially Jeppe
 answer)
 -
 http://old.nabble.com/Lift-Wizard-Fields-incompatible-with-lift-record-fields-tc27230782.html
 
 
 So, I'm going to see how wizards are working,
 
 Cool, let me know how it works. As you noted, I basically have the
 same needs, but haven't started to  look into this yet :-)
 
 I saw the Lift example now includes a one page form (based on
 wizards): http://demo.liftweb.net/simple_screen
 
 /Jeppe
 
 -- 
 You received this message because you are subscribed to the Google Groups 
 Lift group.
 To post to this group, send email to lift...@googlegroups.com.
 To unsubscribe from this group, send email to 
 liftweb+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/liftweb?hl=en.
 

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



[Lift] Re: Issue, The URL params can't contains ? ****

2010-03-09 Thread Marius
Your request needs to be like:

http://localhost:8080/download.html?link=http%3A%2F%2Ftest.com%2Ffile.zip%2612345678

and on the server side you can get the link from parameter with
S.param(link)

On Mar 9, 4:38 pm, Neil.Lv anim...@gmail.com wrote:
  I want get the these strings (http://test.com/file.zip12345678)
 from the
  URL (http://localhost:8080/download.html?link=http://test.com/
 file.zip12345678)

  Thanks very much!

 Cheers,
   Neil

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



[Lift] Re: RequestVar copy /clone ?

2010-03-09 Thread hexa
I think we still have a miss understanding

The client_id code  clientBox map (_.id.toLong) work ok .. no problems
with that

What doesnt work would be doing something like :

 val clientBox = ViewClient.currentClient

  def processEntry () {
  inInvoice.client (clientBox.open_!)
  inInvoice.save
  S.notice (Entre : Description  + inInvoice.description + 
Montant :  + inInvoice.amount)
}

Since in this case inInvoice.client (clientBox.open_!) return an empty
box since the RequestVar has been destroyed ...

So I was trying to do this but I need to copy or ref the RequestVar so
that I use it in the next request...

At first I tought because of the closure it would ref it... but it
seems not..

It's looking more and more like a statefull snippet is the way to
go...
On Mar 9, 11:10 am, Lukasz Kuczera kuk...@gmail.com wrote:
 Ok i think I see the bug. It is the magic which i don't understand
 yet that if you change your client_id from val to var it will be auto
 promoted into Heap and live out Snippet. Try this out.

 Change:
 val client_id = clientBox map (_.id.toLong)
 To:
 var client_id = clientBox map (_.id.toLong)

 On Mar 9, 3:34 pm, hexa hex...@gmail.com wrote:

  Hi, thanks for the suggestions I like that match  {} code.. will try
  that..

  But what you suggest but the post_id is similar to what I'm doing
  now.. since this id is a long it will be copied by value
  and I can pass it to multiple requests using a closure...

  I'll try to clarify a bit :

  A have  a ViewClient snippet and an AddInvoice snippet

  In the ViewClient I add the action AddInvoice  which must be bound to
  a client..

  Now passing the client to the AddInvoice form is ok .. I can send the
  whole client object to the form snippet using a RequestVar..
  which I find kinda neet not having to go trough thoses ids... (maybe
  i'm wrong thinking that)

  But the trick is now that i'm in the AddInvoice snipped and that I
  have my RequestVar...

  I would like to form a closure on it.. an keep it for the post request
  so that it gets to ProcesssEntry and I do just :

  inInvoice.client (client)
  inInvoice.save

  As so no ids are involved...

  I would need to make a new RequestVar for the post submit with a copy
  of the input RequestVar I got in the AddInvoice from the ViewClient
  snippet

  But a SessionVar is out it's way overkill and a statefull snippet
  might be an idea ... would the RequestVar persist in the statefull
  snippet?

  Also I'm having trouble understanding how that scoping is done for the
  RequestVar if anyone could shed some light on it... like why a closure
  won't ref it... (I'm new to scala)

  Thanks

  hexa

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



Re: [Lift] Re: RequestVar copy /clone ?

2010-03-09 Thread Naftoli Gugenheim
You can use StatefulSnippets if you like, but what you want to do is perfectly 
doable with RequestVars.
Clearly it's not being set in the same request as it's being read.

-
hexahex...@gmail.com wrote:

I think we still have a miss understanding

The client_id code  clientBox map (_.id.toLong) work ok .. no problems
with that

What doesnt work would be doing something like :

 val clientBox = ViewClient.currentClient

  def processEntry () {
  inInvoice.client (clientBox.open_!)
  inInvoice.save
  S.notice (Entre : Description  + inInvoice.description + 
Montant :  + inInvoice.amount)
}

Since in this case inInvoice.client (clientBox.open_!) return an empty
box since the RequestVar has been destroyed ...

So I was trying to do this but I need to copy or ref the RequestVar so
that I use it in the next request...

At first I tought because of the closure it would ref it... but it
seems not..

It's looking more and more like a statefull snippet is the way to
go...
On Mar 9, 11:10 am, Lukasz Kuczera kuk...@gmail.com wrote:
 Ok i think I see the bug. It is the magic which i don't understand
 yet that if you change your client_id from val to var it will be auto
 promoted into Heap and live out Snippet. Try this out.

 Change:
 val client_id = clientBox map (_.id.toLong)
 To:
 var client_id = clientBox map (_.id.toLong)

 On Mar 9, 3:34 pm, hexa hex...@gmail.com wrote:

  Hi, thanks for the suggestions I like that match  {} code.. will try
  that..

  But what you suggest but the post_id is similar to what I'm doing
  now.. since this id is a long it will be copied by value
  and I can pass it to multiple requests using a closure...

  I'll try to clarify a bit :

  A have  a ViewClient snippet and an AddInvoice snippet

  In the ViewClient I add the action AddInvoice  which must be bound to
  a client..

  Now passing the client to the AddInvoice form is ok .. I can send the
  whole client object to the form snippet using a RequestVar..
  which I find kinda neet not having to go trough thoses ids... (maybe
  i'm wrong thinking that)

  But the trick is now that i'm in the AddInvoice snipped and that I
  have my RequestVar...

  I would like to form a closure on it.. an keep it for the post request
  so that it gets to ProcesssEntry and I do just :

  inInvoice.client (client)
  inInvoice.save

  As so no ids are involved...

  I would need to make a new RequestVar for the post submit with a copy
  of the input RequestVar I got in the AddInvoice from the ViewClient
  snippet

  But a SessionVar is out it's way overkill and a statefull snippet
  might be an idea ... would the RequestVar persist in the statefull
  snippet?

  Also I'm having trouble understanding how that scoping is done for the
  RequestVar if anyone could shed some light on it... like why a closure
  won't ref it... (I'm new to scala)

  Thanks

  hexa

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

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



[Lift] NodeSeq to JsExp how to?

2010-03-09 Thread Stuart Roebuck
I'm trying to produce a web page with editable content.

When the user clicks an edit button on a line it uses jQuery to
display a modal dialog which allows fields of that line to be edited.

I can easily produce a snippet to produce the lines using the backend
data and an XHTML template and binding etc.

However, I also want the template to include the template for the
dialog.  So I want the ajax button callback to send JavaScript to
instantiate the jQuery UI dialog based on the template and bindings.

To build this I need to assemble a JsCmd containing the NodeSeq that
comes from the XHTML sequence and the bindings.

In short, if this was straight jQuery I would have some JavaScript of
the form:

$(div title=Dialog TitletheFormNodeSeq/div).dialog()

But in my case theFormNodeSeq comes from a NodeSeq that was assembled
from part of the XHTML template and the bindings and the end result
needs to be a JsCmd.

So I'm trying to do something like:

JsCmds.Run($( + theFormNodeSeq.toString + ).dialog())

But I need to address escaping issues with the HTML and I also need to
pre-process any lift:… / commands in theFormNodeSeq.

Any advice (please)?

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



Re: [Lift] Re: More dynamic Lift

2010-03-09 Thread David Pollak
My development cycle has never worked well with JRebel.

First, I've got so many machines I do development on (5, 3 of which get
wiped each time Ubuntu releases a new version), getting all of those
machines set up with JRebel is something of a pain.  Further, having JRebel
run in some cases is *very bad* (e.g., any compilation takes 10x longer with
JRebel).

So, when I do use JRebel, it is generally a bad experience for me.  This is
based on the way I code.  First, I use a whole lot of for comprehensions in
my code.  The problem with for comprehensions is that they create a bunch of
anonymous inner classes that are named based on the order they appear in the
code.  This means that the classes for a given thing change and that leads
to incompatible class change issues.  Further, I write a lot of code in
traits that I mix into lots of different classes.  This also leads to less
than optimal results in JRebel (more incompatible class change issues.)  The
JRebel folks and Martin have worked to address the former issue, have not
completely eliminated it.

There's a further issue... JRebel doesn't work automatically with Lift.
Technically, it's costless, but you have to register it with ZeroTurnaround,
etc.  This means you start using JRebel after you've made a commitment to
Lift rather than during the early stages of using Lift.

So, based on our recent discussion about onboarding, some discussions Jeppe
and I have been having, and my non-JRebel-friendly development style, I
thought that there might be a way to address all of these issues at once.

On Tue, Mar 9, 2010 at 6:48 AM, Timothy Perrett timo...@getintheloop.euwrote:

 No it doesn't work for sitemap... as thats loaded at boot only ;-) My point
 was that it can still be a good experience without JR for our users.

 Interesting what you were saying about your dev style... i'm usually the
 other way around and implement sitemap last as I see it as a concrete
 setting of my content.

 Cheers, Tim


 On 9 Mar 2010, at 11:20, Jeppe Nejsum Madsen wrote:

  On Tue, Mar 9, 2010 at 12:08 PM, Timothy Perrett
  timo...@getintheloop.eu wrote:
  BTW, with SBT, don't forget you can do:
 
  jetty-run
  (make changes to your code)
  prepare-webapp
 
  That will redeploy chnaged files / classses to the running jetty
 instance so
  development with SBT can still be slick without javarebel :-)
 
  But still this doesn't address the problem (I think?) of changing
  things in Boot. Maybe I code differently from everybody else, but when
  iterating new features, I always end up making lots of changes to
  Sitemap. And afaik everyone of those changes requires a restart
 
  For the rest I agree JRebel fits quite nicely (it does have it's
  problems as David points out)
 
  /Jeppe
 
  --
  You received this message because you are subscribed to the Google Groups
 Lift group.
  To post to this group, send email to lift...@googlegroups.com.
  To unsubscribe from this group, send email to
 liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com
 .
  For more options, visit this group at
 http://groups.google.com/group/liftweb?hl=en.
 
 

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




-- 
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 lift...@googlegroups.com.
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en.



Re: [Lift] NodeSeq to JsExp how to?

2010-03-09 Thread Ross Mellgren
Try this (I haven't tested it, so there could be lurking bugs):

case class JQueryNodeSeq(ns: NodeSeq) extends JsExp with JQueryLeft with 
HtmlFixer {
override def toJsCmd = jQuery( + JsStr(fixHtml(NodeSeqDialog, 
ns)).toJsCmd + )
}

Then JQueryNodeSeq(ns) ~ JsFunc(dialog)

-Ross

On Mar 9, 2010, at 12:06 PM, Stuart Roebuck wrote:

 I'm trying to produce a web page with editable content.
 
 When the user clicks an edit button on a line it uses jQuery to
 display a modal dialog which allows fields of that line to be edited.
 
 I can easily produce a snippet to produce the lines using the backend
 data and an XHTML template and binding etc.
 
 However, I also want the template to include the template for the
 dialog.  So I want the ajax button callback to send JavaScript to
 instantiate the jQuery UI dialog based on the template and bindings.
 
 To build this I need to assemble a JsCmd containing the NodeSeq that
 comes from the XHTML sequence and the bindings.
 
 In short, if this was straight jQuery I would have some JavaScript of
 the form:
 
 $(div title=Dialog TitletheFormNodeSeq/div).dialog()
 
 But in my case theFormNodeSeq comes from a NodeSeq that was assembled
 from part of the XHTML template and the bindings and the end result
 needs to be a JsCmd.
 
 So I'm trying to do something like:
 
 JsCmds.Run($( + theFormNodeSeq.toString + ).dialog())
 
 But I need to address escaping issues with the HTML and I also need to
 pre-process any lift:… / commands in theFormNodeSeq.
 
 Any advice (please)?
 
 -- 
 You received this message because you are subscribed to the Google Groups 
 Lift group.
 To post to this group, send email to lift...@googlegroups.com.
 To unsubscribe from this group, send email to 
 liftweb+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/liftweb?hl=en.
 

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



Re: [Lift] NodeSeq to JsExp how to?

2010-03-09 Thread Ross Mellgren
Whoops, I meant Str(fixHtml(...)) not JsStr(fixHtml(...))

-Ross

On Mar 9, 2010, at 12:14 PM, Ross Mellgren wrote:

 Try this (I haven't tested it, so there could be lurking bugs):
 
 case class JQueryNodeSeq(ns: NodeSeq) extends JsExp with JQueryLeft with 
 HtmlFixer {
override def toJsCmd = jQuery( + JsStr(fixHtml(NodeSeqDialog, 
 ns)).toJsCmd + )
 }
 
 Then JQueryNodeSeq(ns) ~ JsFunc(dialog)
 
 -Ross
 
 On Mar 9, 2010, at 12:06 PM, Stuart Roebuck wrote:
 
 I'm trying to produce a web page with editable content.
 
 When the user clicks an edit button on a line it uses jQuery to
 display a modal dialog which allows fields of that line to be edited.
 
 I can easily produce a snippet to produce the lines using the backend
 data and an XHTML template and binding etc.
 
 However, I also want the template to include the template for the
 dialog.  So I want the ajax button callback to send JavaScript to
 instantiate the jQuery UI dialog based on the template and bindings.
 
 To build this I need to assemble a JsCmd containing the NodeSeq that
 comes from the XHTML sequence and the bindings.
 
 In short, if this was straight jQuery I would have some JavaScript of
 the form:
 
 $(div title=Dialog TitletheFormNodeSeq/div).dialog()
 
 But in my case theFormNodeSeq comes from a NodeSeq that was assembled
 from part of the XHTML template and the bindings and the end result
 needs to be a JsCmd.
 
 So I'm trying to do something like:
 
 JsCmds.Run($( + theFormNodeSeq.toString + ).dialog())
 
 But I need to address escaping issues with the HTML and I also need to
 pre-process any lift:… / commands in theFormNodeSeq.
 
 Any advice (please)?
 
 -- 
 You received this message because you are subscribed to the Google Groups 
 Lift group.
 To post to this group, send email to lift...@googlegroups.com.
 To unsubscribe from this group, send email to 
 liftweb+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/liftweb?hl=en.
 
 

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



Re: [Lift] Re: More dynamic Lift

2010-03-09 Thread Timothy Perrett
Wow, I wish I had 5 machines ;-) lol.

Thats an interesting outlook and an explanatory rationale. Can you explain the 
implementation? Perhaps I can be persuaded. Right now, i'm not convinced about 
hampering development mode in this way.

Cheers, Tim

On 9 Mar 2010, at 17:13, David Pollak wrote:

 So, based on our recent discussion about onboarding, some discussions Jeppe 
 and I have been having, and my non-JRebel-friendly development style, I 
 thought that there might be a way to address all of these issues at once.

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



Re: [Lift] NodeSeq to JsExp how to?

2010-03-09 Thread David Pollak
On Tue, Mar 9, 2010 at 9:14 AM, Ross Mellgren dri...@gmail.com wrote:

 Try this (I haven't tested it, so there could be lurking bugs):

 case class JQueryNodeSeq(ns: NodeSeq) extends JsExp with JQueryLeft with
 HtmlFixer {
override def toJsCmd = jQuery( + JsStr(fixHtml(NodeSeqDialog,
 ns)).toJsCmd + )
 }


Ross,

This is good code, but introduces a potential security vulnerability. ;-)

fixHtml runs the NodeSeq through Lift's snippet handler.  If you have
web-user input, a user could type in lift:/ and cause server-side code
to be executed.

import net.liftweb.util._
import Helpers._

Personally, I'd suggest jQuery( + AltXML.toXML(nodeSeq, false, true).encJs
+ )

Thanks,

David



 Then JQueryNodeSeq(ns) ~ JsFunc(dialog)

 -Ross

 On Mar 9, 2010, at 12:06 PM, Stuart Roebuck wrote:

  I'm trying to produce a web page with editable content.
 
  When the user clicks an edit button on a line it uses jQuery to
  display a modal dialog which allows fields of that line to be edited.
 
  I can easily produce a snippet to produce the lines using the backend
  data and an XHTML template and binding etc.
 
  However, I also want the template to include the template for the
  dialog.  So I want the ajax button callback to send JavaScript to
  instantiate the jQuery UI dialog based on the template and bindings.
 
  To build this I need to assemble a JsCmd containing the NodeSeq that
  comes from the XHTML sequence and the bindings.
 
  In short, if this was straight jQuery I would have some JavaScript of
  the form:
 
  $(div title=Dialog TitletheFormNodeSeq/div).dialog()
 
  But in my case theFormNodeSeq comes from a NodeSeq that was assembled
  from part of the XHTML template and the bindings and the end result
  needs to be a JsCmd.
 
  So I'm trying to do something like:
 
  JsCmds.Run($( + theFormNodeSeq.toString + ).dialog())
 
  But I need to address escaping issues with the HTML and I also need to
  pre-process any lift:… / commands in theFormNodeSeq.
 
  Any advice (please)?
 
  --
  You received this message because you are subscribed to the Google Groups
 Lift group.
  To post to this group, send email to lift...@googlegroups.com.
  To unsubscribe from this group, send email to
 liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com
 .
  For more options, visit this group at
 http://groups.google.com/group/liftweb?hl=en.
 

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




-- 
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 lift...@googlegroups.com.
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en.



Re: [Lift] Re: More dynamic Lift

2010-03-09 Thread Naftoli Gugenheim
Why is compilation running with JRebel?
Also, how critical is JRebel to people getting their feet wet? When I was new 
to Lift, I used the default setting in the POM that caused a jetty hot redeploy 
when class files were updated. (Possibly earlier on I restarted jetty 
manually.) While that meant sitemap would be updated, after a number of 
restarts it would run out of PermGen memory. I only started using JRebel later.
The best of both worlds would be JRebel + manual hot redeploy, which it sounds 
like is possible with SBT, which Lift plans to switch to.


-
David Pollakfeeder.of.the.be...@gmail.com wrote:

My development cycle has never worked well with JRebel.

First, I've got so many machines I do development on (5, 3 of which get
wiped each time Ubuntu releases a new version), getting all of those
machines set up with JRebel is something of a pain.  Further, having JRebel
run in some cases is *very bad* (e.g., any compilation takes 10x longer with
JRebel).

So, when I do use JRebel, it is generally a bad experience for me.  This is
based on the way I code.  First, I use a whole lot of for comprehensions in
my code.  The problem with for comprehensions is that they create a bunch of
anonymous inner classes that are named based on the order they appear in the
code.  This means that the classes for a given thing change and that leads
to incompatible class change issues.  Further, I write a lot of code in
traits that I mix into lots of different classes.  This also leads to less
than optimal results in JRebel (more incompatible class change issues.)  The
JRebel folks and Martin have worked to address the former issue, have not
completely eliminated it.

There's a further issue... JRebel doesn't work automatically with Lift.
Technically, it's costless, but you have to register it with ZeroTurnaround,
etc.  This means you start using JRebel after you've made a commitment to
Lift rather than during the early stages of using Lift.

So, based on our recent discussion about onboarding, some discussions Jeppe
and I have been having, and my non-JRebel-friendly development style, I
thought that there might be a way to address all of these issues at once.

On Tue, Mar 9, 2010 at 6:48 AM, Timothy Perrett timo...@getintheloop.euwrote:

 No it doesn't work for sitemap... as thats loaded at boot only ;-) My point
 was that it can still be a good experience without JR for our users.

 Interesting what you were saying about your dev style... i'm usually the
 other way around and implement sitemap last as I see it as a concrete
 setting of my content.

 Cheers, Tim


 On 9 Mar 2010, at 11:20, Jeppe Nejsum Madsen wrote:

  On Tue, Mar 9, 2010 at 12:08 PM, Timothy Perrett
  timo...@getintheloop.eu wrote:
  BTW, with SBT, don't forget you can do:
 
  jetty-run
  (make changes to your code)
  prepare-webapp
 
  That will redeploy chnaged files / classses to the running jetty
 instance so
  development with SBT can still be slick without javarebel :-)
 
  But still this doesn't address the problem (I think?) of changing
  things in Boot. Maybe I code differently from everybody else, but when
  iterating new features, I always end up making lots of changes to
  Sitemap. And afaik everyone of those changes requires a restart
 
  For the rest I agree JRebel fits quite nicely (it does have it's
  problems as David points out)
 
  /Jeppe
 
  --
  You received this message because you are subscribed to the Google Groups
 Lift group.
  To post to this group, send email to lift...@googlegroups.com.
  To unsubscribe from this group, send email to
 liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com
 .
  For more options, visit this group at
 http://groups.google.com/group/liftweb?hl=en.
 
 

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




-- 
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 lift...@googlegroups.com.
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en.

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



Re: [Lift] Converting a null String to an empty String

2010-03-09 Thread Heiko Seeberger
On 9 March 2010 16:48, David Pollak feeder.of.the.be...@gmail.com wrote:

 Can you be a little more specific?


Sure ;-)
I am looking for a method like this:
def stringNullTest(s: String): String = if (s != null) s else 

Of course I could roll my own, but if it is already around (e.g. in
StringHelpers) I would use it from there.

Heiko

Company: weiglewilczek.com
Blog: heikoseeberger.name
Follow me: twitter.com/hseeberger
OSGi on Scala: scalamodules.org
Lift, the simply functional web framework: liftweb.net

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



[Lift] Re: How to use lazy-load?

2010-03-09 Thread Marius
I opened defect 412 and this is now on the review board:
http://reviewboard.liftweb.net/r/263/diff/#index_header

On Mar 9, 6:08 pm, Marius marius.dan...@gmail.com wrote:
 Dear Jeppe,

 I spent some time today in looking to your issue. I was able to
 reproduce. The problem was that a NPE was thrown as the S,functionsMap
 was not initialized as I was doing a light S init to capture original
 request state. I have a fix for it but I need to do some more testing
 on it first.

 I'll open a ticket for this.

 Br's,
 Marius

 On Mar 9, 1:21 pm, Marius marius.dan...@gmail.com wrote:



  I assume you are using Lift from master ...

  lazy-load should be able to wrap anything. I'll try to put in some
  ajaxSelects to see if I can repro.

  On Mar 8, 10:54 pm, Jeppe Nejsum Madsen je...@ingolfs.dk wrote:

   On Mon, Mar 8, 2010 at 5:42 PM, Marius marius.dan...@gmail.com wrote:
Can you please send me a minimalistic example ? .. The comet actor
shutdown looks correct to me as after the lazy content is rendered
that comet is not needed anymore.

   Not easily. When I get some time I'll see if I can reproduce it in a 
   sample.

Can you check with firebug if you get any asynchronous javascript back
from the comet request?

   It looks a bit strange. The normal request (with not lazy load) is
   about 3s. With the lazy load the comet request is almost 60s before
   anything (not the correct content) is returned (timed out?)

   Hold on! I did some more digging :-) Since this was just a naive
   application of lazy-load around an existing snippet, it contained bind
   with a few ajaxSelects inside. It seems this is what caused the
   problems. If I remove the ajaxSelects it seems to work.

   Not sure if this is a supported scenario or not, but if not we should
   probably emit some notification when running in dev mode.or at
   least document what can be put inside lazy-load

   /Jeppe

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



Re: [Lift] NodeSeq to JsExp how to?

2010-03-09 Thread Ross Mellgren
Ah yes, the reason I went through the fixHtml route is because Stuart 
specifically mentioned he wanted to process those.

Stuart, you should make sure to properly secure this stuff -- either as an 
admin-only thing (understanding that that person has as much rights as you) or 
by scrubbing the XML thoroughly.

-Ross

On Mar 9, 2010, at 12:26 PM, David Pollak wrote:

 
 
 On Tue, Mar 9, 2010 at 9:14 AM, Ross Mellgren dri...@gmail.com wrote:
 Try this (I haven't tested it, so there could be lurking bugs):
 
 case class JQueryNodeSeq(ns: NodeSeq) extends JsExp with JQueryLeft with 
 HtmlFixer {
override def toJsCmd = jQuery( + JsStr(fixHtml(NodeSeqDialog, 
 ns)).toJsCmd + )
 }
 
 Ross,
 
 This is good code, but introduces a potential security vulnerability. ;-)
 
 fixHtml runs the NodeSeq through Lift's snippet handler.  If you have 
 web-user input, a user could type in lift:/ and cause server-side code 
 to be executed.
 
 import net.liftweb.util._
 import Helpers._
 
 Personally, I'd suggest jQuery( + AltXML.toXML(nodeSeq, false, true).encJs 
 + )
 
 Thanks,
 
 David
  
 
 Then JQueryNodeSeq(ns) ~ JsFunc(dialog)
 
 -Ross
 
 On Mar 9, 2010, at 12:06 PM, Stuart Roebuck wrote:
 
  I'm trying to produce a web page with editable content.
 
  When the user clicks an edit button on a line it uses jQuery to
  display a modal dialog which allows fields of that line to be edited.
 
  I can easily produce a snippet to produce the lines using the backend
  data and an XHTML template and binding etc.
 
  However, I also want the template to include the template for the
  dialog.  So I want the ajax button callback to send JavaScript to
  instantiate the jQuery UI dialog based on the template and bindings.
 
  To build this I need to assemble a JsCmd containing the NodeSeq that
  comes from the XHTML sequence and the bindings.
 
  In short, if this was straight jQuery I would have some JavaScript of
  the form:
 
  $(div title=Dialog TitletheFormNodeSeq/div).dialog()
 
  But in my case theFormNodeSeq comes from a NodeSeq that was assembled
  from part of the XHTML template and the bindings and the end result
  needs to be a JsCmd.
 
  So I'm trying to do something like:
 
  JsCmds.Run($( + theFormNodeSeq.toString + ).dialog())
 
  But I need to address escaping issues with the HTML and I also need to
  pre-process any lift:… / commands in theFormNodeSeq.
 
  Any advice (please)?
 
  --
  You received this message because you are subscribed to the Google Groups 
  Lift group.
  To post to this group, send email to lift...@googlegroups.com.
  To unsubscribe from this group, send email to 
  liftweb+unsubscr...@googlegroups.com.
  For more options, visit this group at 
  http://groups.google.com/group/liftweb?hl=en.
 
 
 --
 You received this message because you are subscribed to the Google Groups 
 Lift group.
 To post to this group, send email to lift...@googlegroups.com.
 To unsubscribe from this group, send email to 
 liftweb+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/liftweb?hl=en.
 
 
 
 
 -- 
 Lift, 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 lift...@googlegroups.com.
 To unsubscribe from this group, send email to 
 liftweb+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/liftweb?hl=en.

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



[Lift] Re: NodeSeq to JsExp how to?

2010-03-09 Thread Stuart Roebuck
Thanks for that amazingly quick response!

I only wish I understood the proposed solution! :-)

So (confession time) I simplified things a little, the actual
JavaScript is…

var theDialog = $(…).dialog( { autoOpen: true, width: 500, modal:
true, close: function() { theDialog.destroy; }; } )

How do I assemble this, or is there any documentation / examples you
can point me to.

Thanks very much,

Stuart.

On Mar 9, 5:14 pm, Ross Mellgren dri...@gmail.com wrote:
 Whoops, I meant Str(fixHtml(...)) not JsStr(fixHtml(...))

 -Ross

 On Mar 9, 2010, at 12:14 PM, Ross Mellgren wrote:



  Try this (I haven't tested it, so there could be lurking bugs):

  case class JQueryNodeSeq(ns: NodeSeq) extends JsExp with JQueryLeft with 
  HtmlFixer {
     override def toJsCmd = jQuery( + JsStr(fixHtml(NodeSeqDialog, 
  ns)).toJsCmd + )
  }

  Then JQueryNodeSeq(ns) ~ JsFunc(dialog)

  -Ross

  On Mar 9, 2010, at 12:06 PM, Stuart Roebuck wrote:

  I'm trying to produce a web page with editable content.

  When the user clicks an edit button on a line it uses jQuery to
  display a modal dialog which allows fields of that line to be edited.

  I can easily produce a snippet to produce the lines using the backend
  data and an XHTML template and binding etc.

  However, I also want the template to include the template for the
  dialog.  So I want the ajax button callback to send JavaScript to
  instantiate the jQuery UI dialog based on the template and bindings.

  To build this I need to assemble a JsCmd containing the NodeSeq that
  comes from the XHTML sequence and the bindings.

  In short, if this was straight jQuery I would have some JavaScript of
  the form:

  $(div title=Dialog TitletheFormNodeSeq/div).dialog()

  But in my case theFormNodeSeq comes from a NodeSeq that was assembled
  from part of the XHTML template and the bindings and the end result
  needs to be a JsCmd.

  So I'm trying to do something like:

  JsCmds.Run($( + theFormNodeSeq.toString + ).dialog())

  But I need to address escaping issues with the HTML and I also need to
  pre-process any lift:… / commands in theFormNodeSeq.

  Any advice (please)?

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

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



[Lift] Re: NodeSeq to JsExp how to?

2010-03-09 Thread Stuart Roebuck
Ross,

Thanks - yes, the NodeSeq is all generated from templates internally.
The end user does not have any access to change this stuff so this
particular security issue shouldn't be a problem in this case.

Stuart.

On Mar 9, 5:30 pm, Ross Mellgren dri...@gmail.com wrote:
 Ah yes, the reason I went through the fixHtml route is because Stuart 
 specifically mentioned he wanted to process those.

 Stuart, you should make sure to properly secure this stuff -- either as an 
 admin-only thing (understanding that that person has as much rights as you) 
 or by scrubbing the XML thoroughly.

 -Ross

 On Mar 9, 2010, at 12:26 PM, David Pollak wrote:





  On Tue, Mar 9, 2010 at 9:14 AM, Ross Mellgren dri...@gmail.com wrote:
  Try this (I haven't tested it, so there could be lurking bugs):

  case class JQueryNodeSeq(ns: NodeSeq) extends JsExp with JQueryLeft with 
  HtmlFixer {
     override def toJsCmd = jQuery( + JsStr(fixHtml(NodeSeqDialog, 
  ns)).toJsCmd + )
  }

  Ross,

  This is good code, but introduces a potential security vulnerability. ;-)

  fixHtml runs the NodeSeq through Lift's snippet handler.  If you have 
  web-user input, a user could type in lift:/ and cause server-side 
  code to be executed.

  import net.liftweb.util._
  import Helpers._

  Personally, I'd suggest jQuery( + AltXML.toXML(nodeSeq, false, 
  true).encJs + )

  Thanks,

  David

  Then JQueryNodeSeq(ns) ~ JsFunc(dialog)

  -Ross

  On Mar 9, 2010, at 12:06 PM, Stuart Roebuck wrote:

   I'm trying to produce a web page with editable content.

   When the user clicks an edit button on a line it uses jQuery to
   display a modal dialog which allows fields of that line to be edited.

   I can easily produce a snippet to produce the lines using the backend
   data and an XHTML template and binding etc.

   However, I also want the template to include the template for the
   dialog.  So I want the ajax button callback to send JavaScript to
   instantiate the jQuery UI dialog based on the template and bindings.

   To build this I need to assemble a JsCmd containing the NodeSeq that
   comes from the XHTML sequence and the bindings.

   In short, if this was straight jQuery I would have some JavaScript of
   the form:

   $(div title=Dialog TitletheFormNodeSeq/div).dialog()

   But in my case theFormNodeSeq comes from a NodeSeq that was assembled
   from part of the XHTML template and the bindings and the end result
   needs to be a JsCmd.

   So I'm trying to do something like:

   JsCmds.Run($( + theFormNodeSeq.toString + ).dialog())

   But I need to address escaping issues with the HTML and I also need to
   pre-process any lift:… / commands in theFormNodeSeq.

   Any advice (please)?

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

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

  --
  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 lift...@googlegroups.com.
  To unsubscribe from this group, send email to 
  liftweb+unsubscr...@googlegroups.com.
  For more options, visit this group 
  athttp://groups.google.com/group/liftweb?hl=en.

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



Re: [Lift] Re: NodeSeq to JsExp how to?

2010-03-09 Thread Ross Mellgren
That's why I factored this as a JQueryNodeSeq, so you can pass anything to 
dialog (I've used JQuery, and figured you'd need to pass something in there ;-)

JQueryNodeSeq(ns) ~ JsFunc(dialog, JsObj(autoOpen - JsTrue, width - 
500, ..., close - AnonFunc(JsVal(this) ~ JsFunc(destroy

 case class JQueryNodeSeq(ns: NodeSeq) extends JsExp with JQueryLeft with 
 HtmlFixer {
JsExp is the basic trait of the JavaScript DSL. Anything that can go into a 
JavaScript expression should have this trait.
JQueryLeft is a trait used by the JQuery portion of the JavaScript DSL to 
indicate that you can chain JQuery calls onto this.
HtmlFixer is a trait that provides fixHtml

override def toJsCmd = jQuery( + JsStr(fixHtml(NodeSeqDialog, 
 ns)).toJsCmd + )

fixHtml takes the given NodeSeq and does all the appropriate magics to process 
lift: tags and then converts the NodeSeq to valid XHTML.

 }

And don't forget the security implications!

Hope that helps,
-Ross


On Mar 9, 2010, at 12:30 PM, Stuart Roebuck wrote:

 Thanks for that amazingly quick response!
 
 I only wish I understood the proposed solution! :-)
 
 So (confession time) I simplified things a little, the actual
 JavaScript is…
 
 var theDialog = $(…).dialog( { autoOpen: true, width: 500, modal:
 true, close: function() { theDialog.destroy; }; } )
 
 How do I assemble this, or is there any documentation / examples you
 can point me to.
 
 Thanks very much,
 
 Stuart.
 
 On Mar 9, 5:14 pm, Ross Mellgren dri...@gmail.com wrote:
 Whoops, I meant Str(fixHtml(...)) not JsStr(fixHtml(...))
 
 -Ross
 
 On Mar 9, 2010, at 12:14 PM, Ross Mellgren wrote:
 
 
 
 Try this (I haven't tested it, so there could be lurking bugs):
 
 case class JQueryNodeSeq(ns: NodeSeq) extends JsExp with JQueryLeft with 
 HtmlFixer {
override def toJsCmd = jQuery( + JsStr(fixHtml(NodeSeqDialog, 
 ns)).toJsCmd + )
 }
 
 Then JQueryNodeSeq(ns) ~ JsFunc(dialog)
 
 -Ross
 
 On Mar 9, 2010, at 12:06 PM, Stuart Roebuck wrote:
 
 I'm trying to produce a web page with editable content.
 
 When the user clicks an edit button on a line it uses jQuery to
 display a modal dialog which allows fields of that line to be edited.
 
 I can easily produce a snippet to produce the lines using the backend
 data and an XHTML template and binding etc.
 
 However, I also want the template to include the template for the
 dialog.  So I want the ajax button callback to send JavaScript to
 instantiate the jQuery UI dialog based on the template and bindings.
 
 To build this I need to assemble a JsCmd containing the NodeSeq that
 comes from the XHTML sequence and the bindings.
 
 In short, if this was straight jQuery I would have some JavaScript of
 the form:
 
 $(div title=Dialog TitletheFormNodeSeq/div).dialog()
 
 But in my case theFormNodeSeq comes from a NodeSeq that was assembled
 from part of the XHTML template and the bindings and the end result
 needs to be a JsCmd.
 
 So I'm trying to do something like:
 
 JsCmds.Run($( + theFormNodeSeq.toString + ).dialog())
 
 But I need to address escaping issues with the HTML and I also need to
 pre-process any lift:… / commands in theFormNodeSeq.
 
 Any advice (please)?
 
 --
 You received this message because you are subscribed to the Google Groups 
 Lift group.
 To post to this group, send email to lift...@googlegroups.com.
 To unsubscribe from this group, send email to 
 liftweb+unsubscr...@googlegroups.com.
 For more options, visit this group 
 athttp://groups.google.com/group/liftweb?hl=en.
 
 -- 
 You received this message because you are subscribed to the Google Groups 
 Lift group.
 To post to this group, send email to lift...@googlegroups.com.
 To unsubscribe from this group, send email to 
 liftweb+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/liftweb?hl=en.
 

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



Re: [Lift] Re: More dynamic Lift

2010-03-09 Thread David Pollak
On Tue, Mar 9, 2010 at 9:25 AM, Timothy Perrett timo...@getintheloop.euwrote:

 Wow, I wish I had 5 machines ;-) lol.

 Thats an interesting outlook and an explanatory rationale. Can you explain
 the implementation? Perhaps I can be persuaded. Right now, i'm not convinced
 about hampering development mode in this way.


Basically, Boot will be run and then LiftRules will be snapshot.  Then the
function in the dynamic block is run.  This gives us the baseline LiftRules.

For each request, we roll LiftRules back to the snapshot, create a new class
loader, reload the function passed to the dynamic block and run that in the
scope of the new classloader, then proceed to service the request.  This
means that all the classes referenced by the request are reloaded (although
the excluded classes in model, etc. will be loaded by the servlet scope
classloader rather than our per-request classloader).

I can structure things such that if you don't use the dynamic block, you
will see the same behavior as we have now.  I can also structure things that
will allow a less dynamic block that allows for SiteMap updates without
causing the whole machinery to get invoked.

So, what you'd see is:

   - Existing code would work exactly the way it works now
   - Any code that used the dynamic block in Boot would cause the new
   dynamic mechanism to be invoked (this would be the default for new projects,
   but well commented to suggest alternatives)
   - There would be a less dynamic mode for SiteMap and other LiftRules
   changes (this would be run on each request against the snapshotted
   LiftRules, but there would not be a new classloader).  In this mode, you'd
   only be able to serve 1 request at once.

Now, we could wait until 2.8 is the default... with package objects, we
could define LiftRules in the package objects to be differently visible to
each request (a la RequestVars).



 Cheers, Tim

 On 9 Mar 2010, at 17:13, David Pollak wrote:

  So, based on our recent discussion about onboarding, some discussions
 Jeppe and I have been having, and my non-JRebel-friendly development style,
 I thought that there might be a way to address all of these issues at once.

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




-- 
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 lift...@googlegroups.com.
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en.



Re: [Lift] Re: NodeSeq to JsExp how to?

2010-03-09 Thread David Pollak
On Tue, Mar 9, 2010 at 9:34 AM, Stuart Roebuck stuart.roeb...@gmail.comwrote:

 Ross,

 Thanks - yes, the NodeSeq is all generated from templates internally.


Then Ross's solution is the best for you.


 The end user does not have any access to change this stuff so this
 particular security issue shouldn't be a problem in this case.

 Stuart.

 On Mar 9, 5:30 pm, Ross Mellgren dri...@gmail.com wrote:
  Ah yes, the reason I went through the fixHtml route is because Stuart
 specifically mentioned he wanted to process those.
 
  Stuart, you should make sure to properly secure this stuff -- either as
 an admin-only thing (understanding that that person has as much rights as
 you) or by scrubbing the XML thoroughly.
 
  -Ross
 
  On Mar 9, 2010, at 12:26 PM, David Pollak wrote:
 
 
 
 
 
   On Tue, Mar 9, 2010 at 9:14 AM, Ross Mellgren dri...@gmail.com
 wrote:
   Try this (I haven't tested it, so there could be lurking bugs):
 
   case class JQueryNodeSeq(ns: NodeSeq) extends JsExp with JQueryLeft
 with HtmlFixer {
  override def toJsCmd = jQuery( + JsStr(fixHtml(NodeSeqDialog,
 ns)).toJsCmd + )
   }
 
   Ross,
 
   This is good code, but introduces a potential security vulnerability.
 ;-)
 
   fixHtml runs the NodeSeq through Lift's snippet handler.  If you have
 web-user input, a user could type in lift:/ and cause server-side code
 to be executed.
 
   import net.liftweb.util._
   import Helpers._
 
   Personally, I'd suggest jQuery( + AltXML.toXML(nodeSeq, false,
 true).encJs + )
 
   Thanks,
 
   David
 
   Then JQueryNodeSeq(ns) ~ JsFunc(dialog)
 
   -Ross
 
   On Mar 9, 2010, at 12:06 PM, Stuart Roebuck wrote:
 
I'm trying to produce a web page with editable content.
 
When the user clicks an edit button on a line it uses jQuery to
display a modal dialog which allows fields of that line to be edited.
 
I can easily produce a snippet to produce the lines using the backend
data and an XHTML template and binding etc.
 
However, I also want the template to include the template for the
dialog.  So I want the ajax button callback to send JavaScript to
instantiate the jQuery UI dialog based on the template and bindings.
 
To build this I need to assemble a JsCmd containing the NodeSeq that
comes from the XHTML sequence and the bindings.
 
In short, if this was straight jQuery I would have some JavaScript of
the form:
 
$(div title=Dialog TitletheFormNodeSeq/div).dialog()
 
But in my case theFormNodeSeq comes from a NodeSeq that was assembled
from part of the XHTML template and the bindings and the end result
needs to be a JsCmd.
 
So I'm trying to do something like:
 
JsCmds.Run($( + theFormNodeSeq.toString + ).dialog())
 
But I need to address escaping issues with the HTML and I also need
 to
pre-process any lift:… / commands in theFormNodeSeq.
 
Any advice (please)?
 
--
You received this message because you are subscribed to the Google
 Groups Lift group.
To post to this group, send email to lift...@googlegroups.com.
To unsubscribe from this group, send email to
 liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com
 .
For more options, visit this group athttp://
 groups.google.com/group/liftweb?hl=en.
 
   --
   You received this message because you are subscribed to the Google
 Groups Lift group.
   To post to this group, send email to lift...@googlegroups.com.
   To unsubscribe from this group, send email to
 liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com
 .
   For more options, visit this group athttp://
 groups.google.com/group/liftweb?hl=en.
 
   --
   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 lift...@googlegroups.com.
   To unsubscribe from this group, send email to
 liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com
 .
   For more options, visit this group athttp://
 groups.google.com/group/liftweb?hl=en.

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




-- 
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 lift...@googlegroups.com.
To unsubscribe from this group, send email

Re: [Lift] Converting a null String to an empty String

2010-03-09 Thread David Pollak
On Tue, Mar 9, 2010 at 9:30 AM, Heiko Seeberger 
heiko.seeber...@googlemail.com wrote:

 On 9 March 2010 16:48, David Pollak feeder.of.the.be...@gmail.com wrote:

 Can you be a little more specific?


 Sure ;-)
 I am looking for a method like this:
 def stringNullTest(s: String): String = if (s != null) s else 

 Of course I could roll my own, but if it is already around (e.g. in
 StringHelpers) I would use it from there.


Nothing like that in StringHelpers... feel encouraged to open a ticket and
enhance StringHelpers with this method.



 Heiko

 Company: weiglewilczek.com
 Blog: heikoseeberger.name
 Follow me: twitter.com/hseeberger
 OSGi on Scala: scalamodules.org
 Lift, the simply functional web framework: liftweb.net

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




-- 
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 lift...@googlegroups.com.
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en.



Re: [Lift] Converting a null String to an empty String

2010-03-09 Thread Timothy Perrett
how about:

def stringTest(x: String): String = Box !! x openOr 

Cheers, Tim

On 9 Mar 2010, at 17:30, Heiko Seeberger wrote:

 On 9 March 2010 16:48, David Pollak feeder.of.the.be...@gmail.com wrote:
 Can you be a little more specific? 
 
 Sure ;-)
 I am looking for a method like this:
 def stringNullTest(s: String): String = if (s != null) s else 
 
 Of course I could roll my own, but if it is already around (e.g. in 
 StringHelpers) I would use it from there.
 
 Heiko
 
 Company: weiglewilczek.com
 Blog: heikoseeberger.name
 Follow me: twitter.com/hseeberger
 OSGi on Scala: scalamodules.org
 Lift, the simply functional web framework: liftweb.net
 
 -- 
 You received this message because you are subscribed to the Google Groups 
 Lift group.
 To post to this group, send email to lift...@googlegroups.com.
 To unsubscribe from this group, send email to 
 liftweb+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/liftweb?hl=en.

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



[Lift] Re: RequestVar copy /clone ?

2010-03-09 Thread hexa
It is not set in the same request as it's being read exactly...

But how is that doable with RequestVars then ?



On Mar 9, 11:55 am, Naftoli Gugenheim naftoli...@gmail.com wrote:
 You can use StatefulSnippets if you like, but what you want to do is 
 perfectly doable with RequestVars.
 Clearly it's not being set in the same request as it's being read.

 -

 hexahex...@gmail.com wrote:

 I think we still have a miss understanding

 The client_id code  clientBox map (_.id.toLong) work ok .. no problems
 with that

 What doesnt work would be doing something like :

  val clientBox = ViewClient.currentClient

   def processEntry () {
       inInvoice.client (clientBox.open_!)
       inInvoice.save
       S.notice (Entre : Description  + inInvoice.description + 
 Montant :  + inInvoice.amount)
     }

 Since in this case inInvoice.client (clientBox.open_!) return an empty
 box since the RequestVar has been destroyed ...

 So I was trying to do this but I need to copy or ref the RequestVar so
 that I use it in the next request...

 At first I tought because of the closure it would ref it... but it
 seems not..

 It's looking more and more like a statefull snippet is the way to
 go...
 On Mar 9, 11:10 am, Lukasz Kuczera kuk...@gmail.com wrote:



  Ok i think I see the bug. It is the magic which i don't understand
  yet that if you change your client_id from val to var it will be auto
  promoted into Heap and live out Snippet. Try this out.

  Change:
  val client_id = clientBox map (_.id.toLong)
  To:
  var client_id = clientBox map (_.id.toLong)

  On Mar 9, 3:34 pm, hexa hex...@gmail.com wrote:

   Hi, thanks for the suggestions I like that match  {} code.. will try
   that..

   But what you suggest but the post_id is similar to what I'm doing
   now.. since this id is a long it will be copied by value
   and I can pass it to multiple requests using a closure...

   I'll try to clarify a bit :

   A have  a ViewClient snippet and an AddInvoice snippet

   In the ViewClient I add the action AddInvoice  which must be bound to
   a client..

   Now passing the client to the AddInvoice form is ok .. I can send the
   whole client object to the form snippet using a RequestVar..
   which I find kinda neet not having to go trough thoses ids... (maybe
   i'm wrong thinking that)

   But the trick is now that i'm in the AddInvoice snipped and that I
   have my RequestVar...

   I would like to form a closure on it.. an keep it for the post request
   so that it gets to ProcesssEntry and I do just :

   inInvoice.client (client)
   inInvoice.save

   As so no ids are involved...

   I would need to make a new RequestVar for the post submit with a copy
   of the input RequestVar I got in the AddInvoice from the ViewClient
   snippet

   But a SessionVar is out it's way overkill and a statefull snippet
   might be an idea ... would the RequestVar persist in the statefull
   snippet?

   Also I'm having trouble understanding how that scoping is done for the
   RequestVar if anyone could shed some light on it... like why a closure
   won't ref it... (I'm new to scala)

   Thanks

   hexa

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

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



[Lift] Re: Converting a null String to an empty String

2010-03-09 Thread Heiko Seeberger
On Tuesday, March 9, 2010, Timothy Perrett timo...@getintheloop.eu wrote:
 how about:
 def stringTest(x: String): String = Box !! x openOr 

Looks great, especially for a one-handed-writer ;-)

Heiko


 Cheers, Tim
 On 9 Mar 2010, at 17:30, Heiko Seeberger wrote:
 On 9 March 2010 16:48, David Pollak feeder.of.the.be...@gmail.com wrote:

 Can you be a little more specific?
 Sure ;-)I am looking for a method like this:def stringNullTest(s: String): 
 String = if (s != null) s else 

 Of course I could roll my own, but if it is already around (e.g. in 
 StringHelpers) I would use it from there.
 Heiko
 Company: weiglewilczek.com http://weiglewilczek.com/
 Blog: heikoseeberger.name http://heikoseeberger.name/
 Follow me: twitter.com/hseeberger
 OSGi on Scala: scalamodules.org http://scalamodules.org/
 Lift, the simply functional web framework: liftweb.net http://liftweb.net/



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





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


-- 
Heiko Seeberger

Company: weiglewilczek.com
Blog: heikoseeberger.name
Follow me: twitter.com/hseeberger
OSGi on Scala: scalamodules.org
Lift, the simply functional web framework: liftweb.net

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



Re: [Lift] Re: RequestVar copy /clone ?

2010-03-09 Thread Naftoli Gugenheim
A RequestVar is a container that transcends Scala's scope rules: multiple 
instances of the class holding the RequestVar will see the same value in their 
respective RequestVars.
On the other hand its value is per request. That has nothing to do with; two 
simultaneous requests can set and get two distinct values without conflict.
Contrast all this with regular scala variables. If a class defines a field, and 
spawns a thread that reads it later, clearly it is accessing the same field, 
even in Java. Somewhat similarly in Scala a closure (function) *captures* its 
references, possibly promoting them from stack to heap. So if a method a 
defines a val b and passes a function that references b to some API, b will 
outlive a's execution.
So Scala variables are limited by lexical scope but not by request, while 
RequestVars are limited by request but not by scope.
Thus, if a function will be executed in the next request, to bridge requests 
you have to store the *value* of the RequestVar outside of it (requestVar.is), 
then at the beginning of the next request set the RequestVar from that val.
This is a common pattern in Lift: one request specifies a function to be 
executed in the beginning of the next request, whether it is triggered by a 
link, a form submit, or redirect. This function can bridge the two requests 
because it's in the lexical scope of the first request, so to speak, and can 
capture its state with the basic rules of scala; but it since it actually 
executes in the next request, it can set RequestVars etc. that the next request 
will see.


-
hexahex...@gmail.com wrote:

It is not set in the same request as it's being read exactly...

But how is that doable with RequestVars then ?



On Mar 9, 11:55 am, Naftoli Gugenheim naftoli...@gmail.com wrote:
 You can use StatefulSnippets if you like, but what you want to do is 
 perfectly doable with RequestVars.
 Clearly it's not being set in the same request as it's being read.

 -

 hexahex...@gmail.com wrote:

 I think we still have a miss understanding

 The client_id code  clientBox map (_.id.toLong) work ok .. no problems
 with that

 What doesnt work would be doing something like :

  val clientBox = ViewClient.currentClient

   def processEntry () {
       inInvoice.client (clientBox.open_!)
       inInvoice.save
       S.notice (Entre : Description  + inInvoice.description + 
 Montant :  + inInvoice.amount)
     }

 Since in this case inInvoice.client (clientBox.open_!) return an empty
 box since the RequestVar has been destroyed ...

 So I was trying to do this but I need to copy or ref the RequestVar so
 that I use it in the next request...

 At first I tought because of the closure it would ref it... but it
 seems not..

 It's looking more and more like a statefull snippet is the way to
 go...
 On Mar 9, 11:10 am, Lukasz Kuczera kuk...@gmail.com wrote:



  Ok i think I see the bug. It is the magic which i don't understand
  yet that if you change your client_id from val to var it will be auto
  promoted into Heap and live out Snippet. Try this out.

  Change:
  val client_id = clientBox map (_.id.toLong)
  To:
  var client_id = clientBox map (_.id.toLong)

  On Mar 9, 3:34 pm, hexa hex...@gmail.com wrote:

   Hi, thanks for the suggestions I like that match  {} code.. will try
   that..

   But what you suggest but the post_id is similar to what I'm doing
   now.. since this id is a long it will be copied by value
   and I can pass it to multiple requests using a closure...

   I'll try to clarify a bit :

   A have  a ViewClient snippet and an AddInvoice snippet

   In the ViewClient I add the action AddInvoice  which must be bound to
   a client..

   Now passing the client to the AddInvoice form is ok .. I can send the
   whole client object to the form snippet using a RequestVar..
   which I find kinda neet not having to go trough thoses ids... (maybe
   i'm wrong thinking that)

   But the trick is now that i'm in the AddInvoice snipped and that I
   have my RequestVar...

   I would like to form a closure on it.. an keep it for the post request
   so that it gets to ProcesssEntry and I do just :

   inInvoice.client (client)
   inInvoice.save

   As so no ids are involved...

   I would need to make a new RequestVar for the post submit with a copy
   of the input RequestVar I got in the AddInvoice from the ViewClient
   snippet

   But a SessionVar is out it's way overkill and a statefull snippet
   might be an idea ... would the RequestVar persist in the statefull
   snippet?

   Also I'm having trouble understanding how that scoping is done for the
   RequestVar if anyone could shed some light on it... like why a closure
   won't ref it... (I'm new to scala)

   Thanks

   hexa

 --
 You received this message because you are subscribed to the Google Groups 
 Lift group.
 To post to this group, send email to lift...@googlegroups.com.
 To unsubscribe from

Re: [Lift] London Lift talk

2010-03-09 Thread Richard Dallaway
On Sat, Feb 20, 2010 at 8:22 PM, andy andy1...@gmail.com wrote:
 The London Scala User Group (LSUG) will be presenting a talk by
 Richard Dallaway on 'Getting started with Lift' at SkillsMatter

It is done: http://icanhaz.com/gswl ... where you will find a link to
the Skillsmatter video.

Richard

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



Re: [Lift] Re: Converting a null String to an empty String

2010-03-09 Thread Timothy Perrett
haha!! thanks Heiko... perhaps for my next trick i'll tap out a response using 
only my nose ;-)

Cheers, Tim

On 9 Mar 2010, at 18:56, Heiko Seeberger wrote:

 Looks great, especially for a one-handed-writer ;-)

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



[Lift] Re: More dynamic Lift

2010-03-09 Thread Lukasz Kuczera
I see almost any difference with JRebel

On Mar 9, 6:13 pm, David Pollak feeder.of.the.be...@gmail.com wrote:
 My development cycle has never worked well with JRebel.

 First, I've got so many machines I do development on (5, 3 of which get
 wiped each time Ubuntu releases a new version), getting all of those
 machines set up with JRebel is something of a pain.  Further, having JRebel
 run in some cases is *very bad* (e.g., any compilation takes 10x longer with
 JRebel).

 So, when I do use JRebel, it is generally a bad experience for me.  This is
 based on the way I code.  First, I use a whole lot of for comprehensions in
 my code.  The problem with for comprehensions is that they create a bunch of
 anonymous inner classes that are named based on the order they appear in the
 code.  This means that the classes for a given thing change and that leads
 to incompatible class change issues.  Further, I write a lot of code in
 traits that I mix into lots of different classes.  This also leads to less
 than optimal results in JRebel (more incompatible class change issues.)  The
 JRebel folks and Martin have worked to address the former issue, have not
 completely eliminated it.

 There's a further issue... JRebel doesn't work automatically with Lift.
 Technically, it's costless, but you have to register it with ZeroTurnaround,
 etc.  This means you start using JRebel after you've made a commitment to
 Lift rather than during the early stages of using Lift.

 So, based on our recent discussion about onboarding, some discussions Jeppe
 and I have been having, and my non-JRebel-friendly development style, I
 thought that there might be a way to address all of these issues at once.

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



[Lift] Re: London Lift talk

2010-03-09 Thread Marius
Really nice talk Richard. Great stuff !!!

On Mar 9, 9:05 pm, Richard Dallaway dalla...@gmail.com wrote:
 On Sat, Feb 20, 2010 at 8:22 PM, andy andy1...@gmail.com wrote:
  The London Scala User Group (LSUG) will be presenting a talk by
  Richard Dallaway on 'Getting started with Lift' at SkillsMatter

 It is done:http://icanhaz.com/gswl... where you will find a link to
 the Skillsmatter video.

 Richard

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



Re: [Lift] Re: How to use lazy-load?

2010-03-09 Thread Jeppe Nejsum Madsen
Marius marius.dan...@gmail.com writes:

 I opened defect 412 and this is now on the review board:
 http://reviewboard.liftweb.net/r/263/diff/#index_header

Wow, that was fast :-) Thanks for looking into this!

/Jeppe

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



Re: [Lift] RequestVar copy /clone ?

2010-03-09 Thread David Pollak
Howdy,

Lift does rendering most basically with Snippets.  Snippets are functions
NodeSeq = NodeSeq... they take a NodeSeq and return a NodeSeq.  Snippets
are generally independent entities.  They do not know about each other.
 They can ask about the state of the session and the state of the request.

We introduced RequestVar (and SessionVar) to give developers a type-safe way
to share information during the scope of a request (RequestVar) and session
(SessionVar).

RequestVars are strongly typed.  That means if you define a RequestVar to
hold a String, the compiler will not allow you to put a List into it.

Behind the scenes, RequestVars use a shared Map[String, Any] to store the
information.  The String is the name of the RequestVar and the Any is the
thing that you are putting into the slot for the Var.

So, we use a little magic to generate the unique but stable name of the
Var.  Specifically, we look at the class name that the compiler selected for
the object that extends RequestVar.  If the object is defined within a
class, the class name for the RequestVar will depend on that class name.
 When you have an object that extends a class, the Scala compiler may
generate a new class and thus your currentClient RequestVar in the
ViewClient class and the ViewClient object are different RequestVars.  They
point to different things.

The easiest way to deal with this is to make your currentClient a top-level
object.  If you want to scope the currentClient RequestVar someplace, I'd
suggest:

object ViewClient extends ViewClient {
  object currentClient extends RequestVar...
}


So, please try putting the currentClient someplace where there's a single
path (from a class perspective) to it and I'm guessing that your issue will
go away.

Thanks,

David

On Mon, Mar 8, 2010 at 10:13 PM, hexa hex...@gmail.com wrote:

 Hi,
  I have a RequestVar that I send to a snippet which will then do a
 post...

 But I would like the RequestVar to persist between the moment it it
 received in the post snippet and the post itself...

 The only way I found of doing it right now is like :

 Source Snippet :

 object ViewClient extends ViewClient

 class ViewClient
 {
  object currentClient extends RequestVar [Box [Client]] (Empty)

 bind  (...
  addInvoice - SHtml.link (/invoice/create, () = currentClient
 (Full (c)), Text (Ajouter Facture)))


 Destination Post Snippet :

 def add (inhtml: NodeSeq) : NodeSeq = {

val inInvoice = Invoice.create
val clientBox = ViewClient.currentClient

val client_id = clientBox map (_.id.toLong)

def processEntry () {
  Client.findByKey (client_id openOr 0) map (inInvoice.client (_))
  inInvoice.save
  S.notice (Entre : Description  + inInvoice.description + 
 Montant :  + inInvoice.amount)
}

 bind (e, inhtml,
  description - inInvoice.description.toForm,
  amount - inInvoice.amount.toForm,
  submit - SHtml.submit (Ajouter Facture,  processEntry))

 If I try to access the clientBox in processEntry, even with the
 closure it should generate.. I get an empty box...

 Is there any way to copy / ref or anything or make a new RequestVar
 with a copy of the preceding one ?

 Would have been nice not to be obligated to do the client_id toLong
 code...
 And juste do inInvoice.client (client)  , inInvoice.save


 Thanks a lot

 hexa

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




-- 
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 lift...@googlegroups.com.
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en.



[Lift] Re: RequestVar copy /clone ?

2010-03-09 Thread hexa
Ha ha! :) Good that's exactly what I needed ...

so I can do something like :

object postedValue extends RequestVar...
val clientBox = ViewClient.currentClient
map clientBox (postedValue (_.is))

And the value will be copied to the new RequestVar for the post
request...

I was missing that is function ...

Thanks a lot  exelent explaination! can't wait to try this when I get
home...

On Mar 9, 2:01 pm, Naftoli Gugenheim naftoli...@gmail.com wrote:
 A RequestVar is a container that transcends Scala's scope rules: multiple 
 instances of the class holding the RequestVar will see the same value in 
 their respective RequestVars.
 On the other hand its value is per request. That has nothing to do with; two 
 simultaneous requests can set and get two distinct values without conflict.
 Contrast all this with regular scala variables. If a class defines a field, 
 and spawns a thread that reads it later, clearly it is accessing the same 
 field, even in Java. Somewhat similarly in Scala a closure (function) 
 *captures* its references, possibly promoting them from stack to heap. So if 
 a method a defines a val b and passes a function that references b to some 
 API, b will outlive a's execution.
 So Scala variables are limited by lexical scope but not by request, while 
 RequestVars are limited by request but not by scope.
 Thus, if a function will be executed in the next request, to bridge requests 
 you have to store the *value* of the RequestVar outside of it 
 (requestVar.is), then at the beginning of the next request set the RequestVar 
 from that val.
 This is a common pattern in Lift: one request specifies a function to be 
 executed in the beginning of the next request, whether it is triggered by a 
 link, a form submit, or redirect. This function can bridge the two requests 
 because it's in the lexical scope of the first request, so to speak, and can 
 capture its state with the basic rules of scala; but it since it actually 
 executes in the next request, it can set RequestVars etc. that the next 
 request will see.

 -

 hexahex...@gmail.com wrote:

 It is not set in the same request as it's being read exactly...

 But how is that doable with RequestVars then ?

 On Mar 9, 11:55 am, Naftoli Gugenheim naftoli...@gmail.com wrote:



  You can use StatefulSnippets if you like, but what you want to do is 
  perfectly doable with RequestVars.
  Clearly it's not being set in the same request as it's being read.

  -

  hexahex...@gmail.com wrote:

  I think we still have a miss understanding

  The client_id code  clientBox map (_.id.toLong) work ok .. no problems
  with that

  What doesnt work would be doing something like :

   val clientBox = ViewClient.currentClient

    def processEntry () {
        inInvoice.client (clientBox.open_!)
        inInvoice.save
        S.notice (Entre : Description  + inInvoice.description + 
  Montant :  + inInvoice.amount)
      }

  Since in this case inInvoice.client (clientBox.open_!) return an empty
  box since the RequestVar has been destroyed ...

  So I was trying to do this but I need to copy or ref the RequestVar so
  that I use it in the next request...

  At first I tought because of the closure it would ref it... but it
  seems not..

  It's looking more and more like a statefull snippet is the way to
  go...
  On Mar 9, 11:10 am, Lukasz Kuczera kuk...@gmail.com wrote:

   Ok i think I see the bug. It is the magic which i don't understand
   yet that if you change your client_id from val to var it will be auto
   promoted into Heap and live out Snippet. Try this out.

   Change:
   val client_id = clientBox map (_.id.toLong)
   To:
   var client_id = clientBox map (_.id.toLong)

   On Mar 9, 3:34 pm, hexa hex...@gmail.com wrote:

Hi, thanks for the suggestions I like that match  {} code.. will try
that..

But what you suggest but the post_id is similar to what I'm doing
now.. since this id is a long it will be copied by value
and I can pass it to multiple requests using a closure...

I'll try to clarify a bit :

A have  a ViewClient snippet and an AddInvoice snippet

In the ViewClient I add the action AddInvoice  which must be bound to
a client..

Now passing the client to the AddInvoice form is ok .. I can send the
whole client object to the form snippet using a RequestVar..
which I find kinda neet not having to go trough thoses ids... (maybe
i'm wrong thinking that)

But the trick is now that i'm in the AddInvoice snipped and that I
have my RequestVar...

I would like to form a closure on it.. an keep it for the post request
so that it gets to ProcesssEntry and I do just :

inInvoice.client (client)
inInvoice.save

As so no ids are involved...

I would need to make a new RequestVar for the post submit with a copy
of the input RequestVar I got

Re: [Lift] Re: London Lift talk

2010-03-09 Thread David Pollak
On Tue, Mar 9, 2010 at 11:45 AM, Marius marius.dan...@gmail.com wrote:

 Really nice talk Richard. Great stuff !!!


It's excellent stuff!



 On Mar 9, 9:05 pm, Richard Dallaway dalla...@gmail.com wrote:
  On Sat, Feb 20, 2010 at 8:22 PM, andy andy1...@gmail.com wrote:
   The London Scala User Group (LSUG) will be presenting a talk by
   Richard Dallaway on 'Getting started with Lift' at SkillsMatter
 
  It is done:http://icanhaz.com/gswl... where you will find a link to
  the Skillsmatter video.
 
  Richard

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




-- 
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 lift...@googlegroups.com.
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en.



Re: [Lift] Re: field without mapper and Form validation

2010-03-09 Thread David Pollak
On Tue, Mar 9, 2010 at 6:17 AM, Francois fan...@gmail.com wrote:

 Le 09/03/2010 10:12, Francois a écrit :

  Hello guys,


 I'm often using forms without anything to do persistence and RDBMS
 related, but I would like to be able to use Fields (StringField,
 EmailField, my owns, etc), validation, error management, etc. without
 having everything to manage by hand.



 After searching more carefully on the mailing list archive, it seems that
 what I'm looking for is something like a mix of one-page wizard with
 Record/Mapper fields integration (or fields that are currently in
 Record/Mapper/Wizard may live in there own package and only manage the
 domain/client part ?)


Please look at LiftScreen.  Here's the code from example//Wizard.scala:

object PersonScreen extends LiftScreen {
  object person extends ScreenVar(Person.create)


  override def screenTopTextAsHtml = Full(bA single screen with some input
validation/b)

  _register(() = person.is)

  val shouldSave = new Field with BooleanField {
def name = Save ?
  }

  def finish() {
if (shouldSave.is) {
  person.is.save
}
  }
}

So, you can define your own fields (e.g. val shouldSave extends new Field
with BooleanField)  You can also register a FieldContainer (by calling
_register in the constructor).  A FieldContainer will return you a list of
BaseField (net.liftweb.util.BaseField).  So, Mapper objects implement
FieldContainer.  So, you can blend in a Mapper objects as well as anything
else that has collections of BaseField with fields that you define.

You can override doSetup() on the LiftScreen.  It will be called when the
Screen is entered.  You have to implement the finish() method which will be
called on successful submission of the Screen.  Each field has its own
validation rules.  If you want to validate across fields, you can overload
the LiftScreen's validate method.

Does this help?  One of my open tickets is to provide documentation and
examples of LiftScreen and Wizard (Wizard is a multi-page collection of
Screens).  If you can give me a idea of a good example for you, I'll work on
it.

Thanks,

David




 Relevant threads:
 - http://old.nabble.com/Multipage-wizards-td26504293.html (especially
 Jeppe answer)
 -
 http://old.nabble.com/Lift-Wizard-Fields-incompatible-with-lift-record-fields-tc27230782.html


 So, I'm going to see how wizards are working,


 Thanks,
 --
 Francois ARMAND
 http://fanf42.blogspot.com

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




-- 
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 lift...@googlegroups.com.
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en.



Re: [Lift] Re: field without mapper and Form validation

2010-03-09 Thread Francois Armand

Le 09/03/2010 21:27, David Pollak a écrit :

[...]

Does this help?


Yes, clearly, it seems to be what I was looking for. I missed at first 
in lift example, until Jeppe point it to me.


With your explanation, it really looks like it's what I need :)



One of my open tickets is to provide documentation and
examples of LiftScreen and Wizard (Wizard is a multi-page collection of
Screens).  If you can give me a idea of a good example for you, I'll
work on it.


I'm going to think about it,

Thanks for you help,

--
Francois Armand
http://fanf42.blogspot.com

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



[Lift] Re: NodeSeq to JsExp how to?

2010-03-09 Thread Stuart Roebuck
Once again, thanks for all of this.  I will now go away and
contemplate it all.

On the face of it, as a newby, this JavaScript DSL adds another layer
of complexity to using Lift with JavaScript.  Is there an option to
use mostly raw JavaScript?  What are the advantages / disadvantages?

Sorry, I thought I'd get my moneys worth from you and then try to put
something onto the wiki.

Best,

Stuart.

On Mar 9, 5:35 pm, Ross Mellgren dri...@gmail.com wrote:
 That's why I factored this as a JQueryNodeSeq, so you can pass anything to 
 dialog (I've used JQuery, and figured you'd need to pass something in there 
 ;-)

 JQueryNodeSeq(ns) ~ JsFunc(dialog, JsObj(autoOpen - JsTrue, width - 
 500, ..., close - AnonFunc(JsVal(this) ~ JsFunc(destroy

  case class JQueryNodeSeq(ns: NodeSeq) extends JsExp with JQueryLeft with 
  HtmlFixer {

 JsExp is the basic trait of the JavaScript DSL. Anything that can go into a 
 JavaScript expression should have this trait.
 JQueryLeft is a trait used by the JQuery portion of the JavaScript DSL to 
 indicate that you can chain JQuery calls onto this.
 HtmlFixer is a trait that provides fixHtml

     override def toJsCmd = jQuery( + JsStr(fixHtml(NodeSeqDialog, 
  ns)).toJsCmd + )

 fixHtml takes the given NodeSeq and does all the appropriate magics to 
 process lift: tags and then converts the NodeSeq to valid XHTML.

  }

 And don't forget the security implications!

 Hope that helps,
 -Ross

 On Mar 9, 2010, at 12:30 PM, Stuart Roebuck wrote:



  Thanks for that amazingly quick response!

  I only wish I understood the proposed solution! :-)

  So (confession time) I simplified things a little, the actual
  JavaScript is…

  var theDialog = $(…).dialog( { autoOpen: true, width: 500, modal:
  true, close: function() { theDialog.destroy; }; } )

  How do I assemble this, or is there any documentation / examples you
  can point me to.

  Thanks very much,

  Stuart.

  On Mar 9, 5:14 pm, Ross Mellgren dri...@gmail.com wrote:
  Whoops, I meant Str(fixHtml(...)) not JsStr(fixHtml(...))

  -Ross

  On Mar 9, 2010, at 12:14 PM, Ross Mellgren wrote:

  Try this (I haven't tested it, so there could be lurking bugs):

  case class JQueryNodeSeq(ns: NodeSeq) extends JsExp with JQueryLeft with 
  HtmlFixer {
     override def toJsCmd = jQuery( + JsStr(fixHtml(NodeSeqDialog, 
  ns)).toJsCmd + )
  }

  Then JQueryNodeSeq(ns) ~ JsFunc(dialog)

  -Ross

  On Mar 9, 2010, at 12:06 PM, Stuart Roebuck wrote:

  I'm trying to produce a web page with editable content.

  When the user clicks an edit button on a line it uses jQuery to
  display a modal dialog which allows fields of that line to be edited.

  I can easily produce a snippet to produce the lines using the backend
  data and an XHTML template and binding etc.

  However, I also want the template to include the template for the
  dialog.  So I want the ajax button callback to send JavaScript to
  instantiate the jQuery UI dialog based on the template and bindings.

  To build this I need to assemble a JsCmd containing the NodeSeq that
  comes from the XHTML sequence and the bindings.

  In short, if this was straight jQuery I would have some JavaScript of
  the form:

  $(div title=Dialog TitletheFormNodeSeq/div).dialog()

  But in my case theFormNodeSeq comes from a NodeSeq that was assembled
  from part of the XHTML template and the bindings and the end result
  needs to be a JsCmd.

  So I'm trying to do something like:

  JsCmds.Run($( + theFormNodeSeq.toString + ).dialog())

  But I need to address escaping issues with the HTML and I also need to
  pre-process any lift:… / commands in theFormNodeSeq.

  Any advice (please)?

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

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

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



[Lift] Re: File Download

2010-03-09 Thread DavidV
Any thoughts on this?  Still trying to get it to work.
Thanks

On Mar 5, 2:56 pm, DavidV david.v.villa...@gmail.com wrote:
 I have recreated a number of StreamingResponse methods from both the
 Loop link above and the Lift book and I still can't seem to get the
 desired effect.  I have been able to get a PlainTextResponse to work
 by using LiftRules.dispatch in the Boot, like so:

     LiftRules.dispatch.prepend {
       case Req((analysis :: inprocess :: Nil), _, _) =
         () = Full(PlainTextResponse(test))
     }

 However, I am unable to get any sort of streaming response to work in
 the particular snippet which contains the data I would like to use.
 Here are some of the methods I've tried:

   def textResponse: Box[LiftResponse] = {
     println(TEXT RESPONSE)
     val ab = text would go here
     Full(PlainTextResponse(ab,
       (Content-Type - text/plain) :: Nil, 200
     ))
   }

   def streamingResponseFile: Box[LiftResponse] = {
     println(STREAMING RESPONSE FILE)
     val file: File = new File(
         C:\\Source\\trunk\\eclipse\\testLift\\src\\main\\webapp\\images\
 \ultra.png
     )
     val length = file.length
     val fileInput = new java.io.FileInputStream(file)
     Full(StreamingResponse(fileInput,
       () = { fileInput.close },
       length,
       (Content-Type - image/png) :: Nil,
       Nil,
       200)
     )
   }

 Do I have to make a LiftRules.dispatch function in the Boot in
 addition to the StreamingResponse in my snippet?

 I am trying to download plain text, but it is variable and dependent
 on some parameters and other variables in the particular Snippet
 class.  Would I have to pass that data into the boot method in order
 to get the desired response?  I would prefer to handle it entirely in
 the snippet itself.

 Finally, I'm not really sure how exactly to handle the
 Full(StreamingResponse) once I have created it in order to actually
 download the data and save it to the client computer.  Although I
 assume the browser will handle this one I've formatted the Response
 correctly and actually have it working.

 Thanks again,
 David

 On Mar 4, 11:13 am, Marius marius.dan...@gmail.com wrote:

  If you want todownloadthrough Lift than yes you can use
  StreamingResponse, or simply any other LiftResponse (depending on your
  mime-type) and use LiftRules.dispatch mechanism. But you could also
  let the container to serve thefile. By default Lift is trying to
  serve .html, .xhtml, .htm, .xml etc.. You can write your own rules by
  setting

  LiftRules.liftRequest = {
    case req = true // Pattern match whatever you like and return a
  Boolean

  }

  If Lift cannot find a resource for some reason and you want the
  container (or subsequent filters) to handle that you can set

  LiftRules.passNotFoundToChain = true

  On 4 mar., 17:09, DavidV david.v.villa...@gmail.com wrote:

   I am also looking todownloadafilefrom the server that is hosting
   my Lift web app.  There is a very useful fileUpload method in the
   SHtml class and I was wondering if there may be something similar for
   afiledownload?  I was unable to find anything, and searching for
   Lift or Scala Liftdownload on Google returns nothing but pages to
  downloadthe libraries, plugins or source code.  I suppose I could use
   the StreamingResponse, but I am already saving thefileI need to the
   server and it would be nice to be able todownloadit to any client
   computer with the typical Browse button, similar to the upload,
   Thanks,
   David

   On Feb 14, 3:58 pm, Gang wangga...@gmail.com wrote:

Thanks Tim, that's exactly what I'm looking for!

On Feb 14, 11:27 am, Timothy Perrett timo...@getintheloop.eu wrote:

 See:

http://blog.getintheloop.eu/2009/3/19/understanding-lift-s-streamingr...

 Construct the CSV in memory and just then stuff it into a streaming 
 response as a byte array.

 Cheers, Tim

 On 14 Feb 2010, at 16:18, Gang wrote:

  Hi,

  I have a question and it may not be a pure Lift one.  But since I'm
  working on a Lift app and this group is the most responsive one I 
  have
  seen, might just try it here.

  I need todownloaddata from database in CSV format.  What is the best
  approach within Lift framework?  Do I have to write the data on the
  server somewhere and then provide user with a link?  I have tried to
  google scala, lift,filedownload..., but could not come up with
  what I'm looking for.  Maybe I didn't use the right key words in
  search?  Thanks in advance!

  Brs
  Gang

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

 - Show quoted text

Re: [Lift] Re: File Download

2010-03-09 Thread Timothy Perrett
Is your dispatch defined it boot? It doesnt sound like it is... 

Cheers, tim


On 9 Mar 2010, at 21:45, DavidV wrote:

 Any thoughts on this?  Still trying to get it to work.
 Thanks
 
 On Mar 5, 2:56 pm, DavidV david.v.villa...@gmail.com wrote:
 I have recreated a number of StreamingResponse methods from both the
 Loop link above and the Lift book and I still can't seem to get the
 desired effect.  I have been able to get a PlainTextResponse to work
 by using LiftRules.dispatch in the Boot, like so:
 
 LiftRules.dispatch.prepend {
   case Req((analysis :: inprocess :: Nil), _, _) =
 () = Full(PlainTextResponse(test))
 }
 
 However, I am unable to get any sort of streaming response to work in
 the particular snippet which contains the data I would like to use.
 Here are some of the methods I've tried:
 
   def textResponse: Box[LiftResponse] = {
 println(TEXT RESPONSE)
 val ab = text would go here
 Full(PlainTextResponse(ab,
   (Content-Type - text/plain) :: Nil, 200
 ))
   }
 
   def streamingResponseFile: Box[LiftResponse] = {
 println(STREAMING RESPONSE FILE)
 val file: File = new File(
 C:\\Source\\trunk\\eclipse\\testLift\\src\\main\\webapp\\images\
 \ultra.png
 )
 val length = file.length
 val fileInput = new java.io.FileInputStream(file)
 Full(StreamingResponse(fileInput,
   () = { fileInput.close },
   length,
   (Content-Type - image/png) :: Nil,
   Nil,
   200)
 )
   }
 
 Do I have to make a LiftRules.dispatch function in the Boot in
 addition to the StreamingResponse in my snippet?
 
 I am trying to download plain text, but it is variable and dependent
 on some parameters and other variables in the particular Snippet
 class.  Would I have to pass that data into the boot method in order
 to get the desired response?  I would prefer to handle it entirely in
 the snippet itself.
 
 Finally, I'm not really sure how exactly to handle the
 Full(StreamingResponse) once I have created it in order to actually
 download the data and save it to the client computer.  Although I
 assume the browser will handle this one I've formatted the Response
 correctly and actually have it working.
 
 Thanks again,
 David
 
 On Mar 4, 11:13 am, Marius marius.dan...@gmail.com wrote:
 
 If you want todownloadthrough Lift than yes you can use
 StreamingResponse, or simply any other LiftResponse (depending on your
 mime-type) and use LiftRules.dispatch mechanism. But you could also
 let the container to serve thefile. By default Lift is trying to
 serve .html, .xhtml, .htm, .xml etc.. You can write your own rules by
 setting
 
 LiftRules.liftRequest = {
   case req = true // Pattern match whatever you like and return a
 Boolean
 
 }
 
 If Lift cannot find a resource for some reason and you want the
 container (or subsequent filters) to handle that you can set
 
 LiftRules.passNotFoundToChain = true
 
 On 4 mar., 17:09, DavidV david.v.villa...@gmail.com wrote:
 
 I am also looking todownloadafilefrom the server that is hosting
 my Lift web app.  There is a very useful fileUpload method in the
 SHtml class and I was wondering if there may be something similar for
 afiledownload?  I was unable to find anything, and searching for
 Lift or Scala Liftdownload on Google returns nothing but pages to
 downloadthe libraries, plugins or source code.  I suppose I could use
 the StreamingResponse, but I am already saving thefileI need to the
 server and it would be nice to be able todownloadit to any client
 computer with the typical Browse button, similar to the upload,
 Thanks,
 David
 
 On Feb 14, 3:58 pm, Gang wangga...@gmail.com wrote:
 
 Thanks Tim, that's exactly what I'm looking for!
 
 On Feb 14, 11:27 am, Timothy Perrett timo...@getintheloop.eu wrote:
 
 See:
 
 http://blog.getintheloop.eu/2009/3/19/understanding-lift-s-streamingr...
 
 Construct the CSV in memory and just then stuff it into a streaming 
 response as a byte array.
 
 Cheers, Tim
 
 On 14 Feb 2010, at 16:18, Gang wrote:
 
 Hi,
 
 I have a question and it may not be a pure Lift one.  But since I'm
 working on a Lift app and this group is the most responsive one I have
 seen, might just try it here.
 
 I need todownloaddata from database in CSV format.  What is the best
 approach within Lift framework?  Do I have to write the data on the
 server somewhere and then provide user with a link?  I have tried to
 google scala, lift,filedownload..., but could not come up with
 what I'm looking for.  Maybe I didn't use the right key words in
 search?  Thanks in advance!
 
 Brs
 Gang
 
 --
 You received this message because you are subscribed to the Google 
 Groups Lift group.
 To post to this group, send email to lift...@googlegroups.com.
 To unsubscribe from this group, send email to 
 liftweb+unsubscr...@googlegroups.com.
 For more options, visit this group 
 athttp://groups.google.com/group/liftweb?hl=en.-Hidequotedtext-
 
 - Show quoted text -
 
 -- 
 You received

Re: [Lift] Re: More dynamic Lift

2010-03-09 Thread Francois

Le 09/03/2010 18:35, David Pollak a écrit :



On Tue, Mar 9, 2010 at 9:25 AM, Timothy Perrett timo...@getintheloop.eu
mailto:timo...@getintheloop.eu wrote:

Wow, I wish I had 5 machines ;-) lol.

Thats an interesting outlook and an explanatory rationale. Can you
explain the implementation? Perhaps I can be persuaded. Right now,
i'm not convinced about hampering development mode in this way.


Basically, Boot will be run and then LiftRules will be snapshot.  Then
the function in the dynamic block is run.  This gives us the baseline
LiftRules.



Tapestry 5 has such a functionnality build-in (JRebel wasn't around at 
the time when T5 was built, so there was no alternatives - and JRebel is 
not free for Java application)


The user view is here:
http://tapestry.apache.org/tapestry5.1/guide/reload.html

I think that the implementation is somewhat like what you described (a 
classloader that can be dismissed used for class that could be reload) 
with some more logic to handle when reloads happen


I'm not sure into what extends the comparison may be followed (T5 
internal is quite different than Lift, there is pools of already 
instantiated component/pages waiting to be assembled for a request. 
See[0] for the component instantiation logic)


Basically, there is a  resquest filter[1] that look for time elapsed 
since last reload, and a update listener hub[2] is said to say to each 
of its registered resources to check for update[3]. Resources know how 
to check for update depending of their type (template resource, 
class[5], etc).


If it is inspiring...

The corresponding code is here, for last release:
[0] 
http://svn.apache.org/viewvc/tapestry/tapestry5/tags/releases/5.1.0.7/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ComponentInstantiatorSourceImpl.java?view=markup


[1] Tapestry request filter:
http://svn.apache.org/viewvc/tapestry/tapestry5/tags/releases/5.1.0.7/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/CheckForUpdatesFilter.java?view=markup

[2] Update Listener Hub:
http://svn.apache.org/viewvc/tapestry/tapestry5/tags/releases/5.1.0.7/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/UpdateListenerHubImpl.java?view=markup

[4] Update listener:
http://svn.apache.org/viewvc/tapestry/tapestry5/tags/releases/5.1.0.7/tapestry-core/src/main/java/org/apache/tapestry5/services/UpdateListener.java?view=markup

[5] Page (checkForUpdate):
http://svn.apache.org/viewvc/tapestry/tapestry5/tags/releases/5.1.0.7/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/PagePoolImpl.java?view=markup


--
Francois ARMAND
http://fanf42.blogspot.com

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



Re: [Lift] Re: File Download

2010-03-09 Thread David Pollak
On Tue, Mar 9, 2010 at 1:45 PM, DavidV david.v.villa...@gmail.com wrote:

 Any thoughts on this?  Still trying to get it to work.


See the enclosed example code.  Specifically, there's a dpp.gif file in
src/main/resources and in Boot.scala:

LiftRules.statelessDispatchTable.append {
  case Req(image :: name :: Nil, gif, GetRequest) =
() =
for {
  stream - tryo(this.getClass.getResourceAsStream(/+name+.gif))
if null ne stream
} yield StreamingResponse(stream, () = stream.close,
stream.available, List(Content-Type - image/gif), Nil, 200)
}

If you put other GIF files in resources, the server will find and serve
them.


 Thanks

 On Mar 5, 2:56 pm, DavidV david.v.villa...@gmail.com wrote:
  I have recreated a number of StreamingResponse methods from both the
  Loop link above and the Lift book and I still can't seem to get the
  desired effect.  I have been able to get a PlainTextResponse to work
  by using LiftRules.dispatch in the Boot, like so:
 
  LiftRules.dispatch.prepend {
case Req((analysis :: inprocess :: Nil), _, _) =
  () = Full(PlainTextResponse(test))
  }
 
  However, I am unable to get any sort of streaming response to work in
  the particular snippet which contains the data I would like to use.
  Here are some of the methods I've tried:
 
def textResponse: Box[LiftResponse] = {
  println(TEXT RESPONSE)
  val ab = text would go here
  Full(PlainTextResponse(ab,
(Content-Type - text/plain) :: Nil, 200
  ))
}
 
def streamingResponseFile: Box[LiftResponse] = {
  println(STREAMING RESPONSE FILE)
  val file: File = new File(
  C:\\Source\\trunk\\eclipse\\testLift\\src\\main\\webapp\\images\
  \ultra.png
  )
  val length = file.length
  val fileInput = new java.io.FileInputStream(file)
  Full(StreamingResponse(fileInput,
() = { fileInput.close },
length,
(Content-Type - image/png) :: Nil,
Nil,
200)
  )
}
 
  Do I have to make a LiftRules.dispatch function in the Boot in
  addition to the StreamingResponse in my snippet?
 
  I am trying to download plain text, but it is variable and dependent
  on some parameters and other variables in the particular Snippet
  class.  Would I have to pass that data into the boot method in order
  to get the desired response?  I would prefer to handle it entirely in
  the snippet itself.
 
  Finally, I'm not really sure how exactly to handle the
  Full(StreamingResponse) once I have created it in order to actually
  download the data and save it to the client computer.  Although I
  assume the browser will handle this one I've formatted the Response
  correctly and actually have it working.
 
  Thanks again,
  David
 
  On Mar 4, 11:13 am, Marius marius.dan...@gmail.com wrote:
 
   If you want todownloadthrough Lift than yes you can use
   StreamingResponse, or simply any other LiftResponse (depending on your
   mime-type) and use LiftRules.dispatch mechanism. But you could also
   let the container to serve thefile. By default Lift is trying to
   serve .html, .xhtml, .htm, .xml etc.. You can write your own rules by
   setting
 
   LiftRules.liftRequest = {
 case req = true // Pattern match whatever you like and return a
   Boolean
 
   }
 
   If Lift cannot find a resource for some reason and you want the
   container (or subsequent filters) to handle that you can set
 
   LiftRules.passNotFoundToChain = true
 
   On 4 mar., 17:09, DavidV david.v.villa...@gmail.com wrote:
 
I am also looking todownloadafilefrom the server that is hosting
my Lift web app.  There is a very useful fileUpload method in the
SHtml class and I was wondering if there may be something similar for
afiledownload?  I was unable to find anything, and searching for
Lift or Scala Liftdownload on Google returns nothing but pages to
   downloadthe libraries, plugins or source code.  I suppose I could use
the StreamingResponse, but I am already saving thefileI need to the
server and it would be nice to be able todownloadit to any client
computer with the typical Browse button, similar to the upload,
Thanks,
David
 
On Feb 14, 3:58 pm, Gang wangga...@gmail.com wrote:
 
 Thanks Tim, that's exactly what I'm looking for!
 
 On Feb 14, 11:27 am, Timothy Perrett timo...@getintheloop.eu
 wrote:
 
  See:
 
 
 http://blog.getintheloop.eu/2009/3/19/understanding-lift-s-streamingr...
 
  Construct the CSV in memory and just then stuff it into a
 streaming response as a byte array.
 
  Cheers, Tim
 
  On 14 Feb 2010, at 16:18, Gang wrote:
 
   Hi,
 
   I have a question and it may not be a pure Lift one.  But since
 I'm
   working on a Lift app and this group is the most responsive one
 I have
   seen, might just try it here.
 
   I need todownloaddata from database in CSV format.  What is the
 best
   approach within Lift framework

[Lift] Re: NodeSeq to JsExp how to?

2010-03-09 Thread Stuart Roebuck
Thanks Ross and David…  the code seems to be working great now.

Stuart.

On Mar 9, 10:16 pm, David Pollak feeder.of.the.be...@gmail.com
wrote:
 On Tue, Mar 9, 2010 at 1:11 PM, Stuart Roebuck 
 stuart.roeb...@gmail.comwrote:

  Once again, thanks for all of this.  I will now go away and
  contemplate it all.

  On the face of it, as a newby, this JavaScript DSL adds another layer
  of complexity to using Lift with JavaScript.  Is there an option to
  use mostly raw JavaScript?  What are the advantages / disadvantages?

 JsRaw(my JavaScript Here)

 The disadvantage is type-safety/having the compiler help you.

 I wrote most of the JavaScript helpers (or at least wrote the core stuff and
 other followed my pattern.)  A few months back, there was a discussion about
 changing that stuff around.  I'd like to see Lift's JavaScript helper be a
 lot more composable than they are now... like the Lift-json stuff and also
 integrate better with Lift-json.  But I don't see that happening with Lift
 2.0 unless there's a huge block of time/effort that someone wants to throw
 at the issue.







  Sorry, I thought I'd get my moneys worth from you and then try to put
  something onto the wiki.

  Best,

  Stuart.

  On Mar 9, 5:35 pm, Ross Mellgren dri...@gmail.com wrote:
   That's why I factored this as a JQueryNodeSeq, so you can pass anything
  to dialog (I've used JQuery, and figured you'd need to pass something in
  there ;-)

   JQueryNodeSeq(ns) ~ JsFunc(dialog, JsObj(autoOpen - JsTrue, width
  - 500, ..., close - AnonFunc(JsVal(this) ~ JsFunc(destroy

case class JQueryNodeSeq(ns: NodeSeq) extends JsExp with JQueryLeft
  with HtmlFixer {

   JsExp is the basic trait of the JavaScript DSL. Anything that can go into
  a JavaScript expression should have this trait.
   JQueryLeft is a trait used by the JQuery portion of the JavaScript DSL to
  indicate that you can chain JQuery calls onto this.
   HtmlFixer is a trait that provides fixHtml

   override def toJsCmd = jQuery( + JsStr(fixHtml(NodeSeqDialog,
  ns)).toJsCmd + )

   fixHtml takes the given NodeSeq and does all the appropriate magics to
  process lift: tags and then converts the NodeSeq to valid XHTML.

}

   And don't forget the security implications!

   Hope that helps,
   -Ross

   On Mar 9, 2010, at 12:30 PM, Stuart Roebuck wrote:

Thanks for that amazingly quick response!

I only wish I understood the proposed solution! :-)

So (confession time) I simplified things a little, the actual
JavaScript is…

var theDialog = $(…).dialog( { autoOpen: true, width: 500, modal:
true, close: function() { theDialog.destroy; }; } )

How do I assemble this, or is there any documentation / examples you
can point me to.

Thanks very much,

Stuart.

On Mar 9, 5:14 pm, Ross Mellgren dri...@gmail.com wrote:
Whoops, I meant Str(fixHtml(...)) not JsStr(fixHtml(...))

-Ross

On Mar 9, 2010, at 12:14 PM, Ross Mellgren wrote:

Try this (I haven't tested it, so there could be lurking bugs):

case class JQueryNodeSeq(ns: NodeSeq) extends JsExp with JQueryLeft
  with HtmlFixer {
   override def toJsCmd = jQuery( + JsStr(fixHtml(NodeSeqDialog,
  ns)).toJsCmd + )
}

Then JQueryNodeSeq(ns) ~ JsFunc(dialog)

-Ross

On Mar 9, 2010, at 12:06 PM, Stuart Roebuck wrote:

I'm trying to produce a web page with editable content.

When the user clicks an edit button on a line it uses jQuery to
display a modal dialog which allows fields of that line to be
  edited.

I can easily produce a snippet to produce the lines using the
  backend
data and an XHTML template and binding etc.

However, I also want the template to include the template for the
dialog.  So I want the ajax button callback to send JavaScript to
instantiate the jQuery UI dialog based on the template and bindings.

To build this I need to assemble a JsCmd containing the NodeSeq that
comes from the XHTML sequence and the bindings.

In short, if this was straight jQuery I would have some JavaScript
  of
the form:

$(div title=Dialog TitletheFormNodeSeq/div).dialog()

But in my case theFormNodeSeq comes from a NodeSeq that was
  assembled
from part of the XHTML template and the bindings and the end result
needs to be a JsCmd.

So I'm trying to do something like:

JsCmds.Run($( + theFormNodeSeq.toString + ).dialog())

But I need to address escaping issues with the HTML and I also need
  to
pre-process any lift:… / commands in theFormNodeSeq.

Any advice (please)?

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

[Lift] Re: RequestVar copy /clone ?

2010-03-09 Thread hexa
Unfortunately this did not solve my problem :

Let me paste the complete code :

Client View :

object ViewClient extends ViewClient
{
  object currentClient extends RequestVar [Box [Client]] (Empty)
}

class ViewClient
{
  val clientId = S.param (id) openOr 

  val client = try {
Client.findByKey (clientId.toLong)
  }
  catch {
case e:NumberFormatException = Empty
  }

  def view (inhtml: NodeSeq) : NodeSeq = {

client map ( { c =
  bind (client, inhtml,
firstName - c.firstName.asHtml,
lastName - c.lastName.asHtml,
addInvoice - SHtml.link (/invoice/create, () =
ViewClient.currentClient (Full (c)), Text (Ajouter Facture)))
   } )  openOr Text (Client invalide)

  }
}

AddInvoice View : (linked to /invoice/create)

class AddInvoice {

  def add (inhtml: NodeSeq) : NodeSeq = {

val inInvoice = Invoice.create
val clientBox = ViewClient.currentClient
val client = ViewClient.currentClient.open_!

def processEntry () {
  S.notice (Test  + client.firstName)
  clientBox map (inInvoice.client (_))
  inInvoice.save
  S.notice (Entre : Description  + inInvoice.description + 
Montant :  + inInvoice.amount)
}

bind (e, inhtml,
  description - inInvoice.description.toForm,
  amount - inInvoice.amount.toForm,
  submit - SHtml.submit (Ajouter Facture,  processEntry))
  }
}

This yeilds an empty box exception...

The method suggested by Naftoli Gugenheim does the same .. it seems
the is does not copy the value either...

So in both cases whatever was in my RequestVar is gone on the second
request...


Any ideas ?

Thanks!

hexa

On Mar 9, 3:09 pm, David Pollak feeder.of.the.be...@gmail.com wrote:
 Howdy,

 Lift does rendering most basically with Snippets.  Snippets are functions
 NodeSeq = NodeSeq... they take a NodeSeq and return a NodeSeq.  Snippets
 are generally independent entities.  They do not know about each other.
  They can ask about the state of the session and the state of the request.

 We introduced RequestVar (and SessionVar) to give developers a type-safe way
 to share information during the scope of a request (RequestVar) and session
 (SessionVar).

 RequestVars are strongly typed.  That means if you define a RequestVar to
 hold a String, the compiler will not allow you to put a List into it.

 Behind the scenes, RequestVars use a shared Map[String, Any] to store the
 information.  The String is the name of the RequestVar and the Any is the
 thing that you are putting into the slot for the Var.

 So, we use a little magic to generate the unique but stable name of the
 Var.  Specifically, we look at the class name that the compiler selected for
 the object that extends RequestVar.  If the object is defined within a
 class, the class name for the RequestVar will depend on that class name.
  When you have an object that extends a class, the Scala compiler may
 generate a new class and thus your currentClient RequestVar in the
 ViewClient class and the ViewClient object are different RequestVars.  They
 point to different things.

 The easiest way to deal with this is to make your currentClient a top-level
 object.  If you want to scope the currentClient RequestVar someplace, I'd
 suggest:

 object ViewClient extends ViewClient {
   object currentClient extends RequestVar...

 }

 So, please try putting the currentClient someplace where there's a single
 path (from a class perspective) to it and I'm guessing that your issue will
 go away.

 Thanks,

 David



 On Mon, Mar 8, 2010 at 10:13 PM, hexa hex...@gmail.com wrote:
  Hi,
   I have a RequestVar that I send to a snippet which will then do a
  post...

  But I would like the RequestVar to persist between the moment it it
  received in the post snippet and the post itself...

  The only way I found of doing it right now is like :

  Source Snippet :

  object ViewClient extends ViewClient

  class ViewClient
  {
   object currentClient extends RequestVar [Box [Client]] (Empty)

  bind  (...
   addInvoice - SHtml.link (/invoice/create, () = currentClient
  (Full (c)), Text (Ajouter Facture)))

  Destination Post Snippet :

  def add (inhtml: NodeSeq) : NodeSeq = {

     val inInvoice = Invoice.create
     val clientBox = ViewClient.currentClient

     val client_id = clientBox map (_.id.toLong)

     def processEntry () {
       Client.findByKey (client_id openOr 0) map (inInvoice.client (_))
       inInvoice.save
       S.notice (Entre : Description  + inInvoice.description + 
  Montant :  + inInvoice.amount)
     }

  bind (e, inhtml,
           description - inInvoice.description.toForm,
           amount - inInvoice.amount.toForm,
           submit - SHtml.submit (Ajouter Facture,  processEntry))

  If I try to access the clientBox in processEntry, even with the
  closure it should generate.. I get an empty box...

  Is there any way to copy / ref or anything or make a new RequestVar
  with a copy of the preceding one ?

  Would

[Lift] Re: RequestVar copy /clone ?

2010-03-09 Thread hexa
Oops in the previous code it's actually :

class AddInvoice {

  val clientBox = ViewClient.currentClient
  val client = ViewClient.currentClient.open_!

  def add (inhtml: NodeSeq) : NodeSeq = {

val inInvoice = Invoice.create

def processEntry () {
  S.notice (Test  + client.firstName)
  inInvoice.client (client)
  inInvoice.save
  S.notice (Entre : Description  + inInvoice.description + 
Montant :  + inInvoice.amount)
}

bind (e, inhtml,
  description - inInvoice.description.toForm,
  amount - inInvoice.amount.toForm,
  submit - SHtml.submit (Ajouter Facture,  processEntry))
  }
}

The client* are in the class not the method... works great with a
statful snippet tought

On Mar 9, 7:04 pm, hexa hex...@gmail.com wrote:
 Unfortunately this did not solve my problem :

 Let me paste the complete code :

 Client View :

 object ViewClient extends ViewClient
 {
   object currentClient extends RequestVar [Box [Client]] (Empty)

 }

 class ViewClient
 {
   val clientId = S.param (id) openOr 

   val client = try {
     Client.findByKey (clientId.toLong)
   }
   catch {
     case e:NumberFormatException = Empty
   }

   def view (inhtml: NodeSeq) : NodeSeq = {

     client map ( { c =
       bind (client, inhtml,
             firstName - c.firstName.asHtml,
             lastName - c.lastName.asHtml,
             addInvoice - SHtml.link (/invoice/create, () =
 ViewClient.currentClient (Full (c)), Text (Ajouter Facture)))
                } )  openOr Text (Client invalide)

   }

 }

 AddInvoice View : (linked to /invoice/create)

 class AddInvoice {

   def add (inhtml: NodeSeq) : NodeSeq = {

     val inInvoice = Invoice.create
     val clientBox = ViewClient.currentClient
     val client = ViewClient.currentClient.open_!

     def processEntry () {
       S.notice (Test  + client.firstName)
       clientBox map (inInvoice.client (_))
       inInvoice.save
       S.notice (Entre : Description  + inInvoice.description + 
 Montant :  + inInvoice.amount)
     }

     bind (e, inhtml,
           description - inInvoice.description.toForm,
           amount - inInvoice.amount.toForm,
           submit - SHtml.submit (Ajouter Facture,  processEntry))
   }

 }

 This yeilds an empty box exception...

 The method suggested by Naftoli Gugenheim does the same .. it seems
 the is does not copy the value either...

 So in both cases whatever was in my RequestVar is gone on the second
 request...

 Any ideas ?

 Thanks!

 hexa

 On Mar 9, 3:09 pm, David Pollak feeder.of.the.be...@gmail.com wrote:

  Howdy,

  Lift does rendering most basically with Snippets.  Snippets are functions
  NodeSeq = NodeSeq... they take a NodeSeq and return a NodeSeq.  Snippets
  are generally independent entities.  They do not know about each other.
   They can ask about the state of the session and the state of the request.

  We introduced RequestVar (and SessionVar) to give developers a type-safe way
  to share information during the scope of a request (RequestVar) and session
  (SessionVar).

  RequestVars are strongly typed.  That means if you define a RequestVar to
  hold a String, the compiler will not allow you to put a List into it.

  Behind the scenes, RequestVars use a shared Map[String, Any] to store the
  information.  The String is the name of the RequestVar and the Any is the
  thing that you are putting into the slot for the Var.

  So, we use a little magic to generate the unique but stable name of the
  Var.  Specifically, we look at the class name that the compiler selected for
  the object that extends RequestVar.  If the object is defined within a
  class, the class name for the RequestVar will depend on that class name.
   When you have an object that extends a class, the Scala compiler may
  generate a new class and thus your currentClient RequestVar in the
  ViewClient class and the ViewClient object are different RequestVars.  They
  point to different things.

  The easiest way to deal with this is to make your currentClient a top-level
  object.  If you want to scope the currentClient RequestVar someplace, I'd
  suggest:

  object ViewClient extends ViewClient {
    object currentClient extends RequestVar...

  }

  So, please try putting the currentClient someplace where there's a single
  path (from a class perspective) to it and I'm guessing that your issue will
  go away.

  Thanks,

  David

  On Mon, Mar 8, 2010 at 10:13 PM, hexa hex...@gmail.com wrote:
   Hi,
    I have a RequestVar that I send to a snippet which will then do a
   post...

   But I would like the RequestVar to persist between the moment it it
   received in the post snippet and the post itself...

   The only way I found of doing it right now is like :

   Source Snippet :

   object ViewClient extends ViewClient

   class ViewClient
   {
    object currentClient extends RequestVar [Box [Client]] (Empty)

   bind  (...
    addInvoice - SHtml.link (/invoice/create, () = currentClient
   (Full

[Lift] Serious widget action

2010-03-09 Thread aw
It is time for me to add some serious widgets to my lift app.

So far, I am most enamored by ExtJS.
Another alternative could possibly be ZK.

Does anybody have any experience with these frameworks?  Can you
comment on why integrating them with Scala/Lift would be a bad idea
(or not work)?

I searched for some historical posts on ExtJS and discovered some
threads about it's license and how it impacts inclusion in the lift
framework.  Would a commercial license prohibit it from being a lift-
widget submodule candidate?

Does anybody have a better suggestion that you think can compete with
ExtJS?

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



  1   2   3   4   5   6   7   8   9   10   >