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.



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 to
 

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.



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

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] 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 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 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] 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.



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: 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? 

Re: [Lift] lift-blog - lift based blogging app

2010-03-08 Thread David Pollak
On Mon, Mar 8, 2010 at 4:51 AM, Lukasz Kuczera kuk...@gmail.com wrote:

 Hi Folks.
 I've spawned very simple blog app on lift. This is alpha version and
 code base is not clean (i'm quite new to scala and lift). You can pull
 it from github: git://github.com/kukems/lift-blog.git And there is
 even demo ;) http://www.acidbits.org/lift-blog/

 I need your assistance in choosing name for project and licence type.


Awesome!

If you want to make it easy for people to use your code for any purpose, the
Apache 2.0 does that well.

If you are looking for a license that allows for commercial usage but also
requires a contribute-back if any of the code you wrote is changed, the LGPL
and Mozzila Public License (MPL) do that.

If you are looking to make sure that your code can only be used in open
projects (all the code that touches yours has to be open), go with the GPL.
This option allows you to sell separate commercial licenses that allow for
non-open use of your code.

Name-wise, lift-blog is available in almost all domain suffixes, so that'd
be a good choice.


 I want it open source, but dunno current most fancy licence on the
 street. I've you want to join and help me improving drop me an email
 and i'll give you commit access. If you want to use it just pull out
 from github customize with taste and deploy on your favorite app
 server.

 --
 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: IdPK Model boiler-plate

2010-03-08 Thread David Pollak
I'm going to implement this as a sub-trait of IdPK (anyone got a good name
for the trait).  So, by default, you'll get the current behavior, but if you
think equality should be based on primary key rather than on the field
values, you don't have to have all the boilerplate.

On Sun, Mar 7, 2010 at 11:01 PM, aw anth...@whitford.com wrote:

 What's wrong with KeyedMapper's implementation?

 Well, that was exactly why I was asking the question, Is this
 implementation for equals and hashCode a good idea?  I had gotten
 this at some point, been using it, and am only questioning it now
 because if it truly is a good idea, I think it should be part of the
 framework...

 The hashCode implementation for KeyedMapper looks essentially the
 same:

this.id.is.hashCode
 vs.
primaryKeyField.is.hashCode

 However, the equals implementation for KeyedMapper is a little
 different:

  override def equals (other : Any) = other match {
case t : Team if t.id.is == this.id.is = true
case _ = false
  }

 vs.

  override def equals (other : Any) : Boolean = {
other match {
  case null = false
  case km: KeyedMapper[Nothing,Nothing] if
 this.getClass.isAssignableFrom(km.getClass) ||
km.getClass.isAssignableFrom(this.getClass) =
 this.primaryKeyField == km.primaryKeyField
  case k = super.equals(k)
}
  }

 There are some subtle differences.  I have never used inheritance with
 Mapper to make a complex class hierarchy, so I'm not 100% sure of the
 ramifications (or if it is even possible).


 Personally, I would imagine that two mapper objects are equal using a
 primary key comparison only as long as they are read-only singletons.
 If I had instance #1 loaded into val A and again into var B, then
 modified some elements of B, I would no longer expect A to equal B --
 but with the above implementation, they remain equal as long as the
 primary key field is not altered.

 In JPA/Hibernate land, I actually have a different approach for equals
 and hashCode:  each field is compared with the exception of the @Id
 and @Version columns because they can change upon persistence, and so
 are not part of the equality.  I leverage Apache Commons-Lang
 builders:

@Override
public boolean equals (final Object obj) {
return EqualsBuilder.reflectionEquals(this, obj,
EXCLUDE_FROM_EQUALS_AND_HASH_CODE);
}

@Override
public int hashCode () {
return HashCodeBuilder.reflectionHashCode(this,
EXCLUDE_FROM_EQUALS_AND_HASH_CODE);
}

/**
 * Exclude fields from equals, hashCode, and compareTo that may
 change upon
 * persistence.
 *
 * @see a href=http://www.hibernate.org/109.html;Best
 strategies for
 * implementation of equals() and hashcode() in your persistent
 classes./a
 */
private static final String [] EXCLUDE_FROM_EQUALS_AND_HASH_CODE =
 {id, version};

 So, if Hibernate suggests that you should NOT just compare the primary
 key field, why should Lift-Mapper be doing that?

 --
 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: Js normalizations

2010-03-08 Thread David Pollak
On Mon, Mar 8, 2010 at 12:36 AM, Peter Robinett pe...@bubblefoundry.comwrote:

 +!


Does this translate to I vote you must do this? ;-)

+1



 On Mar 7, 11:11 pm, Heiko Seeberger heiko.seeber...@googlemail.com
 wrote:
  On 7 March 2010 19:37, Marius marius.dan...@gmail.com wrote:
 
 
 
   If you think that this makes sense I'll add a ticket and put it in my
   backlog.
 
  Makes a lot of sense for me. Go for it!
 
  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] Re: BSON support in lift-json

2010-03-08 Thread David Pollak
On Mon, Mar 8, 2010 at 12:50 AM, Joni Freeman freeman.j...@gmail.comwrote:

 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 to lift-json for
   these other data types? Is this even feasible?
 
   Thanks,
   Tim
 
   [1]http://github.com/eltimn/scamongo
   [2]http://bsonspec.org/
   [3]http://www.mongodb.org/display/DOCS/Object+IDs
 
   --
   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.
 
   --
   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 

Re: [Lift] Reorganize mapper specs?

2010-03-08 Thread David Pollak
On Sun, Mar 7, 2010 at 12:47 PM, Naftoli Gugenheim naftoli...@gmail.comwrote:

 Based on discussion on Review Board item 247, I want to propose the
 following change to the organization of Mapper specs.
 Currently there are four files in
 framework/lift-persistence/lift-mapper/src/test/scala/net/liftweb/mapper:
 DBProviders - initalization for each provider to be tested
 MapperSpecs - the original set of tests. Tested per provider, which makes
 sense for tests that interact with the database
 ManyToManySpecs - tests I added with an enhancement to ManyToMany to not
 choke on broken joins. Only uses DBProviders.H2MemoryProvider. When FK
 constraints are enabled in H2 this will have to disable them.
 ItemsListSpecs - tests for a bugfix in ItemsList. Also only uses
 DBProviders.H2MemoryProvider.

 Currently MapperSpecs takes about five minutes to run on my laptop. So any
 new test that isn't driver dependent should probably not be tested on all
 drivers. Thus I'm considering consolidating ItemsListSpecs and
 ManyToManySpecs into one specs for all H2MemoryProvider-only tests.
 Then, with two set of tests, one run for each driver and one not, maybe
 their names should reflect that.
 It's just a possible idea, but what do people think? Also, if I would go
 ahead would it need a ticket or just straight to RB?


I agree with the goal of shortening the time it takes to run mapper tests.

I would like there to be a way (not the default, but something that can be
done with some form of compiler/maven flags) to run all cross-products of
all tests so we just make 100% sure that things work on all RDBMSs.

Please open a ticket first before putting stuff on RB.



 --
 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] Enable -Xcheckinit in 2.8 port?

2010-03-08 Thread David Pollak
On Mon, Mar 8, 2010 at 10:01 AM, Jeppe Nejsum Madsen je...@ingolfs.dkwrote:

 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?)



 /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.




-- 
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] Reorganize mapper specs?

2010-03-08 Thread David Pollak
On Mon, Mar 8, 2010 at 12:00 PM, Naftoli Gugenheim naftoli...@gmail.comwrote:

 I'm not 100% clear on your proposal.
 First of all, is what I've done (on RB) in the meantime okay (without a
 ticket)?


What part of Please open a ticket first before putting stuff on RB. is
unclear?

You've consumed all of my time for stuff related to you until April.


 Basically, I renamed ItemsListSpecs to MapperSpecs2 and put the test for
 issue 370 there. MapperSpecs2 only uses H2 memory db. (Any suggestions for a
 better name?)
 As for your proposal, are you saying that things like ItemsListSpecs and
 370, which deal with high-level Mapper API not directly related to the
 database, should ideally be testable on every database vendor? And/or are
 you saying that *all* the tests should be run by default on only one driver
 but have the option to run on all?
 Also, is it possible to run MapperSpecs for all the drivers in parallel,
 and if so would that cause it to finish faster?

 Thanks.

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

 On Sun, Mar 7, 2010 at 12:47 PM, Naftoli Gugenheim naftoli...@gmail.com
 wrote:

  Based on discussion on Review Board item 247, I want to propose the
  following change to the organization of Mapper specs.
  Currently there are four files in
  framework/lift-persistence/lift-mapper/src/test/scala/net/liftweb/mapper:
  DBProviders - initalization for each provider to be tested
  MapperSpecs - the original set of tests. Tested per provider, which makes
  sense for tests that interact with the database
  ManyToManySpecs - tests I added with an enhancement to ManyToMany to not
  choke on broken joins. Only uses DBProviders.H2MemoryProvider. When FK
  constraints are enabled in H2 this will have to disable them.
  ItemsListSpecs - tests for a bugfix in ItemsList. Also only uses
  DBProviders.H2MemoryProvider.
 
  Currently MapperSpecs takes about five minutes to run on my laptop. So
 any
  new test that isn't driver dependent should probably not be tested on all
  drivers. Thus I'm considering consolidating ItemsListSpecs and
  ManyToManySpecs into one specs for all H2MemoryProvider-only tests.
  Then, with two set of tests, one run for each driver and one not, maybe
  their names should reflect that.
  It's just a possible idea, but what do people think? Also, if I would go
  ahead would it need a ticket or just straight to RB?
 

 I agree with the goal of shortening the time it takes to run mapper tests.

 I would like there to be a way (not the default, but something that can be
 done with some form of compiler/maven flags) to run all cross-products of
 all tests so we just make 100% sure that things work on all RDBMSs.

 Please open a ticket first before putting stuff on RB.


 
  --
  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 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.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.



[Lift] More dynamic Lift

2010-03-08 Thread David Pollak
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 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-08 Thread David Pollak
It's less sensitive to inner class name changes and supports changing 
interfaces.

Connected by MOTOBLUR™ on T-Mobile

-Original message-
From: harryh har...@gmail.com
To: Lift liftweb@googlegroups.com
Sent: Tue, Mar 9, 2010 01:42:10 GMT+00:00
Subject: [Lift] Re: More dynamic Lift

What's the advantage of this sort of setup over using JavaRebel?

-harryh

-- 
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: asHtml compiler exception traversing code ?

2010-03-08 Thread David Pollak
Try doing and mvn clean compile

There are known issues with the Scala 2.7.x compiler related to nested traits 
and only partial recompilation.

Connected by MOTOBLUR™ on T-Mobile

-Original message-
From: hexa hex...@gmail.com
To: Lift liftweb@googlegroups.com
Sent: Tue, Mar 9, 2010 03:15:31 GMT+00:00
Subject: [Lift] Re: asHtml compiler exception traversing code ?

Wow it seems that I now get that even without the asHtml...

Using scala 2.7.7 with lift 1.1-M8 ...


On Mar 8, 9:51 pm, hexa hex...@gmail.com wrote:
 Hi all,

  I have this code :

 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,
             lastName - c.lastName)
                } )  openOr Text (Client invalide)

   }

 }

 class Client extends LongKeyedMapper [Client] with IdPK with OneToMany
 [Long, Client]
 {
   def getSingleton = Client

   object firstName extends MappedString (this, 256)
   object lastName extends MappedString (this, 256)

 A fairly simple view ...

 I would like to call :
     firstName - c.firstName.asHtml

 It would seem appropriate to me since c is a Client ...

 But I get :

 INFO] exception when traversing ((x$2: com.envirobiz.model.Client) = x
 $2.firstName)
 [INFO] exception when traversing client.map[object
 com.envirobiz.model.Client#firstName](((x$2:
 com.envirobiz.model.Client) = x$2.firstName))
 [INFO] exception when traversing client.map[object
 com.envirobiz.model.Client#firstName](((x$2:
 com.envirobiz.model.Client) = x$2.firstName)).toString
 [INFO] exception when traversing client.map[object
 com.envirobiz.model.Client#firstName](((x$2:
 com.envirobiz.model.Client) = x$2.firstName)).toString()

 And more... until :

 [ERROR] scala.tools.nsc.symtab.Types$TypeError: type mismatch;
 [INFO]  found   : x$2.firstName.type (with underlying type object x
 $2.firstName)
 [INFO]  required: com.envirobiz.model.Client#firstName.type

 If I do not do asHtml it works properly...

 Also this works in other contexts like :

  toShow.flatMap (client =
       bind (client, inhtml,
             firstName - client.firstName.asHtml,

 In another list view ..  so i'm confused ...

 Any ideas ?

 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.



Re: [Lift] toForm function passing problem ... ?

2010-03-07 Thread David Pollak
On Sun, Mar 7, 2010 at 9:54 AM, hexa hex...@gmail.com wrote:

 Hi,

  I'm trying to do something which should be simple I think .. passing
 a function to toForm like so :

 class AddClient {

  def add (inhtml: NodeSeq) : NodeSeq = {

val client = Client.create

def processEntry () =  {
  client.save
  S.notice (Entre : Prenom  + client.prenom +  Nom :  +
 client.nom)
}

client.toForm (Full (Ajouter Client),   processEntry )


try:

client.toForm(Full(), processEntrry _ ) // the _ turns it into a
function


  }
 }

 But I keep getting something like :

 AddClient.scala:23: error: overloaded method value toForm with
 alternatives (net.liftweb.util.Box[String],
 (com.envirobiz.model.Client) = Any)scala.xml.NodeSeq and
 (net.liftweb.util.Box[String],String)scala.xml.NodeSeq cannot be
 applied to (net.liftweb.util.Full[java.lang.String],Unit)
 [INFO] client.toForm (Full (Ajouter Client),   processEntry )

 Looking at the spect I see :
 def toForm(button : Box[String], f : (A) = Any)

 So seems to me it should take any func... ,

 Any ideas ?

 Note that i'm new to scala/lift...




 --
 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] IdPK Model boiler-plate

2010-03-07 Thread David Pollak
Good idea.  Please open a ticket at
https://liftweb.assembla.com/spaces/liftweb/tickets and assign it to me.

On Sun, Mar 7, 2010 at 10:57 AM, aw anth...@whitford.com wrote:

 My model classes mix-in IdPK and have the following boiler-plate for
 equals and hashCode:

 class Team extends LongKeyedMapper[Team] with IdPK {
  

  override def equals (other : Any) = other match {
case t : Team if t.id.is == this.id.is = true
case _ = false
  }

  override def hashCode = this.id.is.hashCode
 }


 I'm pretty sure I acquired this boiler-plate for equals and hashCode
 from this Google Group.

 Is this implementation for equals and hashCode a good idea?  If so,
 shouldn't it be part of the IdPK trait?

 --
 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: [lift] superficial first impressions from a rails junkie

2010-03-07 Thread David Pollak
Jonathan, your comments are someplace between not helpful and troll-like.
It'd be best if you did not continue to participate in this thread.

On Sun, Mar 7, 2010 at 5:36 AM, jonathan mawson umpti...@gmail.com wrote:




 If there's no rational reason to use Lift, then perhaps you could find
 another community to spend your time in.


 I didn't say that there was no rational reason to use Lift BUT THAT YOU ARE
 FAILING TO COMMUNICATE WHAT THAT REASON MIGHT BE TO POTENTIAL USERS! You
 can't expect potential users to be Internet mind readers. Which is what
 your
 current strategy amounts to - other than People will try Lift because
 there
 is a buzz about Scala.



  Lift is not a clone of any framework.  It's different and there are
  reasons for those differences.  If you don't like them, please use what
  you like best.  Use what feels most comfortable for you.  Use what works
  best for you.
 

 I very carefully did NOT say that Lift should be a clone. I did say that,
 when you ask users to do things contrary to their expectations of a modern
 web framework, you tell them WHY you are asking them to do that and what
 the
 payoff will be for them. I'd talk them through these surprises with a
 series of short snippets in boxes - I'd also use these snippets for any
 gotchas like those critical spaces after the /. I might start with:

 Working through this tutorial you'll encounter a horrible surprise - Lift
 is
 not YARC! (Yet Another Rails Clone.) That is because we have designed Lift
 to be a fundamentally different creature to Rails. Rails is an excellent
 framework whose first priority is ease of use for simple jobs where server
 efficiency can be traded away to get a site running quickly with minimum
 effort. Lift is a framework designed for jobs where Rails has run out. A
 well designed Lift site can handle up to 20 times the traffic of an
 equivalent Rails site on the same server. And while it perhaps isn't as
 easy
 to do simple things in Lift as in Rails, it is much easier to do most of
 the
 hard ones. In a way, both frameworks carry their philosophy in their names
 -

 - Rails expects you, the programmer, to be happy to run on a relatively
 pre-determined track in return for a simpler life.

 - Lift, like its host language Scala, is designed for HEAVY LIFTING. Its
 priorities are delivering security, maintainability and performance over
 the
 widest possible range of applications. It makes obtaining these good things
 as simple as possible, but occasionally you just have to eat your greens if
 you want to grow up big and strong.

 Those are the rationales behind the design choices we made. Creating your
 first toy site with Lift will take longer than with Rails, but creating
 your
 first secure, scalable site will take less time. Whenever Lift wants you to
 do something particularly surprising in this tutorial you'll see another
 box
 explaining why and what the pay-off will be for you. You'll also see boxes
 warning you of any fiddly 'gotchas'. Happy Lifting!

 Lightly adapted that might work as an intro for Lift in general. It
 *differentiates* you from Rails and gives potential users the info they
 need
 to decide whether or nor Lift is right for them to try, which is what
 technical marketing should be about. (It also obeys the tell them three
 times rule of Writing Stuff You Really Want People To Remember.)

 Oh - and I have now seen the Lift logo, and I think it looks fine!

 --
 View this message in context:
 http://old.nabble.com/superficial-first-impressions-from-a-rails-junkie-tp27802055p27811402.html
 Sent from the liftweb mailing list archive at Nabble.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: [lift] superficial first impressions from a rails junkie

2010-03-07 Thread David Pollak
On Sun, Mar 7, 2010 at 12:15 PM, Naftoli Gugenheim naftoli...@gmail.comwrote:

 I think that Jonathan was impolite in expressing his frustration at being
 misunderstood.


First, don't you think that it's ironic that someone who was trying to teach
us about marketing was so incapable of expressing himself effectively?
 Would you take the marketing advice of someone who cannot communicate basic
concepts without resorting to belittling and screaming?  What you don't know
is that Jonathan made some posting that were more troll-like that I did not
approve (something that's very rare) because they were just rants about us
not understanding what he was saying (including quotes like Lift is just
the flavor of the month).

Some other things you don't know is that Jonathan contacted me privately...
something I generally frown on (see
http://groups.google.com/group/liftweb/browse_thread/thread/c7a97cbf60780f0
 )

He suggested that I read some books by Geoffrey
Moorehttp://mdv.com/team_bio.html?id=11and some books about not
letting MBAs fleece you.

He also offered to help with marketing by offering his email address and no
other information about who he was or why his help would be of value.
 Hmmm another example of not effective marketing. (and yes, I did search
for him via Google and LinkedIn to see if he was some hot shot who was used
to talking in short-hand... but he was no where to be found.)

I suggested that he check out who I run with and asked him to tell me why he
would help with marketing Lift.

His response was that he Googled me and was unable to find any information
about me on Google, that I was not nearly as good at communications as I
thought and that I should include information (a mini-CV in his words) on
the Lift site.

So, let's work through this.

First, there are a couple of links in my sig-line.  The first one is to
Apress's listing for my book: http://www.apress.com/book/view/1430219890  This
page includes information about the author:

David Pollak

David Pollak has been writing commercial software since 1977. He wrote the
award–winning Mesa spreadsheet, which in 1992 was the first real–time
spreadsheet. Wall Street companies traded billions of dollars a day through
Mesa. In 1996, David sold his company to CMP Media and became CTO of CMP
Media’s NetGuide Live and was one of the first large–scale users of Java and
WebLogic to power an Internet site. In 1998, David released Integer, the
world’s first browser–accessible, multiuser spreadsheet. Since 2000, David
has been consulting for companies including Hewlett–Packard, Pretzel
Logic/WebGain, BankServ, Twitter, and SAP. David has been using Scala since
2006 and is the lead developer of the Lift Web Framework.

There's also a link to my Twitter feed http://twitter.com/dpp which
contains a link to my blog http://blog.lostlake.org/.

Now, let's take a look at the Lift http://liftweb.net web site.  On the
front page is a mini-bio:

David Pollak has been writing commercial software since 1977. He wrote the
first real-time spreadsheet and the worlds highest performance spreadsheet
engine. Since 1996, David has been using and devising web development tools.

So, even without searching, one can find a fair amount about me.  But, let's
click through to the Team page on the Lift site.  There's a slightly longer
bio:

David Pollak has been writing commercial software since 1977. He wrote the
first real-time spreadsheet and the worlds highest performance spreadsheet
engine. Since 1996, David has been using and devising web development tools.
As CTO of CMP Media, David oversaw the first large-scale deployment of
WebLogic. David was CTO and VPE at Cenzic, a web application security
company. David has also developed numerous commercial projects in Ruby on
Rails. In 2007, David founded the Lift Web Framework open source project.

If you spend a little time with some of the other team bios, one in
particular will seem out of place... a suit.  Specifically, Debby
Meredith's bio reads:

I'm a currently an engineering management consultant and a venture partner
at JAFCO Ventures. I work hands-on with company founders, helping to
assemble world class teams, architect software products and roadmaps, and
establish operational processes to build success from the beginning.
Previously, I was a venture partner at Mohr Davidow Ventures, VP Eng at
Netscape, VP Eng at Collabra Software, VP Eng at Slate Software, and had key
technical positions at Metaphor Computer Systems, Logitech, and Bell
Laboratories.

So, we've got someone who is a venture partner at JAFCO (a VC firm) who used
to be with MDV (another VC firm) who is a Lift committer.  Now, let me
connect a couple of dots.  Geoffrey Moore is a venture partner at MDV where
Debby used to be a Venture partner.  MDV also funded Cenzic.  What do you
think the chances are that I've at least heard of Crossing the Chasm?  What
are the chances I've read Crossing the Chasm?  What are the chances that
I've spent more than

Re: [Lift] Activity

2010-03-07 Thread David Pollak
On Sat, Mar 6, 2010 at 7:10 PM, Martin martin.lyn...@gmail.com wrote:

 Hey,

 First of all, let me take the complete opposite stance observed from
 one of the most reason posts from a Rails Junkie. I'm very excited
 to see a framework that takes the good from so many different projects
 and houses it under a language that does the same. I find it
 refreshing to have the powerful tools developed around Java available
 for development in this new Scala language and the Lift framework. No
 matter how much one hates the design choices and the verbosity of the
 most popular platform in our lifetime, it is only a benefit that we
 have access to the years of effort devoted to it. The powerful
 compiler behind Scala is my sole reason for preferring it to ports
 like JRuby and Groovy.

 Now to the point of my query, what is the activity and excitement
 levels around lift at this point? I understand that money drives the
 world and to make a framework successful one must market like Rails
 and make some bank to promote future maintenance and improvements.


Please see http://www.ohloh.net/p/liftweb/

They do an analysis of commits to open source projects.  A couple of
take-aways is the increase in both team size and number of commits to Lift
over the last year.  33 different people contributed code.  That's
significant momentum.



 I notice the last production quality release was over a year ago;


Actually, it was last week.  Companies including FourSquare run their
service on Lift milestone releases.

We were hoping to have Lift 1.1 (now 2.0) out a long time ago, but we've
been tracking Scala 2.8 which was, well, supposed to be out a long time ago.
 So, every few months, it looks as if Scala 2.8 is just around the corner
and it seems that it makes sense to hold off on the Lift 2.0 final until
Scala 2.8.

But, I spent a week hanging with Martin Odersky a few weeks back (as well as
Paul Philips) and I think a mid to late Spring 2.8 release is a reality
which means that a Lift 2.0 release will happen 3-6 weeks after that
(depending on where in the month Scala lands and how stable the 2.8.0
release is).


 I do
 notice there have been much more frequent updates to say the wiki and
 the work on the 1.1 milestones. It just seems strange that a minor
 release on such a young project would taking such a long time.


This will change after our 2.0 release.   Perhaps we'll do monthly
milestones and quarterly dot releases (ports of the best of the milestones
that do not break API compatibility).


 This is
 a completely naive view of what is going on, and this is why i post
 this query because I want to be disproven so I can feel comfortable
 suggesting the use of this framework for the long term.


Take a look at ticket velocity and review board velocity.  As you watch the
increase in number of tickets, you'll get, I hope, a sense of vibrance in
the code and the community.  The other thing to look at is the mailing list
velocity and size.  http://groups.google.com/group/liftweb/about?hl=en
We've doubled the number of messages on the list over last year and
the
mailing list size is  1,700 and growing steadily at an average of 5-7 new
people per day.



 Thanks for letting me take some of your time away from more important
 things :). I just figured seeing this was a question in my mind,
 others thinking about using the framework might have the same
 question.


I hope I've addressed your concerns.  If you are thinking about Lift for a
production site (profit or non-profit), please contact me off-list to tell
me about your project.  I may have people that could help you communicate
effectively with your team about the risks and benefits of going with Lift.

Thanks,

David


 -- Martin

 --
 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] superficial first impressions from a rails junkie

2010-03-06 Thread David Pollak
Thanks for your comments.

I did Ruby/Rails for 2 years until I found Scala in November 2006.

Please allow me to rebut your thoughtful post.

On Fri, Mar 5, 2010 at 8:43 PM, cageface milese...@gmail.com wrote:

 Like many other web developers, I abandoned some heavyweight Java web
 frameworks about 6 years ago for Rails and have been working pretty
 much exclusively in Rails ever since.


Back when I was doing Rails, the state of Rails' documentation was not
materially different from the current state of Lift's documentation with the
exception of DHH's awesome book (which is my all time favorite tech book).
Most of the online documentation was weak or non-existent.  It was never
possible to figure out what mixins impacted the behavior of a class.  I
spent most of my time reading Rail's source to figure out how to do anything
that marginally off the beaten path.



 However, I've always had a
 secret lust for functional languages so when I heard about Scala and
 Lift I decided to take a closer look. My first impression of the
 community from studying this list and many other blogs, articles etc
 is that it's a group of smart, dedicated folks that have generously
 dedicated a lot of time and energy to making Lift a first-class
 alternative to the more conventional options.

 However, my first brush with the framework itself has so far left a
 very different impression. I think one of the reasons Rails caught on
 so quickly in the beginning was that it was marketed brilliantly.


This is one of the things I wanted to do differently with Lift.  I didn't
want to market it.  I wanted to build solid technology that addressed
serious needs including security, highly interactive apps, and scalability.
I also wanted to create a welcoming community (Warren does not represent
this community except for his brains which were missing last night when he
wrote his snarky response) so that the adoption of Lift would come from
substance, not a pile of fanboys (this is not a reference to you) who were
not able to see past the flaws in Rails.


 DHH
 made Rails look so simple, stylish and intuitive that anybody drowning
 in the bulk and complexity of Java web dev at the time couldn't help
 but take notice. Lift, in contrast, and particularly for anybody with
 a prior history in Java, seems very daunting and rough.


It depends on what you want to do.

One of the problems I found with new Rails apps was that they were ugly and
unstyled.  We adopted Blueprint CSS as a default for Lift projects so at
least they looked clean.  Further, Lift's templating with surround makes
it much easier to swap out better looking sites.  My experience doing Rails
(remember, this goes back 5 years, so this situation may have changed) was
that I spent the first hour of any project doing the layout.

The second issue with Rails apps is when you do them easy they tend not to
be secure.  When I say secure, I mean this kind of secure:
http://twitter.com/rasmus/status/5929904263 When you protoype in Lift, you
get secure by default.  You don't have to have the security sprint or
other stuff after prototype stage to get things right.


 The following
 impressions are very much superficial first impressions and may really
 have no deeper substance than that but I think first impressions count
 for a lot in this sphere.


While I agree, that early impressions are important. But at the same time,
Lift is unabashedly different.  It's different for reasons and those reasons
are often borne out of experience.  It takes some time to get used to the
differences.

My goal with the getting started guide was to set up ET-style Reese's Pieces
so that the reader would get a sense of success and a sense of Lift's
difference and benefits.  I'm sorry that the pieces didn't taste good to
you. ;-)



 First, the liftweb.net site is nice. It's a clean, elegant,
 contemporary design. So far so good. Let's click on getting started.
 What's this? PDF? Who uses PDF?


While I'm not sure I 100% agree with Tim's 6 million dollar man argument
about PDF, PDF is common and useful... Scribd (which is definitely in the
hip-cool-kids side of street) is built on PDF.


 Nevermind, let's look at the HTML.
 Gack! This looks like an academic LaTEX conversion from the 90s.
 Layout and formatting are next to non-existent. This doesn't look like
 the intro for a simple, ready-to-use tool.


Okay... sorry... but this is a gratuitous swipe.  Ugly == Not Easy to Use.
Nope.  Sorry.  I don't buy this.



 Oh well, pushing past the wall of text intro we discover that we need
 Maven. Alarms are starting to go off in the heads of many Java
 refugees that remember Maven as the nadir of the XML-situp
 overabstracted agony that was pre-Rails Java web dev.


We are not in the build tool business.  When we started with Lift, the
options were Ant and Maven.  You can read this list for the occasional
anti-Maven flare-up.  I stand by the decision.

Currently, there are a couple of alternatives to Maven.  

Re: [Lift] superficial first impressions from a rails junkie

2010-03-06 Thread David Pollak
On Fri, Mar 5, 2010 at 9:58 PM, Warren Henning warren.henn...@gmail.comwrote:

 tl;dr

 Want a cookie for your efforts?

 If you don't like Lift, don't use it. Problem solved. Hooray, turkey
 for everyone!


Warren -- this comment is way out of bounds for the Lift list.  You know I
love your sarcasm and your grumpy-as-an-80-year-old-at-21 attitude, but
dude... somewhere else 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.




-- 
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: [lift] superficial first impressions from a rails junkie

2010-03-06 Thread David Pollak
On Sat, Mar 6, 2010 at 9:02 AM, jonathan mawson umpti...@gmail.com wrote:




 Timothy Perrett wrote:
 
  By all means, come here with questions and you will find this group to be
  very responsive and helpful, but do not come here and automatically
 assume
  that you can illuminate to us the errors in our project marketing or
  experience.
 

 What's automatic about Mark's analysis? He's a new Lift user, he's told you
 what the new user experience is like - he did the appropriate work to be
 able to do this. If there is anything automatic here it is your dismissal
 of
 the problems that Mark had. This sort of user feedback is gold - he's made
 a
 real effort to tell you what trying to get started with Lift was like for
 him. And reading what Mark wrote, I'm sure that he is much brighter and
 more
 interested in Lift than the average Java/RoR programmer.


  Lift is not Rails. It really bugs me when people are like oh, well rails
 does XYZ.

 The guy never said it was. He explained why he switched to Rails and why he
 thinks Rails has been successful.

 The important point that Rails people who want their framework to takeoff
 have to understand here is ***that at no time during Mark's experience did
 anyone communicate a reason to him why Lift was worth persevering with.***
 That's what marketing is about. If Mark had known there was a strong enough
 potential benefit then he would have persisted. At the moment Lift's only
 perceived benefit seems to be that it provides you with a web framework for
 Scala. That's a nice strategy for getting a couple of dozen FPophiles to
 commit code, but it won't take Lift anywhere in the real world of What
 does
 this framework do for my project/career/business.

 You need to start telling people what Lift especially well so that they
 have
 some idea why they might use it! The best effort I have seen to do this
 comes not from the Lift community but from another reviewer, here -


 http://ikaisays.com/2009/03/03/first-impressions-of-lift-scala-web-development-framework-from-a-ruby-on-rails-developer/

 Other concerns:

 - I suspect that Lift has enough mass inside the Scala community to prevent
 the emergence of another web framework. And that without an acceptable web
 framework Scala - which I am now 100% in love with - will not be a
 successful language.

 - How much of the difficulty that people seem to have in using Lift is
 intrinsic to the framework and how much to poor docs? What are the
 ***pay-offs*** for those design decisions that have made Lift harder to
 use?


You mistake different with harder.  People who are used to one way to do
things will find different harder than the same.

In the case of view-first, there are plenty of posts as to why it's better.

In the case of Maven, there are plenty of posts and discussions on that
matter as well.

More broadly, and I wish I had pointed this out to the OP, Lift projects are
typically smaller than similar Rails projects.  The couple of ports I've
done, I've seen some substantive code reductions and significant test code
reductions.  And, what I've gotten in addition to a smaller code base is
higher performance, more security, and more maintainability.  So, Lift is in
fact not harder to use.


 (Even when this simply means less Rails-like.) Communicating these would go
 a long way to reducing newbie frustration. Is Lift even designed to have as
 wide an appeal as RoR or Grails? If not, be frank about it and communicate
 where its strengths lie.




 --
 View this message in context:
 http://old.nabble.com/superficial-first-impressions-from-a-rails-junkie-tp27802055p27805572.html
 Sent from the liftweb mailing list archive at Nabble.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: [lift] superficial first impressions from a rails junkie

2010-03-06 Thread David Pollak
On Sat, Mar 6, 2010 at 9:19 AM, jonathan mawson umpti...@gmail.com wrote:


 As this is likely to be very controversial, I'll recap one more time while
 my
 gf finishes dying her hair -

 - Don't ignore people like Mark. His feedback was detailed, thoughtful, and
 invaluable if want non-committers to use Lift

 - Do decide how you are going to position Lift. Position being about
 -- What can Lift do better than its rivals?
 -- Who should use it? Is it a master programmer's tool or accessible to the
 Drupal crowd? If inbetween, where exactly?

 Having done that then, rather than a new logo, I'd suggest writing a couple
 of articles about Lift that centre around above (Eg Lift is *the* tool for
 intermediate  experienced Java programmers who need to deploy high
 performance sites that do X)


There are articles in the pipeline.


 and creating a new and thoroughly debugged new
 user guide.


And where are the bugs in the existing user guide?  Further, the complaint
of the OP seem to be the formatting is ugly (okay, we can address this),
I don't like Maven (this will change) I don't like markup in my code,
except I do this implicitly in Rails (yeah... not much to talk about).




 Get new users, sit them in front of a PC and watch what happens.
 Do not help them. Do make notes on what they do and say - and fix every
 problem that comes out this way. (I'd probably be willing to work on these
 things, although I expect the sentiment for lynching me will be stronger.)


 --
 View this message in context:
 http://old.nabble.com/superficial-first-impressions-from-a-rails-junkie-tp27802055p27805716.html
 Sent from the liftweb mailing list archive at Nabble.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: [lift] superficial first impressions from a rails junkie

2010-03-06 Thread David Pollak
On Sat, Mar 6, 2010 at 5:50 AM, jonathan mawson umpti...@gmail.com wrote:




 Jeppe Nejsum Madsen wrote:
 
  Timothy Perrett timo...@getintheloop.eu writes:
 
  Sorry Jeppe, but I disagree.
 
  On which part :-) Maybe the not really into the visual
  aesthetics. What I meant was not that we don't care, but more that we
  will rather spend time on coding.
 
  The issue to date has been getting someone to work on it for
  free... The recession has worked against us here because people have
  been hand-to-mouth work wise, and couldn't spare time that wasn't paid
  for.
 
  Look at it this way: Committers work on the code for free and I guess
  that's also the case for many other OSS projects. Yet some still manage
  to create visually pleasing websites  introduction material. I can only
  (perhaps falsely?)  attribute this to the difference in focus/skills of
  the team.
 
  I actually come from a marketing / design background, and have tried
  to move this aspect of Lift along, but its been problematic with
  designers not committing and so forth. Lift needs a rebrand / restyle,
  yes, however, its easier said than done.
 
  My point exactly. If someone on the Lift community feels strong enough
  about this (and has the skills) it would move forward in the same way as
  the code...alas it doesn't, so we need to force it by trying to
  hire/manage someone external.
 
  /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.
 
 
 

 Rebranding Lift wouldn't be about logos. They're irrelevant to a product
 aimed at programmers. You need to identify an occupy-able niche and then
 communicate your advantage in that niche to the right people. That means
 saying convincingly

 - Lift does X better than existing solutions
 - Here's why you should believe that and invest time
 - Here is how to get started

 And that X has to be very concrete.


You mean:

Lift stresses the importance of security, maintainability, scalability and
performance, while allowing for high levels of developer productivity.



At the moment Lift's brand is It uses
 Scala, It has a reputation for being hard, and I don't know if anyone
 is
 really using it.

 You also have to kill the potential killer negatives - eg concerns that
 Lift
 will still be around in two or three years.


This is more of a concern about Scala in general.  Every available metric
points to the fact that Lift has reached critical mass.  Our community is
larger than Wicket's.  Our code velocity is faster than Wicket's. Etc.

The bigger issue that I've heard from the corporate adoption side is will
Scala be around in 2 years?



 I would also say that re-branding needs to happen *fast* before attention
 focuses on Grails - there is only so much new mindshare available at any
 time.


Every Grails vs. Lift bake-off I've been involved, Lift has won hands down.
Once you do Ajax or Comet, Lift wins.  Once you try to scale, Lift wins.
More generally, ever Java shop that's adopted Groovy and then Scala has
dumped Groovy.

The advantage that Groovy/Grails has is SpringSource/VMWare.  But actual
adoption is waning (just look at Tiobe).

There will be an answer to the corporate types looking for support on Lift
and Scala in the next few weeks.






 --
 View this message in context:
 http://old.nabble.com/superficial-first-impressions-from-a-rails-junkie-tp27802055p27804368.html
 Sent from the liftweb mailing list archive at Nabble.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: Re: [lift] superficial first impressions from a rails junkie

2010-03-06 Thread David Pollak
On Sat, Mar 6, 2010 at 3:29 PM, jonathan mawson umpti...@gmail.com wrote:




 You mistake different with harder.  People who are used to one way to do
 things will find different harder than the same.


 No, I don't. Different *is* harder. When there is a convention it should be
 followed unless there is a good reason not to do so. This is one of the
 half
 dozen or so key principles of usability. When you choose to do something in
 a way that requires extra effort - *especially* when there is a convention
 you could have followed - then tell people, briefly, that you have a good
 reason for doing so. One that will benefit them.



  In the case of view-first, there are plenty of posts as to why it's
  better.
 

 Said posts won't help when trying to get more people to use Lift. It's up
 to
 you to set your priorities, but if one of those is creating a framework
 that
 people use in significant numbers then you can't adopt a People could read
 posts attitude to your new user experience. Especially when RoR and Grails
 have set the bar so high.



  The couple of ports I've
  done, I've seen some substantive code reductions and significant test
 code
  reductions.  And, what I've gotten in addition to a smaller code base is
  higher performance, more security, and more maintainability.  So, Lift is
  in
  fact not harder to use.
 

 Sorry, no. A better result does NOT equal easier to use. It might equal
 Easier to use for a superior programmer who has tougher requirements.
 Otherwise Emacs and Latex would be easier to use than Word - and much
 easier than Notepad. What you are saying is that Scala is more powerful.
 Which is great, because in any software product category there are usually
 three viable niches - easiest to use, cheapest, and most powerful. In your
 shoes I'd think about going after that most powerful niche.

 I know that you're anti marketing, but not all marketing is BS. A lot of it
 - at least in technical products - is honest communication regarding the
 niches that your product is designed for. If you don't tell potential Lift
 users what Lift can do for them, why should they try it? There really isn't
 a rational reason.


If there's no rational reason to use Lift, then perhaps you could find
another community to spend your time in.


 And why create a framework which no one will use?


Yeah, there are 1,700 nobodies on the Lift list.  The folks at FourSquare
and Novell and Innovation Games and Xerox and SAP and Siemenns and etc. are
nobody.

Lift is not a clone of any framework.  It's different and there are reasons
for those differences.  If you don't like them, please use what you like
best.  Use what feels most comfortable for you.  Use what works best for
you.





 --
 View this message in context:
 http://old.nabble.com/superficial-first-impressions-from-a-rails-junkie-tp27802055p27808051.html
 Sent from the liftweb mailing list archive at Nabble.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: superficial first impressions from a rails junkie

2010-03-06 Thread David Pollak
On Sat, Mar 6, 2010 at 12:13 PM, cageface milese...@gmail.com wrote:

 On Mar 6, 9:35 am, David Pollak feeder.of.the.be...@gmail.com wrote:
  Back when I was doing Rails, the state of Rails' documentation was not
  materially different from the current state of Lift's documentation with
 the
  exception of DHH's awesome book (which is my all time favorite tech
 book).
  Most of the online documentation was weak or non-existent.

 This is true, but *getting started* was extremely easy.


Apparently you used Rails in a different era from me.

Rails and Ruby and Gem were not native on OS X (it became part of the OS in
10.4).  One had to be a serious guru to build and install the basic Ruby
system.   Even using RedHat and RPMs, it was a good 2 hours to get Ruby and
Gem and Rails installed.  Back in 2005-2006 Ruby and Rails were not easy to
get started with.

Once that was done, yes, the initial Rails project was easy to create... a
tad easier than Tim's 1 line Maven command, but not that much easier.


 A few very non-
 intimidating commands and you were up  running and making quick edits
 that appeared in real time.


Yep.  There is a difference between a statically compiled language and a
dynamic one.  There is a difference between keeping a fair amount of state
around and not.  There are costs and benefits with each.  While I would like
to make Lift easier to be change and reload out of the box, in general, if
that is the barrier to adoption for a certain segment, then so be it.


 Once you started to dig a little deeper
 you ran into the problems you describe but by that point the fish was
 already on the hook.


So, the key thing is what's the flash to bang.  Yes, these days, the flash
to bang with Rails is fast.  Maybe we should have built the real time chat
stuff as the first project.  http://liftweb.blip.tv/file/2033658/  It's
faster flash to bang.  But, I disagree with the assertion that the flash to
bang for Lift is long.  Yeah, if someone is going to spend 2 minutes with
Lift, we probably won't make a case.  If someone spends enough time to see
the Ajax features of Lift (especially coming from the Java frameworks, but
even coming from Rails), we get a substantial number of folks who are hooked
like
http://groups.google.com/group/liftweb/browse_thread/thread/136d2accec22f300?hl=en(Lift
is so complex but once you wrap your head around it is so easy :D )



  This is one of the things I wanted to do differently with Lift.  I didn't
  want to market it.  I wanted to build solid technology that addressed
  serious needs including security, highly interactive apps, and
 scalability.

 I started working with Lisp  other functional languages about 10
 years ago and it's been frustrating to watch inferior languages like
 Ruby and Python sail past them in popularity over that time. I think a
 lot of this has to do with a naivety in the functional programming
 community that solving the hard problems is what matters and that
 people will naturally  logically adopt tools that do this.
 Unfortunately, it appears that the opposite is much more often then
 case and that people choose easy  fashionable first.


A big part of gaining long term adoption of any technology is timing the
chasm crossing such that when the chasm is crossed, there is long term
sustainability.

DHH promoted Rails too early in my opinion.  VeriSign adopted Rails for some
projects and after deploying those projects and then paying Zed Shaw to
write Mongrel, VeriSign dumped Rails.  Had Rails been lower visibility, the
Rails community would not have suffered through this embarrassment followed
by the Twitter embarrassment.  To this day, even though Rails has high
visibility and is more stable than it used to be, it is still tarred on the
corporate side with the doesn't scale moniker.  This has opened the doors
for Grails.

Another failing of Rails is the community.  The Rails community is a
significant detractor to adoption outside of the young hip kids.

What we have in Lift is very solid technology, an excellent community,
tremendous committers, and an increasing number of very high profile
projects built on Lift.  These are very solid, very defensible assets.  But
I'd rather try to cross the chasm and actively promote Lift and Scala to the
broader community when we know what community we're promoting to (hip Web
2.0+ kids, Enterprisy folks, ???), what the real value proposition is, and
when we have a revenue model that is not based on selling out to the likes
of Sun or VMWare.  As an aside, I've been getting calls from VCs lately
about investing in Lift  Scala.  Some of them just want to bet on a horse
and some of them have been actively working with me, Martin and others to
figure out what Lift and Scala look like across the chasm.

But right now, Lift is a community, committers and excellent technology for
building secure, maintainable, highly interactive web sites.  When it's time
to build a business around Lift and Scala, you will see

Re: [Lift] Re: Newbie Q: how to append html on ajaxForm submission

2010-03-05 Thread David Pollak
On Fri, Mar 5, 2010 at 2:00 AM, Lukasz Kuczera kuk...@gmail.com wrote:

 So i've solved it on my own :D Using jQuery in Lift :D
 Lift is so complex but once you wrap your head around it is so easy :D


Glad you found the answer... and yes... it's good to build your own
JavaScript helpers for Lift.  Most of the JavaScript stuff that's currently
in Lift is based on the helpers I and some other committers have used...
thus they are not complete.

More generally, there's no need to prefix your email subjects with
Newbie.  We're all newbies on this list.  I asked a newbie question
about json yesterday and I've got more Lift experience than anyone else with
Lift. ;-)

Please ask polite questions (and yours are).  Please help others when you
know the answer.  Please help make this community better!



 http://pastebin.com/J5msUQ56

 On Mar 5, 9:57 am, Lukasz Kuczera kuk...@gmail.com wrote:
  Hi Folks,
  I've hard time to figure out how to append html snippet after ajaxForm
  is submitted. I know how to make it in jQuery but i would prefer to
  have it in one place. My code is:http://pastebin.com/wgAXd2ag
 
  I would love to have AppendHtml(afterId: String, body: NodeSeq)
  method.

 --
 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] email validation configuration

2010-03-05 Thread David Pollak
If you set the Mailer.authenticator in Boot, that will do authentication for
mail sending.

On Fri, Mar 5, 2010 at 5:33 AM, Jeppe Nejsum Madsen je...@ingolfs.dkwrote:

 On Fri, Mar 5, 2010 at 2:21 PM, GA my_li...@me.com wrote:
  Hello guys,
 
  could you please let me know where I can find information about how to
 configure the email validation for the MegaProtoUser?
 
  I do not know how to tell Lift about our SMTP server, Authentication
 data, etc. I was searching in the wiki and this list but I could not find
 anything.

 Have a look at the Mailer object. Specifically, it reads either jndi
 or the property mail.smtp.host for the hostname. Not sure if handles
 authentication.

 /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.




-- 
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] Wow... Lift has some amazing stats

2010-03-05 Thread David Pollak
Folks,

I just looked at Lift's stats on ohloh.  ( http://www.ohloh.net/p/liftweb )
A couple of key items:

Very large, active development team

Over the past twelve months, 33
developershttp://www.ohloh.net/p/liftweb/contributorscontributed new
code to
 Lift http://www.ohloh.net/p/liftweb.

This is one of the largest open-source teams in the world, and is in the top
2% of all project teams on Ohloh.

For this measurement, Ohloh considered only recent changes to the code. Over
the entire history of the project, 45 developers have contributed.
Increasing year-over-year development activity

Over the last twelve months, Lift http://www.ohloh.net/p/liftweb has seen
a substantial increase in activity. This is probably good sign that interest
in this project is rising, and that the open source community has embraced
this project.

Ohloh makes this determination by comparing total number of commits made by
all developers during the most recent twelve months with the same figure for
the twelve months before that. The number of developers and total lines of
code are not considered.
So, a big thanks to the community for driving Lift and another big thanks to
the Lift committers for adding so much to Lift!

Thanks,

David

-- 
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: Lift security vulnerability

2010-03-05 Thread David Pollak
On Fri, Mar 5, 2010 at 9:32 AM, Dano olearydani...@gmail.com wrote:

 I would never claim to be astute.  However, I did observe that
 demo.liftweb.net is now built using 2.0-M3 as is clearly listed at the
 bottom of the page.  I also observed that the Wizard example is still
 broken (paste binary characters into 'First Name' and then click the
 Next button).  I have not yet registered for an account with Assembla
 but would be happy to file the bug.


I don't know what you mean by pasting binary characters into a field, but
I have updated the Arc Challenge code to:
class ArcChallenge extends StatefulSnippet {
  var dispatch: DispatchIt = {case _ = xhtml = ask}

  def control: String = (for (i - 0 until 65000) yield i.toChar).mkString

  /**
   * Step 1: Type in a Phrase.
   */
  def ask = {
p
Say Anything:
{text(, p = phrase = control + p + control)}
{submit(Submit, () = dispatch = {case _ = xhtml = think})}
/p
  }

  /**
   * Step 2: Show a link that takes you to the Phrase you entered.
   */
  def think = submit(Click here to see what you said,
 () = dispatch = {case _ = xhtml = answer})

  /**
   * Step 3: Show the phrase.
   */
  def answer = pYou said: {phrase}/p

  private var phrase = 
}
}
}

This code inserts characters 0 - 65,000 into the string to be sent back to
the browser, including every control character.

Once again, if you have a reproducible case (the exact steps that someone
must follow) to cause Lift to emit illegal XHTML, please open a defect on
Assembla




 Dan

 On Mar 4, 7:33 pm, Ross Mellgren dri...@gmail.com wrote:
  Check dpp's response as of 8:01
 
  -Ross
 
  On Mar 4, 2010, at 7:49 PM, Naftoli Gugenheim wrote:
 
 
 
   What version is the demo running?
 
   -
   Danoolearydani...@gmail.com wrote:
 
   Just saw that Lift 2.0-M3 was released.  I looked to see if the
   vulnerability was still present in demo.liftweb.net and I am still
   able to generate exceptions in the browser when I paste binary
   characters in the textfields for the Wizard, Wizard Challenge, and Arc
   Challenge examples in the Misc section.
 
   Don't know if this remaining problem is supposed to be handled by the
   application or framework, but thought I would make a post to alert the
   group.
 
   Dan
 
   On Feb 24, 11:49 am, Dano olearydani...@gmail.com wrote:
   The recent scala days conference activity may have cause the updates
   to this thread to escape notice.  Just wondering if there is concern
   about the remaining binary character problems I noted in my prior
   post.
 
   Thanks in advance.
 
   Dan
 
   On Feb 22, 1:34 pm, Dano olearydani...@gmail.com wrote:
 
   More information on this in case anyone is interested.  If you go to
   theliftdemo website, it appears the issue with characters is mostly
   addressed except for the Misc code section.   Specifically, the
   Wizard, Wizard Challenge and Arc Challenge #1 examples will
   generate XML parsing errors.
 
   For these problems, I am not sure if the issue if the example or the
   framework.  If the issue is with the example, it would be good to
 know
   whatLiftapps need to do to avoid getting bitten by binary characters
   entered into form fields.
 
   Thanks in advance.
 
   Dan
 
   On Feb 17, 11:06 am, Dano olearydani...@gmail.com wrote:
 
   Hello,
 
   I was wondering if the fix for the control characters issue was
   included in 2.0-M2.  I just did a test with ourLiftapplication built
   with 2.0-M2 and I am still seeing problems (i.e. javascript
 exceptions
   - NS_ERROR_INVALID_POINTER).
 
   Thanks in advance.
 
   Dan
 
   On Feb 3, 9:08 am, David Pollak feeder.of.the.be...@gmail.com
 wrote:
 
   Thanks for pointing that out.  There are other problems as well...
 I'll fix
   them (in both the Scala andLiftdiffs)
 
   On Wed, Feb 3, 2010 at 7:39 AM, Feng Zhang sharpzh...@gmail.com
 wrote:
   I found that in the fix, \n is changed to \t, while \t to \n. Is
 this
   desired behavior?
 
   Thank you,
 
   Feng
 
   On Wed, Feb 3, 2010 at 9:20 AM, Indrajit Raychaudhuri 
 indraj...@gmail.com
   wrote:
 
   1. Fix in head/master (2.0-SNAPSHOT) and prepone 2.0-M2.
 
   2. Backport in 1.0.x branch and spin 1.0.4. We haven't marked
 1.0.x
   'unsupported' yet. Forcing apps to move to 2.0-M2 just for this
   vulnerability fix isn't fun.
 
   Cheers, Indrajit
 
   On 03/02/10 3:34 PM, Timothy Perrett wrote:
 
   +1
 
   Fix it in head, no need to back-port; M2 is only around the
 corner.
 
   Cheers, Tim
 
   On 3 Feb 2010, at 09:49, Jeppe Nejsum Madsen wrote:
 
David Pollakfeeder.of.the.be...@gmail.com  writes:
 
I'd like to get a sense of how important the community views
 this
   defect.
   Is it a backport the fix to every milestone and release
 yesterday or
   is it
   a fix it in 2.0-M2 or someplace in between.
 
   For me, it's fix it in 2.0-SNAPSHOT
 
   /Jeppe
 
   --
   You received this message because you are subscribed to the
 Google
   Groups

Re: [Lift] Re: Lift security vulnerability

2010-03-05 Thread David Pollak
On Fri, Mar 5, 2010 at 10:26 AM, Dano olearydani...@gmail.com wrote:

 I think I would like to amend my last post by asking if it is possible
 that the lift-json library support the ability to strip out binary
 characters since many times an application uses the results of JSON
 operations to render back to the client.


Control characters are legal in JSON so it's not the place of the library to
strip out control characters.

If you're sending JSON strings that are supposed to be valid XHTML, then
it's up to your app to make sure the Strings are valid.  If you are using
Scala's XML literals and toString, you are hitting a bug in the XML
libraries that render incorrect Strings.  I have fixed the bug in the 2.8
branch, but there's no practical way to go back and make the fix part of
2.7.x.

If you use Lift's AltXML library to convert the XML to String.  Lift's
library also has the patch to ensure that XML - String is valid per this
W3C page: http://www.w3.org/International/questions/qa-controls



 Thanks.


 Dan

 On Mar 5, 9:53 am, Dano olearydani...@gmail.com wrote:
  I can reproduce it in our application, but I think it is not
  necessarily due to Lift.  This is what I am trying to sort out.  We
  have client-side javascript which is sending JSON commands to the
  server and things blow up once things come back from the server.  In
  this case, Lift is not responsible for the rendering so I would say
  this is an application issue.
 
  I am poking at the demo lift application to try to flush out issues
  common to the group and understand what is a framework issue and what
  needs to be addressed by the application.
 
  Thanks.
 
  Dan
 
  On Mar 5, 9:47 am, Naftoli Gugenheim naftoli...@gmail.com wrote:
 
 
 
   Can you reproduce the vulnerability in your own M3 app?
 
   -
 
   Danoolearydani...@gmail.com wrote:
 
   I would never claim to be astute.  However, I did observe that
   demo.liftweb.net is now built using 2.0-M3 as is clearly listed at the
   bottom of the page.  I also observed that the Wizard example is still
   broken (paste binary characters into 'First Name' and then click the
   Next button).  I have not yet registered for an account with Assembla
   but would be happy to file the bug.
 
   Dan
 
   On Mar 4, 7:33 pm, Ross Mellgren dri...@gmail.com wrote:
 
Check dpp's response as of 8:01
 
-Ross
 
On Mar 4, 2010, at 7:49 PM, Naftoli Gugenheim wrote:
 
 What version is the demo running?
 
 -
 Danoolearydani...@gmail.com wrote:
 
 Just saw that Lift 2.0-M3 was released.  I looked to see if the
 vulnerability was still present in demo.liftweb.net and I am still
 able to generate exceptions in the browser when I paste binary
 characters in the textfields for the Wizard, Wizard Challenge, and
 Arc
 Challenge examples in the Misc section.
 
 Don't know if this remaining problem is supposed to be handled by
 the
 application or framework, but thought I would make a post to alert
 the
 group.
 
 Dan
 
 On Feb 24, 11:49 am, Dano olearydani...@gmail.com wrote:
 The recent scala days conference activity may have cause the
 updates
 to this thread to escape notice.  Just wondering if there is
 concern
 about the remaining binary character problems I noted in my prior
 post.
 
 Thanks in advance.
 
 Dan
 
 On Feb 22, 1:34 pm, Dano olearydani...@gmail.com wrote:
 
 More information on this in case anyone is interested.  If you go
 to
 theliftdemo website, it appears the issue with characters is
 mostly
 addressed except for the Misc code section.   Specifically, the
 Wizard, Wizard Challenge and Arc Challenge #1 examples will
 generate XML parsing errors.
 
 For these problems, I am not sure if the issue if the example or
 the
 framework.  If the issue is with the example, it would be good to
 know
 whatLiftapps need to do to avoid getting bitten by binary
 characters
 entered into form fields.
 
 Thanks in advance.
 
 Dan
 
 On Feb 17, 11:06 am, Dano olearydani...@gmail.com wrote:
 
 Hello,
 
 I was wondering if the fix for the control characters issue was
 included in 2.0-M2.  I just did a test with ourLiftapplication
 built
 with 2.0-M2 and I am still seeing problems (i.e. javascript
 exceptions
 - NS_ERROR_INVALID_POINTER).
 
 Thanks in advance.
 
 Dan
 
 On Feb 3, 9:08 am, David Pollak feeder.of.the.be...@gmail.com
 wrote:
 
 Thanks for pointing that out.  There are other problems as
 well... I'll fix
 them (in both the Scala andLiftdiffs)
 
 On Wed, Feb 3, 2010 at 7:39 AM, Feng Zhang 
 sharpzh...@gmail.com wrote:
 I found that in the fix, \n is changed to \t, while \t to \n.
 Is this
 desired behavior?
 
 Thank you,
 
 Feng
 
 On Wed, Feb 3, 2010 at 9:20 AM, Indrajit Raychaudhuri 
 indraj...@gmail.com
 wrote

Re: [Lift] Re: Lift security vulnerability

2010-03-05 Thread David Pollak
On Fri, Mar 5, 2010 at 12:06 PM, Dano olearydani...@gmail.com wrote:

 I should have been more clear on 'pasting binary characters'.  At the
 url http://www.webmasterworld.com/forum39/1098.htm, they talk about an
 issue with binary characters.  I copied the 'square character' text
 (which I have confirmed are binary) from that page into the Wizard
 example on the demo lift site.


Dan,

And I did the same thing and it caused no problems.  I also modified the
example code to print out the characters and they were in fact control
characters (1 and 4).  They can through the other side (back to my browser)
stripped from the XHTML.

As I said, if there is a reproducible case that you can show against Lift
2.0-M3 or 2.0-SNAPSHOT, open a ticket.  However, in the future, please do
not expect that I'll spend any more of my time addressing your issues.

David



 As to JSON, our client side code is sending JSON containing what the
 user entered in the form.  Based on the above, it sounds like we
 should strip the binary characters when processing the JSON commands.

 Thanks.


 Dan


 On Mar 5, 10:49 am, David Pollak feeder.of.the.be...@gmail.com
 wrote:
  On Fri, Mar 5, 2010 at 10:26 AM, Dano olearydani...@gmail.com wrote:
   I think I would like to amend my last post by asking if it is possible
   that the lift-json library support the ability to strip out binary
   characters since many times an application uses the results of JSON
   operations to render back to the client.
 
  Control characters are legal in JSON so it's not the place of the library
 to
  strip out control characters.
 
  If you're sending JSON strings that are supposed to be valid XHTML, then
  it's up to your app to make sure the Strings are valid.  If you are using
  Scala's XML literals and toString, you are hitting a bug in the XML
  libraries that render incorrect Strings.  I have fixed the bug in the 2.8
  branch, but there's no practical way to go back and make the fix part of
  2.7.x.
 
  If you use Lift's AltXML library to convert the XML to String.  Lift's
  library also has the patch to ensure that XML - String is valid per this
  W3C page:http://www.w3.org/International/questions/qa-controls
 
 
 
 
 
   Thanks.
 
   Dan
 
   On Mar 5, 9:53 am, Dano olearydani...@gmail.com wrote:
I can reproduce it in our application, but I think it is not
necessarily due to Lift.  This is what I am trying to sort out.  We
have client-side javascript which is sending JSON commands to the
server and things blow up once things come back from the server.  In
this case, Lift is not responsible for the rendering so I would say
this is an application issue.
 
I am poking at the demo lift application to try to flush out issues
common to the group and understand what is a framework issue and what
needs to be addressed by the application.
 
Thanks.
 
Dan
 
On Mar 5, 9:47 am, Naftoli Gugenheim naftoli...@gmail.com wrote:
 
 Can you reproduce the vulnerability in your own M3 app?
 
 -
 
 Danoolearydani...@gmail.com wrote:
 
 I would never claim to be astute.  However, I did observe that
 demo.liftweb.net is now built using 2.0-M3 as is clearly listed at
 the
 bottom of the page.  I also observed that the Wizard example is
 still
 broken (paste binary characters into 'First Name' and then click
 the
 Next button).  I have not yet registered for an account with
 Assembla
 but would be happy to file the bug.
 
 Dan
 
 On Mar 4, 7:33 pm, Ross Mellgren dri...@gmail.com wrote:
 
  Check dpp's response as of 8:01
 
  -Ross
 
  On Mar 4, 2010, at 7:49 PM, Naftoli Gugenheim wrote:
 
   What version is the demo running?
 
   -
   Danoolearydani...@gmail.com wrote:
 
   Just saw that Lift 2.0-M3 was released.  I looked to see if the
   vulnerability was still present in demo.liftweb.net and I am
 still
   able to generate exceptions in the browser when I paste binary
   characters in the textfields for the Wizard, Wizard Challenge,
 and
   Arc
   Challenge examples in the Misc section.
 
   Don't know if this remaining problem is supposed to be handled
 by
   the
   application or framework, but thought I would make a post to
 alert
   the
   group.
 
   Dan
 
   On Feb 24, 11:49 am, Dano olearydani...@gmail.com wrote:
   The recent scala days conference activity may have cause the
   updates
   to this thread to escape notice.  Just wondering if there is
   concern
   about the remaining binary character problems I noted in my
 prior
   post.
 
   Thanks in advance.
 
   Dan
 
   On Feb 22, 1:34 pm, Dano olearydani...@gmail.com wrote:
 
   More information on this in case anyone is interested.  If
 you go
   to
   theliftdemo website, it appears the issue with characters is
   mostly
   addressed except

Re: [Lift] Re: Lift or Scala first?

2010-03-05 Thread David Pollak
Try working through:
http://liftweb.net/docs/getting_started/mod_master.html

If you find yourself confused about stuff at the language/syntax level, then
by all means, buy my book. ;-)

On Fri, Mar 5, 2010 at 2:42 PM, Peter Robinett pe...@bubblefoundry.comwrote:

 Yes, yes, yes! David's book was a fantastic guide for me as I learned
 Scala and Lift at the same time.

 Going back to the original question, I've learned a language and a
 framework at the same time twice (Lift and Scala, Pylons and Python)
 and I'm torn. On one hand having lots of high quality example code and
 defined goals really helped guide my learning but on the other hand
 you have that much more to learn at all once. I guess it really
 depends on your style of learning.

 Just my two cents...

 Peter

 On Mar 5, 2:23 pm, Wilson MacGyver wmacgy...@gmail.com wrote:
  I highly recommend first you read chapter 1-5 of Beginning Scala by
  David Pollak.
 
  then you are ready to start working through lift's tutorial, samples,
 etc.
 
  On Fri, Mar 5, 2010 at 12:19 PM, Mini Naim minin...@gmail.com wrote:
   Hi guys:
   I have a simple question, it's necessary to learn Scala first? or i
   can go with Lift framework, without learn Scala language?
 
   Thanks
 
   --
   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.
 
  --
  Omnem crede diem tibi diluxisse supremum.

 --
 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: non snapshot version of lift for scala 2.8

2010-03-04 Thread David Pollak
I've been using Lift's 280_port_refresh branch for developing Goat Rodeo and
it's been working quite well for me.

We're going to wait a little while (probably until a Scala 2.8 release
candidate) before publishing a Lift on Scala release (vs. snapshot).

On Thu, Mar 4, 2010 at 6:36 AM, Lukasz Kuczera kuk...@gmail.com wrote:

 I'm developing blog app on 280 and so far no problems yet. Only one
 weird thing i see is that CRUDify shuffles columns, data is misplaced
 with header in tables, but I didn't have time yet to look at it
 closer. BTW is there any public blog app available for Lift ?


None that I know of.


 If there
 is i'm wasting my time i hope not so i could publish it as a give
 back ;)



That'd be wicked awesome!



 On Mar 4, 12:32 pm, Jeppe Nejsum Madsen je...@ingolfs.dk wrote:
  On Thu, Mar 4, 2010 at 12:27 PM, Indrajit Raychaudhuri
 
 
 
 
 
  indraj...@gmail.com wrote:
 
   On 04/03/10 3:26 PM, Jeppe Nejsum Madsen wrote:
 
   On Thu, Mar 4, 2010 at 10:39 AM, Indrajit Raychaudhuri
   indraj...@gmail.com  wrote:
 
   Lukasz,
 
   We don't have non-SNAPSHOT version of Lift for scala 2.8 branch yet.
   You are encouraged to use 2.0-scala280-SNAPSHOT and report any issue
 that
   you encounter.
 
   Is there a status of the 2.8 branch somewhere on what works and what
   doesn't? (Ie. are some modules missing, known things that don't work)
   Or is everything ported and stuff that doesn't work is a defect?
 
   The only module missing at the moment is lift-osgi and related ones
 because
   it is dependent on 2.8 port of scalamodules. Heiko said one is on its
 way as
   an Eclipse project (www.eclipse.org/proposals/scalamodules).
 
   The rest are either of:
   - defects
   - non-functional because of API change
   - sub-optimal design
   - combination of the above
 
   (look for the comment FIXME: 280 in the code-base)
 
   I would love to get to the 2.8 Eclipse plugin and I've just started a
   new Lift project where I can accept some bumps along the road, but
   I've held off until now because I wasn't really sure of the status
 
   If you can accept the bumps, you are welcome to give scala 2.8 port a
 shot.
   This would be great in fact.
 
  Cool! Thanks for the update, I think I'll try it...
 
  /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.




-- 
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: Response Optimizations too aggressive

2010-03-04 Thread David Pollak
On Thu, Mar 4, 2010 at 9:27 AM, aw anth...@whitford.com wrote:

 On Mar 4, 6:56 am, Naftoli Gugenheim naftoli...@gmail.com wrote:
  How about
  LiftRules.stripComments.default.set( () = !Req.isIE)
  etc.?


This is where Lift's FactoryMaker shines.  You can modify the behavior of
stripComments on a request-by-request basis.  You can have a snippet called
from your default template that tests the request and does:

LiftRules.stripComments.request.set(S.request.map(!_.isIE) openOr false)

But, as you point out, that means that CometActors will not get the right
settings... so you can set the rule on a session-by-session basis:

LiftRules.stripComments.request.set(S.request.map(!_.isIE) openOr false)

If that's not enough, you could also do the following in Boot.scala:

object shouldStripComments extends SessionVar(S.request.map(!_.isIE) openOr
false)

S.addAround(List(new LoanWrapper {
  def apply[T](f: = T): T =
LiftRules.stripComments.doWith(shouldStripComments.is)(f)
}))

The above code wraps each request with access to the shouldStripComments
Session Variable.

The above vomit of different options is more for the benefit of those that
are confused by FactoryMaker and why it seems so complex... it's because it
offers a ton of different flexibility.

Thanks,

David


 Well, this doesn't quite work because I need a Req class instance, not
 just the static object.
 Also, to me, this determination is really at the Session level rather
 than the Request level as I don't expect it to change.  But of course
 I don't have a Session.isIE field...  What about Comet responses?  I
 have no Request in that scenario, but is it using the same code to
 produce the xhtml?

 I see that the Factory trait has a session-specific Maker and a
 request-specific Maker, but it is unclear to me how I can get that
 context.  I require more guidance.

 --
 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] Textmate bundle with codecompletion (beta)

2010-03-04 Thread David Pollak
I might have to fire up my Mac to try this out. ;-)

On Wed, Mar 3, 2010 at 3:34 PM, Mads Hartmann Jensen mads...@gmail.comwrote:

 Ok,
 This is the last time I'll bump this  (I promise) - anyone using TextMate
 can follow the bundle on github.

 I improved the bundle and it's fairly usable now, check  out a teaser video
 here: http://www.sidewayscoding.com/2010/03/textmate-lift-bundle-v02.html

 Thanks

 On 23/02/2010, at 19.08, Mads Hartmann Jensen wrote:

  Duh, I comittet a wrong version of the bundle to git! The right version
 is up now if you wan't to give it a try Indrajit :) I would appreciate the
 feedback:
  http://github.com/mads379/Lift-TextMate-Bundle
 
  On 22/02/2010, at 13.12, Mads Hartmann Jensen wrote:
 
  Don't get too excited, it's very beta right now ;)
 
  Sent from my iPhone
 
  On 22/02/2010, at 13.04, Indrajit Raychaudhuri indraj...@gmail.com
 wrote:
 
  Heavens! Need to give this a shot.
 
  On 22/02/10 4:55 PM, Mads Hartmann wrote:
  Hello everyone,
  I've been working a bit on a TextMate bundle for Lift projects that
  has codecompletion. It's still very beta but I'm sure someone would
  find it helpfull :)
 
  If you're interested you can read a bit more about it here:
 
 http://www.sidewayscoding.com/2010/02/lift-textmate-bundle-now-with-primitive.html
 
  NB: It's nowhere near as good as what I've seen in intelliJ (haven't
  tried netbeans or eclipse) but that doesn't mean it isn't helpful :)
 
  If you want to help out, please fork me on github
 http://github.com/mads379
 
 
  --
  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] Newbie Q: can I manually create a LiftSession?

2010-03-04 Thread David Pollak
Do you want to create/access a LiftSession from outside a Lift-handed
request, but make sure the same LiftSession is available when you access the
Lift parts of your app? (sorry, I want to make sure I understand the
problem)

Right now, there's no good way to do that... sorry :-(

Feel encouraged to open a ticket on it at
https://liftweb.assembla.com/spaces/liftweb/tickets  It'd be ideal if you
could include a test application so we could verify it was doing the right
thing.

On Wed, Mar 3, 2010 at 6:04 PM, David Dearing dpdear...@gmail.com wrote:

 I'm new to Lift and am trying to use Lift within a subpath of my web
 application.  For example, http://domain.com is an existing webapp,
 but my LiftFilter handles the user_mgt subpath (http://domain.com/
 user_mgt/* http://domain.com/%0Auser_mgt/*).  My existing webapp already
 handles user authentication,
 but I want to use the lost/change password functionality of Lift's
 MegaProtoUser.

 How do I create a LiftSession from my existing webapp so that I can
 call User.logUserIn(my_user)?

 I am embedding my User.logUserIn call within S.initIfUninitted like
 this:
   S.initIfUninitted(my_lift_session.openOr(** SOMETHING? **))
   {
  User.logUserIn(user)
   }

 If a LiftSession exists, I can retrieve it and it works fine:
   val my_lift_session = SessionMaster.getSession(current_session_id,
 Empty)

 However, when my_lift_session is Empty, I have tried:
   LiftRules.sessionCreator(new
 provider.servlet.HTTPServletSession(current_session), ))

 which appears to create a new LiftSession, but when I actually
 navigate to a page in the subpath
 http://domain.com/user_mgt/change_password
 it doesn't recognize that I've logged in.  Perhaps when I load the
 page http://domain.com/user_mgt/change_password it is creating a new
 LiftSession even though one already exists?

 I've been banging my head on this for a while.
 Any help would be greatly appreciated!
 dave

 --
 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] JSON help...

2010-03-04 Thread David Pollak
Folks,

I'm working on parsing through some JSON that's posted/put as part of a
request.  I'd like to find the messageId field and only get it if its type
is JInt.  I'm doing this within a for comprehension that has a Box at the
top of it, so the resulting expression must play well with Box.  What I've
got is:

  for {
user - WorkerMgr.find(UserId(user)) ?~ User not found
json - r.json
(_, messageJson) - (json \ classOf[JField]).find(_._1 ==
messageId)
messageId - Box.asA[JInt](messageJson)
(_, timemillisJson) - (json \ classOf[JField]).find(_._1 ==
timestamp)
timemillis - Box.asA[JInt](timemillisJson)
  } yield ...

The lines that look for messageId and timestamp and insure they are JInts
are kinda verbose.  Is there a better way to do what I'm trying to do?

Thanks,

David

-- 
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: SQL error

2010-03-04 Thread David Pollak
On Thu, Mar 4, 2010 at 1:10 PM, Mads Hartmann Jensen mads...@gmail.comwrote:

 This has already been on reviewboard and comitted to master - should i send
 out a breaking change note?


Yeah.  Send out a breaking change note.  The likelihood of breakage is low,
but possible.



 I'm not sure i get why this is a breaking change though?

 On 04/03/2010, at 22.07, Jim Barrows wrote:

 On Thu, Mar 4, 2010 at 1:47 PM, Naftoli Gugenheim naftoli...@gmail.comwrote:

 Is blob a standard reserved word or only on MySQL?
 If the latter this is a potential breaking change.


 Blob is not apparently part of the ANSI standard reserved word for SQL.  I
 would have sworn it was.   However, it is common in Oracle, MS SQL server
 and others.  Might as well be standard.




 -
 Mads Hartmannmads...@gmail.com wrote:

 Ah! That fixed it, thanks a lot Jeppe ;)

 I'm not sure what to say in the ticket though, the column-name blob
 was a bad choise made by me.

 On Mar 4, 1:32 pm, Jeppe Nejsum Madsen je...@ingolfs.dk wrote:
  On Thu, Mar 4, 2010 at 1:25 PM, Mads Hartmann mads...@gmail.com
 wrote:
   Hello everyone,
   I'm not sure if this is a lift problem or it's me. I'm trying to add
   the ability to upload images to a project - I'm using the code
   explained here:
  http://groups.google.com/group/liftweb/browse_thread/thread/b0509263e.
 ..
 
   I added two mapper classes:
   ---
   class ImageInfo extends LongKeyedMapper[ImageInfo] with IdPK {
def getSingleton = ImageInfo
 
object date extends MappedLong(this) {
  override def defaultValue = Helpers.millis
}
object mimeType extends MappedPoliteString(this, 64)
object name extends MappedPoliteString(this, 256) {
  override def dbIndexed_? = true
  override def defaultValue = 
 
  private def noSlashes(s: String) : List[FieldError] =
if (s.contains(/))
  List(FieldError(this, Text(Image name
 \ + s + \ may not
   contain \/\)))
else
  Nil
 
  override def validations =
valMinLen(1, Image name must not be empty) _ ::
valUnique(Image name must be unique) _ ::
noSlashes _ ::
super.validations
}
 
object blob extends MappedLongForeignKey(this, ImageBlob)
 
def deleteWithBlob {
  this.blob.obj match {
case Full(x) = x.delete_!
case _ =
  }
  this.delete_!
}
   }
   -
   and
   --
   class ImageBlob extends LongKeyedMapper[ImageBlob] with IdPK {
def getSingleton = ImageBlob
 
object image extends MappedBinary(this)
   }
   -
 
   The schemifier couldn't create the tables it gave to following
   error ::
   You have an error in your SQL syntax; check the manual that
   corresponds to your MySQL server version for the right syntax to use
   near 'blob BIGINT UNSIGNED)  ENGINE = InnoDB' at line 1
 
   this is the sql statement it tried to execute
 
   CREATE TABLE imageinfo (name VARCHAR(256) , id BIGINT UNSIGNED NOT
   NULL AUTO_INCREMENT UNIQUE KEY , date_c BIGINT , mimetype
   VARCHAR(64) , blob BIGINT UNSIGNED)  ENGINE = InnoDB
 
  I looks like it tries to create a column named blob, afaiks blob is a
  reserved word in MySqlhttp://
 dev.mysql.com/doc/refman/5.0/en/reserved-words.html
 
  You could try renaming the field. If this solves the problem, please
  file a ticket
 
  /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.




 --
 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.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 

Re: [Lift] Re: JSON help...

2010-03-04 Thread David Pollak
On Thu, Mar 4, 2010 at 12:52 PM, Joni Freeman freeman.j...@gmail.comwrote:

 Tried it myself and that version does not work. You probably need
 nested for-comprehension which parses the JSON:


I added:

  implicit def iterableToBox[X](in: Iterable[X]): Box[X] = in.headOption

And it makes things hunky dory.

Thanks for your help!


 for {
  user - WorkerMgr.find(UserId(user)) ?~ User not found
  json - r.json
   data - Box(for {
 JField(messageId, JInt(messageId))  - json
JField(timestamp, JInt(timemillis)) - json
   } yield (messageId, timemillis))
 } yield ...

 Cheers Joni

 On Mar 4, 9:55 pm, Joni Freeman freeman.j...@gmail.com wrote:
  Hi David,
 
  Does this work?
 
for {
  user - WorkerMgr.find(UserId(user)) ?~ User not found
  json - r.json
  JField(messageId, JInt(messageId))  - json
  JField(timestamp, JInt(timemillis)) - json
} yield ..
 
  Cheers Joni
 
  On Mar 4, 9:28 pm, David Pollak feeder.of.the.be...@gmail.com wrote:
 
   Folks,
 
   I'm working on parsing through some JSON that's posted/put as part of a
   request.  I'd like to find the messageId field and only get it if its
 type
   is JInt.  I'm doing this within a for comprehension that has a Box at
 the
   top of it, so the resulting expression must play well with Box.  What
 I've
   got is:
 
 for {
   user - WorkerMgr.find(UserId(user)) ?~ User not found
   json - r.json
   (_, messageJson) - (json \ classOf[JField]).find(_._1 ==
   messageId)
   messageId - Box.asA[JInt](messageJson)
   (_, timemillisJson) - (json \ classOf[JField]).find(_._1 ==
   timestamp)
   timemillis - Box.asA[JInt](timemillisJson)
 } yield ...
 
   The lines that look for messageId and timestamp and insure they are
 JInts
   are kinda verbose.  Is there a better way to do what I'm trying to do?
 
   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.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] Resuming a Statefull Snippet.

2010-03-04 Thread David Pollak
On Thu, Mar 4, 2010 at 2:00 PM, andythedestroyer andythedestro...@gmail.com
 wrote:

 Hello,

 I have a simple use case where there is a 2 page form wizard then a
 redirect to a third party ( for some external validation ) which
 redirects back to a third and final page of the wizard.

 I know I could just use snippets and SessionVars to manage this but I
 have been using StatefullSnippets and would like to try to solve this
 problem rather than accept failure and use another method.

 I pass the url for the third page to the third party to redirect to
 when their work is done. The problem is the snippet state is lost
 after the redirect. I have tried many different things and it seems
 like something like this should work.

 // in the processing done before redirect to third party.
 // assemble the return path url.

 class Wizard extends StatefulSnippet with Logger {
 
 def doRedirect = {
 val returnPath = urlEncode(S.hostAndPath + ( link(/lastPage, () =
 redirectTo(/lastPage), NodeSeq.Empty) \ @href).text)

 redirectTo( third_party_url +?return= + returnPath)
 }
 }


Try:

def doRedirect {
  val tmp = Helpers.randomString(20)

  S.addHighLevelSessionDispatcher(wizard, {
 case Req(List(tmp), _, _) = () = {
 S.removeHighLevelSessionDispatcher(wizard)
 redirectTo(/lastPage)
   }
   }

   val returnPath= urlEncode(S.hostAndPath + tmp)

   S.redirectTo(third_party_url+?return= + returnPath)
}


The high level session dispatcher was built for this very reason... further,
the return URL is random and only associated with the current session so it
makes hijacking any information or redirecting other sessions back to the
URL a non-issue.

Thanks,

David


 This does generate a return path like http://localhost:8080/lastPage?
 F1151306194165AHF=_ , however all state is gone after the third party
 redirects back to the site, however if I don't redirect to the third
 party and instead redirect the val returnPath I construct directly,
 state is maintained.

 Is it possible to resume my StatefulSnippet? Or shall I just use
 something else?

 Thanks to all who read and or respond.

 -Andy

 --
 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: Resuming a Statefull Snippet.

2010-03-04 Thread David Pollak
On Thu, Mar 4, 2010 at 4:26 PM, andythedestroyer andythedestro...@gmail.com
 wrote:

 Ok Wow. Sometimes you really impress me dpp. That worked. I don't
 think I ever would have figured that out but now that I see it I see
 what is going on. I have never used HighLevelSessionDispatcher before
 though.. I need to go though the code and learn that one.


Nobody but me (and now you) that I know of ever used
highLevelSessionDispatch.

I added the feature when we were working on some code back in the
CircleShare day that had to go out to an external service and then have a
return URL which contained state.  Being able to define a throw-away URL was
the best answer.

Please add this to the wiki.



 Good stuff. Thanks again you smart smart man.


blush/



 -Andy

 On Mar 4, 3:56 pm, David Pollak feeder.of.the.be...@gmail.com wrote:
  On Thu, Mar 4, 2010 at 2:00 PM, andythedestroyer 
 andythedestro...@gmail.com
 
 
 
   wrote:
   Hello,
 
   I have a simple use case where there is a 2 page form wizard then a
   redirect to a third party ( for some external validation ) which
   redirects back to a third and final page of the wizard.
 
   I know I could just use snippets and SessionVars to manage this but I
   have been using StatefullSnippets and would like to try to solve this
   problem rather than accept failure and use another method.
 
   I pass the url for the third page to the third party to redirect to
   when their work is done. The problem is the snippet state is lost
   after the redirect. I have tried many different things and it seems
   like something like this should work.
 
   // in the processing done before redirect to third party.
   // assemble the return path url.
 
   class Wizard extends StatefulSnippet with Logger {
   
   def doRedirect = {
   val returnPath = urlEncode(S.hostAndPath + ( link(/lastPage, () =
   redirectTo(/lastPage), NodeSeq.Empty) \ @href).text)
 
   redirectTo( third_party_url +?return= + returnPath)
   }
   }
 
  Try:
 
  def doRedirect {
val tmp = Helpers.randomString(20)
 
S.addHighLevelSessionDispatcher(wizard, {
   case Req(List(tmp), _, _) = () = {
   S.removeHighLevelSessionDispatcher(wizard)
   redirectTo(/lastPage)
 }
 }
 
 val returnPath= urlEncode(S.hostAndPath + tmp)
 
 S.redirectTo(third_party_url+?return= + returnPath)
 
  }
 
  The high level session dispatcher was built for this very reason...
 further,
  the return URL is random and only associated with the current session so
 it
  makes hijacking any information or redirecting other sessions back to the
  URL a non-issue.
 
  Thanks,
 
  David
 
 
 
   This does generate a return path like http://localhost:8080/lastPage?
   F1151306194165AHF=_ , however all state is gone after the third party
   redirects back to the site, however if I don't redirect to the third
   party and instead redirect the val returnPath I construct directly,
   state is maintained.
 
   Is it possible to resume my StatefulSnippet? Or shall I just use
   something else?
 
   Thanks to all who read and or respond.
 
   -Andy
 
   --
   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...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en.



Re: [Lift] Re: Lift security vulnerability

2010-03-04 Thread David Pollak
On Thu, Mar 4, 2010 at 4:33 PM, Dano olearydani...@gmail.com wrote:

 Just saw that Lift 2.0-M3 was released.  I looked to see if the
 vulnerability was still present in demo.liftweb.net


And the astute and not-so-astute observer will note at the bottom of each
page on demo.liftweb.net:
Lift version 1.1-SNAPSHOT built on Tue Nov 24 13:58:20 PST 2009.

If you have a reproducible case (running against Lift 2.0-M3 or
2.0-SNAPSHOT) of the security vulnerability, you are welcome to submit it as
a ticket.


 and I am still
 able to generate exceptions in the browser when I paste binary
 characters in the textfields for the Wizard, Wizard Challenge, and Arc
 Challenge examples in the Misc section.

 Don't know if this remaining problem is supposed to be handled by the
 application or framework, but thought I would make a post to alert the
 group.


 Dan

 On Feb 24, 11:49 am, Dano olearydani...@gmail.com wrote:
  The recent scala days conference activity may have cause the updates
  to this thread to escape notice.  Just wondering if there is concern
  about the remaining binary character problems I noted in my prior
  post.
 
  Thanks in advance.
 
  Dan
 
  On Feb 22, 1:34 pm, Dano olearydani...@gmail.com wrote:
 
   More information on this in case anyone is interested.  If you go to
   theliftdemo website, it appears the issue with characters is mostly
   addressed except for the Misc code section.   Specifically, the
   Wizard, Wizard Challenge and Arc Challenge #1 examples will
   generate XML parsing errors.
 
   For these problems, I am not sure if the issue if the example or the
   framework.  If the issue is with the example, it would be good to know
   whatLiftapps need to do to avoid getting bitten by binary characters
   entered into form fields.
 
   Thanks in advance.
 
   Dan
 
   On Feb 17, 11:06 am, Dano olearydani...@gmail.com wrote:
 
Hello,
 
I was wondering if the fix for the control characters issue was
included in 2.0-M2.  I just did a test with ourLiftapplication built
with 2.0-M2 and I am still seeing problems (i.e. javascript
 exceptions
- NS_ERROR_INVALID_POINTER).
 
Thanks in advance.
 
Dan
 
On Feb 3, 9:08 am, David Pollak feeder.of.the.be...@gmail.com
 wrote:
 
 Thanks for pointing that out.  There are other problems as well...
 I'll fix
 them (in both the Scala andLiftdiffs)
 
 On Wed, Feb 3, 2010 at 7:39 AM, Feng Zhang sharpzh...@gmail.com
 wrote:
  I found that in the fix, \n is changed to \t, while \t to \n. Is
 this
  desired behavior?
 
  Thank you,
 
  Feng
 
  On Wed, Feb 3, 2010 at 9:20 AM, Indrajit Raychaudhuri 
 indraj...@gmail.com
   wrote:
 
  1. Fix in head/master (2.0-SNAPSHOT) and prepone 2.0-M2.
 
  2. Backport in 1.0.x branch and spin 1.0.4. We haven't marked
 1.0.x
  'unsupported' yet. Forcing apps to move to 2.0-M2 just for this
  vulnerability fix isn't fun.
 
  Cheers, Indrajit
 
  On 03/02/10 3:34 PM, Timothy Perrett wrote:
 
  +1
 
  Fix it in head, no need to back-port; M2 is only around the
 corner.
 
  Cheers, Tim
 
  On 3 Feb 2010, at 09:49, Jeppe Nejsum Madsen wrote:
 
   David Pollakfeeder.of.the.be...@gmail.com  writes:
 
   I'd like to get a sense of how important the community views
 this
  defect.
  Is it a backport the fix to every milestone and release
 yesterday or
  is it
  a fix it in 2.0-M2 or someplace in between.
 
  For me, it's fix it in 2.0-SNAPSHOT
 
  /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
 .
  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.
 
  --
  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.
 
   --
  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

Re: [Lift] Snippets in subpackages?

2010-03-03 Thread David Pollak
On Tue, Mar 2, 2010 at 11:42 PM, Heiko Seeberger 
heiko.seeber...@googlemail.com wrote:

 On 3 March 2010 00:03, David Pollak feeder.of.the.be...@gmail.com wrote:



 On Tue, Mar 2, 2010 at 1:05 PM, Heiko Seeberger 
 heiko.seeber...@googlemail.com wrote:

 Hi,

 Isn't it possible to put snippets in subpackages of xxx.snippet?
 Something like lift:snippet
 type=com.acme.snippet.subpackage.SnippetClass?

 If not, what's the best way to deal with a large number of snippets?


 Explicitly registering the snippet dispatch in LiftRules is the way I'd
 recommend doing it.  If this is less than 100% optimal for your use case,
 let's learn more about your use case and see if we have to expand how
 Snippets are looked up.


 Well, registering quite a lot of snippets is indeed less than 100% optimal.

 OK, I have got a not-so-small website with about 100 templates and
 snippets. The templates are organized as a tree, e.g. /login/signup/seeker,
 /login/signup/offerer, etc. There is not a perfect 1:1 relationship between
 templates and snippets, but for sake of simplicity let's assume so. Hence I
 would like to organize my snippets in packages according to the templates,
 e.g. ...snippet.login.signup.Seeker, ...snippet.login.signup.Offerer, etc.


One of the things I do with page-specific snippets is call them out in
SiteMap:

Loc(..., Snippet(foo, snipetFunc))

But it might also be interesting to explore a model like Wickets:

foo/bar/page.html - look in snippets.foo.bar in addition to the normal
snippets package... would that help?



 Thank you,

 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] Transactions with Mapper

2010-03-03 Thread David Pollak
On Tue, Mar 2, 2010 at 5:53 AM, Timothy Perrett timo...@getintheloop.euwrote:

 Probally worth sticking this on the wiki

 Cheers, Tim

 Sent from my iPhone


Wait... you've got a broken hand and you can still type on your iPhone?!?!
:-)




 On 2 Mar 2010, at 14:37, Jeppe Nejsum Madsen je...@ingolfs.dk wrote:

  ced docpom...@googlemail.com writes:

  When I use Mapper outside a request, say in an actor, how do I wrap it
 in a transaction? I know that I do a S.addAround(DB.buildLoanWrapper)
 to have transactions within a request.
 Can anyone provide a simple code snippet?


 You can use use :-)

 DB.use(DefaultConnectionIdenfifier) {connection =
  User.findAll 
 }

 /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] Snippets in subpackages?

2010-03-03 Thread David Pollak
On Wed, Mar 3, 2010 at 8:27 AM, Ross Mellgren dri...@gmail.com wrote:

 On Mar 3, 2010, at 11:25 AM, David Pollak wrote:

 On Tue, Mar 2, 2010 at 11:42 PM, Heiko Seeberger 
 heiko.seeber...@googlemail.com wrote:

 On 3 March 2010 00:03, David Pollak feeder.of.the.be...@gmail.comwrote:

 On Tue, Mar 2, 2010 at 1:05 PM, Heiko Seeberger 
 heiko.seeber...@googlemail.com wrote:

 Hi,

 Isn't it possible to put snippets in subpackages of xxx.snippet?
 Something like lift:snippet
 type=com.acme.snippet.subpackage.SnippetClass?

 If not, what's the best way to deal with a large number of snippets?


 Explicitly registering the snippet dispatch in LiftRules is the way I'd
 recommend doing it.  If this is less than 100% optimal for your use case,
 let's learn more about your use case and see if we have to expand how
 Snippets are looked up.


 Well, registering quite a lot of snippets is indeed less than 100%
 optimal.

 OK, I have got a not-so-small website with about 100 templates and
 snippets. The templates are organized as a tree, e.g. /login/signup/seeker,
 /login/signup/offerer, etc. There is not a perfect 1:1 relationship between
 templates and snippets, but for sake of simplicity let's assume so. Hence I
 would like to organize my snippets in packages according to the templates,
 e.g. ...snippet.login.signup.Seeker, ...snippet.login.signup.Offerer, etc.


 One of the things I do with page-specific snippets is call them out in
 SiteMap:

 Loc(..., Snippet(foo, snipetFunc))

 But it might also be interesting to explore a model like Wickets:

 foo/bar/page.html - look in snippets.foo.bar in addition to the normal
 snippets package... would that help?


 I have wanted this for a while, I think it would be great.


Does that mean you just signed up to write it? ;-)



 -Ross

  --
 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: Snippets in subpackages?

2010-03-03 Thread David Pollak
On Wed, Mar 3, 2010 at 9:30 AM, Heiko Seeberger 
heiko.seeber...@googlemail.com wrote:

 Yep, that would help a lot!


Cool.  Please open a ticket and assign it to Ross... if he wants, he can
assign it to me or you. ;-)


 Heiko

 On Wednesday, March 3, 2010, David Pollak feeder.of.the.be...@gmail.com
 wrote:
 
 
  On Tue, Mar 2, 2010 at 11:42 PM, Heiko Seeberger 
 heiko.seeber...@googlemail.com wrote:
 
  On 3 March 2010 00:03, David Pollak feeder.of.the.be...@gmail.com
 wrote:
 
 
 
 
  On Tue, Mar 2, 2010 at 1:05 PM, Heiko Seeberger 
 heiko.seeber...@googlemail.com wrote:
 
  Hi,
  Isn't it possible to put snippets in subpackages of xxx.snippet?Something
 like lift:snippet type=com.acme.snippet.subpackage.SnippetClass?
 
 
 
 
  If not, what's the best way to deal with a large number of snippets?
  Explicitly registering the snippet dispatch in LiftRules is the way I'd
 recommend doing it.  If this is less than 100% optimal for your use case,
 let's learn more about your use case and see if we have to expand how
 Snippets are looked up.
 
 
  Well, registering quite a lot of snippets is indeed less than 100%
 optimal.
  OK, I have got a not-so-small website with about 100 templates and
 snippets. The templates are organized as a tree, e.g. /login/signup/seeker,
 /login/signup/offerer, etc. There is not a perfect 1:1 relationship between
 templates and snippets, but for sake of simplicity let's assume so. Hence I
 would like to organize my snippets in packages according to the templates,
 e.g. ...snippet.login.signup.Seeker, ...snippet.login.signup.Offerer, etc.
 
  One of the things I do with page-specific snippets is call them out in
 SiteMap:
  Loc(..., Snippet(foo, snipetFunc))
  But it might also be interesting to explore a model like Wickets:
 
  foo/bar/page.html - look in snippets.foo.bar in addition to the normal
 snippets package... would that help?
 
 
  Thank you,
  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.comliftweb%2bunsubscr...@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.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: Snippets in subpackages?

2010-03-03 Thread David Pollak
On Wed, Mar 3, 2010 at 10:08 AM, Ross Mellgren dri...@gmail.com wrote:

 Haha okay okay I'll write it, but *you* have to review it ;-)


Will do.



 -Ross

 On Mar 3, 2010, at 12:37 PM, David Pollak wrote:



 On Wed, Mar 3, 2010 at 9:30 AM, Heiko Seeberger 
 heiko.seeber...@googlemail.com wrote:

 Yep, that would help a lot!


 Cool.  Please open a ticket and assign it to Ross... if he wants, he can
 assign it to me or you. ;-)


 Heiko

 On Wednesday, March 3, 2010, David Pollak feeder.of.the.be...@gmail.com
 wrote:
 
 
  On Tue, Mar 2, 2010 at 11:42 PM, Heiko Seeberger 
 heiko.seeber...@googlemail.com wrote:
 
  On 3 March 2010 00:03, David Pollak feeder.of.the.be...@gmail.com
 wrote:
 
 
 
 
  On Tue, Mar 2, 2010 at 1:05 PM, Heiko Seeberger 
 heiko.seeber...@googlemail.com wrote:
 
  Hi,
  Isn't it possible to put snippets in subpackages of
 xxx.snippet?Something like lift:snippet
 type=com.acme.snippet.subpackage.SnippetClass?
 
 
 
 
  If not, what's the best way to deal with a large number of snippets?
  Explicitly registering the snippet dispatch in LiftRules is the way I'd
 recommend doing it.  If this is less than 100% optimal for your use case,
 let's learn more about your use case and see if we have to expand how
 Snippets are looked up.
 
 
  Well, registering quite a lot of snippets is indeed less than 100%
 optimal.
  OK, I have got a not-so-small website with about 100 templates and
 snippets. The templates are organized as a tree, e.g. /login/signup/seeker,
 /login/signup/offerer, etc. There is not a perfect 1:1 relationship between
 templates and snippets, but for sake of simplicity let's assume so. Hence I
 would like to organize my snippets in packages according to the templates,
 e.g. ...snippet.login.signup.Seeker, ...snippet.login.signup.Offerer, etc.
 
  One of the things I do with page-specific snippets is call them out in
 SiteMap:
  Loc(..., Snippet(foo, snipetFunc))
  But it might also be interesting to explore a model like Wickets:
 
  foo/bar/page.html - look in snippets.foo.bar in addition to the normal
 snippets package... would that help?
 
 
  Thank you,
  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.comliftweb%2bunsubscr...@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.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.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

Re: [Lift] ParamFailure : why a subtype ?

2010-03-03 Thread David Pollak
The short answer is that sometimes inheritance is better than a flat ADT.

A Box can be full or empty: Full or EmptyBox

An empty box can contain no additional information as to why it's empty (the
Empty singleton) or it can contain more information as to why the Box is
empty: Failure.  Now, a Failure could have subclasses such as Failure with
exception and chained Failure, but it seemed to me that there would be an
explosion of subclasses, so I just chose Failure with the various
parameters.

Then someone pointed out that it'd be nice to carry around an HTTP response
code or other data about the Failure which led to ParamFailure.  Because
ParamFailure is a subclass of Failure, you can pattern match on Failure and
it will catch ParamFailure, but you lose the information about the parameter
(just like you can match against EmptyBox if you don't care why the Box is
empty)

The code:

  implicit def handleFailure[T](value: Box[T])(implicit cvt: T =
LiftResponse): Box[LiftResponse] = {
value match {
  case ParamFailure(msg, _, _, code: Int) =
Full(InMemoryResponse(msg.getBytes(UTF-8), (Content-Type -
text/plain; charset=utf-8) :: Nil, Nil, code))

  case Failure(msg, _, _) = Full(NotFoundResponse(msg))

  case Empty = Empty

  case Full(x) = Full(cvt(x))
}
  }

Gives you a good indication of how various subclasses of Box can work
together to give you a nice way to write REST calls.


On Wed, Mar 3, 2010 at 3:42 PM, Francois fan...@gmail.com wrote:

 Hello,

 I really like the use of Box (perhaps one of the best thing in lift :),
 safe for how it handles ParamFailure - so I'm wondering why ParamFailure is
 a subclass of Failure, and not a full case of Box ? Or why Failure does not
 have (always) an option param, like its option exception/chain ?



 Thanks,

 PS: if the answer was already given, I'm sorry, I didn't find it in ml
 archive

 --
 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.



[Lift] Re: [Lift Announce] Lift Web Framework 2.0 Milestone 3 released

2010-03-03 Thread David Pollak
Awesome work team!  A special thanks to Charles and Indrajit for spinning
the build!

On Wed, Mar 3, 2010 at 8:10 PM, Indrajit Raychaudhuri
indraj...@gmail.comwrote:

 The Lift Web Framework team is pleased to announce the framework-2.0-
 M3 release!

 Lift is an expressive and elegant framework for writing web
 applications. Lift stresses the importance of security,
 maintainability, scalability and performance while allowing for high
 levels of developer productivity. Lift is a Scala web framework.

 NOTE: The potential *breaking changes* have been specifically marked
 for your reference. Please take a look at the specific issue at
 http://www.assembla.com/spaces/liftweb/tickets and the Lift
 announcement list for further details.

 Changes in this version include:

 New features:
 o A flag for disabling the onblur stuff for ajax calls  Issue: 117.
 o Added toHtml method to Mapper/MetaMapper  Issue: 350.
 o Added support for area tags  Issue: 70.
 o Added NOT IN to Mapper query builder  Issue: 353.
 o Enhancements to LiftActors and LRU to support Goat Rodeo  Issue:
 335.
 o ByList is uniqued before the query is built  Issue: 298.
 o Added linkToSelf option to Menu.build snippet  Issue: 343.
 o xxxMenuLoc methods now delegate to protected xxxMenuLocParams
 methods in order to get their LocParams.  Issue: 251.
 o Extend Comet (ListenerManager) to selectively update subscribers
 Issue: 326.
 o Add DataBinding types and traits to lift-webkit  Issue: 212.
 o Add CouchDB support (lift-couchdb)  Issue: 306.
 o Integrate Image manipulation code to lift  Issue: 285.
 o Add support to extract primitive values from JSON  Issue: 360.
 o ItemsListEditor (and thus TableEditor) should warn when leaving page
 with unsaved changes  Issue: 339.
 o ItemsListEditor should display items pending removal, albeit in
 strikeout font  Issue: 302.
 o ItemsList.save unremoves removed unsaved items  Issue: 300.
 o ItemsList should be have refresh method to clear added/removed
 without requerying database  Issue: 299.
 o ItemsListEditor should allow custom columns  Issue: 301.
 o ItemsListEditor should catch SQLException in ItemsList.save  Issue:
 340.

 Fixed Bugs:
 o Fixed a stack overflow on non-tail recursive method  Issue: 393.
 o Allow Foreign Key support to be optional in PostgreSQL driver
 Issue: 387.
 o Scope attributes duplicated in certain cases. Fixed those cases.
 Issue: 373.
 o Better support for exceptions in DB Logging  Issue: 369.
 o Further work to make sure control characters don't show up in XML
 output.  Issue: 319.
 o Fix runtime errors in a couple of example programs  Issue: 342.
 o Issues with template cache updating incorrectly  Issue: 367.
 o Fixed a comparison bug in ReplaceOption (wishing for type-safety in
 ==)  Issue: 296.
 o Support for Scala 2.8 deltas in the way Nodes are compared  Issue:
 357.
 o 304 responses should not include Content-Type headers  Issue: 239.
 o Fixed misspelled keys for resource bundles: *pasword* and
 reset.password.confirmarion  Issue: 112.
 o Optional fields in JSONRecord do not work without setting
 needAllJSONFields to false  Issue: 359.
 o JSON deserialization fails for null value  Issue: 358.
 o Type hints are needed in JSON serialization for non-polymorphic Map
 Issue: 341.
 o Do not serialize the internal state of a case class (JSON)  Issue:
 352.
 o Forcing Authentication not working  Issue: 337.
 o Autocomplete never submit value  Issue: 27.
 o Javascript DSL inconsistencies  Issue: 287.
 o Solve CSS/JS unwanted caching  Issue: 346.

 Changes:
 o Support for enhancing foreign key references in PostgreSQL 8.3+
 Issue: 224.
 o Have minimal support for archetype:create telling user to use
 archetype:generate instead  Issue: 238.
 o Internationalizing missing strings in ProtoUser  Issue: 320. Thanks
 to Adam Warski.
 o Enforce Maven version 2.2.1 or higher, but lower than 3.0.  Issue:
 344.
 o lift-flot has been updated to Flot 0.6  Issue: 322.
 o Make OpenID support more extensible  Issue: 329.
 o [BREAKING CHANGE] Lift Mapper (Record) camelCase to snake_case for
 case insensitive databases  Issue: 155.
 o [BREAKING CHANGE] Improved logging facilities  Issue: 309.
 o Deprecate old logging code  Issue: 374.
 o Enhance Facebook Connect utilities and example code  Issue: 336.
 o Add ability to use doc result of query, not just value  Issue: 356.
 o [BREAKING CHANGE] Add Optional variants of the basic record fields
 Issue: 305.
 o Update lift-couchdb to use dispatch 0.7.1 once released  Issue:
 351.
 o [BREAKING CHANGE] LiftRules.jQueryVersion should not be there.
 Issue: 363.


 Have fun!
 -Lift Web Framework team




-- 
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 

Re: [Lift] reload application.properties

2010-03-02 Thread David Pollak
On Tue, Mar 2, 2010 at 12:48 AM, Jeppe Nejsum Madsen je...@ingolfs.dkwrote:

 David Pollak feeder.of.the.be...@gmail.com writes:

 [...]

  1) Change the menu structure? Restart server
 
 
  Yes.  This is a problem.
 
 
  2) Change the menu text? Restart server (yes I use properties for text
  and yes I need an app in different languages, see other thread :-)
 
 
  This is a problem as well.
 
 
  3) Change something in a mapped field? Restart server
 
 
  This is unavoidable.  If the model changes, you have to re-sync to the
 RDBMS
  and this requires a restart.  In practice, how often do you change your
  model?

 Depends on what you mean by model. If you mean adding/changing fields at
 the db level, requiring restart is not a big problem. But when using
 mapper, this is not the only thing that lives in the model. Hiding
 showing fields, render format, the validations etc. I just tried again,
 and some stuff does seem to be working. It may have been a JRebel
 issue.

 I'll try to keep an eye on this and see if there are some specific
 things that doesn't change dynamically.

  4) Change a field label? Restart server
 
 
  With JRebel, the change to a field label should be reflected
  immediately.

 I swear I tried this before writing :-) But you're right, it does seem
 to work (unless you get the label from properties :-)

 [...]

  It would be really nice for some of this to be picked up automatically
  when running in development mode. I still remember some time ago when I
  did a project in PHP. I don't like the PHP language very much, but you
  can't really beat the instant gratification of a code change: Just
  reload the page!
 
 
  The problem is two-fold: (1) Lift is stateful and trying to morph the
 state
  based on change to logic is non-trivial and (2) the amount of logic you
 can
  get into a line of PHP vs. a line of Scala is 2-3 orders of magnitude
  different.

 Agreed, and I'm not looking to get a seamless incorporation of dynamic
 changes. But not having to do the restart/relogin cycle in the most
 frequent scenarios would be nice.

  I think some of these issues could be solved easily, some will require
  more work and some may be impossible.
 
  - Reloading properties if the file has changed should be easy.
 
 
  What do you keep in your properties file?  I keep database connection
 info
  and service endpoints (e.g., Amazon S3 urls and passwords).  Changing
 this
  stuff should require an app restart.

 Agreed.

  What do you keep in your properties files that can change at runtime?

 Translated strings.


You keep your translated strings in the files accessed by
net.liftweb.util.Props?  I haven't done any Lift localization, but I think
that's the wrong place for them.

If the current implementation of the localization stuff isn't reloading the
localization files on change during dev mode, that's a defect (or an
enhancement) and deserves a ticket.



  - Rebooting lift on the fly may not be easy, but perhaps some things
   could be made reloadable (sitemap?). If you then write a JRebel plugin
   (not a hard task) that triggers the reload when a class change is
   detected, you will be one step closer to RAD nirvana.
 
 
  SiteMap is an easy case.  If you'd be so kind as to open a ticket and
 assign
  it to me, I'll make SiteMap morphable in development mode.

 That would be awesome!


 https://www.assembla.com/spaces/liftweb/tickets/385-make-sitemap-dynamic-when-running-in-development-mode

 How do you envision this working? Just calling Boot again from a JRebel
 plugin?


I'm not going to call Boot again, but I have a bunch of ideas of an
efficient mechanism for recalculating stuff on a request-by-request basis in
dev mode, but only once in production mode.



  What other things need changing?  Maybe the LiftRules stuff can be
  more dynamic at runtime.

 Not sure. SiteMap is the main culprit imo. I'll try to keep an eye out
 for others

 /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.




-- 
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: Transactions with Mapper

2010-03-02 Thread David Pollak
On Tue, Mar 2, 2010 at 7:03 AM, ced docpom...@googlemail.com wrote:

 Another question: Is it possible to nest DB.use? I'd like to have the
 same behavior as with the @Transaction annotation from Spring.


DB.use nests.  Only when the last DB.use is exited does the transaction
commit.  I don't know how Spring does stuff.




 On 2 Mrz., 14:55, ced docpom...@googlemail.com wrote:
  Ah great! Thanks!
  - Chris
 
  On Mar 2, 2:37 pm, Jeppe Nejsum Madsen je...@ingolfs.dk wrote:
 
 
 
   ced docpom...@googlemail.com writes:
When I use Mapper outside a request, say in an actor, how do I wrap
 it
in a transaction? I know that I do a S.addAround(DB.buildLoanWrapper)
to have transactions within a request.
Can anyone provide a simple code snippet?
 
   You can use use :-)
 
   DB.use(DefaultConnectionIdenfifier) {connection =
 User.findAll 
 
   }
 
   /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.




-- 
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: Is CometActor the right tool for this job?

2010-03-02 Thread David Pollak
On Tue, Mar 2, 2010 at 6:09 AM, ced docpom...@googlemail.com wrote:

 I have a similar use case and from my experience using a CometActor is
 just great for this.

  1) I assume each page get their own instance of the actor so they can
  hold their own data. Is this correct?

 Yes.


No, it's not correct.  There's one CometActor of a given type/name per
session.


  2) When is a CometActor shutdown? Sometime after the user navigates
  away from page?

 CometActors have a time to live. Override
 override def lifespan: Box[TimeSpan] = Full(2 minutes)
 in your implementation and when the actor doesn't get queried for that
 amount of time it receives a shutdown.

  3) How do I get access to the CometActor instance on the page? I need
  to send a message to it from a function bound to e.g. an ajaxSelect

 You need another Actor that dispatches messages to your CometActors.


This is not correct.  If you create an ajax component from within the scope
of the CometActor (in the CometActor's render method), any of the
CometActor's methods can be called and you can also manipulate private data
during the Ajax call.  Why?  Because Lift ensures that if the function was
created within the scope of the CometActor that it will always be evaluated
via a message passed to the CometActor.




 Say you have ChartCometActor, then implement something like
 object ChartManager extends Actor {
 ...
 }
 where all your CharCometActors register at creation time. Override
 localSetup() for this. Also override localShutdown() to unregister.
 Your snippet function then sends a message to the ChartManager who's
 responsible for dispatching to all/one actor/s. I use a solution where
 I register the CometActors an a session basis, so I can send a message
 either to all or just one CometActor.

 I have some code available that eases the registration/deregistration
 and the sending of messages on a per-session basis.

 Hope that helps,
 -Chris

 --
 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] Is CometActor the right tool for this job?

2010-03-02 Thread David Pollak
On Tue, Mar 2, 2010 at 5:55 AM, Jeppe Nejsum Madsen je...@ingolfs.dkwrote:

 Hi,

 I haven't used Lift's comet support at all, but now it seems like a
 use case has popped up. I can do this with POA (Plain Ol Ajax), but,
 at least for me, it looks like CometActor might be a better fit. The
 use case is this:

 We need to show a page containing a chart and some tables with data.
 The user should be able to filter, group, select new axis values etc
 in the page and the chart/table should be updated. All the views use
 the same underlying data, which will take some time (5-10s) to pull up
 initially. Changing views after initial load will reuse the data.


Unless you're going to update the graph synchronously, the comet solution is
not the best.  A graph with ajax/json elements that update the graph and
send back new data to chart would be my choice.


 So I was thinking to have a CometActor that holds the data and can
 render the specified view. The UI will send view messages that tell
 how to slice the data. The benefits from the actor solution as I see
 it are:

 1) Can load initial data asynchronously
 2) Can hold on to the data while the user is on the page
 3) Page update is asynchronously, so the UI is perceived as faster

 Are these assessments correct? Or is this overkill? A few questions:

 1) I assume each page get their own instance of the actor so they can
 hold their own data. Is this correct?
 2) When is a CometActor shutdown? Sometime after the user navigates
 away from page?
 3) How do I get access to the CometActor instance on the page? I need
 to send a message to it from a function bound to e.g. an ajaxSelect

 /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.




-- 
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: First comet steps

2010-03-02 Thread David Pollak
On Tue, Mar 2, 2010 at 8:03 AM, Nolan Darilek no...@thewordnerd.infowrote:

 Just wondering if anyone had any thoughts on this?

 I still can't bind fields in an embedded template. They're returned as is,
 not transformed. Not sure what I'm doing wrong.


If you put up a runable Maven project on GitHub, I'll fix the code to make
it work for you.




 On 02/23/2010 11:33 AM, Nolan Darilek wrote:

 Cool, thanks for all your help here. It's been quite a bit to digest, and
 I finally got around to revisiting this problem today.

 So I'm not sure why my initial attempts to return a lift:embed from the
 render method failed, but today that seems to work. Need to see if Firefox
 is doing anything odd with caching, because I seem to have lots of odd
 problems of this sort. In the meantime, I'll poke at things with Curl before
 claiming that they don't work.

 I'm trying to create a cleaner design based on returning lift:embed, but
 I'm still having problems, even after Curl. :) Here's what I have thus far.

 My status.html:

 lift:surround with=default at=content

 h2Imports/h2

 lift:comet type=ImportMonitor/
 /lift:surround

 templateshidden/importing.html, returned by comet render:

 table
 tr
 thName/ththComplete/ththTotal/ththStatus/th
 /tr
 tr
 tdimport:name//td
 /tr
 /table

 And part of my ImportMonitor code:

 class ImportMonitor extends CometActor {
 ...
  def render = {
if(importsCount == 0)
 pNo imports are currently in progress./p
else {
  bind(import, lift:embed what=importing/,
name - Name
  )
}
  }

 ...
 }

 I've tried a variety of things at that bind call. What it ultimately does
 is returns my template as is, including the import:name/import:name. I
 also tried eager_eval=true on the embed element, but with no luck.

 Thoughts on what I'm missing? I feel like binding keeps tripping me up. I
 understand the concept, in essence, but it seems like this should work to me
 and I don't see why it isn't.

 Thanks for being such a newbie-friendly community.



 --
 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] MapperRules.nameToDisplayName?

2010-03-02 Thread David Pollak
On Tue, Mar 2, 2010 at 12:27 AM, Jeppe Nejsum Madsen je...@ingolfs.dkwrote:

 David Pollak feeder.of.the.be...@gmail.com writes:

  If the mechanism was something more along the lines of:
 
  display name calculator: (Mapper[_], Locale, String) = Box[String] // we
  could use Lift's factory mechanism here

 I'm completely blank as to the factory mechanism, but this might be a
 good excuse to get started :-) Do you mean something like this in
 MapperRules:

  val displayNameCalculator: FactoryMaker[(Mapper[_], Locale, String) =
  Box[String]] = new FactoryMaker((_,_,_) = Empty) {}


Yeah.


 Is there a need for the Boxed return type? Seems cleaner to just return
 the passed name. But either is fine with me :-)






  Then you have lots of room to keep the current implementation as the
 default
  if there is no actual name calculated.  Further, the calculation is not
  based on the currently logged in user, so you could cache the results (or
  not if you're in development mode).

 I assume in the implementation that Mapper would have to use S.locale to
 supply the locale? Or should this also be abstracted?


S.locale is just fine.



  My issue is that I like to not push functions like this towards external
  files, but allow external files (and other resources) to be consulted
  depending on the localization mechanism chosen for the given project.

 Not sure I understand this correctly (probably a language thing :-) Do
 you mean that you don't like to have this hard coded to e.g. S.?() or
 more that the config hooks should provide enough parameters that you're
 free to choose something other than S.?()


Both.



 I think my original proposal solved the former, but probably (due to
 lack of locale) not the latter.

 /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.




-- 
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] what's the equivalent of php's var $_FILES in lift?

2010-03-02 Thread David Pollak
On Mon, Mar 1, 2010 at 10:35 PM, wm min...@gmail.com wrote:

 http://php.net/manual/en/reserved.variables.files.php

 i.e. the array of items uploaded to the current script via the HTTP
 POST method.

 I know there is FileParamHolder, but I want to get multiple files in
 the array.


Req.uploadedFiles: List[FileParamHolder]



 Thanks.

 --
 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] Setting cookie with ajax link

2010-03-02 Thread David Pollak
On Tue, Mar 2, 2010 at 10:41 AM, Mads Hartmann mads...@gmail.com wrote:

 Hello everyone,
 I can't seem to get my lift app to set a cookie when clicking an ajax-
 link. By looking around the list it looks like it's possible but i've
 failed to get it working. Right now my test-code looks like this:

 bind(banner, xhtml, hideLink - a(() = {
S.addCookie(HTTPCookie(display,false))
JsHideId(banner)
},Text(test)))


That should work.  Please put together a reproducable example project, put
it on GitHub and open a ticket.



 Thanks
 Mads Hartmann

 --
 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] how to override superUser.dbDisplay_? = false

2010-03-02 Thread David Pollak
On Mon, Mar 1, 2010 at 10:57 PM, wm min...@gmail.com wrote:

 superUser is defined in ProtoUser.

 class User extends ProtoUser[User] {
  // I cannot make it work
  //override def superUser = override def dbDisplay_? = false
 }


Because of limitations in Scala, it's not currently possible to change an
inner object in ProtoUser or other proto stuff.  Sorry.


 --
 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] Lift 2.0M2 LiftMerge order?

2010-03-02 Thread David Pollak
On Tue, Mar 2, 2010 at 11:07 AM, Rick R rick.richard...@gmail.com wrote:

 I have a pair of templates which rely on both a Snippet and a
 CometActor. There appears to be a dependency injection


Dependency injection is an entirely different concept.  Lift rewrites the
page as it goes out to insure comet and ajax support.


 process of
 sorts where lift_page is defined and liftAjax.js is included. However,
 it looks like the list of things is being included in reverse order.


What do you mean reverse order?  Are you seeing an actual error?  Is
something actually failing?

All of the stuff in Lift is (or at least should be) invoked only after the
page load is complete.


 The results seem to be the same whether I just return a NodeSeq from
 CometActor.render or if I return a RenderOut defined with  NodeSeq and
 JsCmd.

 I'm not doing anything too crazy, I do Rewrite urls for the pages used
 by the cometactors, but it's pretty standard.
 (On a side note, is there any way to get GET params from a Rewrite to
 the render function in a CometActor?


You can't.  CometActors are not rendered in response to an HTTP request and
have no access to specific request state.


 , I tried a sessionVar but it
 didn't work. What I ended up doing was getting the param in a snippet.
 Setting it as a js variable on the page, then having the js use that
 value to make a JsonCmd  to the cometActor, it should work provided I
 can fix the code represented below)


 For example:  (my comments -- inline)

 -- This is the start of the template: adminchat.html

  h2Welcome to The Interview Tool./h2
p
  div id=F1040260232478N4M_outer style=display: inlinediv
 id=F1040260232478N4M style=display: inlinediv
  pspan id=info/span/p
  p !-- A place to put stuff --

 -- the following is the result of including : Script(JsonInCode)  from
 render in my CometActor. This makes sense that we need to define the
 callback before using it. Note, however, that it's referencing
 liftAjax.lift  but we haven't included liftAjax.js yet.

script type=text/javascript
 // ![CDATA[
 /* JSON Func Other $$ F104026023248133W */function
 F104026023248133W(obj)
 {liftAjax.lift_ajaxHandler('F104026023248133W='+
 encodeURIComponent(JSON.stringify(obj)), null,null);}
 // ]]

 /script
input type=textarea
 onkeypress=processKeyPress(event.which, function(a)
 {F104026023248133W({'command': quot;pressedquot;, 'params':a});})
 id=txt1 /
  /p
/divscript type=text/javascript
 // ![CDATA[

 F104026023248133W({'command': connect, 'params':chatKey});

 -- okay.. we define this function again, I'm not sure why and I didn't
 ask it to, but no real harm done.

 /* JSON Func Other $$ F104026023248133W */function
 F104026023248133W(obj)
 {liftAjax.lift_ajaxHandler('F104026023248133W='+
 encodeURIComponent(JSON.stringify(obj)), null,null);}
 // ]]
 /script/divscript type=text/javascript
 // ![CDATA[
 var destroy_F1040260232478N4M = function() {}
 // ]]
 /script/div

 -- this is the end of the output from the CometACtor

/p

  -- this is the end of output from the template.

  /div

  hr /
/div

 -- this should be the end of output from default.html, but I'm
 guessing this is where stuff gets merged in.
 -- Here we include liftAjax, it's a bit late, but it's still wrong
 because it relies on lift_page.

  script type=text/javascript src=/ajax_request/liftAjax.js/script
 script type=text/javascript
 src=/comet_request/xkvbzq4ueltw/cometAjax.js/script

 -- here's where we finally define the vars needed by liftAjax et al.

 script type=text/javascript
 // ![CDATA[
 var lift_toWatch = {F1040260232478N4M: 1040260232480};
 // ]]
 /script
 script type=text/javascript
 // ![CDATA[

 var lift_page = F1040260232477ZYH;
 // ]]
 /script/body
 /html

 --
 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 rails application to lift

2010-03-02 Thread David Pollak
On Tue, Mar 2, 2010 at 11:56 AM, Achint Sandhu achint.san...@gmail.comwrote:

 Hi,

I'm new to scala (2.7.7) and lift (2.0-M2) and as a learning
 exercise
 have taken on the translation of an existing rails project into a lift
 application.

There are two things I have run into that I'm hoping the more
 experienced members of the list can give me a hand with:

 1) Is there a trait in lift that creates and manages an equivalent of
 the createdAt and updatedAt fields that rails provides? I'm thinking
 something along the lines of IdPK, but have been unable to find
 anything.


There's nothing right now.  Feel encouraged to open a ticket at
https://liftweb.assembla.com/spaces/liftweb/tickets for a feature request.


 2) I've been following the wiki article on setting up One-to-Many
 relationships (http://wiki.github.com/dpp/liftweb/how-to-work-with-one-
 to-many-relationshipshttp://wiki.github.com/dpp/liftweb/how-to-work-with-one-%0Ato-many-relationships)
 and am running into a difference in behaviour.
 Following the example, if I look at anAuthor.books, I get back a List
 of Book objects, however when I look at aBook.author, I get back a
 Long with the ID of the Author. I would expect aBook.author to return
 an Author object. I've copied and pasted the example in the wiki, to
 make sure that it wasn't my implementation.




Other than that, so far, it's gone extremely well and I was able to
 get something up and running very quickly which really is a testament
 to the design of the framework.

Thanks.

 Cheers,
 Achint

 --
 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] Lift 2.0M2 LiftMerge order?

2010-03-02 Thread David Pollak
On Tue, Mar 2, 2010 at 1:21 PM, Rick R rick.richard...@gmail.com wrote:

 
  On Tue, Mar 2, 2010 at 11:07 AM, Rick R rick.richard...@gmail.com
 wrote:
 
  I have a pair of templates which rely on both a Snippet and a
  CometActor. There appears to be a dependency injection
 
  Dependency injection is an entirely different concept.  Lift rewrites the
  page as it goes out to insure comet and ajax support.
 

 Yes,  that was the reason for the quotes.  I am referring to the
 mechanism by which lift determines that a page required ajax, so it
 makes sure to include liftAjax.js.

 
  process of
  sorts where lift_page is defined and liftAjax.js is included. However,
  it looks like the list of things is being included in reverse order.
 
  What do you mean reverse order?  Are you seeing an actual error?  Is
  something actually failing?

 Yes.  As I indicate below (albeit in a messy fashion)  the callbacks
 which use liftAjax are defined before liftAjax.js is included.
 Further, the variables which are needed by liftAjax.js, such as
 lift_page, are defined *after* liftAjax.js is
 included.

 This is what lead me to believe that these three sections are being
 rendered in reverse.
 What I would expect to see is lift_page being rendered before the
 inclusion of liftAjax.js which occurs before
 the definition of the functions which rely on liftAjax.


They are not being rendered in reverse.  There is no problem.  The code
works correctly.

Why?

First, the code in the CometActor is a call a function in response to an
event.  The page will be loaded before you can press the button or otherwise
cause the event to be dispatched.

Second, as I said in my first response, the code in liftAjax only gets
executed after the page is loaded... that means if there's some random event
that causes the page parsing to be delayed until after the liftAjax.js file
is loaded and parsed, the calls in liftAjax that reference the variables on
the page is not going to get executed until after the page is completely
loaded (which also means the page is parsed and the inline JavaScript code
is executed.)

More broadly, we take bug reports from *actual* failures.  Actual failure
means that something is not working as you expect (e.g., the comet component
is not updating, ajax stuff is not firing ajax events.)  The pieces part of
Lift work well and for a wide variety of users from our friends at Four
Square to our friends at Novell to our friends at Innovation Games.  It
would be very likely that if there was an actual problem with the way Lift
dealt with Comet or Ajax, that the hundreds of thousands of users of Lift
applications would have discovered the problem.  But in actual fact, the
Novell folks tend to burn cycles with stuff like
http://twitter.com/djspiewak/status/9837576830 because the core Lift comet
stuff works so well for them.  Sure,
therehttps://liftweb.assembla.com/spaces/liftweb/tickets/319-control-characters-in-input-can-lead-to-denial-of-service-attacks
arehttps://liftweb.assembla.com/spaces/liftweb/tickets/367-exception-net-liftweb-common-lrumap-value1
bugshttps://liftweb.assembla.com/spaces/liftweb/tickets/343-add-linktoself--true-false--option-to-menu-snippet
in
Lift, but the bugs and feature requests get serviced quickly because we can
understand what is expected, we can agree on what is expected, we can
reproduce deviations from what is expected, and then we can bring the code
into line.






  (On a side note, is there any way to get GET params from a Rewrite to
  the render function in a CometActor?
 
  You can't.  CometActors are not rendered in response to an HTTP request
 and
  have no access to specific request state.

 That is fine, should one expect a SessionVar to work for a CometActor
 when it is set in response to a RewriteRequest?


No.  You can only communicate with CometActors via messages sent to the
CometActor with the ! operator.  Comet Actors live outside of the HTTP
request/response pipeline.  They may or may not share Session Vars during a
given request.




 
  For example:  (my comments -- inline)
 
  -- This is the start of the template: adminchat.html
 
   h2Welcome to The Interview Tool./h2
 p
   div id=F1040260232478N4M_outer style=display: inlinediv
  id=F1040260232478N4M style=display: inlinediv
   pspan id=info/span/p
   p !-- A place to put stuff --
 
  -- the following is the result of including : Script(JsonInCode)  from
  render in my CometActor. This makes sense that we need to define the
  callback before using it. Note, however, that it's referencing
  liftAjax.lift  but we haven't included liftAjax.js yet.
 
 script type=text/javascript
  // ![CDATA[
  /* JSON Func Other $$ F104026023248133W */function
  F104026023248133W(obj)
  {liftAjax.lift_ajaxHandler('F104026023248133W='+
  encodeURIComponent(JSON.stringify(obj)), null,null);}
  // ]]
 
  /script
 input type=textarea
  onkeypress=processKeyPress(event.which, function(a)
  

Re: [Lift] Is CometActor the right tool for this job?

2010-03-02 Thread David Pollak
On Tue, Mar 2, 2010 at 2:33 PM, Jeppe Nejsum Madsen je...@ingolfs.dkwrote:

 Thanks to all for the feedbackjust one remaining question below:

 On Tue, Mar 2, 2010 at 7:11 PM, David Pollak
 feeder.of.the.be...@gmail.com wrote:

 [...]

  Unless you're going to update the graph synchronously, the comet solution
 is
  not the best.  A graph with ajax/json elements that update the graph and
  send back new data to chart would be my choice.

 Did you intend to write synchronously?


I meant asynchronously... basically from some event external to the current
HTTP request and subsequent Ajax requests.

I've been having lots of brain misfires yesterday and today... sorry.


 I would think comet would be
 better suited for asynchronous updates, and curious what you had in
 mind otherwise...

 /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.




-- 
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] Snippets in subpackages?

2010-03-02 Thread David Pollak
On Tue, Mar 2, 2010 at 1:05 PM, Heiko Seeberger 
heiko.seeber...@googlemail.com wrote:

 Hi,

 Isn't it possible to put snippets in subpackages of xxx.snippet?
 Something like lift:snippet
 type=com.acme.snippet.subpackage.SnippetClass?

 If not, what's the best way to deal with a large number of snippets?


Explicitly registering the snippet dispatch in LiftRules is the way I'd
recommend doing it.  If this is less than 100% optimal for your use case,
let's learn more about your use case and see if we have to expand how
Snippets are looked up.



 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] Re: Converting a rails application to lift

2010-03-02 Thread David Pollak
On Tue, Mar 2, 2010 at 5:09 PM, Achint Sandhu achint.san...@gmail.comwrote:

 Hi,

 Is there any reason why aBook.author would not simply return a Box
 instead of requiring aBook.author.obj to get the Box ?


For some background, see
http://blog.lostlake.org/index.php?/archives/19-Keeping-the-meaning-with-the-bytes.html

In Lift's Mapper fields are not flat collections of bytes like in
ActiveRecord, but entities that can control access, format, etc. their
values.

aBook.author is the field.  The field is a MappedLongForeignKey.  It has
lots and lots of methods on it to get, set, validate, generate forms, etc.

To make things a little more convenient, the fields know how to convert
themselves to their raw byte values.  So a MappedLongForeignKey is a
MappedField[Long] and knows how to convert itself into a Long.  For example:

val x: Long = aBook.author // legal

But MappedLongForeignKey fields need to be explicitly converted into the
object that they are keys to via the .obj method:

val author: Box[Author] = aBook.author.obj

I guess it would be nice to write a convenience conversion to make:

val author: Box[Author] = aBook.author

legal.  Feel free to open a ticket on this.



 I'm sure there is a really good reason for this and I'm just trying to
 get an understanding of the underlying reasoning.

 Thanks.

 Cheers,
 Achint

 On Mar 2, 3:26 pm, Mads Hartmann Jensen mads...@gmail.com wrote:
  On 02/03/2010, at 20.56, Achint Sandhu wrote:
 
 
 
 
 
   Hi,
 
  I'm new to scala (2.7.7) and lift (2.0-M2) and as a learning
 exercise
   have taken on the translation of an existing rails project into a lift
   application.
 
  There are two things I have run into that I'm hoping the more
   experienced members of the list can give me a hand with:
 
   1) Is there a trait in lift that creates and manages an equivalent of
   the createdAt and updatedAt fields that rails provides? I'm thinking
   something along the lines of IdPK, but have been unable to find
   anything.
 
   2) I've been following the wiki article on setting up One-to-Many
   relationships (
 http://wiki.github.com/dpp/liftweb/how-to-work-with-one-
   to-many-relationships) and am running into a difference in behaviour.
   Following the example, if I look at anAuthor.books, I get back a List
   of Book objects, however when I look at aBook.author, I get back a
   Long with the ID of the Author. I would expect aBook.author to return
   an Author object. I've copied and pasted the example in the wiki, to
   make sure that it wasn't my implementation.
 
  You should be able to get the object by calling aBook.author.obj - this
 should return a Box[Author] so you could get it like this
 
  aBook.author.obj match {
case Full(a) = a // do something with the autor
case Empty = // if the box is empty, handle it somehow
case _ =  // should cover everyhting else, Failure etc
 
  }
 
  Hope it helps
 
 
 
  Other than that, so far, it's gone extremely well and I was able to
   get something up and running very quickly which really is a testament
   to the design of the framework.
 
  Thanks.
 
   Cheers,
   Achint
 
   --
   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 to 
liftweb+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en.



Re: [Lift] Re: newbie question : get lift to actually run (AbstractMethodError)

2010-03-01 Thread David Pollak
If you set -darchetypeVersion to 1.0, then you'll get Lift 1.0 built on Scala 
2.7.3.  If you use 1.0.3 then you'll get the latest branch of Lift 1.0... built 
with Scala 2.7.7.  I strong recommend you use 2.0-M2 which is also built with 
2.7.7

Connected by MOTOBLUR™ on T-Mobile

-Original message-
From: ojonam manojo10...@gmail.com
To: Lift liftweb@googlegroups.com
Sent: Mon, Mar 1, 2010 15:35:17 GMT+00:00
Subject: [Lift] Re: newbie question : get lift to actually run 
(AbstractMethodError)



  - tried to create a lift blank app with 2.0-snapshot, adapting the
  archetype:generate command from the book as required

 Try to show the complete command. Or look in the ML for commands that
 work with 2.0-SNAPSHOT

So I tried two things
- type mvn archetype:generate and then follow the command prompts to
fill up the different properties (this didn't work)

type in the following command directly (it works)

mvn archetype:generate -U   -DarchetypeGroupId=net.liftweb   -
DarchetypeArtifactId=lift-archetype-blank   -DarchetypeVersion=1.0   -
DremoteRepositories=http://scala-tools.org/repo-releases   -
DgroupId=demo.helloworld   -DartifactId=helloworld   -Dversion=2.0-
SNAPSHOT

This gives me a pom.xml with 2.7.3 (how do I by default get it to
2.7.7 instead of modifying it everytime) ?

  - once that is done, I modify the version of scala in my pom.xml
  - then I type 'mvn jetty:run'
  - somehow maven still downloads *both* the 2.7.1 and 2.7.7 versions of
  scala, and I get the warning that both of them exist

 This sounds bad

I went to my local .m2 folder, and removed all scala related folders
by hand. With the new command, I have versions 2.7.3 and 2.7.7 (still
doesn't solve the problem of multiple scala versions)


 You may have old code laying around. If code mysteriously fails, mvn
 clean is your friend. Try; mvn clean jetty:run

I actually removed the complete directory and redid everything.
Somehow, it seems to work now, but still doesn't explain why the first
type of command did not work.

 /Jeppe

Manohar

-- 
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] Compile error

2010-03-01 Thread David Pollak
On Mon, Mar 1, 2010 at 8:03 AM, Donald McLean dmclea...@gmail.com wrote:

 I just updated to Lift 2.0m2 and Scala 2.7.7 and now I'm getting this
 error message. I would greatly appreciate a suggestion on how to
 resolve this.



This is a known bug in the Scala compiler.

To fix it, do: mvn clean





 Donald

 java.lang.RuntimeException: malformed Scala signature of Loc at 5720;
 reference value common of package liftweb refers to nonexisting
 symbol.
at
 scala.tools.nsc.symtab.classfile.UnPickler$UnPickle.errorBadSignature(UnPickler.scala:762)

 --
 Family photographs are a critical legacy for
 ourselves and our descendants. Protect that
 legacy with a digital backup and recovery plan.

 Join the photo preservation advocacy Facebook group:
 http://www.facebook.com/home.php?ref=logo#/group.php?gid=148274709288

 --
 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] ByList using OR instead of IN?

2010-03-01 Thread David Pollak
It used to be IN and then someone asked that it be changed to the current OR
and they had a reasonable argument, so we changed it.

On Sun, Feb 28, 2010 at 11:17 PM, aw anth...@whitford.com wrote:

 From reading Exploring Lift (Section 6.1, page 81), it says that
 ByList corresponds to the “field IN (x,y,z)” syntax in SQL.
 Well, that was what I needed, so I took it for a test drive.  However,
 instead of seeing SQL like:  where some.id in (4, 9, 20)
 I am seeing SQL like:  where some.id = 4 or some.id = 9 or some.id =
 20.

 I double checked the latest code:

 http://github.com/dpp/liftweb/blob/master/framework/lift-persistence/lift-mapper/src/main/scala/net/liftweb/mapper/MetaMapper.scala
 and it looks like there isn't a magical workaround to get IN working
 as I expected.

 To me, this is a violation of SQL Tuning 101:  as a rule of thumb,
 prefer the IN clause over an OR clause.

 Is there a good reason why this code creates OR clauses instead of an
 IN clause?

 --
 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] Compile error

2010-03-01 Thread David Pollak
On Mon, Mar 1, 2010 at 8:19 AM, Donald McLean dmclea...@gmail.com wrote:

 I appreciate the response but I'm not using Maven, I'm using Ant. If
 you could tell me what that would accomplish I could probably figure
 out the equivalent.


whatever does a clean... whatever deletes all the .class files.


 Thank you,

 Donald

 On Mon, Mar 1, 2010 at 11:07 AM, David Pollak
 feeder.of.the.be...@gmail.com wrote:
 
 
  On Mon, Mar 1, 2010 at 8:03 AM, Donald McLean dmclea...@gmail.com
 wrote:
 
  I just updated to Lift 2.0m2 and Scala 2.7.7 and now I'm getting this
  error message. I would greatly appreciate a suggestion on how to
  resolve this.
 
 
  This is a known bug in the Scala compiler.
 
  To fix it, do: mvn clean
 
  java.lang.RuntimeException: malformed Scala signature of Loc at 5720;
  reference value common of package liftweb refers to nonexisting
  symbol.
 at
 
 scala.tools.nsc.symtab.classfile.UnPickler$UnPickle.errorBadSignature(UnPickler.scala:762)
 
  --
  Family photographs are a critical legacy for
  ourselves and our descendants. Protect that
  legacy with a digital backup and recovery plan.
 
  Join the photo preservation advocacy Facebook group:
  http://www.facebook.com/home.php?ref=logo#/group.php?gid=148274709288
 
  --
  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.comliftweb%2bunsubscr...@googlegroups.com
 .
  For more options, visit this group at
  http://groups.google.com/group/liftweb?hl=en.
 



 --
 Family photographs are a critical legacy for
 ourselves and our descendants. Protect that
 legacy with a digital backup and recovery plan.

 Join the photo preservation advocacy Facebook group:
 http://www.facebook.com/home.php?ref=logo#/group.php?gid=148274709288

 --
 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] MapperRules.nameToDisplayName?

2010-03-01 Thread David Pollak
On Mon, Mar 1, 2010 at 8:27 AM, Jim Barrows jim.barr...@gmail.com wrote:


 On Mon, Mar 1, 2010 at 7:19 AM, Jeppe Nejsum Madsen je...@ingolfs.dkwrote:

 Hi,

 In the interest of cutting boilerplate from mapped objects, I would
 like to get the display name from a property file.


 So your replacing code boilerplate with property file boilerplate?  The
 boilerplate has to go somewhere, and abstracting things like this out
 doesn't change that.  On the other hand, if you have to l10n your app, then
 this works.

 What about turning it off by default, and turned on in Boot though.  Also
 it should probably use the existing method by default, rolling to the
 property file if it's turned on and it's not provided.


Yeah... I gotta say, the less stuff that winds up outside Scala by default,
the better.






 So I was thinking that it would be an idea to add a
 MapperRules.nameToDisplayName such as this

 var  nameToDisplayName: ( Mapper[_], String) = (_,name) = name


 A department of redundancy department approved name? :) *LOL*

 How about displayNameFromPropertyFile?  A little wordy, but it shouldn't
 ever need to be typed except to be overridden.




 This would allow me to do things like nameToDisplayName = (m,name) =
 S.?(m.getClass.getName+.+name)

 Thoughts?

 /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.




 --
 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.




-- 
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] reload application.properties

2010-03-01 Thread David Pollak
The Props.get stuff is frozen the first time its accessed.  This is a
philosophical issue for me.  The properties should be fixed at start-up
time.  If there are things to vary, build an administrative interface or
some other thingy (e.g., a separate HTTP listener) that allows you to
manipulate the mutable configuration.

On Mon, Mar 1, 2010 at 4:57 AM, Martin marcin.szla...@gmail.com wrote:

 Hi

 is there any way to reload application.properties file after
 boot.scala finishes? I would like to do dynamic localization of
 properties on my site, without need to stop/start application.
 Mayby there is  much better way to accomplish it.
 I would really appreciate any help.

 best regards,
 Martin

 --
 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] Newbie Q: Lift suitable as webgui for java 6 app with embedded webserver and no database ?

2010-03-01 Thread David Pollak
Jeppe gave a great answer.  Just to reinforce that Lift's webkit is totally
agnostic to the data being presented.  As long as that data can be
materialized as instances of objects in the JVM, you can use Lift.

On Mon, Mar 1, 2010 at 4:54 AM, Jeppe Nejsum Madsen je...@ingolfs.dkwrote:

 mortench morte...@gmail.com writes:

  Hi All,
 

 [...]

  How suited would Lift be for this scenario or to be more precise:
  a) Is a lift web app as fast to startup as a normal jave jsp/servlet
  app ?

 Depends mostly on your own code. If you have an empty Boot, startup is 
 1s.

  b) Can lift be used without a database and can the relate code such as
  the OR mapped be omitted ?

 Yes

  c) Any special considerations needed when starting and stopping an
  embedded lift web app ?

 Dunno :-)

  d) What does lift require of the java web server ? I.e. can some of
  the more lightweight java web servers be used that might not support
  the full servlet/jsp specifications such as the embedded HTTP server
  in Java 6, Winstone, Grizzly etc.? ... What (light) java webservers
  are lift known to work with ?

 You need a recent servlet implementation.


Lift needs Servlet 2.5 or higher.


 JSP is not needed. I'm using
 Jetty although not embedded, but Jetty seems like it should easily be
 embedded. During development, I launch a small Scala app that starts
 jetty (the RunWebApp class generated by the Lift archetype)

  e) What would the best way for the lift web app to communicate with
  the backend code of the java app ? By just calling into the existing
  java code (some integration/classloader issues here?) or more loosely
  by calling REST WS Api exposed by the Java code ?

 Not sure what you envision here, but REST and loosely coupled should
 work :-)


Given that Scala works perfectly calling Java code, I'd go with calling your
Java classes directly.



  f) I am using ANT and not maven to develop the java app. Will be able
  to make Lift work with ANT so I use the same build tool for
  everything?

 Yes, but you're probably on your own

  g) What version of lift should I use ? In particular does Lift 2.0
  change anything for my scenario ?

 You should use the latest 2.0-SNAPSHOT or milestone (M3 is just around
 the corner)

 /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.




-- 
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] Lift 2.0-M3 code slush

2010-03-01 Thread David Pollak
Folks,

The Lift master branch is now in code slush in anticipation of a late
Wednesday March 3rd PST release of Lift 2.0 Milestone 3.

If you are a committer: THANK YOU!! for working hard and working as a team
to make M3 a reality.  If you committed something to M3, please contact me
privately with your shipping address and your preference between coffee, tea
or jam (sorry, I can't send pies) and I will have some shipped to you as a
way of saying Thanks!

If you are a Lift user (this means guys like HarryH and Jon) and want to
help, please test your code thoroughly against the current 2.0-SNAPSHOT.  If
there is a defect or problem, please report it at
https://liftweb.assembla.com/spaces/liftweb/tickets  We'll work to determine
if a fix needs to go into M3.

Thanks,

David

-- 
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] Compile error

2010-03-01 Thread David Pollak
On Mon, Mar 1, 2010 at 9:28 AM, Donald McLean dmclea...@gmail.com wrote:

 That didn't help. The problem is related to the Lift-2.0-M2 libraries.
 I went to 1.0.3 and it is fine.


If you can put together a reproduceable example, we'll look into it.



 Donald

 On Mon, Mar 1, 2010 at 11:51 AM, David Pollak
 feeder.of.the.be...@gmail.com wrote:
 
 
  On Mon, Mar 1, 2010 at 8:19 AM, Donald McLean dmclea...@gmail.com
 wrote:
 
  I appreciate the response but I'm not using Maven, I'm using Ant. If
  you could tell me what that would accomplish I could probably figure
  out the equivalent.
 
 
  whatever does a clean... whatever deletes all the .class files.
 
 
  Thank you,
 
  Donald
 
  On Mon, Mar 1, 2010 at 11:07 AM, David Pollak
  feeder.of.the.be...@gmail.com wrote:
  
  
   On Mon, Mar 1, 2010 at 8:03 AM, Donald McLean dmclea...@gmail.com
   wrote:
  
   I just updated to Lift 2.0m2 and Scala 2.7.7 and now I'm getting this
   error message. I would greatly appreciate a suggestion on how to
   resolve this.
  
  
   This is a known bug in the Scala compiler.
  
   To fix it, do: mvn clean
  
   java.lang.RuntimeException: malformed Scala signature of Loc at 5720;
   reference value common of package liftweb refers to nonexisting
   symbol.
  at
  
  
 scala.tools.nsc.symtab.classfile.UnPickler$UnPickle.errorBadSignature(UnPickler.scala:762)
  
   --
   Family photographs are a critical legacy for
   ourselves and our descendants. Protect that
   legacy with a digital backup and recovery plan.
  
   Join the photo preservation advocacy Facebook group:
  
 http://www.facebook.com/home.php?ref=logo#/group.php?gid=148274709288
  
   --
   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.comliftweb%2bunsubscr...@googlegroups.com
 .
   For more options, visit this group at
   http://groups.google.com/group/liftweb?hl=en.
  
 
 
 
  --
  Family photographs are a critical legacy for
  ourselves and our descendants. Protect that
  legacy with a digital backup and recovery plan.
 
  Join the photo preservation advocacy Facebook group:
  http://www.facebook.com/home.php?ref=logo#/group.php?gid=148274709288
 
  --
  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.comliftweb%2bunsubscr...@googlegroups.com
 .
  For more options, visit this group at
  http://groups.google.com/group/liftweb?hl=en.
 



 --
 Family photographs are a critical legacy for
 ourselves and our descendants. Protect that
 legacy with a digital backup and recovery plan.

 Join the photo preservation advocacy Facebook group:
 http://www.facebook.com/home.php?ref=logo#/group.php?gid=148274709288

 --
 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

[Lift] Emerging Languages Face Off: Scala, Go, Clojure and Ruby

2010-03-01 Thread David Pollak
Folks,

I'll be representing Scala in an emerging languages face-off at
http://www.sdforum.org/index.cfm?fuseaction=Calendar.eventDetaileventID=13632

Interestingly, Scala and Clojure and both functional languages... indicating
that FP is gaining interest from folks inside 2 standard deviations from the
mean.

Looking forward to seeing lots of cool folks there.

Thanks,

David

-- 
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] Compile error

2010-03-01 Thread David Pollak
Send it to me directly, but please make sure that there are no hard-coded
paths or dependencies other than Ant and Ivy that I might not have on my
machine.

On Mon, Mar 1, 2010 at 9:46 AM, Donald McLean dmclea...@gmail.com wrote:

 Fortunately, I'm doing a tech-eval prototype so I can just send the
 whole kit-n-caboodle. It's just under 700k as a tar file.

 Where should I send it?

 Donald

 On Mon, Mar 1, 2010 at 12:32 PM, David Pollak
 feeder.of.the.be...@gmail.com wrote:
 
 
  On Mon, Mar 1, 2010 at 9:28 AM, Donald McLean dmclea...@gmail.com
 wrote:
 
  That didn't help. The problem is related to the Lift-2.0-M2 libraries.
  I went to 1.0.3 and it is fine.
 
  If you can put together a reproduceable example, we'll look into it.

 --
 Family photographs are a critical legacy for
 ourselves and our descendants. Protect that
 legacy with a digital backup and recovery plan.

 Join the photo preservation advocacy Facebook group:
 http://www.facebook.com/home.php?ref=logo#/group.php?gid=148274709288

 --
 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] About the url rewrite (more thant one params and get 404 not found error)

2010-03-01 Thread David Pollak
On Sun, Feb 28, 2010 at 8:28 PM, Neil.Lv anim...@gmail.com wrote:

 Hi all,

  I have a silly question about the url rewrite in the lift.
  It has another two params in the url after the img.

  http://localhost:8080/show/img/version/id

  The url works fine.
  = http://localhost:8080/show/img
  = http://localhost:8080/show/img/v1/
  = http://localhost:8080/show/img/v1/1

  Get 404 error if the / string is not added at the end of the url
 (the id param isn't supplied)
  = http://localhost:8080/show/img/v1

  So, how can i rewrite the url and set the sitemap can make this link
 (  http://localhost:8080/show/img/v1  )
  works fine as (  http://localhost:8080/show/img/v1/  ) when the id
 is not supplied.

  Here is the code:

 ###
  case RewriteRequest(
  ParsePath(List(show, img, version, id), _, _,_), _, _) =
RewriteResponse(List(show, img),
  Map(version - version, id - id)
  )
 ###



This is just basic pattern matching stuff.  So,

case RewriteRequest(
 ParsePath(show :: img :: version :: rest, _, _,_), _, _) =
RewriteResponse(List(show, img),
 Map(version - version, id - (rest.firstOption getOrElse N/A))
 )

Please pick up a copy of one of the Scala books and look at the pattern
matching section related to Lists.  There's a lot of flexibility that's no
Lift-specific, but that Lift leverages.

val entries = Menu(Loc(Home, List(index), Home)) ::
 Menu(Loc(show, List(show), show, Hidden)) :: User.sitemap

 ###

  BTW, I use the LiftView to handle the request.

 ###
 class show extends LiftView {
  def dispatch = {
case img = imgDispatch _
case _ = allDispatch _
  }

  def imgDispatch(): Box[NodeSeq] = {
...
  }

  def allDispatch(): Box[NodeSeq] = {
...
  }
 }
 ###

  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.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] snakify and abbreviations

2010-03-01 Thread David Pollak
On Mon, Mar 1, 2010 at 2:46 AM, Jeppe Nejsum Madsen je...@ingolfs.dkwrote:

 Hi,

 Eager to use the new Mapper support for snake_case I discovered that
 the snakify method doesn' handle abbreviations well:

 StringHelpers.snakify(HTML)
 res5: java.lang.String = h_t_m_l

 StringHelpers.snakify(HTMLEditor)
 res6: java.lang.String = h_t_m_l_editor

 I would expect those to be html and html_editor respectively...

 What do people think?


Yeah, adjacent caps should be part of the same word.



 /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.




-- 
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] Less boilerplate in your specifications / tests

2010-03-01 Thread David Pollak
Eric,

You're a Lift committer.  Feel very encouraged to clean up the tests!

Thanks,

David

On Sun, Feb 28, 2010 at 4:42 PM, etorreborre etorrebo...@gmail.com wrote:

 Hi all Lift-developers,

 I have noticed a few commits recently where the declarations for
 specifications could be reduced to something simpler.

 For example:

 import org.specs._
 import org.specs.runner._

 class BindingsSpecTest extends Runner(BindingsSpec) with JUnit with
 Console
 object BindingsSpec extends Specification

 can be written as

 import org.specs._

 class BindingsSpec extends SpecificationWithJUnit

  - the BindingsSpec class will run with maven, provided that you add
 the proper include directive in the pom.xml file, like this, for
 example:

  plugin
groupIdorg.apache.maven.plugins/groupId
artifactIdmaven-surefire-plugin/artifactId
version2.4.3/version
configuration
  useSystemClassLoaderfalse/useSystemClassLoader
  argLine-Xmx512m/argLine
  forkModealways/forkMode
  includes
include**/*Unit.java/include
include**/*Spec.java/include
  /includes
  excludes
exclude**/*Test.java/exclude
  /excludes
/configuration
  /plugin

  - It will also run in the console, like this:

   scala -cp classpath run net.liftweb.http.BindingsSpec

 I hope this helps, please ping me if you have any concern with this.

 Eric.

 PS: I forgot to mention that I am guilty of the situation above
 because of how things were done in specs when I starting contributing
 the first specifications to Lift,...

 PPS: I've edited the User Guide to make clear what was the preferred
 way of using JUnit with specs:


 http://code.google.com/p/specs/wiki/RunningSpecs#Run_your_specification_with_JUnit4

 --
 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] Emerging Languages Face Off: Scala, Go, Clojure and Ruby

2010-03-01 Thread David Pollak
On Mon, Mar 1, 2010 at 11:18 AM, Mads Hartmann Jensen mads...@gmail.comwrote:

 Any chance that there'll be an audio version after?

 Would love the hear it :)


I don't know.  Miking/mixing 4 participants is non-trivial (beyond what I
can do with my traveling AV stuff)



 On 01/03/2010, at 19.53, Jim Barrows wrote:

 Best of luck!

 Will you be facing off with swords or... oh wait.. never mind... ;)

 On Mon, Mar 1, 2010 at 10:50 AM, David Pollak 
 feeder.of.the.be...@gmail.com wrote:

 Folks,

 I'll be representing Scala in an emerging languages face-off at
 http://www.sdforum.org/index.cfm?fuseaction=Calendar.eventDetaileventID=13632

 Interestingly, Scala and Clojure and both functional languages...
 indicating that FP is gaining interest from folks inside 2 standard
 deviations from the mean.

 Looking forward to seeing lots of cool folks there.

 Thanks,

 David

 --
 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.comliftweb%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/liftweb?hl=en.




 --
 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.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] Running parallel site load balanced

2010-03-01 Thread David Pollak
On Mon, Mar 1, 2010 at 12:29 PM, John Pletka jple...@abraxis.com wrote:

 I was tasked with designing a new web-based application that has the
 requirement of being able to run on multiple servers that could be
 1) Load balanced without requiring sticky sessions and
 2) Single nodes could be transparently shutdown or added without the users
 noticing

 I would like to use Lift if possible, but I'm a bit worried about it's
 state-full nature.  Is it possible to use something like Cassandra or
 Memcached to hold the session data and have Lift grab that from a cookie
 instead of storing it all internally in memory?  I've looked around, but I
 have not found any good articles about how to scale Lift horizontally.


The short answer is that Lift is stateful and you can't shovel Lift state
into a backing store.

You could use Terracotta to create a cluster of Lift machines, but you're
still going to be a lot better off routing requests back to the same machine
to avoid shuffling a lot of state around (which is expensive any way you
slice it)

If you could tell us more about your app, there might be other ways to skin
your cat. http://icanhascheezburger.com/2007/08/08/i-has-minions/

Thanks,

David



 Thanks in advance

 John

 --
 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] Running parallel site load balanced

2010-03-01 Thread David Pollak
On Mon, Mar 1, 2010 at 1:19 PM, Jeppe Nejsum Madsen je...@ingolfs.dkwrote:

 Ahh just saw David beat me to it with the other reply :-)

 John Pletka jple...@abraxis.com writes:

  It is a business application - lots of forms, reports, data lookups.  I'm
  not too concerned about the performance on a single node - at any given
 time
  we'll probably have a max of 1000 requests a minute coming in which I've
  seen Lift handle easily.  The biggest problem is we need near 100%
 up-time.

 But you can have near 100% uptime with sticky sessions. What you can't
 have is High Availability (HA), ie. users won't notice when a server
 breaks.


There are 3 scenarios:

   1. Unplanned fail-over.  Having a hot standby and extended login session
   (See ProtoExtendedSession).  The user would lose a stateful multi-page
   wizard and would lose input to the particular screen they were on.  It would
   appear as a glitch... not optimal, but not end of the world.
   2. Planned transfer.  You could shuffle all new sessions off to the new
   machine and let the old sessions age on the old server.  With a little extra
   work, you could demark when a user was done with a logic task (e.g., going
   back to the home page) and use that as the trigger to move the session to
   the new machine.
   3. Upgrade that breaks the DB schema.  You're going to have downtime.  No
   way around it.




  That means having at least a second server in hot-standby mode
  (preferably parallel production), and some way to do upgrades without
  bringing the whole site offline.

 Doing rolling upgrades is never easy, even if you don't share state. You
 may have all this figured, but you need to account for different app
 versions running simultaneously, expanding/shrinking db upgrades etc.

 /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.




-- 
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] MapperRules.nameToDisplayName?

2010-03-01 Thread David Pollak
If the mechanism was something more along the lines of:

display name calculator: (Mapper[_], Locale, String) = Box[String] // we
could use Lift's factory mechanism here

Then you have lots of room to keep the current implementation as the default
if there is no actual name calculated.  Further, the calculation is not
based on the currently logged in user, so you could cache the results (or
not if you're in development mode).

My issue is that I like to not push functions like this towards external
files, but allow external files (and other resources) to be consulted
depending on the localization mechanism chosen for the given project.

On Mon, Mar 1, 2010 at 12:56 PM, Jeppe Nejsum Madsen je...@ingolfs.dkwrote:

 Jim Barrows jim.barr...@gmail.com writes:

  My point was that you've moved the boilerplate, not eliminated it.  If
 what
  you suggest was in place you'd have to add 100+ properties in a file.

 I'm not sure if we're wandering out on a philosophical tangent here, but
 would genuinely like to hear if you have better solutions:

 Given that I have say 100 fields and need it translated to say 5
 different languages.

 I need to have at least 500 words stored somewhere. If I don't want to
 use a word's position in the file as key, I'll need a key per word. I
 would also like one file per language since this allows independent
 translation. So now I have 5 files each with 100 lines containing two
 words.

 But AFAIKS, there's no repetition (except for the keys, which I think
 are unavoidable), so no boilerplate.

 Now I have to add the 100 overrides to actually look up the translated
 names. This is the only place I see boilerplate, and it could be easily
 removed :-)

 I agree 100% that if you don't need translation, properties are often
 the wrong approach, but when you do need it I've yet to see a better
 alternative (but would love to hear about it!)

 /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.




-- 
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] reload application.properties

2010-03-01 Thread David Pollak
On Mon, Mar 1, 2010 at 12:30 PM, Jeppe Nejsum Madsen je...@ingolfs.dkwrote:

 David Pollak feeder.of.the.be...@gmail.com writes:

  The Props.get stuff is frozen the first time its accessed.  This is a
  philosophical issue for me.  The properties should be fixed at start-up
  time.  If there are things to vary, build an administrative interface or
  some other thingy (e.g., a separate HTTP listener) that allows you to
  manipulate the mutable configuration.

 And I agree very much in this philosophywhen we're talking
 production.

 I'm interested if you feel the same way about this during development? If
 so,
 stop reading as the rest will just be a rant, if not read on :-)

 I think the static nature of some of Lift's internals is one of the
 greatest productivity killers when it comes to rapidly start up with a
 new app where you quickly iterate different ideas (or even do many small
 changes in an existing app).

 1) Change the menu structure? Restart server


Yes.  This is a problem.


 2) Change the menu text? Restart server (yes I use properties for text
 and yes I need an app in different languages, see other thread :-)


This is a problem as well.


 3) Change something in a mapped field? Restart server


This is unavoidable.  If the model changes, you have to re-sync to the RDBMS
and this requires a restart.  In practice, how often do you change your
model?


 4) Change a field label? Restart server


With JRebel, the change to a field label should be reflected immediately.



 Using JRebel doesn't really help in these scenarios as the values are
 fixed at start-up.

 There are probably others, but these are the ones I can recall. Perhaps
 I'm being hit harder than others since 1) We need different languages
 and 2) You need to be logged in to see the app. Or perhaps I just don't
 develop in an efficient way who knows?

 It would be really nice for some of this to be picked up automatically
 when running in development mode. I still remember some time ago when I
 did a project in PHP. I don't like the PHP language very much, but you
 can't really beat the instant gratification of a code change: Just
 reload the page!


The problem is two-fold: (1) Lift is stateful and trying to morph the state
based on change to logic is non-trivial and (2) the amount of logic you can
get into a line of PHP vs. a line of Scala is 2-3 orders of magnitude
different.



 I think some of these issues could be solved easily, some will require
 more work and some may be impossible.

 - Reloading properties if the file has changed should be easy.


What do you keep in your properties file?  I keep database connection info
and service endpoints (e.g., Amazon S3 urls and passwords).  Changing this
stuff should require an app restart.

What do you keep in your properties files that can change at runtime?



 - Rebooting lift on the fly may not be easy, but perhaps some things
  could be made reloadable (sitemap?). If you then write a JRebel plugin
  (not a hard task) that triggers the reload when a class change is
  detected, you will be one step closer to RAD nirvana.


SiteMap is an easy case.  If you'd be so kind as to open a ticket and assign
it to me, I'll make SiteMap morphable in development mode.  What other
things need changing?  Maybe the LiftRules stuff can be more dynamic at
runtime.



 I'm interested to hear if others have the same pain points as me (if
 not, I don't see this changing soon :-) and if there are some ideas how
 to remedy this (either by changing Lift or changing my development
 process :-)

 /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.




-- 
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] New logging code is in master

2010-02-28 Thread David Pollak
Excellent!

We have the deprecations turned off in the pom.xml file by default... but
gotta turn the deprecation warnings on post M3.

On Sun, Feb 28, 2010 at 8:14 AM, Jeppe Nejsum Madsen je...@ingolfs.dkwrote:

 The new logging code is now in master and should be fully usable.
 Therefore, the existing logging code has been deprecated.

 I've added a Wiki article here:
 http://wiki.github.com/dpp/liftweb/logging-in-lift

 /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.




-- 
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] Eearly functions not working in 280_port_refresh

2010-02-27 Thread David Pollak
On Sat, Feb 27, 2010 at 8:32 AM, Michel michel.krae...@googlemail.comwrote:

 Hi!

 I compiles Lift myself using the branch 280_port_refresh. I
 registered a function to be called early in the request cycle to set
 the web servers character encoding:

 override def boot {
  def makeUtf8(r: HTTPRequest) {
//will never be called!
r.setCharacterEncoding(UTF-8)
  }

  LiftRules.early.append(makeUtf8)
  ...
 }

 The makeUtf8 function is never called although it is correctly
 appended to the early list (I checked that using breakpoints in
 Eclipse. I double checked by temporarily throwing dummy
 RuntimeExceptions).

 Is this a bug or am I doing something wrong?


Sounds like a bug.  Please open a ticket at
https://liftweb.assembla.com/spaces/liftweb/tickets



 Thanks,
 Michel

 --
 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] Reasoning Behind Box

2010-02-26 Thread David Pollak
Daniel,

Thanks for asking the question and I hope the discussion will go better than
the last time we had an in depth discussion on the topic.  I'm going to
respond in a Prologue, History, Reactions, Code Examples and Conclusion.

*Prologue*

I'm not a classically trained CS guy.  I've never taken an FP-related CS
course in my life.  I've only done any real FP-related coding since November
2006.  I've only taken 3 CS courses in my entire life (360 assembler [almost
got thrown out because the teacher hated the fact that I always found bugs
in her homework assignments during the class in which she handed out the
assignments], data structures and algorithms [got accused of cheating on
mid-term because my sorting algorithm ran 10x faster than the next
fastest... turns out I randomized the incoming data {avoids O(n^2) issue in
QuickSort} and created faux-pointers and sorted those rather than the
structures {this was in Pascal}], and a database theory class [almost got
thrown out because the comments in my code were considered
unprofessional... rescued my grade by writing a hand SQL parser rather
than using Flex/Bison]).  The reason I say this is that I'm not going to
discuss ADTs, mathematical properties, or anything else.  I'm not qualified
or capable of having that kind of discussion.

I'm also lazy and pragmatic.  If a library works for me, I use it.  If a
library requires a lot of working-around, I ask for fixes and if I don't get
them, I write my own.  I did this with the NextStep Text object... it didn't
have what I needed for Mesa, the Next guys weren't happy about giving what I
needed... I wrote my own... then the Next guys rolled a lot of my concepts
into the NS Text object.  The same thing happened with the NextStep font
chooser... in fact, Mesa's font chooser was the first piece of open source
software I wrote... but I digress.

*History*

Back when I was the only Lift committer (okay, maybe SteveJ had commit
rights back then... I don't remember) and I was working on the first
Lift-based app, I was experiencing a nasty issue.  This was summer of 2007.
This was circa Scala 2.4 and before Either was in the language.  One of the
common patterns I kept running across was iterating through a series of
pieces of user-input (both from the UI and from the REST interfaces) and
having to return a not-answer (None) and the reason for the inability to
complete the operation.  It was about the same time, moved away from pattern
matching against Options in favor of using Options in for comprehensions.
The first thing I tried was to use Options in conjunction with exceptions
(yeah, I was still lost in Java-think) such that in the case of a None for a
particular operation (loading an item from the database, etc.), I'd throw an
exception, the caller would catch the exception and present the right thing
to the user/caller.  It was ugly.

I posted to the Scala mailing list and, well... there were not a lot of good
suggestions other than use Either (e.g., write my own Either library).  The
problem with Either is that it was not usable in for comprehensions and
pattern matching was becoming increasingly deprecated.  One of our advisors
(http://www.lukehohmann.com/ ) was particularly keen on keeping a low McCabe
complexity number for code (see
http://en.wikipedia.org/wiki/Cyclomatic_complexity ).  For comprehensions
offered a very low complexity where pattern matching explodes complexity.

So, I finally bit the bullet and wrote my own set of classes that offered
the kind of functionality that I was cobbling together with Option.  I
originally called the class Can (a short name for something that contains or
does container a unit of something... a can of soup, a can of beans.)  I
patterned Can after Option (btw, Option is one of the worst names in the
Scala libraries... explaining what an Option is to a Java or Ruby guy was
one of my biggest stumbling blocks... Maybe would have been a much better
name, but I digress.)

Can became a better Option.  In addition to having Full/Empty (Some/None),
it also had Failure... a subclass that could contain information as to why
the Can did not contain anything.  From an object hierarchy standpoint, Can
and Option are identical at the first children: Full == Some.  EmptyCan ==
None.  The other problems I saw with Option were:

   - The get method was too easy for Java (and Ruby) developers to get
   wrong.  Get is *FREAKING DANGEROUS*.  It's an exception waiting to happen.
   It should not be used except in the most extreme situation.  But with a
   nice, tasty, comforting, access-worthy name like get, it just begs to be
   invoked.  Something like 30% of our production-time defects resulted from
   mis-using Option.get.  This needed to be changed... so something that says
   danger like open_!  Oh, yeah, the ! says hmmm... why is that !
   there?  Should I be using this method?
   - orElse orElse orElse... who named this method.  In terms of method
   naming the Else is a useless 

  1   2   3   4   5   6   7   8   9   10   >