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

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

-
Matyjasmaty...@gmail.com wrote:


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

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

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

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

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

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

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

object programmer extends LongMappedMapper(this, Programmmer)

object project extends LongMappedMapper(this, Project)
}


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

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

But it doesnt. Any advice would be most appreciated

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

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



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

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

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

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

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

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

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

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

I set it with:

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

Or with:

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

And in another snipped I use it like:

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

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

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


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

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

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

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

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

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

 Source Snippet :

 object ViewClient extends ViewClient

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

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

 Destination Post Snippet :

 def add (inhtml: NodeSeq) : NodeSeq = {

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

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

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

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

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

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

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

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

 Thanks a lot

 hexa

-- 
You received this message because you are 

Re: [Lift] Re: More dynamic Lift

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


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

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

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

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

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

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

/Jeppe

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

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



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

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

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

Hi,

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

Thanks,

Heiko

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

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

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



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

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

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

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

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

   I have a silly question about the URL rewrite .

   How to let the URL params can contains the  character.

   Here is the code:

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

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

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

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

   Maybe the URL rewrite is not correctly ?

   Thanks for any help!

 Cheers,
   Neil

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

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



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

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

-
hexahex...@gmail.com wrote:

I think we still have a miss understanding

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

What doesnt work would be doing something like :

 val clientBox = ViewClient.currentClient

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

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

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

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

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

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

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

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

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

  I'll try to clarify a bit :

  A have  a ViewClient snippet and an AddInvoice snippet

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

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

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

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

  inInvoice.client (client)
  inInvoice.save

  As so no ids are involved...

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

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

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

  Thanks

  hexa

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

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



Re: [Lift] Re: More dynamic Lift

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


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

My development cycle has never worked well with JRebel.

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

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

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

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

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

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

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

 Cheers, Tim


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

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

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




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

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

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



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

2010-03-09 Thread Naftoli Gugenheim
A RequestVar is a container that transcends Scala's scope rules: multiple 
instances of the class holding the RequestVar will see the same value in their 
respective RequestVars.
On the other hand its value is per request. That has nothing to do with; two 
simultaneous requests can set and get two distinct values without conflict.
Contrast all this with regular scala variables. If a class defines a field, and 
spawns a thread that reads it later, clearly it is accessing the same field, 
even in Java. Somewhat similarly in Scala a closure (function) *captures* its 
references, possibly promoting them from stack to heap. So if a method a 
defines a val b and passes a function that references b to some API, b will 
outlive a's execution.
So Scala variables are limited by lexical scope but not by request, while 
RequestVars are limited by request but not by scope.
Thus, if a function will be executed in the next request, to bridge requests 
you have to store the *value* of the RequestVar outside of it (requestVar.is), 
then at the beginning of the next request set the RequestVar from that val.
This is a common pattern in Lift: one request specifies a function to be 
executed in the beginning of the next request, whether it is triggered by a 
link, a form submit, or redirect. This function can bridge the two requests 
because it's in the lexical scope of the first request, so to speak, and can 
capture its state with the basic rules of scala; but it since it actually 
executes in the next request, it can set RequestVars etc. that the next request 
will see.


-
hexahex...@gmail.com wrote:

It is not set in the same request as it's being read exactly...

But how is that doable with RequestVars then ?



On Mar 9, 11:55 am, Naftoli Gugenheim naftoli...@gmail.com wrote:
 You can use StatefulSnippets if you like, but what you want to do is 
 perfectly doable with RequestVars.
 Clearly it's not being set in the same request as it's being read.

 -

 hexahex...@gmail.com wrote:

 I think we still have a miss understanding

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

 What doesnt work would be doing something like :

  val clientBox = ViewClient.currentClient

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

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

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

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

 It's looking more and more like a statefull snippet is the way to
 go...
 On Mar 9, 11:10 am, Lukasz Kuczera kuk...@gmail.com wrote:



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

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

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

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

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

   I'll try to clarify a bit :

   A have  a ViewClient snippet and an AddInvoice snippet

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

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

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

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

   inInvoice.client (client)
   inInvoice.save

   As so no ids are involved...

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

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

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

   Thanks

   hexa

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

Re: [Lift] Re: Lift-M2 One To Many and CRUDify

2010-03-08 Thread Naftoli Gugenheim
You mean MappedLongForeignMapper is deprecated?

-
ojonammanojo10...@gmail.com wrote:

Hi Jeppe,

that works indeed, thanks. Although, in 2.0-M2, technically you need
to extend LongMappedMapper (as MappedForeignKey is deprecated).
Anyway, here is the little bit of code, if anyone is interested (or
interested in changing the wiki page for CRUD) :

class Book extends LongKeyedMapper[Book] with IdPK with Ordered[Book]
{
def getSingleton = Book
object author extends LongMappedMapper[Book, Author](this, Author){
  override def validSelectValues = Full(Author.findAll.map(x = (x.id,
x.name)))
}

Cheers,
Manohar

PS : is there a place where I can find the link to the 2.0-M2 API ?

On Mar 8, 9:46 am, Jeppe Nejsum Madsen je...@ingolfs.dk wrote:
 ojonam manojo10...@gmail.com writes:
  Hello all,

  I recently tested the wiki example of Book and Authors as an exercise,
  and extended them with CRUDify. On generation, however, the Author
  field in the Book create page says : Can't Change!, instead of
  giving me a select list of all the authors.

  My question is : Is this normal behavior ? If not, how do I go
  repairing this ?

 I assume author is a MappedForeignKey? If so, you need to override
 validSelectValues.

 Not sure why there isn't a default impl of this though, should be
 possible

 /Jeppe

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

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



Re: [Lift] Re: Lift-M2 One To Many and CRUDify

2010-03-08 Thread Naftoli Gugenheim
And it is used on the wiki? Would you volunteer to update it then?
Thanks.

-
ojonammanojo10...@gmail.com wrote:

Apologies,

yes, that is what I meant (or rather LongMappedForeignMapper) :
http://scala-tools.org/mvnsites/liftweb-1.1-M6/lift-mapper/scaladocs/net/liftweb/mapper/LongMappedForeignMapper.html

Manohar

On Mar 8, 3:01 pm, Naftoli Gugenheim naftoli...@gmail.com wrote:
 You mean MappedLongForeignMapper is deprecated?

 -

 ojonammanojo10...@gmail.com wrote:

 Hi Jeppe,

 that works indeed, thanks. Although, in 2.0-M2, technically you need
 to extend LongMappedMapper (as MappedForeignKey is deprecated).
 Anyway, here is the little bit of code, if anyone is interested (or
 interested in changing the wiki page for CRUD) :

 class Book extends LongKeyedMapper[Book] with IdPK with Ordered[Book]
 {
 def getSingleton = Book
 object author extends LongMappedMapper[Book, Author](this, Author){
   override def validSelectValues = Full(Author.findAll.map(x = (x.id,
 x.name)))

 }

 Cheers,
 Manohar

 PS : is there a place where I can find the link to the 2.0-M2 API ?

 On Mar 8, 9:46 am, Jeppe Nejsum Madsen je...@ingolfs.dk wrote:



  ojonam manojo10...@gmail.com writes:
   Hello all,

   I recently tested the wiki example of Book and Authors as an exercise,
   and extended them with CRUDify. On generation, however, the Author
   field in the Book create page says : Can't Change!, instead of
   giving me a select list of all the authors.

   My question is : Is this normal behavior ? If not, how do I go
   repairing this ?

  I assume author is a MappedForeignKey? If so, you need to override
  validSelectValues.

  Not sure why there isn't a default impl of this though, should be
  possible

  /Jeppe

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

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

-- 
You received this message because you are subscribed to the Google Groups 
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 Naftoli Gugenheim
I'm very confused. Where is there currently an implementation of equals that 
compares all fields? And what's the difference between KeyedMapper checking 
primaryKeyField and IdPK checking id?

-
Jim Barrowsjim.barr...@gmail.com wrote:

How about:  PrimaryKeyEquality

which would read something like: class foo extends IdPk with
PrimaryKeyEquality


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

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

Re: [Lift] Reorganize mapper specs?

2010-03-08 Thread Naftoli Gugenheim
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)? 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.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.

-- 
You received this message because you are subscribed to the Google Groups 
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 Naftoli Gugenheim
Currently what I did is combine ItemListSpecs with another test, so I gave it a 
more generic name than ItemsList, hence MapperSpecs2. The idea is that some 
tests really have zero to do with the vendor, but higher-level behavior. 
H2MemoryProvider is incidental--in memory databases are perfect for testing. So 
I'd prefer not putting the choice of testing db in the name of a 
driver-independent test.
If an ORM is a form of caching then these are cache-related specs.
If David vetoes the change on RB, a name is irrelevant; and depending on his 
proposal it may be temporary; but I'm looking for a name that says More Mapper 
Specs except these specs are run on one arbitrary driver rather than on all of 
them, because these specs are driver-independent by definition.
Thanks!

-
Jim Barrowsjim.barr...@gmail.com wrote:

On Mon, Mar 8, 2010 at 1: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)? 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?)


ItemsListOnH2MemorySpecs.scala
ItemsListH2MemorySpecs.scala
ItemsList_H2Memory_Specs.scala -- this is probably the most readable and
sets up the pattern for names like
WhatsUnderTest_JDBCDriverSpecificName_Specs

It's wordy, but if you want everything in the same directory, then that's
what happens.  Probably better would be:

itemsList/ItemsListSpecs.scala
itemsList/H2MemorySpecs.scala
itemsList/JdbcDriverSpecs.scala

Less wordy, but you have one more directory to traverse to get there.
 However if you figure we'll have mysql, sqlserver, oracle, h2  postgres at
a minimum, I think that this actually easier on the eyes when trying to find
the right jdbc driver specific tests.  In addition, we'll probably at some
point end up with version specific test cases as well.  That should probably
go in the same file, and use the version as part of the name.

So the specs name (ItemsList, in this case) is the cross driver tests, with
the driver specific specs test in the same directory.


Any other ideas?




 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

Re: [Lift] Reorganize mapper specs?

2010-03-08 Thread Naftoli Gugenheim
Not sure -- it sounded like you were describing a scenario with separate test 
files for each combination of area being tested and driver, where I was 
describing combining multiple areas in one file (like MapperSpecs is now). 
Maybe I misunderstood.

-
Jim Barrowsjim.barr...@gmail.com wrote:

On Mon, Mar 8, 2010 at 1:59 PM, Naftoli Gugenheim naftoli...@gmail.comwrote:

 Currently what I did is combine ItemListSpecs with another test, so I gave
 it a more generic name than ItemsList, hence MapperSpecs2. The idea is that
 some tests really have zero to do with the vendor, but higher-level
 behavior. H2MemoryProvider is incidental--in memory databases are perfect
 for testing. So I'd prefer not putting the choice of testing db in the name
 of a driver-independent test.
 If an ORM is a form of caching then these are cache-related specs.
 If David vetoes the change on RB, a name is irrelevant; and depending on
 his proposal it may be temporary; but I'm looking for a name that says More
 Mapper Specs except these specs are run on one arbitrary driver rather than
 on all of them, because these specs are driver-independent by definition.


I'm curious how my naming proposal doesn't do that?  In a much more
structured way?


-- 
James A Barrows

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

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



Re: [Lift] Re: asHtml compiler exception traversing code ?

2010-03-08 Thread Naftoli Gugenheim
I had that problem a number of times and the fix was changing
bindlabel - entity.field
which uses implicits, to
... entity.field.is
and/or
... entity.field.toString

-
hexahex...@gmail.com wrote:

Seems to work now I had a maybe weird way of getting an attribute from
a box...

I will try that next time

Thanks!


On Mar 8, 10:37 pm, David Pollakfeeder.of.the.be...@gmail.com
wrote:
 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 
 athttp://groups.google.com/group/liftweb?hl=en.

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

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



Re: [Lift] Re: Js normalizations

2010-03-07 Thread Naftoli Gugenheim
Can it be changed with a deprecation phase?

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

I'm not sure about the fastness as I also have other things and a 4
days baby boy ;) ... but I think this is fairly important and I'll try
to prioritize.

On Mar 7, 8:52 pm, Mads Hartmann Jensen mads...@gmail.com wrote:
 Marius,
 I think this sounds like a great idea - but I only have 2 Lift projects under 
 development so it would be quite fast for me to make any changes

 Mads

 On 07/03/2010, at 19.37, Marius wrote:



  Dear all,

  Looking at Js api and specifically JsCmds and JqJsCmds (the Js
  abstractions vs Jquery specify abstractions) IMHO there are several
  redundancies:

  1. JsCmds has ~ method for referencing member of objects (i.e
  elem.focus()) but JQuery abstractions have  method that chains a
  JQueryLeft with JQueryRight
  2. JQueryLeft and JQueryRight also seems redundant because JsExp
  already have the support for building expressions, composing them,
  chaining expressions etc.

  My proposal is to normalize this API and have the JQuery specific
  things to rely on the JsExp support. I'm aware that this would lead to
  some breaking changes but I believe they are necessary.

  If you think that this makes sense I'll add a ticket and put it in my
  backlog.

  Thoughts?

  Br's,
  Marius

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

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

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



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

2010-03-07 Thread Naftoli Gugenheim
I think that Jonathan was impolite in expressing his frustration at being 
misunderstood.
But are his points not valuable?

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

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.

-- 
You received this message because you are subscribed to the Google Groups 
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 

Re: [Lift] Re: Js normalizations

2010-03-07 Thread Naftoli Gugenheim
Then it sounds good to me, although that doesn't count as much since I must 
admit I haven't really had the opportunity to use Lift's ajax and javascript 
parts.

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

Yes that's the idea ... I apologize I didn't actually mean to just
remove things out of the sudden. But I'll know more once I get to dig
deeper.

On Mar 7, 10:13 pm, Naftoli Gugenheim naftoli...@gmail.com wrote:
 Can it be changed with a deprecation phase?

 -

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

 I'm not sure about the fastness as I also have other things and a 4
 days baby boy ;) ... but I think this is fairly important and I'll try
 to prioritize.

 On Mar 7, 8:52 pm, Mads Hartmann Jensen mads...@gmail.com wrote:





  Marius,
  I think this sounds like a great idea - but I only have 2 Lift projects 
  under development so it would be quite fast for me to make any changes

  Mads

  On 07/03/2010, at 19.37, Marius wrote:

   Dear all,

   Looking at Js api and specifically JsCmds and JqJsCmds (the Js
   abstractions vs Jquery specify abstractions) IMHO there are several
   redundancies:

   1. JsCmds has ~ method for referencing member of objects (i.e
   elem.focus()) but JQuery abstractions have  method that chains a
   JQueryLeft with JQueryRight
   2. JQueryLeft and JQueryRight also seems redundant because JsExp
   already have the support for building expressions, composing them,
   chaining expressions etc.

   My proposal is to normalize this API and have the JQuery specific
   things to rely on the JsExp support. I'm aware that this would lead to
   some breaking changes but I believe they are necessary.

   If you think that this makes sense I'll add a ticket and put it in my
   backlog.

   Thoughts?

   Br's,
   Marius

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

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

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

-- 
You received this message because you are subscribed to the Google Groups 
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] Reorganize mapper specs?

2010-03-07 Thread Naftoli Gugenheim
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?

-- 
You received this message because you are subscribed to the Google Groups 
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-07 Thread Naftoli Gugenheim
I may have a project coming up that would use it though. :)

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

You must be unique :)

On Mar 7, 10:21 pm, Naftoli Gugenheim naftoli...@gmail.com wrote:
 Then it sounds good to me, although that doesn't count as much since I must 
 admit I haven't really had the opportunity to use Lift's ajax and javascript 
 parts.

 -

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

 Yes that's the idea ... I apologize I didn't actually mean to just
 remove things out of the sudden. But I'll know more once I get to dig
 deeper.

 On Mar 7, 10:13 pm, Naftoli Gugenheim naftoli...@gmail.com wrote:





  Can it be changed with a deprecation phase?

  -

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

  I'm not sure about the fastness as I also have other things and a 4
  days baby boy ;) ... but I think this is fairly important and I'll try
  to prioritize.

  On Mar 7, 8:52 pm, Mads Hartmann Jensen mads...@gmail.com wrote:

   Marius,
   I think this sounds like a great idea - but I only have 2 Lift projects 
   under development so it would be quite fast for me to make any changes

   Mads

   On 07/03/2010, at 19.37, Marius wrote:

Dear all,

Looking at Js api and specifically JsCmds and JqJsCmds (the Js
abstractions vs Jquery specify abstractions) IMHO there are several
redundancies:

1. JsCmds has ~ method for referencing member of objects (i.e
elem.focus()) but JQuery abstractions have  method that chains a
JQueryLeft with JQueryRight
2. JQueryLeft and JQueryRight also seems redundant because JsExp
already have the support for building expressions, composing them,
chaining expressions etc.

My proposal is to normalize this API and have the JQuery specific
things to rely on the JsExp support. I'm aware that this would lead to
some breaking changes but I believe they are necessary.

If you think that this makes sense I'll add a ticket and put it in my
backlog.

Thoughts?

Br's,
Marius

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

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

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

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

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



[Lift] LongMappedForeignKey should call primeObj in apply(v: O) and apply(v: Box[O])

2010-03-07 Thread Naftoli Gugenheim
Is there any objection to
https://www.assembla.com/spaces/liftweb/tickets/411 - MappedLongForeignKey
should call primeObj in apply(v: O) and apply(v: Box[O])?
In other words, if you set a MappedLongForeignKey by passing it a Mapper
instance of the referenced table, is there any reason not to cache it? The
current behavior is that the next time, after setting it from a Mapper, one
calls obj, another instance will be fetched from the database and cached.

-- 
You received this message because you are subscribed to the Google Groups 
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] Customizing meta fields

2010-03-07 Thread Naftoli Gugenheim
It's not necessary. Just put a head section in the template and it will be 
combined with the head section in default.html.

-
Martin Dale Lynessmartin.lyn...@gmail.com wrote:

Thank you Ross, for the very informative response!

Now, I consider SEO to be closer to a designer task than a developer task so
keeping the power in the design documents would be my best idea. Is there
anyway to allow individual pages to define blocks that are read into the
snippets and then injected into the template?

Here is the scenario i'm thinking of:
1. A single uniform website template: default.html
2. Several HTML files: index.html, product_list.html, product_overview.html
3. Each of these HTML files containing lift:xxx tags referencing snippets.

What i would want is for index.html, product_list.html, and
product_overview.html to all use default.html and various Snippet classes.
Now for SEO i would want the meta tags in the header of default.html to be
customized to index.html, product_list.html, and product_overview.html;
furthermore, product_list and product_overview are dynamic pages so they
would need further customization based on what the snippets are returning.

Essentially, i would want tags something like:
lift:meta_descThis site is totally awesome, better than all our
competitors/lift:meta_desc   in index.html
lift:meta_descLook at all these products in
%%category_name%%/lift:meta_descin product_list.html
lift:meta_desc%product_name% - %product_description%/lift:meta_desc
in product_overview.html

The conceptual road block for me is coming from the controller first pattern
used in frameworks like Rails. In lift snippets are not really the same
conceptually. If i use the second proposed method
(i.e. lift:HelloWorld.hello wrapping the entire template) i would have a
battle between snippets used by each page. For example, perhaps i have a
product overview snippet that sets the meta one way and a login snippet that
sets it another way (intended for when show standalone in a login.html).

The first solution with using a lift:HelloWorld.funcName / to inject a
snippet at a meta location fits better because it would allow me to create a
generic function that would attempt to create the keyword and description
data based on whatever global information is made available to snippets by
lift (i.e. Request Parameters?). My only problem with using this option is
it puts all of the text on the developer side forcing the dev team to update
descriptions and keywords where really the designers should be doing this.

Does anyone have a suggestion on how to put the power in the hands of the
designers in this type of situation?

-- Martin

On Sun, Mar 7, 2010 at 6:17 PM, Ross Mellgren dri...@gmail.com wrote:

 To be parsed by the bind, it must be enclosed by
 lift:HelloWorld.hello.../lift:HelloWorld.hello

 There is relatively little magic -- Lift goes through your template looking
 for lift: prefixed tags. For those tags, it will look up a snippet class by
 using the part before the period (HelloWorld, in the above example) and then
 look for a method on that snippet class mentioned after the period (hello in
 the example). If there is no period, the method is assumed to be called
 render.

 Once that method is found, the method is called with the contents of the
 lift: tag, and the result of the method call is spliced into the XML to
 replace the lift: tag.

 bind is a function that does something kind of similar to overall template
 processing, except you supply some prefix other than lift: (b: in the
 example) and a limited set of things after the colon that are valid (time
 and meta_desc in the example)

 So, you might want something like this instead:

 meta name=descriptionlift:HelloWorld.meta_desc //meta

 class HelloWorld {

def meta_desc(ns: NodeSeq): NodeSeq = Text(test desc)

 }

 Which will result in this XHTML:

 meta name=descriptiontest desc/meta

 Or, if you want to keep it in the hello method, you'd then have to move the
 lift:HelloWorld.hello to the outside of the template:

 lift:HelloWorld.hello
   ...
   head
 meta name=descriptionb:meta:desc //meta
 /head
...
b:time /
 /lift:HelloWorld.hello

 Hope that helps,
 -Ross


 On Mar 7, 2010, at 4:38 AM, Martin wrote:

  How would one go about having dynamic description and keyword meta
  tags in a template? Here is what i've tried:
 
  default.html
  meta name=descriptionb:meta_desc //meta
 
  HelloWorld.scala
  Helpers.bind(b, in, time - date.map(d = Text(d.toString)),
  meta_desc - test desc)
 
  I'm using a basic archetype build of 2.0-M3 and it produces an error:
 
  This page contains the following errors:
 
  error on line 6 at column 28: Namespace prefix b on meta_desc is not
  defined
  Below is a rendering of the page up to the first error.
 
 
  It appears to me that the template is not parsed by the Helpers.bind,
  is this correct?
 
  --
  You 

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

2010-03-06 Thread Naftoli Gugenheim
I think I understand David's point about letting Lift sell itself for now,
rather than pushing for more widespread adoption, until the right time comes
At the same time I would like to mention that it seems to me (not based on
any experience) than Jonathan Mawson has very good marketing sense / common
sense. I think that with David's direction, if Jonathan is interested he
could contribute a lot with his suggestions and helping implement them.
For example, revising the selling points in a way that David and Jonathan
agree on could be very valuable.
I'm sure that if he puts his mind to it, he will have a lot of ideas that
are good for Lift.


On Sat, Mar 6, 2010 at 8:28 PM, David Pollak
feeder.of.the.be...@gmail.comwrote:



 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 

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

2010-03-06 Thread Naftoli Gugenheim
Also, someone was lamenting GitHub's flat wiki. Assembla has a more advanced
wiki system but David said it's not worthwhile to move unless someone will
take on the role of managing the wiki.

On Sat, Mar 6, 2010 at 10:44 PM, Naftoli Gugenheim naftoli...@gmail.comwrote:

 I think I understand David's point about letting Lift sell itself for now,
 rather than pushing for more widespread adoption, until the right time comes
 At the same time I would like to mention that it seems to me (not based on
 any experience) than Jonathan Mawson has very good marketing sense / common
 sense. I think that with David's direction, if Jonathan is interested he
 could contribute a lot with his suggestions and helping implement them.
 For example, revising the selling points in a way that David and Jonathan
 agree on could be very valuable.
 I'm sure that if he puts his mind to it, he will have a lot of ideas that
 are good for Lift.


 On Sat, Mar 6, 2010 at 8:28 PM, David Pollak 
 feeder.of.the.be...@gmail.com wrote:



 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

Re: [Lift] Re: Problem with FocusOnLoad and passing attributes through bind

2010-03-06 Thread Naftoli Gugenheim
The fundamental problem is that at the top bind level you want to use 
FocusOnLoad which returns a NodeSeq, but you also want bind to pass along the 
attributes, which has to operate at a lower level. So you can use bind twice, 
nested.
Try this pattern:
bind(pre, xhtml,
  label - {ns: NodeSeq =
FocusOnLoad(
  bind(pre, ns,
label -% elem
  )
)
  }
)
-
Luke  Nezdalne...@gmail.com wrote:

Marius -

First, thank you for your time! (sorry for the accidental double
response post - browser fail :))

Ok, so below is my current solution.  What I don't understand is how
to avoid hard coding the attributes when constructing the
SHtml.ajaxText AND getting that ajaxText's input to FocusOnLoad.  I
understand how to leave off the parameter for doSearch (fixed below --
you're totally right, that was spurious) and I understand that passing
through attributes to a whole NodeSeq doesn't make much sense.  What
I'm wondering is if there's some way of achieving both: FocusOnLoad 
attribute pass through -- maybe a nested bind or something?

Thanks again,
- Luke

// get FocusOnLoad, hard code attributes
object AjaxWithFocusOnLoad extends DispatchSnippet {
  override def dispatch = {
case searchField = searchField
  }
  // searchField closure
  def searchField(xhtml: NodeSeq): NodeSeq = {
// build up an ajax text box
def doSearch:NodeSeq = {
  FocusOnLoad(SHtml.ajaxText(, q = SetHtml(resultz,
Yawni.query(q)), (size,30), (tabindex, 1), (type,
search)))
}
// bind the view to the functionality
bind(ajax, xhtml,
 searchBox - doSearch
 )
  }
}

// ditch FocusOnLoad functionality, take advantage of attribute pass
through
object AjaxWithAttributePassThrough extends DispatchSnippet {
  override def dispatch = {
case searchField = searchField
  }
  // searchField closure
  def searchField(xhtml: NodeSeq): NodeSeq = {
// build up an ajax text box
def doSearch:Elem = {
  //FocusOnLoad(SHtml.ajaxText(, q = SetHtml(resultz,
Yawni.query(q)), (size,30), (tabindex, 1), (type,
search)))
  // kill FocusOnLoad functionality, take advantage of attribute
pass through in bind below
  SHtml.ajaxText(, q = SetHtml(resultz, Yawni.query(q)))
}
// bind the view to the functionality
bind(ajax, xhtml,
 //searchBox - doSearch
 // use attribute pass through variant
 searchBox -% doSearch
 )
  }
}

On Mar 6, 10:57 am, Marius marius.dan...@gmail.com wrote:
 In the short term you would solve it as I suggested:

 Use in your bind

  searchBox -% doSearch

 and define your doSearch as:

 def doSearch: NodeSeq =  {
 ... do your stuff here

 }

 Actually thinking more into it there is a good reason for -% to not
 have a (NodeSeq) = NodeSeq support. -% means that it preserves the
 attributes specified in the template to the resulting node.But having
 a bunch of attributes we can't apply them to a NodeSeq because aa
 NodeSeq means a sequence of Nodes with no commn parent so we can;t
 determine to which node we'd apply those attributes. AFAIK only an
 Elem can have attributes.

 On Mar 6, 6:45 pm, Luke  Nezda lne...@gmail.com wrote:

  Thanks for responding Marius.  You're right, my doSearch method
  doesn't need the msg parameter -- that was just an artifact of
  transforming an example (removed now).  As far as my specific issue, I
  guess you're saying the best solution is for the framework to add
  overload def -%(in: NodeSeq = NodeSeq) congruent with - -- should I
  file a feature request?  As you said, Group(FocusOnLoad...) doesn't
  compile either because it returns a Node, not the currently required
  Element.  Did I misunderstand?  

 You are correct. I mainly pointed to Group just as a reminder as it
 can be useful to aggregate nodes. It wont work in your case.

 In the short term how would you solve

  this ?

  Thanks,
  - Luke

  On Mar 6, 1:39 am, Marius marius.dan...@gmail.com wrote:

   On 22 feb., 04:12, Luke  Nezda lne...@gmail.com wrote:

Hello,

I am new to Scala and Lift.  I am having a problem using 2 features
together which seem to work fine individually.  Here's a simplified
piece of the code:

class Ajax {
  def someResult(q:String) = spansome results for query {q}.../
span
  // searchField closure
  def searchField(xhtml: NodeSeq): NodeSeq = {
    // build up an ajax text box
    def doSearch(msg: NodeSeq) = {
      // doesn't compile with bind: searchBox -% doSearch _
      FocusOnLoad(SHtml.ajaxText(, q = SetHtml(resultz,
someResult(q
      // compiles with bind: searchBox -% doSearch _
      // SHtml.ajaxText(, q = SetHtml(resultz, someResult(q)))
    }
    // bind the view to the functionality
    bind(ajax, xhtml,
         searchBox - doSearch _
         // doesn't compile if doSearch returns result of FocusOnLoad
         //searchBox -% doSearch _
         )
  }

}

 

Re: [Lift] Re: Lift security vulnerability

2010-03-05 Thread Naftoli Gugenheim
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:

  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 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 frameworkhttp://liftweb.net

Re: [Lift] Re: Response Optimizations too aggressive

2010-03-04 Thread Naftoli Gugenheim
How about
LiftRules.stripComments.default.set( () = !Req.isIE)
etc.?

-
awanth...@whitford.com wrote:

OK, I have disabled the stripping of comments:

LiftRules.stripComments.default.set( () = false )

It seems to work for me.


On Mar 4, 12:36 am, Jeppe Nejsum Madsen je...@ingolfs.dk wrote:
 aw anth...@whitford.com writes:
      !--[if IE 6] script type=text/javascript id=ie6fix ... /
  script ![endif]--

 Ross already described how to disable this, but this seems like a
 genuine useful feature (to not remove some comments). Iircc, there are
 other scenarios (such as AdWords) where you would like to keep the
 some comments.

 Not sure how to handle this in a general way though.

 In this case You can also handle it server side: Req.isIE6

 /Jeppe

Obviously, it would be great to make the stripComments variable
session specific where I could leverage something like isIE.  I do see
that FactoryMaker seems to have a session and request specific vending
concept, so this looks promising.  I think the code that actually does
the comment stripping is in LiftMerge, so I'm thinking that that would
need to be enriched too.  Ideally, I would like to see comments that
are not IE specific to be stripped.  (I am unfamiliar with AdWords and
how they use comments.)

Sound like a ticket?

Thanks everybody for the quick help!

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

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



Re: [Lift] Trouble with lift-couchdb

2010-03-04 Thread Naftoli Gugenheim
If JSONRecord generates a runtime AbstractMethodError, compiling it with the 
same classpath would generate a compiler error.
Do you know what that test.Settings... line is referring to? If not look up the 
line mentioned. Something about that reference is different between compile 
time and runtime.


-
Craig Blakecraigwbl...@gmail.com wrote:

Ok, thanks for the hint.  I clean compiled each Scala library that touches the 
project (including lift), and made sure that their are no conflicting versions 
of Scala in the path (I checked with the Maven dependency plugin, and I do not 
get the warning that multiple versions were detected) but I am still seeing the 
error.  Anything else I should try in order to eliminate library/compile 
versions as the culprit?

Thanks, 
Craig

On Mar 3, 2010, at 9:54 PM, Naftoli Gugenheim wrote:

 AbstractMethodError means you need to do a clean build and make sure you 
 don't have multiple scala versions.
 
 -
 Craig Blakecraigwbl...@gmail.com wrote:
 
 Just took a minor change to compile (didn't like ?~) and I'll let you know 
 how it goes soon.  I'm running into one more problem, this time a runtime 
 exception saving a document:
 
 java.lang.AbstractMethodError: 
 test.Settings$updated$.encode(Ljava/lang/Object;)Ljava/lang/String;
   at 
 net.liftweb.couchdb.JSONEncodedStringFieldMixin$$anonfun$asJValue$6.apply(JSONRecord.scala:319)
   at 
 net.liftweb.couchdb.JSONEncodedStringFieldMixin$$anonfun$asJValue$6.apply(JSONRecord.scala:319)
   at net.liftweb.common.Full.map(Box.scala:330)
   at net.liftweb.couchd...
 
 
 The field is defined as:
 
 object updated extends JSONDateTimeField( this)
 
 Surely something else I missed?
 
 Craig
 
 On Mar 3, 2010, at 8:39 PM, Ross Mellgren wrote:
 
 Try this:
 
 /** Enum data field for JSON records. Encodes as JString */
 class JSONEnumNameField[OwnerType : JSONRecord[OwnerType], EnumType : 
 Enumeration]
  (rec: OwnerType, enum: EnumType)(implicit 
 enumValueType: Manifest[EnumType#Value])
 extends EnumField[OwnerType, EnumType](rec, enum) with JSONField
 {
 def this(rec: OwnerType, enum: EnumType, value: EnumType#Value)(implicit 
 enumValueType: Manifest[EnumType#Value]) = {
 this(rec, enum)
 set(value)
 }
 
 def this(rec: OwnerType, enum: EnumType, value: 
 Box[EnumType#Value])(implicit enumValueType: Manifest[EnumType#Value]) = {
 this(rec, enum)
 setBox(value)
 }
 
 def asJValue: JValue = valueBox.map(v = JString(v.toString)) openOr 
 (JNothing: JValue)
 def fromJValue(jvalue: JValue): Box[EnumType#Value] = jvalue match {
   case JNothing|JNull if optional_? = setBox(Empty)
   case JString(s)   = setBox(enum.valueOf(s) ?~ (Unknown 
 value \ + s + \))
   case other= setBox(expectedA(JString, other))
 }
 }
 
 Let me know if it works for you. If so, I'll start the process of getting it 
 into master as soon as I can.
 
 -Ross
 
 On Mar 3, 2010, at 8:12 PM, Craig Blake wrote:
 
 Sure, will do.  The only thing I think I'll need to figure out is how to 
 persist an enumeration by name rather than ordinal value, but I imagine 
 that it should be pretty straight-forward to add a new field type in my app 
 to handle it.
 
 Thanks,
 Craig
 
 On Mar 3, 2010, at 7:45 PM, Ross Mellgren wrote:
 
 It's no problem, as I mentioned the compiler error is practically useless.
 
 Hope you get along well, let me know if you have any other issues.
 
 -Ross
 
 On Mar 3, 2010, at 7:29 PM, Craig Blake wrote:
 
 Yep, that seems to be better.  Sorry for the noise, I don't know why I 
 didn't think to check that.
 
 Thanks for the quick answer.
 
 Craig
 
 On Mar 3, 2010, at 4:44 PM, Ross Mellgren wrote:
 
 Unfortunately the compiler error is bizarre (due to some of the type 
 shuffling involved), but the underlying problem you're experiencing is 
 that DateTimeFields (and therefore JSONDateTimeFields) have a storage 
 type of Calendar, and you're trying to assign a Date to them. Try 
 Calendar.getInstance instead of new Date() and see if that resolves it 
 for you?
 
 -Ross
 
 On Mar 3, 2010, at 4:32 PM, Craig Blake wrote:
 
 Hi,
 
 I am getting familiar with the lift-couchdb module, and trying to put 
 together a sample based on the tests in the module.  Trying to create a 
 record, based on this test code:
 
 def testRec1: Person = Person.createRecord.name(Alice).age(25)
 
 this is what I have:
 
 class Account extends CouchRecord[Account] {
 def meta = Account
 object created extends JSONDateTimeField(this)
 }
 object Account extends Account with CouchMetaRecord[Account]
 
 ...
 
 val account = Account.createRecord.created(new Date())
 
 
 I get a compilation error:
 
 [WARNING] Test.scala:44: error: overloaded method value apply with 
 alternatives ((net.liftweb.common.Box[_12.MyType])test.Account) forSome 
 { val _12: object test.Account#created } and 
 ((_13.MyType

Re: [Lift] Trouble with lift-couchdb

2010-03-04 Thread Naftoli Gugenheim
Remind me which versions of Lift and Scala you're using?

-
Craig Blakecraigwbl...@gmail.com wrote:

To test further, I've created a simple test project with only one dependency, 
lift-couchdb, and this code:

object Settings extends Settings with CouchMetaRecord[ Settings]
class Settings extends CouchRecord[ Settings] {
def meta = Settings
object updated extends JSONDateTimeField( this)
}

object Testing {

def main( args: Array[ String]) {
import CouchDB.defaultDatabase
defaultDatabase = new Database( :/( localhost, 5984) as_! ( 
username, password), database)

val settings = Settings.createRecord
settings.updated( Calendar.getInstance( TimeZone.getTimeZone( 
UTC)))
settings.save
}
}

I get the same error:

java.lang.AbstractMethodError: 
test.Settings$updated$.encode(Ljava/lang/Object;)Ljava/lang/String;

I've also put the test code in Github in case anyone might be able to reproduce 
it locally:

g...@github.com:craigwblake/lift-couchdb-test.git


Thanks,
Craig


On Mar 3, 2010, at 9:54 PM, Naftoli Gugenheim wrote:

 AbstractMethodError means you need to do a clean build and make sure you 
 don't have multiple scala versions.
 
 -
 Craig Blakecraigwbl...@gmail.com wrote:
 
 Just took a minor change to compile (didn't like ?~) and I'll let you know 
 how it goes soon.  I'm running into one more problem, this time a runtime 
 exception saving a document:
 
 java.lang.AbstractMethodError: 
 test.Settings$updated$.encode(Ljava/lang/Object;)Ljava/lang/String;
   at 
 net.liftweb.couchdb.JSONEncodedStringFieldMixin$$anonfun$asJValue$6.apply(JSONRecord.scala:319)
   at 
 net.liftweb.couchdb.JSONEncodedStringFieldMixin$$anonfun$asJValue$6.apply(JSONRecord.scala:319)
   at net.liftweb.common.Full.map(Box.scala:330)
   at net.liftweb.couchd...
 
 
 The field is defined as:
 
 object updated extends JSONDateTimeField( this)
 
 Surely something else I missed?
 
 Craig
 
 On Mar 3, 2010, at 8:39 PM, Ross Mellgren wrote:
 
 Try this:
 
 /** Enum data field for JSON records. Encodes as JString */
 class JSONEnumNameField[OwnerType : JSONRecord[OwnerType], EnumType : 
 Enumeration]
  (rec: OwnerType, enum: EnumType)(implicit 
 enumValueType: Manifest[EnumType#Value])
 extends EnumField[OwnerType, EnumType](rec, enum) with JSONField
 {
 def this(rec: OwnerType, enum: EnumType, value: EnumType#Value)(implicit 
 enumValueType: Manifest[EnumType#Value]) = {
 this(rec, enum)
 set(value)
 }
 
 def this(rec: OwnerType, enum: EnumType, value: 
 Box[EnumType#Value])(implicit enumValueType: Manifest[EnumType#Value]) = {
 this(rec, enum)
 setBox(value)
 }
 
 def asJValue: JValue = valueBox.map(v = JString(v.toString)) openOr 
 (JNothing: JValue)
 def fromJValue(jvalue: JValue): Box[EnumType#Value] = jvalue match {
   case JNothing|JNull if optional_? = setBox(Empty)
   case JString(s)   = setBox(enum.valueOf(s) ?~ (Unknown 
 value \ + s + \))
   case other= setBox(expectedA(JString, other))
 }
 }
 
 Let me know if it works for you. If so, I'll start the process of getting it 
 into master as soon as I can.
 
 -Ross
 
 On Mar 3, 2010, at 8:12 PM, Craig Blake wrote:
 
 Sure, will do.  The only thing I think I'll need to figure out is how to 
 persist an enumeration by name rather than ordinal value, but I imagine 
 that it should be pretty straight-forward to add a new field type in my app 
 to handle it.
 
 Thanks,
 Craig
 
 On Mar 3, 2010, at 7:45 PM, Ross Mellgren wrote:
 
 It's no problem, as I mentioned the compiler error is practically useless.
 
 Hope you get along well, let me know if you have any other issues.
 
 -Ross
 
 On Mar 3, 2010, at 7:29 PM, Craig Blake wrote:
 
 Yep, that seems to be better.  Sorry for the noise, I don't know why I 
 didn't think to check that.
 
 Thanks for the quick answer.
 
 Craig
 
 On Mar 3, 2010, at 4:44 PM, Ross Mellgren wrote:
 
 Unfortunately the compiler error is bizarre (due to some of the type 
 shuffling involved), but the underlying problem you're experiencing is 
 that DateTimeFields (and therefore JSONDateTimeFields) have a storage 
 type of Calendar, and you're trying to assign a Date to them. Try 
 Calendar.getInstance instead of new Date() and see if that resolves it 
 for you?
 
 -Ross
 
 On Mar 3, 2010, at 4:32 PM, Craig Blake wrote:
 
 Hi,
 
 I am getting familiar with the lift-couchdb module, and trying to put 
 together a sample based on the tests in the module.  Trying to create a 
 record, based on this test code:
 
 def testRec1: Person = Person.createRecord.name(Alice).age(25)
 
 this is what I have:
 
 class Account extends CouchRecord[Account] {
 def meta = Account
 object created extends JSONDateTimeField(this)
 }
 object Account extends Account with CouchMetaRecord[Account

Re: [Lift] Re: SQL error

2010-03-04 Thread Naftoli Gugenheim
Is blob a standard reserved word or only on MySQL?
If the latter this is a potential breaking change.

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

2010-03-04 Thread Naftoli Gugenheim
If you didn't yet send it also to lift-announce.

-
Mads Hartmann Jensenmads...@gmail.com wrote:

Ah yeah I see, it would be looking for a column named blob_c then, right? 

So what do you say - I send out a **Potential breaking change** message that 
states that if 'blob' is not a keyword in your DB and you're currently using 
blob as a column name you should change it to blob_c?

On 04/03/2010, at 22.16, Ross Mellgren wrote:

 It would be breaking only if somebody were using a database backend where 
 it's NOT a keyword and also had a mapper field called blob, right?
 
 Seems pretty unlikely, but that's just my opinion.
 
 -Ross
 
 On Mar 4, 2010, at 4:13 PM, Jim Barrows wrote:
 
 On Thu, Mar 4, 2010 at 2:10 PM, Mads Hartmann Jensen mads...@gmail.com 
 wrote:
 This has already been on reviewboard and comitted to master - should i send 
 out a breaking change note? 
 
 I'm not sure i get why this is a breaking change though? 
 
 
 Not sure if it is.  However it's certainly something folks will want to 
 upgrade to asap.
 
 Naming columns keywords in SQL is bad.
 
 
 
 On 04/03/2010, at 22.07, Jim Barrows wrote:
 
 On Thu, Mar 4, 2010 at 1:47 PM, Naftoli Gugenheim naftoli...@gmail.com 
 wrote:
 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.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.
 
 
 
 
 -- 
 James A Barrows
 
 
 -- 
 You received this message because you are subscribed to the Google

Re: [Lift] Resuming a Statefull Snippet.

2010-03-04 Thread Naftoli Gugenheim
You have to save the snippet instance in a variable somewhere that won't go out 
of scope, and then in redirectTo's second parameter write 
instance.registerThisSnippet.

-
andythedestroyerandythedestro...@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)
}
}

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

2010-03-04 Thread Naftoli Gugenheim
Actually if you're grabbing the href from StatefulSnippet.link then you 
shouldn't need to write registerThisSnippet, or redirect.
Can you verify that the code block passed to StatefulSnippet.link is getting 
executed?

-
andythedestroyerandythedestro...@gmail.com wrote:

Naftoli,

Thanks for the response.

I don't think I understand your post very well. I have two redirectTos
in the code and I tried putting registerThisSnippet in both. This what
I tried.

object mySnip extends SessionVar[Box[Wizard]](Emtpy)
class Wizard extends StatefulSnippet with Logger {

def doRedirect = {
mySnip.set( Full(this) )
val returnPath = urlEncode(
 S.hostAndPath + ( link(/lastPage, () = redirectTo(/lastPage),
NodeSeq.Empty) \ @href).text
)

S.redirectTo( third_party_url +?return= + returnPath,
mySnip.get.get.registerThisSnippet())
}
}


And

object mySnip extends SessionVar[Box[Wizard]](Emtpy)
class Wizard extends StatefulSnippet with Logger {

def doRedirect = {
mySnip.set( Full(this) )
val returnPath = urlEncode(
  S.hostAndPath + ( link(/lastPage, () = S.redirectTo(/lastPage,
mySnip.get.get.registerThisSnippet()), NodeSeq.Empty) \ @href).text
)

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


Neither worked. The SessionVar shouldn't go out of scope. It seems
like I should be able to generate a link and just take the href from
the generated link. I don't understand why that doesn't work.

Thanks,
Andy

On Mar 4, 2:26 pm, Naftoli Gugenheim naftoli...@gmail.com wrote:
 You have to save the snippet instance in a variable somewhere that won't go 
 out of scope, and then in redirectTo's second parameter write 
 instance.registerThisSnippet.

 -

 andythedestroyerandythedestro...@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)

 }
 }

 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.com.
 For more options, visit this group 
 athttp://groups.google.com/group/liftweb?hl=en.

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

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



Re: [Lift] Re: Resuming a Statefull Snippet.

2010-03-04 Thread Naftoli Gugenheim
I don't think Scala's XPath supports @attributes. You have to use the API 
of scala.xml.Elem to look up the value of an attribute.
But there's a better way: do what StatefulSnippet.link does yourself. Look up 
the source. I think the method you want is S.fmapFunc or something like that if 
I'm not getting mixed up.


-
andythedestroyerandythedestro...@gmail.com wrote:

Naftoli,

Thanks for the response.

I don't think I understand your post very well. I have two redirectTos
in the code and I tried putting registerThisSnippet in both. This what
I tried.

object mySnip extends SessionVar[Box[Wizard]](Emtpy)
class Wizard extends StatefulSnippet with Logger {

def doRedirect = {
mySnip.set( Full(this) )
val returnPath = urlEncode(
 S.hostAndPath + ( link(/lastPage, () = redirectTo(/lastPage),
NodeSeq.Empty) \ @href).text
)

S.redirectTo( third_party_url +?return= + returnPath,
mySnip.get.get.registerThisSnippet())
}
}


And

object mySnip extends SessionVar[Box[Wizard]](Emtpy)
class Wizard extends StatefulSnippet with Logger {

def doRedirect = {
mySnip.set( Full(this) )
val returnPath = urlEncode(
  S.hostAndPath + ( link(/lastPage, () = S.redirectTo(/lastPage,
mySnip.get.get.registerThisSnippet()), NodeSeq.Empty) \ @href).text
)

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


Neither worked. The SessionVar shouldn't go out of scope. It seems
like I should be able to generate a link and just take the href from
the generated link. I don't understand why that doesn't work.

Thanks,
Andy

On Mar 4, 2:26 pm, Naftoli Gugenheim naftoli...@gmail.com wrote:
 You have to save the snippet instance in a variable somewhere that won't go 
 out of scope, and then in redirectTo's second parameter write 
 instance.registerThisSnippet.

 -

 andythedestroyerandythedestro...@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)

 }
 }

 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.com.
 For more options, visit this group 
 athttp://groups.google.com/group/liftweb?hl=en.

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

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



Re: [Lift] Re: Resuming a Statefull Snippet.

2010-03-04 Thread Naftoli Gugenheim
See my other email, but session vars have the obvious disclaimer that there's 
only one per session, while any number of StatefulSnippets can be tracked in 
parallel.

-
andythedestroyerandythedestro...@gmail.com wrote:

Although it would be cool to figure out how to pause and resume
StatefulSnippets, I just reworked it to use DispatchSnippets and
SessionVars and in only took 10 mins.

Thanks again to Naftoli.

-A

On Mar 4, 3:03 pm, andythedestroyer andythedestro...@gmail.com
wrote:
 Naftoli,

 Thanks for the response.

 I don't think I understand your post very well. I have two redirectTos
 in the code and I tried putting registerThisSnippet in both. This what
 I tried.

 object mySnip extends SessionVar[Box[Wizard]](Emtpy)
 class Wizard extends StatefulSnippet with Logger {
 
 def doRedirect = {
 mySnip.set( Full(this) )
 val returnPath = urlEncode(
  S.hostAndPath + ( link(/lastPage, () = redirectTo(/lastPage),
 NodeSeq.Empty) \ @href).text
 )

 S.redirectTo( third_party_url +?return= + returnPath,
 mySnip.get.get.registerThisSnippet())

 }
 }

 And

 object mySnip extends SessionVar[Box[Wizard]](Emtpy)
 class Wizard extends StatefulSnippet with Logger {
 
 def doRedirect = {
 mySnip.set( Full(this) )
 val returnPath = urlEncode(
   S.hostAndPath + ( link(/lastPage, () = S.redirectTo(/lastPage,
 mySnip.get.get.registerThisSnippet()), NodeSeq.Empty) \ @href).text
 )

 redirectTo( third_party_url +?return= + returnPath)

 }
 }

 Neither worked. The SessionVar shouldn't go out of scope. It seems
 like I should be able to generate a link and just take the href from
 the generated link. I don't understand why that doesn't work.

 Thanks,
 Andy

 On Mar 4, 2:26 pm, Naftoli Gugenheim naftoli...@gmail.com wrote:

  You have to save the snippet instance in a variable somewhere that won't go 
  out of scope, and then in redirectTo's second parameter write 
  instance.registerThisSnippet.

  -

  andythedestroyerandythedestro...@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)

  }
  }

  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.com.
  For more options, visit this group 
  athttp://groups.google.com/group/liftweb?hl=en.

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

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



Re: [Lift] Re: Lift security vulnerability

2010-03-04 Thread Naftoli Gugenheim
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 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 frameworkhttp://liftweb.net
Beginning Scalahttp://www.apress.com/book/view/1430219890
Follow me:http://twitter.com/dpp
Surf the harmonics

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

-- 
You received this message because you are subscribed to the Google 

Re: [Lift] The role of LiftRules

2010-03-03 Thread Naftoli Gugenheim
See David's last post on this thread, and the updated diff on RB.

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

Naftoli Gugenheim naftoli...@gmail.com writes:

 Would it be a bad idea to use java.util.Date for now, and if and when support 
 is added for JodaTime, change it to a DateHolder (which would be added then)?

Haven't looked in detail, but wouldn't this require two changes to
client code?

1) One to use the new ConversionRules
2) One when DateHolder is introduced

If so, I suggest we take the hit now to allow for a seamless (if such a
thing exists :-) change to JodaTime

/Jeppe



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

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



Re: [Lift] The role of LiftRules

2010-03-03 Thread Naftoli Gugenheim
When are the implicits on a companion object invoked without needing to be 
imported?

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

Naftoli Gugenheim naftoli...@gmail.com writes:

 Would it be a bad idea to use java.util.Date for now, and if and when support 
 is added for JodaTime, change it to a DateHolder (which would be added then)?

Haven't looked in detail, but wouldn't this require two changes to
client code?

1) One to use the new ConversionRules
2) One when DateHolder is introduced

If so, I suggest we take the hit now to allow for a seamless (if such a
thing exists :-) change to JodaTime

/Jeppe



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

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



Re: [Lift] Converting a rails application to lift

2010-03-03 Thread Naftoli Gugenheim
Is a syntax like this okay (inside an Author mapper)?
object created extends MappedDateTime(this) with CreatedTimestamp[Author]
Although if we say that timestamps are always a date-time (not date only or 
time only) this could be shortened to
object created extends CreatedTimestamp(this)


-
Achint Sandhuachint.san...@gmail.com 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.

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

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



Re: [Lift] Trouble with lift-couchdb

2010-03-03 Thread Naftoli Gugenheim
AbstractMethodError means you need to do a clean build and make sure you don't 
have multiple scala versions.

-
Craig Blakecraigwbl...@gmail.com wrote:

Just took a minor change to compile (didn't like ?~) and I'll let you know how 
it goes soon.  I'm running into one more problem, this time a runtime exception 
saving a document:

java.lang.AbstractMethodError: 
test.Settings$updated$.encode(Ljava/lang/Object;)Ljava/lang/String;
at 
net.liftweb.couchdb.JSONEncodedStringFieldMixin$$anonfun$asJValue$6.apply(JSONRecord.scala:319)
at 
net.liftweb.couchdb.JSONEncodedStringFieldMixin$$anonfun$asJValue$6.apply(JSONRecord.scala:319)
at net.liftweb.common.Full.map(Box.scala:330)
at net.liftweb.couchd...


The field is defined as:

object updated extends JSONDateTimeField( this)

Surely something else I missed?

Craig

On Mar 3, 2010, at 8:39 PM, Ross Mellgren wrote:

 Try this:
 
 /** Enum data field for JSON records. Encodes as JString */
 class JSONEnumNameField[OwnerType : JSONRecord[OwnerType], EnumType : 
 Enumeration]
   (rec: OwnerType, enum: EnumType)(implicit 
 enumValueType: Manifest[EnumType#Value])
  extends EnumField[OwnerType, EnumType](rec, enum) with JSONField
 {
  def this(rec: OwnerType, enum: EnumType, value: EnumType#Value)(implicit 
 enumValueType: Manifest[EnumType#Value]) = {
  this(rec, enum)
  set(value)
  }
 
  def this(rec: OwnerType, enum: EnumType, value: 
 Box[EnumType#Value])(implicit enumValueType: Manifest[EnumType#Value]) = {
  this(rec, enum)
  setBox(value)
  }
 
  def asJValue: JValue = valueBox.map(v = JString(v.toString)) openOr 
 (JNothing: JValue)
  def fromJValue(jvalue: JValue): Box[EnumType#Value] = jvalue match {
case JNothing|JNull if optional_? = setBox(Empty)
case JString(s)   = setBox(enum.valueOf(s) ?~ (Unknown 
 value \ + s + \))
case other= setBox(expectedA(JString, other))
  }
 }
 
 Let me know if it works for you. If so, I'll start the process of getting it 
 into master as soon as I can.
 
 -Ross
 
 On Mar 3, 2010, at 8:12 PM, Craig Blake wrote:
 
 Sure, will do.  The only thing I think I'll need to figure out is how to 
 persist an enumeration by name rather than ordinal value, but I imagine that 
 it should be pretty straight-forward to add a new field type in my app to 
 handle it.
 
 Thanks,
 Craig
 
 On Mar 3, 2010, at 7:45 PM, Ross Mellgren wrote:
 
 It's no problem, as I mentioned the compiler error is practically useless.
 
 Hope you get along well, let me know if you have any other issues.
 
 -Ross
 
 On Mar 3, 2010, at 7:29 PM, Craig Blake wrote:
 
 Yep, that seems to be better.  Sorry for the noise, I don't know why I 
 didn't think to check that.
 
 Thanks for the quick answer.
 
 Craig
 
 On Mar 3, 2010, at 4:44 PM, Ross Mellgren wrote:
 
 Unfortunately the compiler error is bizarre (due to some of the type 
 shuffling involved), but the underlying problem you're experiencing is 
 that DateTimeFields (and therefore JSONDateTimeFields) have a storage 
 type of Calendar, and you're trying to assign a Date to them. Try 
 Calendar.getInstance instead of new Date() and see if that resolves it 
 for you?
 
 -Ross
 
 On Mar 3, 2010, at 4:32 PM, Craig Blake wrote:
 
 Hi,
 
 I am getting familiar with the lift-couchdb module, and trying to put 
 together a sample based on the tests in the module.  Trying to create a 
 record, based on this test code:
 
 def testRec1: Person = Person.createRecord.name(Alice).age(25)
 
 this is what I have:
 
 class Account extends CouchRecord[Account] {
  def meta = Account
  object created extends JSONDateTimeField(this)
 }
 object Account extends Account with CouchMetaRecord[Account]
 
 ...
 
 val account = Account.createRecord.created(new Date())
 
 
 I get a compilation error:
 
 [WARNING] Test.scala:44: error: overloaded method value apply with 
 alternatives ((net.liftweb.common.Box[_12.MyType])test.Account) forSome 
 { val _12: object test.Account#created } and 
 ((_13.MyType)test.Account) forSome { val _13: object 
 test.Account#created } cannot be applied to (java.util.Date)
 [WARNING]val account = Account.createRecord.created( new 
 Date())
 
 
 I'm sure that I am just missing something obvious.  Any ideas what?
 
 Thanks,
 Craig
 
 -- 
 You received this message because you are subscribed to the Google 
 Groups 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 
 

Re: [Lift] Response Optimizations too aggressive

2010-03-03 Thread Naftoli Gugenheim
I don't know the answer, but did you look through LiftRules to see if there's 
any setting about comments?

-
awanth...@whitford.com wrote:

After fielding calls as to why my UI doesn't look correctly on IE, I
discovered that Lift is doing an optimization in production mode
that is effectively breaking my application's compatibility for IE...

To get around IE6 deficiencies, I am leveraging JQuery.  For example,
if I have a CSS style that uses attribute selectors, like
input[type=checkbox], IE6 ignores them, but I can get JQuery to apply
the style.

Since this JavaScript applies to IE only, I wrap them in comments
like:

!--[if IE 6] script type=text/javascript id=ie6fix ... /
script ![endif]--

Firefox and Chrome will ignore these, which is perfect, and only IE
will pay attention (and suffer the overhead).

All was working fine in dev, then came time to roll out to production
and I naturally specified -Drun.mode=production.  Surprisingly,
production mode has an optimization that strips HTML comments from
the output.  Generally, I think this is a great idea -- EXCEPT if we
have IE specific comments responding to an IE browser.

Is there a way to modify the optimization so that IE specific comments
are retained?  Alternatively, can I simply disable this optimization
feature so that my IE users are OK?

How can I find out more about these production mode optimizations?
Is there a list?

I have drilled into Props.scala and I read it very carefully.  I think
of my environments as Dev/QA/Prod, but I think this translates best to
Test/Staging/Production in Lift-speak.  I am expecting that
production mode optimizations are applied to both Staging (aka QA)
as well as Production -- because I need to validate actual production
behavior.

Note that I am running 2.0-M2.

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

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



Re: [Lift] Converting a rails application to lift

2010-03-02 Thread Naftoli Gugenheim
You can assign the ticket to me because I have code for such fields that I can 
contribute.

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

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.

-- 
You received this message because you are subscribed to the Google Groups 
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 Naftoli Gugenheim
Yes, because, as in the database, essentially it's a MappedLong (for example), 
with support built on top of it (via trait mixins) to lookup and cache the 
referenced entity.
Is there a problem with the .obj syntax?

-
Achint Sandhuachint.san...@gmail.com wrote:

Hi,

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

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.com.
  For more options, visit this group 
  athttp://groups.google.com/group/liftweb?hl=en.

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

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



Re: [Lift] The role of LiftRules

2010-03-02 Thread Naftoli Gugenheim
Would it be a bad idea to use java.util.Date for now, and if and when support 
is added for JodaTime, change it to a DateHolder (which would be added then)?

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

A ConversionRules singleton is the wrong concept.

What you want is:

case class DateHolder(date: JodaTime) {
  implicit def asJt: JodaTime = date
  implicit def asJavaDate: java.util.Date = // convert to Java date here
}

object DateHolder {
  implicit def dateToDH(in: java.util.Date): DateHolder = ...
  implicit def jtToDH(in: JodaTime): DateHolder = new DateHolder(in)
}

trait DateTimeConverter {
  def formatDate(in: DateHolder): String
  def formatTime(in: DateHodler): String
  ...
  def parseDate(in: String): Box[DateHolder]
  def parseTime(in: String): Box[DateHolder]
  ...
}

in util:

object DateTimeConverter {
  def vend(locale: java.util.Locale): DateTimeConverter = build/cache locale
specific converters here
}

So, we've addressed the JodaTime vs. java.util.Date issue.  Next we hook
things up to LiftRules:

LiftRules {
  val dateTimeConverter = new FactoryMaker[DateTimeConverter](() =
DateTimeConverter.vend(S.locale))
}

Make sense?


On Fri, Feb 26, 2010 at 1:54 PM, Naftoli Gugenheim naftoli...@gmail.comwrote:

 Oh, right--I forgot about per-session and request.
 So what do you vote on this, then:
 A. ConversionRules is its own singleton, but as a bonus it can also be
 accessed from LiftRules.
 B. Same as A but ConversionRules is private[liftweb], so there's only one
 path.
 C. Less redundant: define (a renamed) ConversionRules inside LiftRules
 D. Make ConversionRules a class with immutable vals, and LiftRules will
 have a ConversionRules FactoryMaker. We can provide several default
 ConversionRules instances. This makes it easier to have preset
 configurations switched all at a time, which is a very reasonable thing to
 want to do. (At some point there could be a JodaTime instance maybe...) This
 also allows putting ConversionRules in lift-util while still having the
 benefits of FactoryMaker.
 Personally D sounds the best but I'm open to whatever others want.

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

 The basic DI (the stuff Factory/FactoryMaker are built on) are located in
 util: see Maker.scala

 The Factory stuff is in webkit because it relies on session and request
 state.  You can change the rules for vending something on a
 session-by-session and request-by-request basis.

 LiftRules is the single locus of setting webkit rules.  There should be one
 and only one.  Before Marius came along and put everything in one place,
 webkit was a mess of configuration singletons.  I support his design and
 think it has held up well.  People know where to set webkit related stuff.

 As much as possible, we try not to allow the stuff in util to have mutable
 state/settings.  Why?  Because the stuff in util should always behave the
 same way: predictably.

 But the date/time stuff transcends webkit... it should be generically
 useful
 across non-webkit applications.

 At this point, I think the easiest answer is to put the date/time stuff in
 webkit until there's a better answer.  The locus of configuration for
 webkit
 stuff is LiftRules, so the date/time configuration should live there.

 On Thu, Feb 25, 2010 at 7:01 PM, Naftoli Gugenheim naftoli...@gmail.com
 wrote:

  Hi, I'd like to get some opinions on the following.
  You may want to read http://reviewboard.liftweb.net/r/158/.
 
  I have on Review Board a patch for some date-and-time parsing and
  formatting configuration. I put the settings inside a singleton object
  called ConversionRules.
  The question is, where do these configurations belong?
  Marius feels that LiftRules is the place where people look for all
  Lift-related configuration. So that the LiftRules code shouldn't become
 too
  monstrous, it makes sense to put the code in ConversionRules and have a
 val
  in LiftRules pointing to ConversionRules.
  My opinion is that LiftRules is, at least for the most part, http-
  (lift-webkit) related, and should be that way. I would actually prefer to
  ConversionRules in lift-util, but it relies on Factory which is in
 webkit.
  Preferably Factory could be moved to lift-util and ConversionRules with
 it.
  Now I suppose pointing LiftRules to ConversionRules is possible even if
 the
  latter is moved to lift-util, so I guess it really boils down to whether
 it
  would be beneficial for ConversionRules to be presented as side by side
  with LiftRules, or as a member of it. (If the latter, I suppose
  ConversionRules could be made private[liftweb] so there's only one path
 to
  it...)
  Thoughts?
  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

Re: [Lift] Re: how to override superUser.dbDisplay_? = false

2010-03-02 Thread Naftoli Gugenheim
As a last resort override toForm on the mapper to not include it.

-
wmmin...@gmail.com wrote:

Then what's the best way to remove this field from the toForm()
generation?

I override fieldOrder:

object User extends User with KeyedMetaMapper[Long, User] {
  // define the order fields will appear in forms and output
  override def fieldOrder = id :: name :: firstName :: lastName ::
email :: password :: Nil
}

but superUser is still there in the form.


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

2010-03-01 Thread Naftoli Gugenheim
When you bind a form, you write functions that handle parts of the form. They 
are stored in memory and when the form is submitted they are executed. They are 
triggered by assigning them a unique id and using it as the form element's 
name. There's no way to preserve the functions to survive a restart. So it may 
be a good idea to warn users in advance about maintenance and that form data 
won't be submitted if the page is loaded before and submitted after.
It would be a nice feature if Lift could somehow detect query params that look 
like they are bound to functions but are not actually, and give the app a 
chance to notify the user that the form was not submitted, if such a thing is 
possible.

-
John Pletkajple...@abraxis.com wrote:

The ProtoExtendedSession looks like it might match what I'm looking for.
With that, they won't have to re-login, right?  We're trying to avoid
multi-page state-full workflows so that is not a problem.  Are you saying if
they have a form up, then submit it (say to update a record), that will
fail?  Will it generate an error that could be caught and nicely handled by
the app?

On a related note, any recommendations about a open-source loadbalancer that
would allow you to take a server offline for new connections, but still
allow the old connections to flow through?

On Mon, Mar 1, 2010 at 5:39 PM, David Pollak
feeder.of.the.be...@gmail.comwrote:



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

2010-03-01 Thread Naftoli Gugenheim
Maybe there could be
case class Or(qps: QueryParam*) extends QueryParam
or something like it? This way ByList could use IN but one can also do OR?

-
awanth...@whitford.com wrote:

I was searching for a prior thread and couldn't find it last night,
but I think I found it today:

http://groups.google.com/group/liftweb/browse_thread/thread/1cf5c0e153e98b47/5b60451a961ad78d?lnk=gstq=ByList#
Is this the thread you are referring to?

It leaves me with much to be desired since the precise issue is
unclear and limited to Postgres.  (It sounds like the author might
have experienced the issue with the IN (select ...) construct which
isn't even the same thing.)

I like James Iry's idea that the final SQL would be dependent on the
database dialect (Driver, I guess).  I know that different vendors
have different limits for the number of elements in an IN clause.  If
we had a limit of 250, for example, but had 300 items, you could
transform it into:

where (a in (1, 2, 3, ..., 250) or a in (251, 252, ..., 300))

That would be clever (and probably necessary if the database vendor
has a relatively small number for the maximum number of IN clause
elements).  I'm pretty sure that Oracle has a limit of 1,000 elements
for an IN clause, and I can't imagine requiring more than that.

For the average case ( 30 items), the IN clause is going to be easier
to read, faster to parse, and likely faster to execute on almost all
database vendors -- that is why I like it.

(I luckily don't have a large data set right now, so this won't bother
me too much.)

-- 
You received this message because you are subscribed to the Google Groups 
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] reload application.properties

2010-03-01 Thread Naftoli Gugenheim
Is a dynamic menu not advantageous for production apps (e.g., a CMS)?
Would changing setSiteMap (if that's what it's called) to take a call by name 
be a bad idea?

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

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.

-- 
You received this message because you are subscribed to the Google Groups 
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 

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

2010-03-01 Thread Naftoli Gugenheim
I think that AbstractMethodError always means either mismatched scala version 
or out of date class file.

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

On Mon, Mar 1, 2010 at 3:39 PM, ojonam manojo10...@gmail.com wrote:
 Hello all,

 I am trying to launch a lift web app on my computer, but trying to use
 Snapshot 2.0 instead of 1.0 (which seems to have some problems with
 Scala 2.7.7).

 I have taken the following steps :

 - 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

 - 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

 when trying to look at the webpage on localhost:8080, I am given the
 following error :

  Request for / failed net.liftweb.http.SessionMaster$.mailbox_
 $eq(Lscala/actors/MessageQueue;)V
 java.lang.AbstractMethodError: net.liftweb.http.SessionMaster$.mailbox_
 $eq(Lscala/actors/MessageQueue;)V
        at scala.actors.Actor$class.$init$(Actor.scala:370)
        at net.liftweb.http.SessionMaster$.init(LiftSession.scala:47)
        at net.liftweb.http.SessionMaster$.clinit(LiftSession.scala)
        at net.liftweb.http.LiftSession.setSession(LiftSession.scala:138)
        at net.liftweb.http.LiftSession$.createSession(LiftSession.scala:34)
        at net.liftweb.http.LiftSession$$anonfun$1.apply(LiftSession.scala:
 36)
        at net.liftweb.http.LiftSession$$anonfun$1.apply(LiftSession.scala:
 36)
        at net.liftweb.http.LiftSession$.apply(LiftSession.scala:39)


 I have not posted the whole stacktrace, but will do so if necessary.
 Googling for this error gives me messages that are very old, and they
 don't apply to me.

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

/Jeppe

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

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



[Lift] Re: [Lift committers] Lots to do by end of day on Sunday **Important for Committers**

2010-02-27 Thread Naftoli Gugenheim
Would anyone be able to change my open tickets to after M3? I don't think I'l 
have a chance to deal with them before code slush. I'm not sure but I think 
they're 257, 258, 370, and 371.
Thanks!

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

Folks,

Code slush for 2.0-M3 is Sunday at midnight.  We've done a lot over the last
3 weeks, but we've still got a lot more to do.  See
https://liftweb.assembla.com/spaces/liftweb/milestones/163151-lift-2-0-m3

If you've got open tickets, please make sure they get code checked in or
that you move them to M4 (except for tickets 238 and 322 which I would
really, really like to see in M3).

If you've got code on the review board and you don't have enough reviews,
please ping the committers list with the reviews.

Please also spend an hour or two over the weekend reviewing other code.

If you've gotten a Ship It, please roll it into master ASAP.

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-committers group.
To post to this group, send email to lift-committ...@googlegroups.com.
To unsubscribe from this group, send email to 
lift-committers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/lift-committers?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] Matching on Mapper fields

2010-02-26 Thread Naftoli Gugenheim
case _ if f eq ... ?

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

Hi,

I would expect the following code to print at most a single line:

 Vehicle.mappedFields.filter(_.dbIncludeInForm_?) foreach {f =
 f match {
   case Vehicle.customCategory = Log.info(Matched on field: +f.name)
   case _ =
 }
   }

But what happens is that the following:

15:57:27.917 [tp-1441471922-0] INFO  lift
   - Matched on field: organizationalUnit
15:57:27.918 [tp-1441471922-0] INFO  lift
   - Matched on field: price
15:57:27.918 [tp-1441471922-0] INFO  lift
   - Matched on field: tax
15:57:27.918 [tp-1441471922-0] INFO  lift
   - Matched on field: customCategory
15:57:27.918 [tp-1441471922-0] INFO  lift
   - Matched on field: vehicleType

I think what happens is that the equals method of MappedField compares
the value of the fields, which is 0 in the above cases. But this
doesn't make much sense when it is really the meta fields that are
being compared.

Is it possible somehow to match on the fields, not the field values?

/Jeppe

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

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



Re: [Lift] Matching on Mapper fields

2010-02-26 Thread Naftoli Gugenheim
Does the field know if it's the meta instance?

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

On Fri, Feb 26, 2010 at 7:05 AM, Jeppe Nejsum Madsen je...@ingolfs.dkwrote:

 Hi,

 I would expect the following code to print at most a single line:

  Vehicle.mappedFields.filter(_.dbIncludeInForm_?) foreach {f =
 f match {
   case Vehicle.customCategory = Log.info(Matched on field: +
 f.name)
   case _ =
 }
   }

 But what happens is that the following:

 15:57:27.917 [tp-1441471922-0] INFO  lift
   - Matched on field: organizationalUnit
 15:57:27.918 [tp-1441471922-0] INFO  lift
   - Matched on field: price
 15:57:27.918 [tp-1441471922-0] INFO  lift
   - Matched on field: tax
 15:57:27.918 [tp-1441471922-0] INFO  lift
   - Matched on field: customCategory
 15:57:27.918 [tp-1441471922-0] INFO  lift
   - Matched on field: vehicleType

 I think what happens is that the equals method of MappedField compares
 the value of the fields, which is 0 in the above cases. But this
 doesn't make much sense when it is really the meta fields that are
 being compared.

 Is it possible somehow to match on the fields, not the field values?


No... sorry.

The equals method for fields allow:

if (model.field == 3) ...

rather than
if (model.field.is == 3) ...

Pattern matching uses the equals method.

The comparison use case is likely to be more common than pattern matching
against the Meta field.  If you can figure out how to get the use case
you're looking for without breaking the primary use case, I'm open to making
them both work.



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

-- 
You received this message because you are subscribed to the Google Groups 
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] scala-time and Lift pom.xml

2010-02-26 Thread Naftoli Gugenheim
java.util.Date.before/after

-
Hanneshannes.flo...@gmx.li wrote:

I swear that I ONLY use it to compare if things are older than other 
things. I think comparison of long values is faster than string or date 
comparison, or?

thanks.

 On Fri, Feb 26, 2010 at 10:52 AM, Hannes hannes.flo...@gmx.li 
 mailto:hannes.flo...@gmx.li wrote:

 THANKS!

 You saved my weekend


 You're welcome.
  On the other hand using a Long as a date terrifies me, and makes 
 me think your weekend, and the next three are all toast... but, maybe 
 not...


  



 On Fri, Feb 26, 2010 at 10:43 AM, Hannes hannes.flo...@gmx.li
 mailto:hannes.flo...@gmx.li wrote:

 Jim,

 Thanks that helped!

 Maybe its to late, or I don't know what, but.

 Its a bit complicated to use I think. What's about
 scala-time? For my purpose, I just need the the time as a
 number (e.g. long). How do I do that?


 java.util.Date will give it to you.
  


 thanks.

 In what fashion do you mean integrate?
 Adding this:
 dependency
 groupIdjoda-time/groupId
 artifactIdjoda-time/artifactId
 version1.6/version

 /dependency
   

  to the dependency section to your maven POM will bring in
 the jar files.

 On Fri, Feb 26, 2010 at 10:14 AM, Hannes
 hannes.flo...@gmx.li mailto:hannes.flo...@gmx.li wrote:

 Hi Peter,

 I read your mail, maybe you can help me. I'm wondering
 how I can integrate JodaTime or scala-time into my project.

 thanks.
 Hannes

 This is more a question for Jorge than anyone else
 but since it's Lift-
 related I thought I'd put it here:

 What's the easiest way to add scala-tools to my Lift
 project's
 pom.xml? My knowledge of Maven is very limited, but
 I hope that it is
 simply a matter of adding another repository and
 dependency.

 Thanks,
 Peter Robinett

 --

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


  


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




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




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

Re: [Lift] The role of LiftRules

2010-02-26 Thread Naftoli Gugenheim
Oh, right--I forgot about per-session and request.
So what do you vote on this, then:
A. ConversionRules is its own singleton, but as a bonus it can also be accessed 
from LiftRules.
B. Same as A but ConversionRules is private[liftweb], so there's only one path.
C. Less redundant: define (a renamed) ConversionRules inside LiftRules
D. Make ConversionRules a class with immutable vals, and LiftRules will have a 
ConversionRules FactoryMaker. We can provide several default ConversionRules 
instances. This makes it easier to have preset configurations switched all at a 
time, which is a very reasonable thing to want to do. (At some point there 
could be a JodaTime instance maybe...) This also allows putting ConversionRules 
in lift-util while still having the benefits of FactoryMaker.
Personally D sounds the best but I'm open to whatever others want.

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

The basic DI (the stuff Factory/FactoryMaker are built on) are located in
util: see Maker.scala

The Factory stuff is in webkit because it relies on session and request
state.  You can change the rules for vending something on a
session-by-session and request-by-request basis.

LiftRules is the single locus of setting webkit rules.  There should be one
and only one.  Before Marius came along and put everything in one place,
webkit was a mess of configuration singletons.  I support his design and
think it has held up well.  People know where to set webkit related stuff.

As much as possible, we try not to allow the stuff in util to have mutable
state/settings.  Why?  Because the stuff in util should always behave the
same way: predictably.

But the date/time stuff transcends webkit... it should be generically useful
across non-webkit applications.

At this point, I think the easiest answer is to put the date/time stuff in
webkit until there's a better answer.  The locus of configuration for webkit
stuff is LiftRules, so the date/time configuration should live there.

On Thu, Feb 25, 2010 at 7:01 PM, Naftoli Gugenheim naftoli...@gmail.comwrote:

 Hi, I'd like to get some opinions on the following.
 You may want to read http://reviewboard.liftweb.net/r/158/.

 I have on Review Board a patch for some date-and-time parsing and
 formatting configuration. I put the settings inside a singleton object
 called ConversionRules.
 The question is, where do these configurations belong?
 Marius feels that LiftRules is the place where people look for all
 Lift-related configuration. So that the LiftRules code shouldn't become too
 monstrous, it makes sense to put the code in ConversionRules and have a val
 in LiftRules pointing to ConversionRules.
 My opinion is that LiftRules is, at least for the most part, http-
 (lift-webkit) related, and should be that way. I would actually prefer to
 ConversionRules in lift-util, but it relies on Factory which is in webkit.
 Preferably Factory could be moved to lift-util and ConversionRules with it.
 Now I suppose pointing LiftRules to ConversionRules is possible even if the
 latter is moved to lift-util, so I guess it really boils down to whether it
 would be beneficial for ConversionRules to be presented as side by side
 with LiftRules, or as a member of it. (If the latter, I suppose
 ConversionRules could be made private[liftweb] so there's only one path to
 it...)
 Thoughts?
 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.

-- 
You received this message because you are subscribed to the Google Groups 
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] The role of LiftRules

2010-02-26 Thread Naftoli Gugenheim
Sounds good!

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

A ConversionRules singleton is the wrong concept.

What you want is:

case class DateHolder(date: JodaTime) {
  implicit def asJt: JodaTime = date
  implicit def asJavaDate: java.util.Date = // convert to Java date here
}

object DateHolder {
  implicit def dateToDH(in: java.util.Date): DateHolder = ...
  implicit def jtToDH(in: JodaTime): DateHolder = new DateHolder(in)
}

trait DateTimeConverter {
  def formatDate(in: DateHolder): String
  def formatTime(in: DateHodler): String
  ...
  def parseDate(in: String): Box[DateHolder]
  def parseTime(in: String): Box[DateHolder]
  ...
}

in util:

object DateTimeConverter {
  def vend(locale: java.util.Locale): DateTimeConverter = build/cache locale
specific converters here
}

So, we've addressed the JodaTime vs. java.util.Date issue.  Next we hook
things up to LiftRules:

LiftRules {
  val dateTimeConverter = new FactoryMaker[DateTimeConverter](() =
DateTimeConverter.vend(S.locale))
}

Make sense?


On Fri, Feb 26, 2010 at 1:54 PM, Naftoli Gugenheim naftoli...@gmail.comwrote:

 Oh, right--I forgot about per-session and request.
 So what do you vote on this, then:
 A. ConversionRules is its own singleton, but as a bonus it can also be
 accessed from LiftRules.
 B. Same as A but ConversionRules is private[liftweb], so there's only one
 path.
 C. Less redundant: define (a renamed) ConversionRules inside LiftRules
 D. Make ConversionRules a class with immutable vals, and LiftRules will
 have a ConversionRules FactoryMaker. We can provide several default
 ConversionRules instances. This makes it easier to have preset
 configurations switched all at a time, which is a very reasonable thing to
 want to do. (At some point there could be a JodaTime instance maybe...) This
 also allows putting ConversionRules in lift-util while still having the
 benefits of FactoryMaker.
 Personally D sounds the best but I'm open to whatever others want.

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

 The basic DI (the stuff Factory/FactoryMaker are built on) are located in
 util: see Maker.scala

 The Factory stuff is in webkit because it relies on session and request
 state.  You can change the rules for vending something on a
 session-by-session and request-by-request basis.

 LiftRules is the single locus of setting webkit rules.  There should be one
 and only one.  Before Marius came along and put everything in one place,
 webkit was a mess of configuration singletons.  I support his design and
 think it has held up well.  People know where to set webkit related stuff.

 As much as possible, we try not to allow the stuff in util to have mutable
 state/settings.  Why?  Because the stuff in util should always behave the
 same way: predictably.

 But the date/time stuff transcends webkit... it should be generically
 useful
 across non-webkit applications.

 At this point, I think the easiest answer is to put the date/time stuff in
 webkit until there's a better answer.  The locus of configuration for
 webkit
 stuff is LiftRules, so the date/time configuration should live there.

 On Thu, Feb 25, 2010 at 7:01 PM, Naftoli Gugenheim naftoli...@gmail.com
 wrote:

  Hi, I'd like to get some opinions on the following.
  You may want to read http://reviewboard.liftweb.net/r/158/.
 
  I have on Review Board a patch for some date-and-time parsing and
  formatting configuration. I put the settings inside a singleton object
  called ConversionRules.
  The question is, where do these configurations belong?
  Marius feels that LiftRules is the place where people look for all
  Lift-related configuration. So that the LiftRules code shouldn't become
 too
  monstrous, it makes sense to put the code in ConversionRules and have a
 val
  in LiftRules pointing to ConversionRules.
  My opinion is that LiftRules is, at least for the most part, http-
  (lift-webkit) related, and should be that way. I would actually prefer to
  ConversionRules in lift-util, but it relies on Factory which is in
 webkit.
  Preferably Factory could be moved to lift-util and ConversionRules with
 it.
  Now I suppose pointing LiftRules to ConversionRules is possible even if
 the
  latter is moved to lift-util, so I guess it really boils down to whether
 it
  would be beneficial for ConversionRules to be presented as side by side
  with LiftRules, or as a member of it. (If the latter, I suppose
  ConversionRules could be made private[liftweb] so there's only one path
 to
  it...)
  Thoughts?
  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
 liftweb%2bunsubscr...@googlegroups.comliftweb%252bunsubscr...@googlegroups.com
 
  .
  For more options

Re: [Lift] Re: Logging, part 2

2010-02-25 Thread Naftoli Gugenheim
Why should an initLogger method be in LiftRules?

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

Then perhaps:

LiftRules.initLogger(Log4J)



On Feb 25, 12:16 pm, Jeppe Nejsum Madsen je...@ingolfs.dk wrote:
 On Thu, Feb 25, 2010 at 10:32 AM, Marius marius.dan...@gmail.com wrote:
  I'd opt in for something like:

  LiftRules.logger = Log4J

 Agree this fits the current idioms, but how should this be triggered?
 The new logging code is in lift-common so cannot call stuff in
 LiftRules.

 Note we're not talking about Loggers (objects that have warn  info
 methods) but about configuring the logging system, which needs to be
 done before Loggers can be used.

 /Jeppe

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

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



Re: [Lift] Re: Logging, part 2

2010-02-25 Thread Naftoli Gugenheim
Wait, I misunderstood something.
What's the difference between logger = X and initLogger(X)?

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

Why not? LiftRules is about configuring a lift app at startup.

On 25 feb., 16:56, Naftoli Gugenheim naftoli...@gmail.com wrote:
 Why should an initLogger method be in LiftRules?

 -

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

 Then perhaps:

 LiftRules.initLogger(Log4J)

 On Feb 25, 12:16 pm, Jeppe Nejsum Madsen je...@ingolfs.dk wrote:

  On Thu, Feb 25, 2010 at 10:32 AM, Marius marius.dan...@gmail.com wrote:
   I'd opt in for something like:

   LiftRules.logger = Log4J

  Agree this fits the current idioms, but how should this be triggered?
  The new logging code is in lift-common so cannot call stuff in
  LiftRules.

  Note we're not talking about Loggers (objects that have warn  info
  methods) but about configuring the logging system, which needs to be
  done before Loggers can be used.

  /Jeppe

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

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

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



[Lift] The role of LiftRules

2010-02-25 Thread Naftoli Gugenheim
Hi, I'd like to get some opinions on the following.
You may want to read http://reviewboard.liftweb.net/r/158/.

I have on Review Board a patch for some date-and-time parsing and formatting
configuration. I put the settings inside a singleton object called
ConversionRules.
The question is, where do these configurations belong?
Marius feels that LiftRules is the place where people look for all
Lift-related configuration. So that the LiftRules code shouldn't become too
monstrous, it makes sense to put the code in ConversionRules and have a val
in LiftRules pointing to ConversionRules.
My opinion is that LiftRules is, at least for the most part, http-
(lift-webkit) related, and should be that way. I would actually prefer to
ConversionRules in lift-util, but it relies on Factory which is in webkit.
Preferably Factory could be moved to lift-util and ConversionRules with it.
Now I suppose pointing LiftRules to ConversionRules is possible even if the
latter is moved to lift-util, so I guess it really boils down to whether it
would be beneficial for ConversionRules to be presented as side by side
with LiftRules, or as a member of it. (If the latter, I suppose
ConversionRules could be made private[liftweb] so there's only one path to
it...)
Thoughts?
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.com.
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en.



Re: [Lift] Reasoning Behind Box

2010-02-25 Thread Naftoli Gugenheim
I'm assuming you know that it has a third, Failure state, and you're asking 
about the names.
I guess open_! is in keeping with the metaphor of a box (or originally, a can). 
The _! is Lift's way of saying, Danger! And I guess 'or' is just shorter. (Lift 
tends to put practicality before academic functionalness etc.)

-
Daniel Spiewakdjspie...@gmail.com wrote:

I'm sure this has been discussed before, but I'm curious as to the
rationale for the Box ADT.  I'm most distressed by the fact that it
seems to be masquerading as a drop-in Option replacement, and yet the
mathematical properties of the ADT are widely divergent.  What's more,
the API is very, very different, leading to a great deal of confusion
whenever I'm working with code which touches both ADTs (as I often
do).  Things like `or` vs `orElse`, `open_!` vs `get` and so on are
very confusing.  The implicit conversion Box[A] = Option[A] doesn't
help either, since it means I can easily forget and use Option methods
on Box values, accidentally triggering a conversion.

The whole `or` vs `orElse` thing is particularly annoying since I
spend a fair amount of time wading through research which discusses
the `orElse` function in its abstract monadic sense.  Given the
standard nature of the name (dating back long before Scala), I'm
surprised that Box went with something else.

I'm sure there are good reasons for all of this, I would just like to
know what they are.  :-)

Daniel

-- 
You received this message because you are subscribed to the Google Groups 
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] Reasoning Behind Box

2010-02-25 Thread Naftoli Gugenheim
Either -- but it's more verbose.
I'm not so sure David will want to rewrite the entire lift anyway...

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

Daniel,

I would like to look at this question from a solution oriented
perspective: Certainly you already noticed the third Box subtype Failure and
are aware of its usage. I agree with you, that Option vs Box is confusing
for Lift (and nowadays Goat Rodeo) adopters. As Scala and Lift are still
very young adoption is vital and hence I would like to know, what you
suggest: How could we only use Option *and* get something like Failure? Any
ideas?

Heiko

On 26 February 2010 05:40, Daniel Spiewak djspie...@gmail.com wrote:

 I'm sure this has been discussed before, but I'm curious as to the
 rationale for the Box ADT.  I'm most distressed by the fact that it
 seems to be masquerading as a drop-in Option replacement, and yet the
 mathematical properties of the ADT are widely divergent.  What's more,
 the API is very, very different, leading to a great deal of confusion
 whenever I'm working with code which touches both ADTs (as I often
 do).  Things like `or` vs `orElse`, `open_!` vs `get` and so on are
 very confusing.  The implicit conversion Box[A] = Option[A] doesn't
 help either, since it means I can easily forget and use Option methods
 on Box values, accidentally triggering a conversion.

 The whole `or` vs `orElse` thing is particularly annoying since I
 spend a fair amount of time wading through research which discusses
 the `orElse` function in its abstract monadic sense.  Given the
 standard nature of the name (dating back long before Scala), I'm
 surprised that Box went with something else.

 I'm sure there are good reasons for all of this, I would just like to
 know what they are.  :-)

 Daniel

 --
 You received this message because you are subscribed to the Google Groups
 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.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] *Minor breaking change* - issue #363

2010-02-24 Thread Naftoli Gugenheim
Lift-anounce? :)

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

Folks,

The ability to specify the JQuery version was changed from:


LiftRules.jQueryVersion = ...

to

LiftRules.jsArtifacts = JQuery14Artifacts // this points to JQuery
1.4.2.

By default this points to JQuery13Artifacts which points to jQuery
1.3.2

Br's,
Marius

-- 
You received this message because you are subscribed to the Google Groups 
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: Liftweb and javascript

2010-02-24 Thread Naftoli Gugenheim
LiftRules.enableLiftGC = false
LiftRules.autoIncludeAjax = _ = false

-
Peter Robinettpe...@bubblefoundry.com wrote:

I believe you just need to turn off a garbage collection setting in
boot.scala but if it's there I assume it's an app-wide setting...

Peter

On Feb 24, 1:46 pm, Cliff Zhao zha...@gmail.com wrote:
 I am new to the Lift framework and currently trying to evaluate it. Canada
 Government web sites need to comply with Government of Canada's Common Look
 and Feel 2.0 standard. One of the requirments ia that the web site needs to
 work with and WITHOUT javascript enabled.

 I tried with one simple form, I didn't use any javascript, while the view
 page source showed that Lift generated some javascript code.

 My question is: Can I turn it off to make the generated page javascript
 free?

 Thanks.

 Best Regards,
 Cliff Zhao

-- 
You received this message because you are subscribed to the Google Groups 
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: LiftRules.jQueryVersion ... :(

2010-02-23 Thread Naftoli Gugenheim
You probably mean case object...
Also, personally I prefer the version without the underscores.

-
Timothy Perretttimo...@getintheloop.eu wrote:

No, sounds good Marius... go for it.

Cheers, Tim

On 23 Feb 2010, at 11:00, Marius wrote:

 I opened this ticket: 
 http://www.assembla.com/spaces/liftweb/tickets/363-liftrules-jqueryversion-should-not-be-there-
 
 I realize that this would bring a slight breaking change but I believe
 it is worth it.
 
 Folks please speak up if you think otherwise.
 
 Br's,
 Marius
 
 On Feb 23, 10:25 am, Marius marius.dan...@gmail.com wrote:
 (yeah forgive me :) ...)
 
 On Feb 23, 10:18 am, Jeppe Nejsum Madsen je...@ingolfs.dk wrote:
 
 
 
 +1 (and we might as well add 1.4.2 as well/instead :-)
 
 On Tue, Feb 23, 2010 at 9:11 AM, Marius marius.dan...@gmail.com wrote:
 Guys,
 
 This has been added not so long ago, and I am aware that I should
 express my perspective on this back then as now it might be too late.
 IMHO LiftRules or other Lift parts except the JsArtifacts and maybe
 ResourceServer should not even be aware of the underlying JS framework
 thus the JQuery  name in LiftRules is very unsound to me.
 
 Here is other proposal of keeping things decoupled:
 
 .
 We currently have JQueryArtifacts which holds the JQuery
 implementation.
 
 We add in the JsArtifacts this:
 
 trait JsArtifacts {
  ...
  def version
 }
 
 then
 
 case class JQueryArtifacts1_3_2 extends JQueryArtifacts  {
  def version = 1.3.2-min
 }
 
 case class JQueryArtifacts1_4_1 extends JQueryArtifacts {
  def version = 1.4.1-min
 }
 
 Then to select one or another we use the existent mechanism:
 
 LiftRules.jsArtifacts = JQueryArtifacts1_3_2 // by default and people
 can change this easily
 
 then in ResourceServer we can easily make the version selection.
 
 In this way LiftRules has no idea about JQuery, YUI etc  and it
 doesn't need to. it is only about feeding different implementations of
 JsArtifact.
 
 Thoughts?
 
 Br's,
 Marius
 
 --
 You received this message because you are subscribed to the Google Groups 
 Lift group.
 To post to this group, send email to lift...@googlegroups.com.
 To unsubscribe from this group, send email to 
 liftweb+unsubscr...@googlegroups.com.
 For more options, visit this group 
 athttp://groups.google.com/group/liftweb?hl=en.
 
 -- 
 You received this message because you are subscribed to the Google Groups 
 Lift group.
 To post to this group, send email to lift...@googlegroups.com.
 To unsubscribe from this group, send email to 
 liftweb+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/liftweb?hl=en.
 
 

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

-- 
You received this message because you are subscribed to the Google Groups 
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] presentation only equivalent of toForm

2010-02-15 Thread Naftoli Gugenheim
asHtml?

2010/2/14 Channing Walton channingwal...@mac.com


 Hi,
 I am using toForm to create forms for crud operations on my mappers, but I
 cannot see an equivalent method for presentation purposes. That is, no form
 elements, just text presented in the same tabular format as the form.

 Is there one ?

 Channing
 --
 View this message in context:
 http://old.nabble.com/presentation-only-equivalent-of-toForm-tp27586473p27586473.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.



-- 
You received this message because you are subscribed to the Google Groups 
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] Error processing SHtml functions withing nested NodeSeq/Scala code

2010-02-15 Thread Naftoli Gugenheim
What does that mean it doesn't return? Can you catch an exception?
Can you show more clearly the line that doesn't work and how it looks to
make it work?

2010/2/15 soumik soum...@gmail.com

 Hi,
  I'm using 1.1-SNAPSHOT lift release and am experiencing strange
 behaviour when trying to output a NodeSeq formed from nested NodeSeq 
 Scala code.

 To highlight the problem let me show you the code I'm trying to
 execute:
 ---
 def listFilesInDir(dirName:String): NodeSeq =
   {
  Log.info(Recursing for:  + dirName)
  val files = (new java.io.File(dirName)).listFiles

  def playFile1() = AAA

  li class=fileElem id=dir{dirName}/li
 ul
 {files.flatMap(f = {
  if (f.isDirectory())
  {
 Log.info(Directory:  + f.toString)
 listFilesInDir(f.toString)
 span/span
  }
  else
  {
 Log.info(Regular file:  + f.getName)
 li class=fileElem id=regfile
  {SHtml.link(, () = playFile1,
 Text(Something)) } /* Problem in this line */
 /li
  }
   }
 )}
 /ul
 ---
 I'm trying to render the output of the above function in a comet
 actor. The problem i see is with the highlighted line of code. When
 the execution reaches this line of code, it gets stuck; the function
 doesn't return and i don't get a NodeSeq to render.
 However, for some reason if I change the highlighted line of code to
 say:
 {f.getName}
 I get the proper NodeSeq which lists all the files in the directory.

 Seems to me that the SHtml class functions are encountering an error
 scenario(frm which its unable to recover). I've tried a couple of
 SHtml functions(a, text, link, submit etc.) all of them show the same
 problem, but if I use some other scala code it executes properly.

 Could anyone look into this and verify whether this is indeed a bug
 with the SHtml functions?

 Thanks,
 Soumik

 --
 You received this message because you are subscribed to the Google Groups
 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.com.
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en.



Re: [Lift] New logging code

2010-02-15 Thread Naftoli Gugenheim
I don't think it's theoretically possible to have the same trait instance
recognize which superclass that it was mixed in to is doing the logging.
Because if A mixes in T, and B extends A and also mixes in T, T is not
really mixed in twice. For the same reason using a type parameter would not
help because any given class can only have one type value.
The closest thing I can think of is using the stack trace to find the method
calling the logging method, and figuring out which trait it comes from. In
other words, not a solution.
If it's important, you may want the logging method to take an implicit
parameter, say of type
case class LoggerName(name: String)
Then your trait can provide a default implicit, but I'm guessing if a
subclass has it's own (say private) implicit val, it would be used.
To determine if this is true, try:
case class N(s: String)
trait T {
  implicit val x = N(t)
  def m(implicit p: N) = println(p)
}
class A extends T {
  private implicit val y = N(a)
  m
}
class B extends A {
  private implicit val z = N(b)
  m
}
new T {}
new A
new B


2010/2/15 Jeppe Nejsum Madsen je...@ingolfs.dk

 On Mon, Feb 15, 2010 at 9:57 PM, Indrajit Raychaudhuri
 indraj...@gmail.com wrote:

 
 http://github.com/dpp/liftweb/blob/add01980aa81875617f38260d710e0558c7ae1b1/framework/lift-base/lift-common/src/main/scala/net/liftweb/common/Logging.scala
 
  One issue remains, which I don't know how to handle (if possible at
  all): The current mixins use the dynamic type of an instance to
  determine the logger name. This may not always be the preferred way.
  E.g:
 
  trait PaymentSystem extends Logger
  trait FullfillmentSystem extends Logger
 
  object MyStore extends PaymentSystem with FullfillmentSystem with Logger
 
  Now everything in the subsystems will be logged with the MyStore
  logger which is not how I would like to see it. The only solution I've
  found so far is to not use the mixins and create private loggers in
  the subsystem, where the static type is known. E.g. val logger =
  Logger(classOf[PaymentSystem])
 
  But this kind of restricts the usage of the mixins. Any thoughts on
  this issue is appreciated
 
  The restriction might be worthwhile in this case for the sake of
  predictability. Having class/object specific logger is to be able to
 filter
  in/out the logs (via configuration) at deployment time. It should not be
 too
  sensitive to minor rearrangement of mixins in the code.
 
  Would it be overcomplicated to make the Logger trait typed?

 Not sure I follow? Logger is already a trait...Or did you mean something
 else?

 Having thought a little more about this, it seems like both solutions
 (mixin and private loggers) has their uses:

  Mixins as convenience for application services that should not be
 subclassed and private loggers for reusable components .

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



Re: [Lift] Re: Cached CSS (and Javascript?) issue

2010-02-15 Thread Naftoli Gugenheim
Is Alex's problem that the browsers update 24 hours later or not at all or
something else?

2010/2/15 Jeppe Nejsum Madsen je...@ingolfs.dk

 On Mon, Feb 15, 2010 at 10:27 PM, Alex Black a...@alexblack.ca wrote:
  We don't seem to have this problem with images..
 
  Could this have to do with the fact that the CSS files and javascript
  are served out of the WAR file, whereas our images are served by a
  separate Jetty context?

 It very well could be.  I just noticed that files served from
 /classpath gets an Expires header 24 hours into the future.

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



Re: [Lift] Custom PreCache in mapper

2010-02-15 Thread Naftoli Gugenheim
Refactor MetaMapper to make it more extensible? :)


2010/2/15 Jeppe Nejsum Madsen je...@ingolfs.dk

 Hi,

 Using PreCache in mapper seems crucial to avoid N+1 select issues and
 works fine for simple FK relationships. I have a model where I need
 something more advanced and would like to avoid doing manual queries:

 1) More than 1 FK level eg.   obj1 - fk1 - fk2
 2) Loading a collection ala OneToMany. ie I select 500 records that
 each have 1-10 members in a collection.

 Has anybody tried stuff like this? Looking at the code in MetaMapper
 it doesn't exactly look like this  area is very extensible. Any hints
 how to proceed? Or is this futile?

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



Re: [Lift] Re: fmapFunc and order of operations

2010-02-15 Thread Naftoli Gugenheim
How would this be used?


2010/2/15 David Pollak feeder.of.the.be...@gmail.com

 If all the SHtml stuff returned a NodeSeq (or Elem) with AnswerHolder and
 AnswerHolder[T] looked like:

 trait AnswerHolder[T] {
   def hasAnswer: Boolean
   def answer: Box[T]
   def map[S](f: T = S): Box[S]
   ...
 }

 Then we could get what you want (no explicit mutability) and keep APIs
 working the way they work now.  What do you think?

 We could even introduce alternative SHtml stuff like:

 def text(original: String): Elem with AnswerHolder[String]

 What do you think?


 On Mon, Jan 25, 2010 at 11:31 AM, Kris Nuttycombe 
 kris.nuttyco...@gmail.com wrote:

 On Mon, Jan 25, 2010 at 12:16 PM, David Pollak
 feeder.of.the.be...@gmail.com wrote:
 
 
  On Mon, Jan 25, 2010 at 11:09 AM, Kris Nuttycombe
  kris.nuttyco...@gmail.com wrote:
 
  On Mon, Jan 25, 2010 at 11:51 AM, Kris Nuttycombe
  kris.nuttyco...@gmail.com wrote:
   On Mon, Jan 25, 2010 at 11:40 AM, David Pollak
   feeder.of.the.be...@gmail.com wrote:
  
  
   On Mon, Jan 25, 2010 at 10:19 AM, Kris Nuttycombe
   kris.nuttyco...@gmail.com wrote:
  
   On Mon, Jan 25, 2010 at 11:07 AM, Marius marius.dan...@gmail.com
   wrote:
S.formFuncName .. should guarantee proper ordering of functions
application respecting the ordering of functions creation (and
 this
is
used by fmapFunc).
   
I'm a bit tired to follow code from this page so could you please
put
together a minimalistic application that I could just try?
   
Br's,
Marius
  
   Thanks, Marius, but I'm too time-crunched at the moment to boil
 this
   down. In any case, I found a solution. My frustration is primarily
   that ordering of function creation matters in the first place;
 making
   the ordering of function creation less relevant is the point of my
   proposal in the other thread. If the order that you do things in
   matters, it completely hoses you for the purposes of composition
 (as I
   painfully found out with this example.) Here, the composition is
 just
   two calls deep and explicit, and even with only that small amount
 of
   composition it was a pain to track down.
  
   Does this make my proposal in the other thread make any more sense
 to
   you?
  
   Ordering is well defined:
  
   The order in which the functions are mapped
   Skewed plus or minus based on value of S.formGroup
  
   There's no way to avoid ordering.  The functions have to be executed
 in
   some
   order.  By default, the stuff in SHtml does this in the order the
   elements
   were defined, but sets S.formGroup to 1 for the submit button (so
 it's
   always the last function executed.)
  
   They have to be executed in some order; I just wish that the
 execution
   could actually be performed by user code! That's the whole point of
 my
   suggestion from the other thread.
  
   More broadly, I think you might want to look at what I did with
 Screen
   and
   Wizard.  These are declarative mechanisms for defining forms,
   validations,
   and behaviors.  Where are these not working for you?
  
   I simply haven't had the time to port thousands of lines of form code
   I've already written over to stuff on SNAPSHOT. I was supposed to
 have
   this stuff released last Friday; my intention was to release on M8
   since I haven't had time to test SNAPSHOT adequately because I've
 been
   hunting down order of evaluation bugs.
  
   Kris
 
  More to the point, I think that with a slight modification in design,
  I wouldn't *have* to think about order of evaluation. The fact that
  it's exposed (and has been, for me, an infuriating source of bugs) is
  a design smell.
 
  But something's going to have to trigger the evaluation of the
 functions.
  If everything is passive, then how does your the form is submitted, now
  start pulling the rest of the form elements in stuff work?
 
  Since we moved to the S.formGroup stuff, other than this thread, there
 has
  not been an issue with form evaluation order, so tossing around design
  smell doesn't necessarily sit well.
 
  Let's go back to what you're trying to accomplish.  I'm not
 understanding
  that at the top level (I haven't read through your Ajax posts, but will
 try
  to get to them today).  What's the delta between what you're trying to
  accomplish and the current state of the Screen/Wizard stuff?

 I think what I'm trying to accomplish is at a somewhat lower level
 than what Screen/Wizard is targeted at. The paste at
 http://paste.pocoo.org/show/169908/ is an example of what I'm trying
 to do, where order of operations has fouled me up. In the before
 example, the function passed in gets evaluated with the correct value
 from the radio button, but since the dateField was inline, it has not
 yet been evaluated at the time of processing of the form that
 contained it.

 It just seems really bad to me that inlining something has different
 behavior than does assigning it to a val and then using the val. This
 is totally nonobvious to me, 

Re: [Lift] Back in the (Goat) Saddle

2010-02-15 Thread Naftoli Gugenheim
From the wiki: Each worker has its own SQL store -- this fills in part of
the picture. :)


On Mon, Feb 15, 2010 at 5:46 PM, David Pollak feeder.of.the.be...@gmail.com
 wrote:



 On Sun, Feb 14, 2010 at 4:37 PM, Naftoli Gugenheim 
 naftoli...@gmail.comwrote:

 Real neat!
 Is it possible to use Goat Rodeo for an offline distributed system?


 Sure.  Goat Rodeo depends on some non-HTTP parts of Lift (although WebKit
 gets pulled in via Mapper, but we need to split out the DB stuff from the
 rest of Mapper as well as some other stuff [shared between Mapper and
 Record] into separate packages... that'll happen after Lift is on 2.8 and we
 have package objects).

 So, you can run Goat Rodeo stand-alone.


 In other words, several systems need to share a common pool of data but
 they are not always connected, so they need to each hold their data locally
 and when they are connected they need to push/pull updates.
 Right now I'm looking at using Symmetric-DS but it's a pretty small,
 tree-like data structure so if there was a more elegant solution for
 synchronization it would be great.
 Thanks!

 2010/2/14 David Pollak feeder.of.the.be...@gmail.com

  Back in June, I started chatting about Goat 
 Rodeohttp://blog.lostlake.org/index.php?/archives/94-Lift,-Goat-Rodeo-and-Such.html:
 a highly scalable mechanism for building distributed applications.  My first
 set of concepts for Goat Rodeo were wrong, most notably trying to do
 distributed Software Transactional Memory.  I've spent the last bunch of
 months revising the concept and code for Goat Rodeo... and today, I'm
 excitied to announce the 0.1 alpha code for Goat 
 Rodeohttp://liftweb.assembla.com/spaces/goat_rodeo/stream
 .

 For more info:
 http://blog.lostlake.org/index.php?/archives/98-Back-in-the-Goat-Saddle.html



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



Re: [Lift] Back in the (Goat) Saddle

2010-02-14 Thread Naftoli Gugenheim
Real neat!
Is it possible to use Goat Rodeo for an offline distributed system? In other
words, several systems need to share a common pool of data but they are not
always connected, so they need to each hold their data locally and when they
are connected they need to push/pull updates.
Right now I'm looking at using Symmetric-DS but it's a pretty small,
tree-like data structure so if there was a more elegant solution for
synchronization it would be great.
Thanks!

2010/2/14 David Pollak feeder.of.the.be...@gmail.com

 Back in June, I started chatting about Goat 
 Rodeohttp://blog.lostlake.org/index.php?/archives/94-Lift,-Goat-Rodeo-and-Such.html:
 a highly scalable mechanism for building distributed applications.  My first
 set of concepts for Goat Rodeo were wrong, most notably trying to do
 distributed Software Transactional Memory.  I've spent the last bunch of
 months revising the concept and code for Goat Rodeo... and today, I'm
 excitied to announce the 0.1 alpha code for Goat 
 Rodeohttp://liftweb.assembla.com/spaces/goat_rodeo/stream
 .

 For more info:
 http://blog.lostlake.org/index.php?/archives/98-Back-in-the-Goat-Saddle.html



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



Re: [Lift] Mapped(Date)(Time) formatter/parser

2010-02-14 Thread Naftoli Gugenheim
Pretty please?

On Fri, Feb 12, 2010 at 2:36 PM, Naftoli Gugenheim naftoli...@gmail.comwrote:

 (FYI: buildSetXXValue methods are called when loading the field from the
 database in MetaMapper.scala. This question is relevant in the context of a
 Mapped(Date)(Time) that corresponds to a database column with a char-based
 type.)

 If the toDate calls in buildSetXXValue are to be replaced with the
 field-customized parser, then the current design of buildSetXXValue would
 require the field-level parser-customize method to take the form

 def parse(s: String): Box[Date]  // no side effect

 rather than something like say

 def fromString(s: String): Unit // set the value

 On the other hand if buildSetXXValue needs to have some more general
 parsing logic then it would be better to have the second syntax.

 Therefore until someone can comment, my current work for Lift is
 effectively frozen midair.


 2010/2/10 Naftoli Gugenheim naftoli...@gmail.com


 - Until now there were two places in Mapped(Date)(Time) where parsing
 occurred. setFromAny used LiftRules.parseDate, while buildSetStringValue
 etc. used TimeHelpers.toDate.
 - Do we need methods like setFromAny and TimeHelpers.toDate, which take
 an Any and pattern match on several types of inputs? Isn't that very
 un-typesafe?
 - Why the inconsistency between setFromAny and buildSetStringValue?
 Should both use ConversionRules? Should both use toDate which should use
 ConversionRules?


 David, it would be great if you could comment on at least these points.
 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.com.
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en.



Re: [Lift] Re: Cached CSS (and Javascript?) issue

2010-02-13 Thread Naftoli Gugenheim
May I suggest that instead of naming the tag 'css,' it be given a name
that's more agnostic of the content it affects and more indicative of what
it does? Technically this could be used for any type of resource.
What about something like
lift:uniqueurl path=url /
Or something else?
Thanks for contributing this!

2010/2/12 Marius marius.dan...@gmail.com



 On 12 feb., 21:31, Jeppe Nejsum Madsen je...@ingolfs.dk wrote:
  On Fri, Feb 12, 2010 at 8:20 PM, Marius marius.dan...@gmail.com wrote:
   Jeppe probably we can combine the two proposals.
 
  Yes, that would be natural
 
   Perhaps something like:
 
   lift:css name=mycss.css, some_other.css. /classpath/baz.css /
 
   thus Lift could generate:
 
   link rel=stylesheet type=text/css href=compound_2434rfe34534.css?
   i784yrfiuhferfhweir57=_/
 
   compound_2434rfe34534.css is a synthetic name that would contain the
   mycss.css, some_other.css. /classpath/baz.css concatenated. Same thing
   for JS. This content could potentially be compressed.
 
  One thing that I think will be important (at some point :-) is to do
  combining of individual tags. If a page is constructed from several
  snippets/widgets, each emitting different js files (think jQuery
  plugins) and css files, these need to be combined somehow. This means
  that each page will get it's own unique synthetic css/js file. This
  probably needs to be configurable in some way :-)

 Yeah that is a slightly different use-case that require more noodling.
 But would worth considering in the future.

 
   I can open a ticket and start looking into this.
 
  Awesome! I'll watch from the sideline!
 
  /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.com.
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en.



Re: [Lift] Binding to a Map

2010-02-12 Thread Naftoli Gugenheim
If you're using fromSeq you don't need toSeq.
And I would appreciate if you don't use such acronyms or vocabulary.

2010/2/10 Nolan Darilek no...@thewordnerd.info

 On 02/10/2010 12:00 PM, Naftoli Gugenheim wrote:

 I mean to wrap the whole flatMap:
 case false =  NodeSeq.fromSeq(user.accounts.flatMap...



 Gotcha. I now have:

case false = NodeSeq.fromSeq(
  user.accounts.flatMap({

case (_, account) = bindAccountFields(in, account, false)
  }).toSeq
)
  }

 and that seems to have done it. I like type safety, but sometimes it's a
 PITA. :)

 Thanks for the help.



 --
 You received this message because you are subscribed to the Google Groups
 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.com.
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en.



Re: [Lift] Mapped(Date)(Time) formatter/parser

2010-02-12 Thread Naftoli Gugenheim
(FYI: buildSetXXValue methods are called when loading the field from the
database in MetaMapper.scala. This question is relevant in the context of a
Mapped(Date)(Time) that corresponds to a database column with a char-based
type.)

If the toDate calls in buildSetXXValue are to be replaced with the
field-customized parser, then the current design of buildSetXXValue would
require the field-level parser-customize method to take the form

def parse(s: String): Box[Date]  // no side effect

rather than something like say

def fromString(s: String): Unit // set the value

On the other hand if buildSetXXValue needs to have some more general parsing
logic then it would be better to have the second syntax.

Therefore until someone can comment, my current work for Lift is effectively
frozen midair.


2010/2/10 Naftoli Gugenheim naftoli...@gmail.com


 - Until now there were two places in Mapped(Date)(Time) where parsing
 occurred. setFromAny used LiftRules.parseDate, while buildSetStringValue
 etc. used TimeHelpers.toDate.
 - Do we need methods like setFromAny and TimeHelpers.toDate, which take an
 Any and pattern match on several types of inputs? Isn't that very
 un-typesafe?
 - Why the inconsistency between setFromAny and buildSetStringValue? Should
 both use ConversionRules? Should both use toDate which should use
 ConversionRules?


 David, it would be great if you could comment on at least these points.
 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.com.
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en.



Re: [Lift] Re: how to set boolean (non-string) value in NodeSeq?

2010-02-11 Thread Naftoli Gugenheim
If you want it false just leave it out.

2010/2/10 wm min...@gmail.com

  Do it XML style:
 
  button disabled=disabled
  /button

 The problem is even after setting disabled= (empty string), it's
 still treated as true; I found it behave as expected only when
 setting it to boolean true/false.

 --
 You received this message because you are subscribed to the Google Groups
 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.com.
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en.



Re: [Lift] Re: Support for page and snippet level localization

2010-02-10 Thread Naftoli Gugenheim
Interesting. What would an example where two pages in the same locale should 
have different values for the same key used by the same snippet?

-
Hugo Palmahugo.m.pa...@gmail.com wrote:

I think a simple inheritance concept would work just fine.
We could have:

application resource bundle (what Lift has now) - page resource bundle -
snippet resource bundle

This would mean that every snippet would inherit the the resource bundle of
the page where it's being rendered. So yes, the same snippet could translate
the same key to a different value depending on the page where it's rendered.

Does that make sense to you ?
In the past i've found such an approach very natural and really useful.

On Wed, Feb 10, 2010 at 06:38, Naftoli Gugenheim naftoli...@gmail.comwrote:

 If the same snippet is used by two pages you would want two separate
 resource bundles to be used for the same snippet?

 -
 Hugo Palmahugo.m.pa...@gmail.com wrote:

 So what you're saying is that a page can include a bunch of snippets and
 that's why it doesn't be an advantage to have page resource bundles ?

 I'm sorry but i don't see why.
 I'm not sure how people are using resource bundles with Lift now but the
 way
 i would do it would be to create a resource bundle for each page that would
 have the properties that are specific to that page and then i would have
 one
 or more bundles with properties that would be used in several
 pages across the application.

 I think this makes sense in large applications because it's just a natural
 way of organizing your translated text.
 I realize this is possible with Lift now, but it has the following
 problems:

 - Even if you separate in bundles the properties are globally available.
 There's no bundle namespace concept. For example, i might want to have
 the
 property page-name with the current page name. And if i'm on the home page
 i
 want it to translate to Home and if i'm on the search page i want it to
 translate to Search. This could be possible with this.

 - I have to register every single resource bundle in
 LiftRules.resourceNames. Although not critical this could easily be replace
 with automatic bindle discovery like i suggested.

 On Tue, Feb 9, 2010 at 17:38, Timothy Perrett timo...@getintheloop.eu
 wrote:

  The analogy would be MVC controllers... the index method has an index
  page and an index resource bundle. Within Lift, we dont use
  controllers, so there is nothing stopping you calling a whole bunch of
  snippets on a single page - thus, there would be no single page
  resource bundle (that is, it wouldn't buy you anything IMHO) as
  different snippets might share localised text or whatever. I guess im
  just trying to say things are not silo'ed in Lift.
 
  Does that add some more clarity to my statement?
 
  Cheers, Tim
 
  On Feb 9, 2:47 pm, Hugo Palma hugo.m.pa...@gmail.com wrote:
   Sorry Tim but i don't quite understand what you mean by page is
   scoped to a single snippet and that invalidates that you have a
   resource bundle per page. Sorry is this is clear to everyone else but
   i'm new with Lift so i'm still grasping basic concepts.
  
   On Feb 8, 10:49 pm, Timothy Perrett timo...@getintheloop.eu wrote:
  
  
  
That wouldn't work for Lift as it assumes a page is scoped to a
 single
  snippet. It works with Tapestry because its an MVC framework.
  
Lift is *not* MVC.
  
Have you seen LiftRules.resourceBundleFactories ?
  
Cheers, Tim
  
On 8 Feb 2010, at 22:11, Hugo Palma wrote:
  
 Lift only support global resource bundles, i think it would be very
 useful if page and snipped level resource bundles were supported.
 For example, if i have a page index it would automatically have
 access to the indexlocale.properties_ bundle. Obviously this
 bundle
 would not be accessible from any other page.
  
 I come from an Apache Tapestry background that has page and
 component
 level localization and it proved very useful.
  
 What do you guys think about this ?
  
 --
 You received this message because you are subscribed to the Google
  Groups 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 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
 liftweb%2bunsubscr...@googlegroups.comliftweb%252bunsubscr...@googlegroups.com
 
  .
  For more options, visit this group at
  http

Re: [Lift] Binding to a Map

2010-02-10 Thread Naftoli Gugenheim
If adding .toSeq or a : NodeSeq type annotation don't trigger the implicit, 
wrap it with NodeSeq.fromSeq(...).
Also, you can do
...flatMap{case (_, account) = bindAccountFields(in, account, false)}

-
Nolan Darilekno...@thewordnerd.info wrote:

I have a Lift app that's managing its own domain objects in a MongoDB. 
At one point I had an object with a list of embedded objects and all 
worked well. My users had many accounts, and I did something like:

   private def bindAccountFields(in:NodeSeq, a:Account, 
isNewAccount:Boolean):NodeSeq = {...}

Then, from my Manage.render snippet:

   user.accounts.isEmpty match {
 case true = pYou have no accounts configured./p
 case false = user.accounts.flatMap(bindAccountFields(in, _, 
false))
   }

I recently wanted to change User.accounts to a Map[String, Account], 
since accounts are named and should have unique names. So I did that, 
and changed the above to:

   user.accounts.isEmpty match {
 case true = pYou have no accounts configured./p
 case false = user.accounts.flatMap((v:Tuple2[String, Account]) 
= bindAccountFields(in, v._2, false))
   }

Except, try though I might, I can't seem to eliminate this error:

[error] 
/home/nolan/Projects/Utterance2/src/main/scala/info/thewordnerd/utterance/snippet/Manage.scala:67:
 
type mismatch;
[error]  found   : Iterable[scala.xml.Node]
[error]  required: scala.xml.NodeSeq
[error] case false = user.accounts.flatMap((v:Tuple2[String, 
Account]) = bindAccountFields(in, v._2, false))
[error] ^
[error] one error found

bindAccountFields hasn't changed at all. I'm just changing the 
collection I iterate over to call it, and the parameter it was passed.

Am I missing something obvious? The whole binding snippets to a 
collection thing seems like magic to me. The getting started guide 
shows it done, but unless I read carelessly, it really doesn't explain 
how binding works in that situation. Are prefixes bound in order such 
that each time I call, say, account.name/ in a form I get the next 
value bound there? Does that hold true such that I can have an 
Account.edit and Account.render snippet, both of which bind to 
account:name/, only the edit snippet binds a text field while the 
render snippet just displays text? So I'd then have to call the snippets 
in the order I've bound them? Obviously that wouldn't be advisable if my 
assumption is true, I'm just trying to understand how this particular 
bit of magic works. :)

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.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] Binding to a Map

2010-02-10 Thread Naftoli Gugenheim
I mean to wrap the whole flatMap:
case false = NodeSeq.fromSeq(user.accounts.flatMap...

-
Nolan Darilekno...@thewordnerd.info wrote:

On 02/10/2010 11:18 AM, Naftoli Gugenheim wrote:
 If adding .toSeq or a : NodeSeq type annotation don't trigger the implicit, 
 wrap it with NodeSeq.fromSeq(...).
 Also, you can do
 ...flatMap{case (_, account) =  bindAccountFields(in, account, false)}



Cool. I made the following changes, but still get the same error:

   user.accounts.isEmpty match {
 case true = pYou have no accounts configured./p
 case false = user.accounts.flatMap({
   case (_, account) = NodeSeq.fromSeq(
 bindAccountFields(in, account, false)
   )
 })
   }

[error] 
/home/nolan/Projects/Utterance2/src/main/scala/info/thewordnerd/utterance/snippet/Manage.scala:67:
 
type mismatch;
[error]  found   : Iterable[scala.xml.Node]
[error]  required: scala.xml.NodeSeq
[error] case false = user.accounts.flatMap({
[error] ^
[error] one error found

Thanks for the partial function tip. I'm starting to learn some of 
Scala's more functional corners and recently read up on those, but 
didn't think to use them there.


-- 
You received this message because you are subscribed to the Google Groups 
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] Mapped(Date)(Time) formatter/parser

2010-02-10 Thread Naftoli Gugenheim
So are you saying to leave buildSetFromString pointing to Helpers.toDate for 
the time being?

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

Naftoli Gugenheim naftoli...@gmail.com writes:

 At what would make sense to move around, i.e., what I should to move #257 and 
 #258 forward.
 Thanks!

I think those look good. In the spirit of incremental progress, I think
any other changes should be on new tickets.

/Jeppe

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

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



Re: [Lift] Deploying Lift app

2010-02-10 Thread Naftoli Gugenheim
What OS is on the server?

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

Mads Hartmann mads...@gmail.com writes:

 Hello everyone

 I can't quite figure out how to deploy my lift app and was hoping one
 of you could point me in the right direction. For  fun i uploaded my
 entire project (uncompiled) to the server and ran mvn jetty:run - this
 worked fine but as soon as i killed my ssh connection the jetty server
 stopped.

 I would be very grateful for a bullet-point explanation of the process
 - I understand you can create a .war file and deploy that but I can't
 seem to figure out how - maybe it's because I'm a bit slow today :)

Assuming you have full control of your server: The container (Jetty)
should be installed on the server and integrated with the server
startup/shutdown cycle.

Then (locally) 

mvn package

to create the war file. Move the war file to the server's app dir (eg
/usr/share/jetty6/webapps)

While a bit dated, here's how you can automate all of these steps
(including bootstrapping the server :-)

http://jeppenejsum.wordpress.com/2009/05/03/ec2-continuous-deployment-hello-world/

/Jeppe

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

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



Re: [Lift] Testing local archetypes?

2010-02-10 Thread Naftoli Gugenheim
Don't understand the question.
mvn test?

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

Quick question:

I'm updating archetypes, how can I test them locally?

/Jeppe

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

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



Re: [Lift] Testing local archetypes?

2010-02-10 Thread Naftoli Gugenheim
I think just mvn install from its directory (or archetypes directory).

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

On Wed, Feb 10, 2010 at 9:21 PM, Naftoli Gugenheim naftoli...@gmail.com wrote:
 Don't understand the question.
 mvn test?

I've modified the archetypes in my local Git repo. How can I create a
new project based on the modified archetypes?

/Jeppe

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

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



Re: [Lift] Mapped(Date)(Time) formatter/parser

2010-02-10 Thread Naftoli Gugenheim
Sorry, type: I was referring to this:

  def buildSetActualValue(accessor: Method, v: AnyRef, columnName: String):
(T, AnyRef) = Unit =
  (inst, v) = doField(inst, accessor, {case f: MappedDate[_] = f.st
(toDate(v))})

  def buildSetLongValue(accessor: Method, columnName: String): (T, Long,
Boolean) = Unit =
  (inst, v, isNull) = doField(inst, accessor, {case f: MappedDate[_] =
f.st(if (isNull) Empty else Full(new Date(v)))})

  def buildSetStringValue(accessor: Method, columnName: String): (T, String)
= Unit =
  (inst, v) = doField(inst, accessor, {case f: MappedDate[_] = f.st
(toDate(v))})

  def buildSetDateValue(accessor: Method, columnName: String): (T, Date) =
Unit =
  (inst, v) = doField(inst, accessor, {case f: MappedDate[_] = f.st
(Full(v))})

  def buildSetBooleanValue(accessor: Method, columnName: String): (T,
Boolean, Boolean) = Unit =
  (inst, v, isNull) = doField(inst, accessor, {case f: MappedDate[_] =
f.st(Empty)})


2010/2/10 Jeppe Nejsum Madsen je...@ingolfs.dk

 On Wed, Feb 10, 2010 at 9:02 PM, Naftoli Gugenheim naftoli...@gmail.com
 wrote:
  So are you saying to leave buildSetFromString pointing to Helpers.toDate
 for the time being?

 I'm not sure I follow? I can't find buildSetFromString (in master)
 anywhere and the setFromAny that covers string seem to call
 ConversionRules?

 To summarize: I think all code in MappedDate/Time should go through
 ConversionRules

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



Re: [Lift] Mapped(Date)(Time) formatter/parser

2010-02-10 Thread Naftoli Gugenheim
In Mapped(Date)(Time)
And 'type' was also a typo. :)

On Wed, Feb 10, 2010 at 5:21 PM, Naftoli Gugenheim naftoli...@gmail.comwrote:

 Sorry, type: I was referring to this:

   def buildSetActualValue(accessor: Method, v: AnyRef, columnName: String):
 (T, AnyRef) = Unit =
   (inst, v) = doField(inst, accessor, {case f: MappedDate[_] = f.st
 (toDate(v))})

   def buildSetLongValue(accessor: Method, columnName: String): (T, Long,
 Boolean) = Unit =
   (inst, v, isNull) = doField(inst, accessor, {case f: MappedDate[_] =
 f.st(if (isNull) Empty else Full(new Date(v)))})

   def buildSetStringValue(accessor: Method, columnName: String): (T,
 String) = Unit =
   (inst, v) = doField(inst, accessor, {case f: MappedDate[_] = f.st
 (toDate(v))})

   def buildSetDateValue(accessor: Method, columnName: String): (T, Date) =
 Unit =
   (inst, v) = doField(inst, accessor, {case f: MappedDate[_] = f.st
 (Full(v))})

   def buildSetBooleanValue(accessor: Method, columnName: String): (T,
 Boolean, Boolean) = Unit =
   (inst, v, isNull) = doField(inst, accessor, {case f: MappedDate[_] =
 f.st(Empty)})


 2010/2/10 Jeppe Nejsum Madsen je...@ingolfs.dk

 On Wed, Feb 10, 2010 at 9:02 PM, Naftoli Gugenheim naftoli...@gmail.com
 wrote:
  So are you saying to leave buildSetFromString pointing to Helpers.toDate
 for the time being?

 I'm not sure I follow? I can't find buildSetFromString (in master)
 anywhere and the setFromAny that covers string seem to call
 ConversionRules?

 To summarize: I think all code in MappedDate/Time should go through
 ConversionRules

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



Re: [Lift] Mapped(Date)(Time) formatter/parser

2010-02-10 Thread Naftoli Gugenheim


 - Until now there were two places in Mapped(Date)(Time) where parsing
 occurred. setFromAny used LiftRules.parseDate, while buildSetStringValue
 etc. used TimeHelpers.toDate.
 - Do we need methods like setFromAny and TimeHelpers.toDate, which take an
 Any and pattern match on several types of inputs? Isn't that very
 un-typesafe?
 - Why the inconsistency between setFromAny and buildSetStringValue? Should
 both use ConversionRules? Should both use toDate which should use
 ConversionRules?


David, it would be great if you could comment on at least these points.
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.com.
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en.



Re: [Lift] Enumeration.Value versus Enumeration#Value

2010-02-10 Thread Naftoli Gugenheim
. means a member of a value.
# means a member of a type.

On Wed, Feb 10, 2010 at 8:32 PM, Strom strommo...@gmail.com wrote:

 What's the difference between Enumeration.Value and Enumeration#Value?

 I'm getting a type mismatch error:
 [INFO]  found   : com.test.States#Value
 [INFO]  required: com.test.States.Value

 When trying to set the Enumeration via a form. Basically, I have a
 mapper object, Address, that has a MappedEnum(this, States) where
 States is my defined enumeration of US states.

 The form method is:
 state - SHtml.selectObj[States.Value](
States.elements.toList.map(v = (v,v.toString)),
  Full(address.state) /*seems to default to first value in
 enum if unassigned*/,
  selected = address.state(selected))

 Thanks,
 Strom

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



Re: [Lift] Welcome javier Goday to the Lift committers

2010-02-09 Thread Naftoli Gugenheim
Welcome!

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

Folks,

Please join me in welcoming Javier Goday to the Lift committers.  Javier
wrote the Lift LDAP module and now that he's a committer, he can make the
LDAP module part of the official Lift distribution (and the crowd goes
wild).

Welcome Javier!!

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.

-- 
You received this message because you are subscribed to the Google Groups 
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] Mapped(Date)(Time) formatter/parser

2010-02-09 Thread Naftoli Gugenheim
Wait--are you saying TimeHelpers should use ConversionRules and ConversionRules 
should *not* reference TimeHelpers?
If so it would involve a lot of refactoring, although I think I hear where 
you're coming from.
I'll try to push the wip-nafg-date branch a bit later. What time zone are you 
in?

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

Naftoli Gugenheim naftoli...@gmail.com writes:

 Any thoughts on this?
 Basically, to restate the questions in a different way.
 - I would like to add overridable methods to MappedDate/Time/DateTime, to 
 allow controlling the way they parse and format strings.
 - Do I need a new 'format' method to controll conversion to a string? Maybe 
 just leverage toString?

I think toString is fine

 - Until now there were two places in Mapped(Date)(Time) where parsing 
 occurred. setFromAny used LiftRules.parseDate, while buildSetStringValue etc. 
 used TimeHelpers.toDate.

Should use same mechanism

 - Do we need methods like setFromAny and TimeHelpers.toDate, which take an 
 Any and pattern match on several types of inputs? Isn't that very un-typesafe?
 - Why the inconsistency between setFromAny and buildSetStringValue? Should 
 both use ConversionRules? Should both use toDate which should use 
 ConversionRules?
 - Should anything in TimeHelpers use ConversionRules? (After all, 
 ConversionRules uses TimeHelpers, and two-way dependencies are probably 
 undesirable.) Should ConversionRules be in util rather than webkit?

I don't know why things are as they are, but going forward, my assumption is
this:

- If I change date/time parsing in ConversionRules, this changes all the
  places where default date/time parsing to/from the UI takes place
- I think this also goes for TimeHelpers. I see this as a higher level
  abstraction (the Helpers) on lower level code (ConversionRules), not
  the other way around
- There can be still be specific date formats (ie internetDate) that is
  being used for API level formatting.

/Jeppe

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



Re: [Lift] Mapped(Date)(Time) formatter/parser

2010-02-09 Thread Naftoli Gugenheim
It would be really great if you could take a look at TimeHelpers and my diff 
(vs. original), on RB and wip-nafg-date.
I asked about your time zone only because I was wondering if you'd be around 
when I pushed it, but it's pushed.


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

Naftoli Gugenheim naftoli...@gmail.com writes:

 Wait--are you saying TimeHelpers should use ConversionRules and
 ConversionRules should *not* reference TimeHelpers?

I think so (without knowing too much about the code :-)

 If so it would involve a lot of refactoring,

In that case, suggest we postpone that bit :-)

 although I think I hear where you're coming from.  I'll try to push
 the wip-nafg-date branch a bit later. What time zone are you in?

CET

/Jeppe

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

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



Re: [Lift] Helpers.bind question

2010-02-09 Thread Naftoli Gugenheim
You have two options: scala.xml.Unparsed(theString), and parsing it explicitly 
into a NodeSeq (see scala.xml.XML or Lift's equivalent which I haven't used but 
believe exists).

-
GAmy_li...@me.com wrote:

What we have here is a iphone native application that has the help screens in 
HTML. The help screens are in multiple languages and are stored in the database.

When the application starts, it checks in the server for updates in the help 
pages calling a particular URL but with different context parameters. The 
downloaded HTML is stored locally in the app to be able to work when the phone 
is offline. The downloaded content has a common template for each language and 
it loads the content from the database.

The help content has been written as HTML in MS Word. It has been already 
formatted there. That is why it is stored altogether in the database. It is not 
a typical lift web site.

If it is not possible to pass the characters unescaped, then we will have to 
create the pages individually loading just the text from the database. It is 
not a big deal and I know it would be cleaner, but I wanted to know if we can 
avoid this change.

Thanks in advance,

GA

On Feb 9, 2010, at 8:31 PM, David Pollak wrote:

 
 
 On Tue, Feb 9, 2010 at 10:00 AM, GA my_li...@me.com wrote:
 Hello guys,
 
 I have a very silly question. I have a snippet that reads a string field from 
 the database and it inserts it within a html page.
 
 So far so good. The text that the snippet reads from the database is a piece 
 of html code. The problem is that the bind method replaces the  and  
 within the string with lt; and gt;. The snippet looks like that:
 
 if (context != ) {
 ContextHelp.findByKey(context.toLong) match {
 case Full(help) = {
 val message = help.contextHelp
 Helpers.bind(b, in, text -  message.toString)
 }
 case _ = Helpers.bind(b, in, text - Context not found)
 }
 } else Helpers.bind(b, in, text - The URL is invalid. )
 
 
 The HTML that calls the snippet looks like this:
 
 lift:LoadHelp.getHelp
   b:text/
 /lift:LoadHelp.getHelp
 
 What should I do to get the html content without changes in the tags?
 
 It is not Helpers.bind() that's transforming the text.  It's the XML 
 libraries that properly XML escape Text() elements when they are converted 
 from XML representation to a byte stream.
 
 In almost every context, this is what you want... you want Strings to be 
 properly escaped.  If that was not the case, there would be tons of cross 
 site scripting issues.
 
 So, what is the type of message in the code above?  Do you really, really, 
 really mean for the String representation of message to be not XML escaped?
  
 
 Thanks in advance,
 
 GA
 
 
 -- 
 You received this message because you are subscribed to the Google Groups 
 Lift group.
 To post to this group, send email to lift...@googlegroups.com.
 To unsubscribe from this group, send email to 
 liftweb+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/liftweb?hl=en.
 
 
 
 -- 
 Lift, the simply functional web framework http://liftweb.net
 Beginning Scala http://www.apress.com/book/view/1430219890
 Follow me: http://twitter.com/dpp
 Surf the harmonics
 
 -- 
 You received this message because you are subscribed to the Google Groups 
 Lift group.
 To post to this group, send email to lift...@googlegroups.com.
 To unsubscribe from this group, send email to 
 liftweb+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/liftweb?hl=en.

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

-- 
You received this message because you are subscribed to the Google Groups 
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] Why not SHtml?

2010-02-09 Thread Naftoli Gugenheim
Could you give me exact instructions what to do to test my code on 2.8?
Thanks.

2010/2/7 David Pollak feeder.of.the.be...@gmail.com



 On Sun, Feb 7, 2010 at 1:01 PM, Naftoli Gugenheim naftoli...@gmail.comwrote:

 So if I get around to it would it indeed be preferable to point it to
 SHtml?


 Changing the code is one of the lowest priorities I could imagine.  I would
 say that closing the stuff you've had on review board for  1 months would
 be much higher priority.  Adding copyright notices and other headers to the
 code you've written in Lift is a higher priority.  Helping to port your code
 to 2.8 would be a higher priority.



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

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

  Hello. Why do Mapper's toForm implementations use S.fmapFunc directly
  rather than using SHtml? Is it not duplicate code?
 

 Because the Mapper code was the earliest Lift code... written long before
 SHtml.


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



Re: [Lift] Why not SHtml?

2010-02-09 Thread Naftoli Gugenheim
Sorry - what's the Windows (eclipse) equivalent--i.e., what does that line do?
Also I wasn't sure what you meant by 'comments around my code.'
Thanks!

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

On Tue, Feb 9, 2010 at 2:28 PM, Naftoli Gugenheim naftoli...@gmail.comwrote:

 Could you give me exact instructions what to do to test my code on 2.8?


git checkout -b 280_port_refresh origin/280_port_refresh
cd framework/lift-persistence/lift-mapper
emacs $(grep -l FIXME: 280 $(find . -name *.scala))

remove the comments around your code.  Make it compile and pass the existing
tests.


 Thanks.

 2010/2/7 David Pollak feeder.of.the.be...@gmail.com



 On Sun, Feb 7, 2010 at 1:01 PM, Naftoli Gugenheim 
 naftoli...@gmail.comwrote:

 So if I get around to it would it indeed be preferable to point it to
 SHtml?


 Changing the code is one of the lowest priorities I could imagine.  I
 would say that closing the stuff you've had on review board for  1 months
 would be much higher priority.  Adding copyright notices and other headers
 to the code you've written in Lift is a higher priority.  Helping to port
 your code to 2.8 would be a higher priority.



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

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

  Hello. Why do Mapper's toForm implementations use S.fmapFunc directly
  rather than using SHtml? Is it not duplicate code?
 

 Because the Mapper code was the earliest Lift code... written long before
 SHtml.


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


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




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

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

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



Re: [Lift] Why not SHtml?

2010-02-09 Thread Naftoli Gugenheim
Never mind, I go your intent. Thanks.

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

On Tue, Feb 9, 2010 at 2:28 PM, Naftoli Gugenheim naftoli...@gmail.comwrote:

 Could you give me exact instructions what to do to test my code on 2.8?


git checkout -b 280_port_refresh origin/280_port_refresh
cd framework/lift-persistence/lift-mapper
emacs $(grep -l FIXME: 280 $(find . -name *.scala))

remove the comments around your code.  Make it compile and pass the existing
tests.


 Thanks.

 2010/2/7 David Pollak feeder.of.the.be...@gmail.com



 On Sun, Feb 7, 2010 at 1:01 PM, Naftoli Gugenheim 
 naftoli...@gmail.comwrote:

 So if I get around to it would it indeed be preferable to point it to
 SHtml?


 Changing the code is one of the lowest priorities I could imagine.  I
 would say that closing the stuff you've had on review board for  1 months
 would be much higher priority.  Adding copyright notices and other headers
 to the code you've written in Lift is a higher priority.  Helping to port
 your code to 2.8 would be a higher priority.



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

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

  Hello. Why do Mapper's toForm implementations use S.fmapFunc directly
  rather than using SHtml? Is it not duplicate code?
 

 Because the Mapper code was the earliest Lift code... written long before
 SHtml.


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


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




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

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

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



Re: [Lift] Why not SHtml?

2010-02-09 Thread Naftoli Gugenheim
Thanks

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

On Tue, Feb 9, 2010 at 2:49 PM, Naftoli Gugenheim naftoli...@gmail.comwrote:

 Sorry - what's the Windows (eclipse) equivalent--i.e., what does that line
 do?


Find all the files that contain FIXME: 280 in the mapper package.


 Also I wasn't sure what you meant by 'comments around my code.'


It will become very obvious when you open the files.  The entire contents
of:
./src/test/scala/net/liftweb/mapper/ManyToManySpecs.scala
./src/main/scala/net/liftweb/mapper/ManyToMany.scala
./src/main/scala/net/liftweb/mapper/OneToMany.scala

Are commented out.


 Thanks!

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

 On Tue, Feb 9, 2010 at 2:28 PM, Naftoli Gugenheim naftoli...@gmail.com
 wrote:

  Could you give me exact instructions what to do to test my code on 2.8?


 git checkout -b 280_port_refresh origin/280_port_refresh
 cd framework/lift-persistence/lift-mapper
 emacs $(grep -l FIXME: 280 $(find . -name *.scala))

 remove the comments around your code.  Make it compile and pass the
 existing
 tests.


  Thanks.
 
  2010/2/7 David Pollak feeder.of.the.be...@gmail.com
 
 
 
  On Sun, Feb 7, 2010 at 1:01 PM, Naftoli Gugenheim naftoli...@gmail.com
 wrote:
 
  So if I get around to it would it indeed be preferable to point it to
  SHtml?
 
 
  Changing the code is one of the lowest priorities I could imagine.  I
  would say that closing the stuff you've had on review board for  1
 months
  would be much higher priority.  Adding copyright notices and other
 headers
  to the code you've written in Lift is a higher priority.  Helping to
 port
  your code to 2.8 would be a higher priority.
 
 
 
  -
  David Pollakfeeder.of.the.be...@gmail.com wrote:
 
  On Sun, Feb 7, 2010 at 12:47 PM, Naftoli Gugenheim 
 naftoli...@gmail.com
  wrote:
 
   Hello. Why do Mapper's toForm implementations use S.fmapFunc directly
   rather than using SHtml? Is it not duplicate code?
  
 
  Because the Mapper code was the earliest Lift code... written long
 before
  SHtml.
 
 
   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
 liftweb%2bunsubscr...@googlegroups.comliftweb%252bunsubscr...@googlegroups.com
 
  liftweb%2bunsubscr...@googlegroups.comliftweb%252bunsubscr...@googlegroups.com
 liftweb%252bunsubscr...@googlegroups.comliftweb%25252bunsubscr...@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
 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.
 
 
 
 
  --
  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
 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

Re: [Lift] Why not SHtml?

2010-02-09 Thread Naftoli Gugenheim
Never mind, apparently I wasn't up to date.

On Tue, Feb 9, 2010 at 11:20 PM, Naftoli Gugenheim naftoli...@gmail.comwrote:

 I got OneToMany to compile (not in a way that would work on 2.7 though).
 Then I tried to push it:
 naft...@naftoli-pc /c/dev/gitrepo/liftweb (280_port_refresh)
 $ git rebase origin/280_port_refresh
 Current branch 280_port_refresh is up to date.

 naft...@naftoli-pc /c/dev/gitrepo/liftweb (280_port_refresh)
 $ git push origin 280_port_refresh
 To g...@github.com:dpp/liftweb.git
  ! [rejected]280_port_refresh - 280_port_refresh (non-fast
 forward)
 error: failed to push some refs to 'g...@github.com:dpp/liftweb.git'

 naft...@naftoli-pc /c/dev/gitrepo/liftweb (280_port_refresh)
 $

 Actually I only did the rebase to be sure, after I had already gotten the
 'non-fast forward' error. What am I doing wrong?

 As far as ManyToMany, I can't work on it because the compiler seems to just
 freeze (using up CPU though). I assume that means there's a compiler bug
 involved.

 Thanks.


 On Tue, Feb 9, 2010 at 5:46 PM, David Pollak 
 feeder.of.the.be...@gmail.com wrote:



 On Tue, Feb 9, 2010 at 2:28 PM, Naftoli Gugenheim 
 naftoli...@gmail.comwrote:

 Could you give me exact instructions what to do to test my code on 2.8?


 git checkout -b 280_port_refresh origin/280_port_refresh
 cd framework/lift-persistence/lift-mapper
 emacs $(grep -l FIXME: 280 $(find . -name *.scala))

 remove the comments around your code.  Make it compile and pass the
 existing tests.


  Thanks.

 2010/2/7 David Pollak feeder.of.the.be...@gmail.com



 On Sun, Feb 7, 2010 at 1:01 PM, Naftoli Gugenheim naftoli...@gmail.com
  wrote:

 So if I get around to it would it indeed be preferable to point it to
 SHtml?


 Changing the code is one of the lowest priorities I could imagine.  I
 would say that closing the stuff you've had on review board for  1 months
 would be much higher priority.  Adding copyright notices and other headers
 to the code you've written in Lift is a higher priority.  Helping to port
 your code to 2.8 would be a higher priority.



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

 On Sun, Feb 7, 2010 at 12:47 PM, Naftoli Gugenheim 
 naftoli...@gmail.comwrote:

  Hello. Why do Mapper's toForm implementations use S.fmapFunc directly
  rather than using SHtml? Is it not duplicate code?
 

 Because the Mapper code was the earliest Lift code... written long
 before
 SHtml.


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

Re: [Lift] Make MenuBuilder generate link for current page

2010-02-09 Thread Naftoli Gugenheim
linkToSelf=true?
(Without getting involved in the different conventions for multiple-word 
attributes :) )

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

On Mon, Feb 8, 2010 at 6:53 AM, Hugo Palma hugo.m.pa...@gmail.com wrote:

 By default the menubuilder snippet doesn't generate a link for the
 current page.
 Can this behavior be changed ?


There's currently no option to override this behavior.  What attribute do
folks think should be added to change this behavior?



 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.

-- 
You received this message because you are subscribed to the Google Groups 
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: Support for page and snippet level localization

2010-02-09 Thread Naftoli Gugenheim
If the same snippet is used by two pages you would want two separate resource 
bundles to be used for the same snippet?

-
Hugo Palmahugo.m.pa...@gmail.com wrote:

So what you're saying is that a page can include a bunch of snippets and
that's why it doesn't be an advantage to have page resource bundles ?

I'm sorry but i don't see why.
I'm not sure how people are using resource bundles with Lift now but the way
i would do it would be to create a resource bundle for each page that would
have the properties that are specific to that page and then i would have one
or more bundles with properties that would be used in several
pages across the application.

I think this makes sense in large applications because it's just a natural
way of organizing your translated text.
I realize this is possible with Lift now, but it has the following problems:

- Even if you separate in bundles the properties are globally available.
There's no bundle namespace concept. For example, i might want to have the
property page-name with the current page name. And if i'm on the home page i
want it to translate to Home and if i'm on the search page i want it to
translate to Search. This could be possible with this.

- I have to register every single resource bundle in
LiftRules.resourceNames. Although not critical this could easily be replace
with automatic bindle discovery like i suggested.

On Tue, Feb 9, 2010 at 17:38, Timothy Perrett timo...@getintheloop.euwrote:

 The analogy would be MVC controllers... the index method has an index
 page and an index resource bundle. Within Lift, we dont use
 controllers, so there is nothing stopping you calling a whole bunch of
 snippets on a single page - thus, there would be no single page
 resource bundle (that is, it wouldn't buy you anything IMHO) as
 different snippets might share localised text or whatever. I guess im
 just trying to say things are not silo'ed in Lift.

 Does that add some more clarity to my statement?

 Cheers, Tim

 On Feb 9, 2:47 pm, Hugo Palma hugo.m.pa...@gmail.com wrote:
  Sorry Tim but i don't quite understand what you mean by page is
  scoped to a single snippet and that invalidates that you have a
  resource bundle per page. Sorry is this is clear to everyone else but
  i'm new with Lift so i'm still grasping basic concepts.
 
  On Feb 8, 10:49 pm, Timothy Perrett timo...@getintheloop.eu wrote:
 
 
 
   That wouldn't work for Lift as it assumes a page is scoped to a single
 snippet. It works with Tapestry because its an MVC framework.
 
   Lift is *not* MVC.
 
   Have you seen LiftRules.resourceBundleFactories ?
 
   Cheers, Tim
 
   On 8 Feb 2010, at 22:11, Hugo Palma wrote:
 
Lift only support global resource bundles, i think it would be very
useful if page and snipped level resource bundles were supported.
For example, if i have a page index it would automatically have
access to the indexlocale.properties_ bundle. Obviously this bundle
would not be accessible from any other page.
 
I come from an Apache Tapestry background that has page and component
level localization and it proved very useful.
 
What do you guys think about this ?
 
--
You received this message because you are subscribed to the Google
 Groups 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.



-- 
You received this message because you are subscribed to the Google Groups 
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: Snippet with no reflection an no massive case statement

2010-02-09 Thread Naftoli Gugenheim
Besides, would it even help? Is the time in obtaining a Method instance rather 
than invoking it?

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

On Tue, Feb 9, 2010 at 9:10 AM, Hugo Palma hugo.m.pa...@gmail.com wrote:

 Why doesn't Lift create the mapping at startup using reflection ?
 It's not using reflection that's the problem, it's using reflection at
 runtime for every single snippet usage.


Why do you care?  The cost of doing a method dispatch via reflection is
about 5x the cost of a doing a method call on an interface with is about 2x
more costly than doing a method call on a class.  The amount of time to do
reflection on the 10 or 20 snippets you may have on a page is unmeasurably
small compared to the cost of rendering the page.



 I may be over simplifying things, but if at startup Lift would go
 through all snippet classes and using reflection found all the methods
 kept all the mappings somewhere in memory i think it could work.
 Is this doable ?


No, it is not possible at start-up time to determine all the classes that
might be snippets.



 On 9 Fev, 17:01, Timothy Perrett timo...@getintheloop.eu wrote:
  So you don't want to write any explicit mapping, and you don't want to
 use reflection??? How would you propose Lift know what your asking for?
 
  Im afraid voodoo is not yet compatible with the JVM ;-)
 
  Cheers, Tim
 
  On 9 Feb 2010, at 16:54, Hugo Palma wrote:
 
 
 
   I just readhttp://wiki.github.com/dpp/liftweb/about-snippetsand i
   have the following question:
 
   So is really the only way to avoid having a reflection call every time
   you use a snippet to use a DispatchSnippet with a case statement for
   every method ?
   It's just that i don't really think that the case is a very clean way
   of doing things. Can be ok for a couple of methods but it can be
   really ugly with more than that.
 
   So, is there any other way ?
   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.

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




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

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

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



Re: [Lift] Re: **IMPORTANT** Lift ticketing system has moved to Assembla

2010-02-08 Thread Naftoli Gugenheim
Every alert message has at its end the link to change your alert settings.

-
Erkki Lindperevill...@gmail.com wrote:

I noticed that Assembla sends a lot of spam (seems I get an e-mail for
everything anyone does in there, including new users registering)

These alerts can be turned off under Stream - Change alert settings
if anyone has trouble finding it.

-- 
You received this message because you are subscribed to the Google Groups 
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.



  1   2   3   4   5   6   7   8   >