[Lift] Re: New features

2009-08-06 Thread David Pollak
There are dependent types that mirror the parameterized types for Mapper,
KeyedMapper, etc.
I've updated ManyToMany to use the dependent types... it should eliminate
the need to have the type parameters.  If it breaks thing, please revert the
changes.

On Thu, Aug 6, 2009 at 9:55 AM, Naftoli Gugenheim wrote:

> In your use case it can only be Long and User. But there has to be a type
> parameter because other people might have a String key and a Request mapper.
> And the contents of ManyToMany have to be type safe to enforce their
> consistency with however the user of ManyToMany wants them to use it. So I
> think what you want is that the compiler should figure out that since you're
> using it with a KeyedMapper[Long, User], which is ManyToMany's T <:
> KeyedMapper[K,T], and ManyToMany extends KeyedMapper[K,T] and it has a self
> type of T, and therefore it would be a compiler error to write anything
> besides Long and User, therefore you must want to use Long and User and they
> should be inferred.
> I could certainly hear that, although I'm not much of a type theorist. So
> feel free to open an enhancement ticket on Scala's Trac! :)
> If I understood correctly...
>
>
> On Thu, Aug 6, 2009 at 12:43 PM, glenn  wrote:
>
>>
>> Naftoli,
>>
>> As I said at the outset, this is really beyond my expertise. But I
>> think it's too
>> broad and maybe, even unnecessary. In my example, K can only be one
>> type,
>> Long, and T can only be of type User. Anything else, and the compiler
>> can't be
>> guaranteed to catch it, but try running the application and you get
>> things like
>> stack overflow errors.
>>
>> How you would fix this is beyond me. All you can really do, at this
>> point, is
>> make sure to include these kinds of restrictions in the docs.
>>
>> Glenn...
>>
>> On Aug 6, 9:33 am, Naftoli Gugenheim  wrote:
>> > It's too broad, or it's too restrictive/unnecessary? I'm confused, you
>> seem
>> > to imply both.If it's too broad, tell me why. But if you want to know
>> why it
>> > needs the type parameter, it's because it has to use the type parameter
>> in
>> > its implentation -- just count how many times its source code uses it!
>> And
>> > if you want to know why the compiler can't infer it or be told to infer
>> > it... that's another issue.
>> > But if passing a type that creates a conflicting inheritance causes a
>> > compiler crash, that's not something I can help. :)
>> > Regards.
>> >
>> > On Thu, Aug 6, 2009 at 12:26 PM, glenn  wrote:
>> >
>> > > Naftoli,
>> >
>> > > At the risk of discussing something obviously beyond my pay grade,
>> > > isn't the real issue Scala traits
>> > > and the use of parameterized types. The ManyToMany trait is defined
>> > > as:
>> >
>> > > trait ManyToMany[K,T<:KeyedMapper[K, T]]
>> >
>> > > But this isn't really correct,is it, the parameter is too broad, and
>> > > that leads to a lot of the confusion and results in the need for
>> > > unnecessary documentation. When you think about it, why all the
>> > > duplication? Why do I need to
>> > > write my User entity as:
>> >
>> > > class User extends MegaProtoUser[User] with ManyToMany[Long,User]
>> >
>> > > when we all know that this would be much cleaner:
>> >
>> > > class User extends MegaProtoUser[User] with ManyToMany.
>> >
>> > > But traits aren't like interfaces. They have implementation and would
>> > > need to know something about
>> > > the parent class they are attached to - and how would you accomplish
>> > > that (reflection, maybe). This is
>> > > more a Scala issue than a Lift one, I think.
>> >
>> > > Glenn...
>> >
>> > > On Aug 5, 8:24 pm, Naftoli Gugenheim  wrote:
>> > > > Building causes a stack overflow?
>> > > > So the question is, is it the resident compiler or plain scalac also
>> > > crashes? Or just the presentation compiler? What do you see in the
>> error log
>> > > view or file?
>> > > > I get compiler crashes very often when doing fancy mapper type
>> related
>> > > tricks.
>> >
>> > > > -
>> >
>> > > > glenn wrote:
>> >
>> > > > Naftoli,
>> >
>> > > > Hate to do this to you, but I'm getting the following error using
>> > > > ManyToMany for Users to Roles:
>> >
>> > > > Message: java.lang.RuntimeException: Broken join
>> > > > scala.Predef$.error(Predef.scala:76)
>> >
>> > > net.liftweb.mapper.ManyToMany$MappedManyToMany$$anonfun$children$1$
>> > > > $anonfun$apply$1.apply(ManyToMany.scala:54)
>> >
>> > > net.liftweb.mapper.ManyToMany$MappedManyToMany$$anonfun$children$1$
>> > > > $anonfun$apply$1.apply(ManyToMany.scala:54)
>> > > > net.liftweb.util.EmptyBox.openOr(Box.scala:372)
>> > > >
>> net.liftweb.mapper.ManyToMany$MappedManyToMany$$anonfun$children
>> > > > $1.apply(ManyToMany.scala:54)
>> > > >
>> net.liftweb.mapper.ManyToMany$MappedManyToMany$$anonfun$children
>> > > > $1.apply(ManyToMany.scala:54)
>> > > > scala.List.map(List.scala:812)
>> > > > net.liftweb.mapper.ManyToMany$MappedManyToMany.children
>> > > > (

[Lift] Re: Custom Login

2009-08-06 Thread David Pollak
I think you could remove the User class/object pair from the app and replace
them with:
object LoginState {
  object primaryKey extends SessionVar[Box[Long]](Empty) // the primary key
of the currently logged in user... change to Box[String] if the PK is a
String
  object currentUser extends
RequestVar[Box[YourUserClass]](primaryKey.is.flatMap(key =>
lookupUser(key)))

  def logUserIn(u: YourUserClass) {
currentUser.remove()
primaryKey.set(Full(u.getPrimaryKey))
  }

  def logUserOut() {
currentUser.remove()
primaryKey.remove()
S.request.foreach(_.request.getSession.invalidate)
  }

  def loggedIn_? = primaryKey.is.isDefined
}

On Thu, Aug 6, 2009 at 8:20 PM, turp1twin  wrote:

>
> I am new to Lift and have a "newbie" question. I have searched the
> group and have not really found an answer to my question. I was hoping
> for some pointers on implementing custom Login logic. I am currently
> looking at the MetaMegaProtoUser code and am trying sort out what I
> will need. I have no need for scaffolding, and am using an existing DB
> with client access through Hibernate/JPA classes. I can sort out the
> DB access, etc., I am just getting a bit overwhelmed trying to figure
> what bits I need to replicate from MetaMegaProtoUser, if any. I know
> it does quite a bit... Anyways, it is probably staring me right in the
> face... and I am just being dense... but any pointers would be
> appreciated! I am loving Scala and am really enjoying learning Lift,
> really cool work guys! Cheers!
>
>
> Jeff
>
> >
>


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

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



[Lift] Re: SiteMap gives "No Navigation Defined."

2009-08-06 Thread David Pollak
Please look at the console output.  If there's a stack trace generated
during the execution of Boot.scala, your app will be in an undefined state
and that may include the lack of a menu and/or title.

On Thu, Aug 6, 2009 at 12:56 PM, pabraham wrote:

>
> Actually, same thing doesn't happen.  If I change the third argument,
> I get this as the title in my browser as well as the link in the site
> map.
>
> On 6 Aug, 20:51, pabraham  wrote:
> > Same thing happens, i.e. I get "No Navigation Defined." and no title.
> >
> > On 6 Aug, 20:38, Naftoli Gugenheim  wrote:
> >
> > > Not sure why you're getting no nav, but I think you want to change the
> other Home - the first string is the id of the link.
> >
> > > -
> >
> > > pabraham wrote:
> >
> > > Hello there,
> >
> > > I've been looking at SiteMap and trying to get it to give me a page
> > > title, based on the SiteMap section in the Lift book (PDF version).
> > > Here's how I've tried.
> >
> > > Boot.scala
> >
> > > // Build SiteMap
> > > val entries = Menu(Loc("Home", "index"::Nil, "Home")) :: Nil
> > > LiftRules.setSiteMap(SiteMap(entries:_*))
> >
> > > default.html
> >
> > > 
> > > ...
> > > 
> > > ...
> > > 
> > > 
> > > ...
> > > 
> >
> > > This works fine, and gives me "Home" as the title of my page.
> >
> > > Now I actually want a different title, so I change the Loc bit to Loc
> > > ("abcdefg", "index"::Nil, "Home") and get "No Navigation Defined."
> >
> > > What am I doing wrong here?
> >
> > > Paul.
>
> >
>


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

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



[Lift] Custom Login

2009-08-06 Thread turp1twin

I am new to Lift and have a "newbie" question. I have searched the
group and have not really found an answer to my question. I was hoping
for some pointers on implementing custom Login logic. I am currently
looking at the MetaMegaProtoUser code and am trying sort out what I
will need. I have no need for scaffolding, and am using an existing DB
with client access through Hibernate/JPA classes. I can sort out the
DB access, etc., I am just getting a bit overwhelmed trying to figure
what bits I need to replicate from MetaMegaProtoUser, if any. I know
it does quite a bit... Anyways, it is probably staring me right in the
face... and I am just being dense... but any pointers would be
appreciated! I am loving Scala and am really enjoying learning Lift,
really cool work guys! Cheers!


Jeff

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



[Lift] Re: Rendering dynamic templates

2009-08-06 Thread David Pollak
First, you can associate a default template with a given Loc in SiteMap view
the Loc.Template mechanism.
Second, you can register a partial function with LiftRules.viewDispatch to
render whatever dynamic content you want.

Third (and this is the recommended solution for a CMS), you can use a
snippet that examines current state and loads the correct template from the
backing store.  You can see an example of this in the wiki code that's in
sites/example.

Also, please remember that Lift snippets are recursive and lazily evaluated.
 This means that the XML returned by a snippet is run through Lift's
transformation process so if your snippet returns , the foo
snippet will be invoked.


On Thu, Aug 6, 2009 at 2:31 PM, fbettag  wrote:

>
> The CMS is my exactly my usecase. I'll try my luck with
> processSurroundAndInclude.
>
> On Aug 6, 11:07 pm, Derek Chen-Becker  wrote:
> > It might be nice to make template loading configurable. Currently,
> > TemplateFinder is used to load templates and it, in turn, uses
> > LiftRules.finder to locate a resource by name from the classloader. I
> think
> > that we could add a layer of indirection there to allow someone to use a
> > partial function to determine where a template is loaded from, and
> provide a
> > default impl that represents the current behavior. I'm thinking something
> > like
> >
> > PartialFunction[(List[String],String),Box[NodeSeq]]
> >
> > One possible use would be for something like a CMS, with the template
> stored
> > in a database. Thoughts?
> >
> > Derek
> >
> > where List[String] is the template path and the second String is the ISO
> > Language code.
> >
> >
> >
> > On Thu, Aug 6, 2009 at 2:12 PM, fbettag  wrote:
> >
> > > Hi there,
> >
> > > i was just wondering how one would go about dynamifying templates?
> > > Atm i store them on disk.
> >
> > > Is there any way to parse a template and execute all the lift:MyStuff
> > > in that template?
> > > Like Xml.load but the way lift does it to render stuff in it.
> >
> > > I tried to find it in code but didn't succeed.
> >
>


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

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



[Lift] Re: Rendering dynamic templates

2009-08-06 Thread fbettag

Yeah, finally i am getting better at finding this stuff out myself ;)

The dirty solution is to create an empty file named "empty.html"
templates-hidden and use this bind:

val res = sess.processSurroundAndInclude(
"empty",
  bind("lift", , 
//XML.loadString(layout.layout),
   "content" -> XML.loadString(content.content)
)
)

XhtmlResponse(res.first, Empty, Nil, Nil, 200, true)


Until we got something "real", this works! :)

On Aug 7, 3:27 am, fbettag  wrote:
> Ok the problem is in src/main/scala/net/liftweb/bultin/snippet/
> Surround.scala line 36:
> #36 ctx.findAndMerge(S.attr.~("with"), paramsMap)
>
> Here is the function which clearly needs a file to work with. u'll do
> the bind by hand.
>
>   private[liftweb] def findAndMerge(templateName: Box[Seq[Node]],
> atWhat: Map[String, NodeSeq]): NodeSeq =
> {
>     val name = templateName.map(s => if (s.text.startsWith("/"))
> s.text else "/"+ s.text).openOr("/templates-hidden/
> default")
>
>     findTemplate(name) match
> {
>       case f@ Failure(msg, be, _) if Props.devMode
> =>
>         failedFind
> (f)
>       case Full(s) => bind(atWhat,
> s)
>       case _ => atWhat.values.flatMap
> (_.elements).toList
>     }
>   }
>
> I will post my solution later.
>
> On Aug 7, 12:49 am, fbettag  wrote:
>
>
>
> > gnaa, i had a caching problem with this one.. the problem is the first
> > argument to processSurroundAndInclude.. still.. ;)
>
> > On Aug 7, 12:47 am, fbettag  wrote:
>
> > >         def render(inContentid: String): LiftResponse = {
> > >                 val content = Content.find(By(Content.id, 
> > > inContentid.toLong)) match
> > > {
> > >                         case Full(obj) => obj
> > >                         case _ => return NotFoundResponse()
> > >                 }
>
> > >                 val layout = Layout.find(By(Layout.id, content.layout)) 
> > > match {
> > >                         case Full(obj) => obj
> > >                         case _ => return NotFoundResponse()
> > >                 }
>
> > >                 val sess = S.session match {
> > >                         case Full(obj: LiftSession) => obj
> > >                         case _ => return InternalServerErrorResponse()
> > >                 }
>
> > >                 val res = sess.processSurroundAndInclude(
> > >                                         layout.layout,
> > >                                           
> > >                                                 
> > > {XML.loadString(content.content)}
> > >                                           
> > >                                 )
>
> > >                 XhtmlResponse(res.first, Empty, Nil, Nil, 200, true)
> > >         }
>
> > > this works very nicely!
>
> > > On Aug 7, 12:18 am, fbettag  wrote:
>
> > > > marius, do you have any idea what i could pass lift:surround's with=""
> > > > attribute?
>
> > > > On Aug 6, 11:31 pm, fbettag  wrote:
>
> > > > > The CMS is my exactly my usecase. I'll try my luck with
> > > > > processSurroundAndInclude.
>
> > > > > On Aug 6, 11:07 pm, Derek Chen-Becker  wrote:
>
> > > > > > It might be nice to make template loading configurable. Currently,
> > > > > > TemplateFinder is used to load templates and it, in turn, uses
> > > > > > LiftRules.finder to locate a resource by name from the classloader. 
> > > > > > I think
> > > > > > that we could add a layer of indirection there to allow someone to 
> > > > > > use a
> > > > > > partial function to determine where a template is loaded from, and 
> > > > > > provide a
> > > > > > default impl that represents the current behavior. I'm thinking 
> > > > > > something
> > > > > > like
>
> > > > > > PartialFunction[(List[String],String),Box[NodeSeq]]
>
> > > > > > One possible use would be for something like a CMS, with the 
> > > > > > template stored
> > > > > > in a database. Thoughts?
>
> > > > > > Derek
>
> > > > > > where List[String] is the template path and the second String is 
> > > > > > the ISO
> > > > > > Language code.
>
> > > > > > On Thu, Aug 6, 2009 at 2:12 PM, fbettag  wrote:
>
> > > > > > > Hi there,
>
> > > > > > > i was just wondering how one would go about dynamifying templates?
> > > > > > > Atm i store them on disk.
>
> > > > > > > Is there any way to parse a template and execute all the 
> > > > > > > lift:MyStuff
> > > > > > > in that template?
> > > > > > > Like Xml.load but the way lift does it to render stuff in it.
>
> > > > > > > I tried to find it in code but didn't succeed.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~---

[Lift] Re: Eclipse setup

2009-08-06 Thread jon

I've found that simply closing all the open files and re-opening fixes
some quirks.

I'm using eclipse 3.5, IAM .10, scala 2.7.5, and javarebel-plugin
1.0.3 with javarebel 2.0.2b

Is anyone else using javarebel with eclipse?  I just run "RunWebApp"
as a scala Application from within eclipse with javarebel.  It works
well when changing non-singletons--  Better than using jetty on a
scanInterval which leaks permgen when it reloads the context.

- Jon

On Aug 6, 6:27 pm, Jonathan A Ferguson  wrote:
> See if the following configuration helps you as it solved most of my  
> problems.
>
>        
> http://blog.spiralarm.com/richard/2009/07/using-existing-scala-maven-...
>
> Cheers
> Jono
>
> On 07/08/2009, at 6:44 AM, Steffen Weißmann wrote:
>
>
>
>
>
> >> You have two output folders: the Scala IDE <= 2.7.5.final only
> >> supports one. Use a single default output folder.
> > That helped somehow, at least in the Boot.scala file it was pretty
> > much ok. But the other files were no better. For instance, clicking on
> > "MetaProtoUser" still opens Object.java source...
>
> >> You also have source directories nested below the top level of your
> >> project. Although I've seen reports that this works from various
> >> people, there's code in 2.7.5.final and earlier which makes this
> >> unlikely. If switching to a single output folder doesn't solve your
> >> problems try also moving your source directories to the top level.
> > I tried to move the scala src folder "src/main/scala" to the project
> > root, but that didn't improve things.
>
> > I really would like to use eclipse, but right now i am using idea
> > (even though I completely agree with David Pollaks blog posts...)
> > since it usually understands the scala source code and it usually
> > displays the lift code (and also other code) properly.
>
> > I guess several people are developing lift projects with eclipse, so I
> > hope there is a chance to get it working. Is there any configuration
> > (Eclipse version+plugin versions+project setup) that is known to work?
>
> >> Both of these issues are fixed on trunk (but don't go there unless
> >> you're using the Lift 2.8.0 branch).
> > Unfortunately it didn't help to avoid these two issues...
>
> >> Let me know how you get on ...
> > Well, I switched to idea for now, and i don't like it. Would it make
> > sense to use the trunk version?
>
> > Cheers, Steffen.
>
> >> Cheers,
>
> >> Miles
>
> >> --
> >> Miles Sabin
> >> tel: +44 (0)7813 944 528
> >> skype:  milessabin
> >>http://www.chuusai.com/
> >>http://twitter.com/milessabin
>
> > --
> > Steffen Weissmann
>
> > Technische Universitaet Berlin - Math. Department - MA 3-2
>
> > Str. des 17. Juni 136
> > 10623 Berlin - Germany
>
> > Phone: +49 30 314-29278
> > Mail: weissm...@math.tu-berlin.de
> > Web:www.math.tu-berlin.de/~weissman
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Rendering dynamic templates

2009-08-06 Thread fbettag

Ok the problem is in src/main/scala/net/liftweb/bultin/snippet/
Surround.scala line 36:
#36 ctx.findAndMerge(S.attr.~("with"), paramsMap)

Here is the function which clearly needs a file to work with. u'll do
the bind by hand.

  private[liftweb] def findAndMerge(templateName: Box[Seq[Node]],
atWhat: Map[String, NodeSeq]): NodeSeq =
{
val name = templateName.map(s => if (s.text.startsWith("/"))
s.text else "/"+ s.text).openOr("/templates-hidden/
default")

findTemplate(name) match
{
  case f@ Failure(msg, be, _) if Props.devMode
=>
failedFind
(f)
  case Full(s) => bind(atWhat,
s)
  case _ => atWhat.values.flatMap
(_.elements).toList
}
  }

I will post my solution later.

On Aug 7, 12:49 am, fbettag  wrote:
> gnaa, i had a caching problem with this one.. the problem is the first
> argument to processSurroundAndInclude.. still.. ;)
>
> On Aug 7, 12:47 am, fbettag  wrote:
>
>
>
> >         def render(inContentid: String): LiftResponse = {
> >                 val content = Content.find(By(Content.id, 
> > inContentid.toLong)) match
> > {
> >                         case Full(obj) => obj
> >                         case _ => return NotFoundResponse()
> >                 }
>
> >                 val layout = Layout.find(By(Layout.id, content.layout)) 
> > match {
> >                         case Full(obj) => obj
> >                         case _ => return NotFoundResponse()
> >                 }
>
> >                 val sess = S.session match {
> >                         case Full(obj: LiftSession) => obj
> >                         case _ => return InternalServerErrorResponse()
> >                 }
>
> >                 val res = sess.processSurroundAndInclude(
> >                                         layout.layout,
> >                                           
> >                                                 
> > {XML.loadString(content.content)}
> >                                           
> >                                 )
>
> >                 XhtmlResponse(res.first, Empty, Nil, Nil, 200, true)
> >         }
>
> > this works very nicely!
>
> > On Aug 7, 12:18 am, fbettag  wrote:
>
> > > marius, do you have any idea what i could pass lift:surround's with=""
> > > attribute?
>
> > > On Aug 6, 11:31 pm, fbettag  wrote:
>
> > > > The CMS is my exactly my usecase. I'll try my luck with
> > > > processSurroundAndInclude.
>
> > > > On Aug 6, 11:07 pm, Derek Chen-Becker  wrote:
>
> > > > > It might be nice to make template loading configurable. Currently,
> > > > > TemplateFinder is used to load templates and it, in turn, uses
> > > > > LiftRules.finder to locate a resource by name from the classloader. I 
> > > > > think
> > > > > that we could add a layer of indirection there to allow someone to 
> > > > > use a
> > > > > partial function to determine where a template is loaded from, and 
> > > > > provide a
> > > > > default impl that represents the current behavior. I'm thinking 
> > > > > something
> > > > > like
>
> > > > > PartialFunction[(List[String],String),Box[NodeSeq]]
>
> > > > > One possible use would be for something like a CMS, with the template 
> > > > > stored
> > > > > in a database. Thoughts?
>
> > > > > Derek
>
> > > > > where List[String] is the template path and the second String is the 
> > > > > ISO
> > > > > Language code.
>
> > > > > On Thu, Aug 6, 2009 at 2:12 PM, fbettag  wrote:
>
> > > > > > Hi there,
>
> > > > > > i was just wondering how one would go about dynamifying templates?
> > > > > > Atm i store them on disk.
>
> > > > > > Is there any way to parse a template and execute all the 
> > > > > > lift:MyStuff
> > > > > > in that template?
> > > > > > Like Xml.load but the way lift does it to render stuff in it.
>
> > > > > > I tried to find it in code but didn't succeed.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: How do I create a function that takes MetaMappers?

2009-08-06 Thread jon

excellent!

thank you both.

- jon

On Aug 6, 3:47 pm, Ross Mellgren  wrote:
> Naftoli's suggestion is good, but I think your problem now is that  
> User is not <: LongKeyedMapper, it's <: KeyedMapper. Here's one that  
> compiles:
>
> object Test {
>      def findAll[T](m: KeyedMetaMapper[_, T]) = m.findAll
>
>      def test {
>          val users: List[User] = findAll(User)
>          users
>      }
>
> }
>
> On Aug 6, 2009, at 3:39 PM, jon wrote:
>
>
>
>
>
> > Thanks Naftoli,
>
> > is this what you mean?
>
> >     def findAll[T <: LongKeyedMapper[T]] (metaObject:
> > LongKeyedMetaMapper[T]): List[T] = {
> >       metaObject.findAll
> >     }
> >     **val users:List[User] = findAll[User](User)
>
> > still get **-> type arguments [com.udorse.lift.model.User] do not
> > conform to method findAll's type parameter bounds [T <:
> > net.liftweb.mapper.LongKeyedMapper[T]]
>
> > On Aug 6, 3:30 pm, Naftoli Gugenheim  wrote:
> >> Pull M out as a type parameter and just declare the value parameter  
> >> to be whatever M means.
>
> >> -
>
> >> Ross Mellgren wrote:
>
> >> What complaint does the compiler have?
>
> >> -Ross
>
> >> On Aug 6, 2009, at 2:06 PM, jon wrote:
>
> >>> I'd like to do something like
>
> >>>     def findAll[T <: LongKeyedMapper[T],M <: LongKeyedMetaMapper[T]]
> >>> (metaObject: M): List[T] = {
> >>>       metaObject.findAll
> >>>     }
>
> >>>     val users:List[User] = findAll(User)
> >>>     val foos:List[Foo] = findAll(Foo)
>
> >>> But the compiler won't have it.

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



[Lift] Re: SOAP web services?

2009-08-06 Thread Timothy Perrett


Myself and Viktor are two committers who do a lot of SOAP work - right now,
the best route forward it to use the Java JAX-WS code and call into it with
a scala wrapper - this is exactly what I do and it works perfectly.

Because there is toll free calling of Java code, there is little point in
porting such massive projects to Scala; just make a wrapper that suits your
needs. 

In my environment I have about 40+ endpoints, with hundreds of methods so I
just made a scala wrapper that lets me do:

DriverManager.whateverdriver.myMethod(params) // Box[T]

IMO, that's a damn lot easier than calling a boat load of Java (of course
its doing the under the hood, but like I said, its just a wrapper).

HTH

Cheers, Tim

On 06/08/2009 16:26, "Jacek Furmankiewicz"  wrote:

> 
> I was reading through the Lift book PDF and it mentions only REST-
> style web services.
> 
> In our case, we need to look at re-implementing a set of existing SOAP
> web services (is there anything like 'wsdl2scala' anywhere?).
> 
> I would appreciate any best practices and suggestions for implementing
> SOAP web services in the context of a larger Lift app (and Scala in
> general).
> 
> > 
> 



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



[Lift] Re: amqp library error

2009-08-06 Thread Timothy Perrett


I wrote a fairly extensive blog about how to use the AMQP module - please
take a read of it and watch the video:  http://is.gd/CkPX - my example is
also not a webapp, so its just what you want!

The source code is also available which should help you.

Cheers, Tim

On 06/08/2009 23:55, "ph"  wrote:

> 
> I'm trying to use lift-amqp library, so I created a maven test project
> (not Lift one, but just Scala with dependency to lift).
> I'm using Eclipse with maven-scala-plugin on Windows.
> 
> I'm using almost exact copy of ExampleStringAMQPSender and
> ExampleStringAMQPListener. And it behaves very weird:
> compiling and running from maven (mvn scala:run ...) and jar (java -
> jar ...) gives runtime error:
> Exception in thread "main" java.lang.reflect.InvocationTargetException
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
> Source)
> at java.lang.reflect.Method.invoke(Unknown Source)
> at com.simontuffs.onejar.Boot.run(Boot.java:306)
> at com.simontuffs.onejar.Boot.main(Boot.java:159)
> Caused by: java.lang.VerifyError: (class: net/liftweb/amqp/
> AMQPDispatcher, method: loop signature: (
> Lscala/List;)V) Can only throw Throwable objects
> at s38.plm.amqp.listener.(connection.scala:35)
> at s38.plm.amqp.App$.(App.scala:10)
> at s38.plm.amqp.App$.(App.scala)
> at s38.plm.amqp.App.main(App.scala)
> ... 6 more
> 
> 
> Running from Eclipse as Scala application works.
> Currently I'm using lift version 1.1-M4, but same was with lift 1.0.
> 
> 
> Any thoughts?
> 
> > 
> 



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



[Lift] amqp library error

2009-08-06 Thread ph

I'm trying to use lift-amqp library, so I created a maven test project
(not Lift one, but just Scala with dependency to lift).
I'm using Eclipse with maven-scala-plugin on Windows.

I'm using almost exact copy of ExampleStringAMQPSender and
ExampleStringAMQPListener. And it behaves very weird:
compiling and running from maven (mvn scala:run ...) and jar (java -
jar ...) gives runtime error:
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.simontuffs.onejar.Boot.run(Boot.java:306)
at com.simontuffs.onejar.Boot.main(Boot.java:159)
Caused by: java.lang.VerifyError: (class: net/liftweb/amqp/
AMQPDispatcher, method: loop signature: (
Lscala/List;)V) Can only throw Throwable objects
at s38.plm.amqp.listener.(connection.scala:35)
at s38.plm.amqp.App$.(App.scala:10)
at s38.plm.amqp.App$.(App.scala)
at s38.plm.amqp.App.main(App.scala)
... 6 more


Running from Eclipse as Scala application works.
Currently I'm using lift version 1.1-M4, but same was with lift 1.0.


Any thoughts?

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



[Lift] Re: Rendering dynamic templates

2009-08-06 Thread fbettag

gnaa, i had a caching problem with this one.. the problem is the first
argument to processSurroundAndInclude.. still.. ;)

On Aug 7, 12:47 am, fbettag  wrote:
>         def render(inContentid: String): LiftResponse = {
>                 val content = Content.find(By(Content.id, 
> inContentid.toLong)) match
> {
>                         case Full(obj) => obj
>                         case _ => return NotFoundResponse()
>                 }
>
>                 val layout = Layout.find(By(Layout.id, content.layout)) match 
> {
>                         case Full(obj) => obj
>                         case _ => return NotFoundResponse()
>                 }
>
>                 val sess = S.session match {
>                         case Full(obj: LiftSession) => obj
>                         case _ => return InternalServerErrorResponse()
>                 }
>
>                 val res = sess.processSurroundAndInclude(
>                                         layout.layout,
>                                           
>                                                 
> {XML.loadString(content.content)}
>                                           
>                                 )
>
>                 XhtmlResponse(res.first, Empty, Nil, Nil, 200, true)
>         }
>
> this works very nicely!
>
> On Aug 7, 12:18 am, fbettag  wrote:
>
>
>
> > marius, do you have any idea what i could pass lift:surround's with=""
> > attribute?
>
> > On Aug 6, 11:31 pm, fbettag  wrote:
>
> > > The CMS is my exactly my usecase. I'll try my luck with
> > > processSurroundAndInclude.
>
> > > On Aug 6, 11:07 pm, Derek Chen-Becker  wrote:
>
> > > > It might be nice to make template loading configurable. Currently,
> > > > TemplateFinder is used to load templates and it, in turn, uses
> > > > LiftRules.finder to locate a resource by name from the classloader. I 
> > > > think
> > > > that we could add a layer of indirection there to allow someone to use a
> > > > partial function to determine where a template is loaded from, and 
> > > > provide a
> > > > default impl that represents the current behavior. I'm thinking 
> > > > something
> > > > like
>
> > > > PartialFunction[(List[String],String),Box[NodeSeq]]
>
> > > > One possible use would be for something like a CMS, with the template 
> > > > stored
> > > > in a database. Thoughts?
>
> > > > Derek
>
> > > > where List[String] is the template path and the second String is the ISO
> > > > Language code.
>
> > > > On Thu, Aug 6, 2009 at 2:12 PM, fbettag  wrote:
>
> > > > > Hi there,
>
> > > > > i was just wondering how one would go about dynamifying templates?
> > > > > Atm i store them on disk.
>
> > > > > Is there any way to parse a template and execute all the lift:MyStuff
> > > > > in that template?
> > > > > Like Xml.load but the way lift does it to render stuff in it.
>
> > > > > I tried to find it in code but didn't succeed.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Rendering dynamic templates

2009-08-06 Thread fbettag

def render(inContentid: String): LiftResponse = {
val content = Content.find(By(Content.id, inContentid.toLong)) 
match
{
case Full(obj) => obj
case _ => return NotFoundResponse()
}

val layout = Layout.find(By(Layout.id, content.layout)) match {
case Full(obj) => obj
case _ => return NotFoundResponse()
}

val sess = S.session match {
case Full(obj: LiftSession) => obj
case _ => return InternalServerErrorResponse()
}

val res = sess.processSurroundAndInclude(
layout.layout,
  

{XML.loadString(content.content)}
  
)

XhtmlResponse(res.first, Empty, Nil, Nil, 200, true)
}


this works very nicely!


On Aug 7, 12:18 am, fbettag  wrote:
> marius, do you have any idea what i could pass lift:surround's with=""
> attribute?
>
> On Aug 6, 11:31 pm, fbettag  wrote:
>
>
>
> > The CMS is my exactly my usecase. I'll try my luck with
> > processSurroundAndInclude.
>
> > On Aug 6, 11:07 pm, Derek Chen-Becker  wrote:
>
> > > It might be nice to make template loading configurable. Currently,
> > > TemplateFinder is used to load templates and it, in turn, uses
> > > LiftRules.finder to locate a resource by name from the classloader. I 
> > > think
> > > that we could add a layer of indirection there to allow someone to use a
> > > partial function to determine where a template is loaded from, and 
> > > provide a
> > > default impl that represents the current behavior. I'm thinking something
> > > like
>
> > > PartialFunction[(List[String],String),Box[NodeSeq]]
>
> > > One possible use would be for something like a CMS, with the template 
> > > stored
> > > in a database. Thoughts?
>
> > > Derek
>
> > > where List[String] is the template path and the second String is the ISO
> > > Language code.
>
> > > On Thu, Aug 6, 2009 at 2:12 PM, fbettag  wrote:
>
> > > > Hi there,
>
> > > > i was just wondering how one would go about dynamifying templates?
> > > > Atm i store them on disk.
>
> > > > Is there any way to parse a template and execute all the lift:MyStuff
> > > > in that template?
> > > > Like Xml.load but the way lift does it to render stuff in it.
>
> > > > I tried to find it in code but didn't succeed.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Eclipse setup

2009-08-06 Thread Jonathan A Ferguson

See if the following configuration helps you as it solved most of my  
problems.


http://blog.spiralarm.com/richard/2009/07/using-existing-scala-maven-project-in.html


Cheers
Jono


On 07/08/2009, at 6:44 AM, Steffen Weißmann wrote:

>
>> You have two output folders: the Scala IDE <= 2.7.5.final only
>> supports one. Use a single default output folder.
> That helped somehow, at least in the Boot.scala file it was pretty
> much ok. But the other files were no better. For instance, clicking on
> "MetaProtoUser" still opens Object.java source...
>
>> You also have source directories nested below the top level of your
>> project. Although I've seen reports that this works from various
>> people, there's code in 2.7.5.final and earlier which makes this
>> unlikely. If switching to a single output folder doesn't solve your
>> problems try also moving your source directories to the top level.
> I tried to move the scala src folder "src/main/scala" to the project
> root, but that didn't improve things.
>
> I really would like to use eclipse, but right now i am using idea
> (even though I completely agree with David Pollaks blog posts...)
> since it usually understands the scala source code and it usually
> displays the lift code (and also other code) properly.
>
> I guess several people are developing lift projects with eclipse, so I
> hope there is a chance to get it working. Is there any configuration
> (Eclipse version+plugin versions+project setup) that is known to work?
>
>> Both of these issues are fixed on trunk (but don't go there unless
>> you're using the Lift 2.8.0 branch).
> Unfortunately it didn't help to avoid these two issues...
>
>> Let me know how you get on ...
> Well, I switched to idea for now, and i don't like it. Would it make
> sense to use the trunk version?
>
> Cheers, Steffen.
>
>>
>> Cheers,
>>
>>
>> Miles
>>
>> --
>> Miles Sabin
>> tel: +44 (0)7813 944 528
>> skype:  milessabin
>> http://www.chuusai.com/
>> http://twitter.com/milessabin
>>
>>>
>>
>
>
>
> -- 
> Steffen Weissmann
>
> Technische Universitaet Berlin - Math. Department - MA 3-2
>
> Str. des 17. Juni 136
> 10623 Berlin - Germany
>
> Phone: +49 30 314-29278
> Mail: weissm...@math.tu-berlin.de
> Web: www.math.tu-berlin.de/~weissman
>
> >


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



[Lift] Re: Rendering dynamic templates

2009-08-06 Thread fbettag

marius, do you have any idea what i could pass lift:surround's with=""
attribute?

On Aug 6, 11:31 pm, fbettag  wrote:
> The CMS is my exactly my usecase. I'll try my luck with
> processSurroundAndInclude.
>
> On Aug 6, 11:07 pm, Derek Chen-Becker  wrote:
>
>
>
> > It might be nice to make template loading configurable. Currently,
> > TemplateFinder is used to load templates and it, in turn, uses
> > LiftRules.finder to locate a resource by name from the classloader. I think
> > that we could add a layer of indirection there to allow someone to use a
> > partial function to determine where a template is loaded from, and provide a
> > default impl that represents the current behavior. I'm thinking something
> > like
>
> > PartialFunction[(List[String],String),Box[NodeSeq]]
>
> > One possible use would be for something like a CMS, with the template stored
> > in a database. Thoughts?
>
> > Derek
>
> > where List[String] is the template path and the second String is the ISO
> > Language code.
>
> > On Thu, Aug 6, 2009 at 2:12 PM, fbettag  wrote:
>
> > > Hi there,
>
> > > i was just wondering how one would go about dynamifying templates?
> > > Atm i store them on disk.
>
> > > Is there any way to parse a template and execute all the lift:MyStuff
> > > in that template?
> > > Like Xml.load but the way lift does it to render stuff in it.
>
> > > I tried to find it in code but didn't succeed.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: StatefulSnippet link and functionMap

2009-08-06 Thread Naftoli Gugenheim

No, because links have associated functions.

-
glenn wrote:


I have a stateful snippet with multiple StatefulSnippet links in the
bind helper. Clicking on each link gives me a
403 error. I noticed that the function map for each link is different.
Shouldn't they be the same, since I'm trying to reload the same page
as the one the link is on?

Glenn...


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



[Lift] StatefulSnippet link and functionMap

2009-08-06 Thread glenn

I have a stateful snippet with multiple StatefulSnippet links in the
bind helper. Clicking on each link gives me a
403 error. I noticed that the function map for each link is different.
Shouldn't they be the same, since I'm trying to reload the same page
as the one the link is on?

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



[Lift] Re: Rendering dynamic templates

2009-08-06 Thread fbettag

The CMS is my exactly my usecase. I'll try my luck with
processSurroundAndInclude.

On Aug 6, 11:07 pm, Derek Chen-Becker  wrote:
> It might be nice to make template loading configurable. Currently,
> TemplateFinder is used to load templates and it, in turn, uses
> LiftRules.finder to locate a resource by name from the classloader. I think
> that we could add a layer of indirection there to allow someone to use a
> partial function to determine where a template is loaded from, and provide a
> default impl that represents the current behavior. I'm thinking something
> like
>
> PartialFunction[(List[String],String),Box[NodeSeq]]
>
> One possible use would be for something like a CMS, with the template stored
> in a database. Thoughts?
>
> Derek
>
> where List[String] is the template path and the second String is the ISO
> Language code.
>
>
>
> On Thu, Aug 6, 2009 at 2:12 PM, fbettag  wrote:
>
> > Hi there,
>
> > i was just wondering how one would go about dynamifying templates?
> > Atm i store them on disk.
>
> > Is there any way to parse a template and execute all the lift:MyStuff
> > in that template?
> > Like Xml.load but the way lift does it to render stuff in it.
>
> > I tried to find it in code but didn't succeed.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Rendering dynamic templates

2009-08-06 Thread Derek Chen-Becker
It might be nice to make template loading configurable. Currently,
TemplateFinder is used to load templates and it, in turn, uses
LiftRules.finder to locate a resource by name from the classloader. I think
that we could add a layer of indirection there to allow someone to use a
partial function to determine where a template is loaded from, and provide a
default impl that represents the current behavior. I'm thinking something
like

PartialFunction[(List[String],String),Box[NodeSeq]]

One possible use would be for something like a CMS, with the template stored
in a database. Thoughts?

Derek

where List[String] is the template path and the second String is the ISO
Language code.

On Thu, Aug 6, 2009 at 2:12 PM, fbettag  wrote:

>
> Hi there,
>
> i was just wondering how one would go about dynamifying templates?
> Atm i store them on disk.
>
> Is there any way to parse a template and execute all the lift:MyStuff
> in that template?
> Like Xml.load but the way lift does it to render stuff in it.
>
> I tried to find it in code but didn't succeed.
> >
>

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



[Lift] Re: SiteMap gives "No Navigation Defined."

2009-08-06 Thread Derek Chen-Becker
So it's working correctly, or it's still broken? "same thing doesn't happen"
is a bit unclear ;)

Derek

On Thu, Aug 6, 2009 at 1:56 PM, pabraham wrote:

>
> Actually, same thing doesn't happen.  If I change the third argument,
> I get this as the title in my browser as well as the link in the site
> map.
>
> On 6 Aug, 20:51, pabraham  wrote:
> > Same thing happens, i.e. I get "No Navigation Defined." and no title.
> >
> > On 6 Aug, 20:38, Naftoli Gugenheim  wrote:
> >
> > > Not sure why you're getting no nav, but I think you want to change the
> other Home - the first string is the id of the link.
> >
> > > -
> >
> > > pabraham wrote:
> >
> > > Hello there,
> >
> > > I've been looking at SiteMap and trying to get it to give me a page
> > > title, based on the SiteMap section in the Lift book (PDF version).
> > > Here's how I've tried.
> >
> > > Boot.scala
> >
> > > // Build SiteMap
> > > val entries = Menu(Loc("Home", "index"::Nil, "Home")) :: Nil
> > > LiftRules.setSiteMap(SiteMap(entries:_*))
> >
> > > default.html
> >
> > > 
> > > ...
> > > 
> > > ...
> > > 
> > > 
> > > ...
> > > 
> >
> > > This works fine, and gives me "Home" as the title of my page.
> >
> > > Now I actually want a different title, so I change the Loc bit to Loc
> > > ("abcdefg", "index"::Nil, "Home") and get "No Navigation Defined."
> >
> > > What am I doing wrong here?
> >
> > > Paul.
>
> >
>

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



[Lift] Re: Eclipse setup

2009-08-06 Thread Miles Sabin

On Thu, Aug 6, 2009 at 9:44 PM, Steffen
Weißmann wrote:
> I guess several people are developing lift projects with eclipse, so I
> hope there is a chance to get it working. Is there any configuration
> (Eclipse version+plugin versions+project setup) that is known to work?

There are these documents,

  http://lampsvn.epfl.ch/trac/scala/wiki/ScalaEclipseMaven
  http://lampsvn.epfl.ch/trac/scala/wiki/ScalaEclipseLift

which have been contributed by Lift/Eclipse users. I can't vouch for
their accuracy or completeness I'm afraid.

Cheers,


Miles

-- 
Miles Sabin
tel: +44 (0)7813 944 528
skype:  milessabin
http://www.chuusai.com/
http://twitter.com/milessabin

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



[Lift] Re: Db.addLogFunc

2009-08-06 Thread Derek Chen-Becker
If there's a consensus that we want our own JDBC wrappers I'll go ahead and
write them.

Derek

On Thu, Aug 6, 2009 at 1:19 PM, marius d.  wrote:

>
> Probably building our own wrappers would be more lightweight then 3-rd
> party. Jus' guessing
>
> Br's,
> Marius
>
> On Aug 6, 9:58 pm, Derek Chen-Becker  wrote:
> > Well, I started looking at it and determined that the only way for us to
> > truly log the queries would be to essentially make our own wrappers over
> > Statement and PreparedStatement. There are projects (log4jdbc, notably)
> that
> > already do this, and in a transparent manner. I'm not sure that adding a
> > whole bunch of SQL logging directly to Lift is better than leveraging
> some
> > existing libraries to do it.
> >
> > Derek
> >
> > On Thu, Aug 6, 2009 at 11:03 AM, marius d. 
> wrote:
> >
> > > Yeah we're aware of that. That is based on toString application which
> > > is JDBC driver dependent. I think Derek started some work on this to
> > > correct this behavior. Derek ?
> >
> > > Br's,
> > > Marius
> >
> > > On Aug 6, 8:01 pm, jon  wrote:
> > > > Hi,
> >
> > > > I have the following in boot:
> > > >   DB.addLogFunc((query, len) => Log.info("The query: "+query+" took
> > > > "+len+" milliseconds"))
> >
> > > > I was expecting the query parameter to be sql, but it's actually some
> > > > sort of guid
> >
> > > > "INFO - The query: 6839c016-0122-f09a-9c96-003844e8 took 5
> > > > milliseconds"
> >
> > > > Any ideas?
> > > > I'm running with derby.
> >
> > > > Thanks,
> >
> > > > Jon
> >
>

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



[Lift] Re: Eclipse setup

2009-08-06 Thread Steffen Weißmann

> You have two output folders: the Scala IDE <= 2.7.5.final only
> supports one. Use a single default output folder.
That helped somehow, at least in the Boot.scala file it was pretty
much ok. But the other files were no better. For instance, clicking on
"MetaProtoUser" still opens Object.java source...

> You also have source directories nested below the top level of your
> project. Although I've seen reports that this works from various
> people, there's code in 2.7.5.final and earlier which makes this
> unlikely. If switching to a single output folder doesn't solve your
> problems try also moving your source directories to the top level.
I tried to move the scala src folder "src/main/scala" to the project
root, but that didn't improve things.

I really would like to use eclipse, but right now i am using idea
(even though I completely agree with David Pollaks blog posts...)
since it usually understands the scala source code and it usually
displays the lift code (and also other code) properly.

I guess several people are developing lift projects with eclipse, so I
hope there is a chance to get it working. Is there any configuration
(Eclipse version+plugin versions+project setup) that is known to work?

> Both of these issues are fixed on trunk (but don't go there unless
> you're using the Lift 2.8.0 branch).
Unfortunately it didn't help to avoid these two issues...

> Let me know how you get on ...
Well, I switched to idea for now, and i don't like it. Would it make
sense to use the trunk version?

Cheers, Steffen.

>
> Cheers,
>
>
> Miles
>
> --
> Miles Sabin
> tel: +44 (0)7813 944 528
> skype:  milessabin
> http://www.chuusai.com/
> http://twitter.com/milessabin
>
> >
>



-- 
Steffen Weissmann

Technische Universitaet Berlin - Math. Department - MA 3-2

Str. des 17. Juni 136
10623 Berlin - Germany

Phone: +49 30 314-29278
Mail: weissm...@math.tu-berlin.de
Web: www.math.tu-berlin.de/~weissman

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



[Lift] Re: Rendering dynamic templates

2009-08-06 Thread marius d.

Please see LiftSession.processSurroundAndInclude ...

I wouldn't recommend processing templates outside normal rendering
pipeline ... but for specific cases it might be ok.

But what is your use case?

Br's,
Marius

On Aug 6, 11:12 pm, fbettag  wrote:
> Hi there,
>
> i was just wondering how one would go about dynamifying templates?
> Atm i store them on disk.
>
> Is there any way to parse a template and execute all the lift:MyStuff
> in that template?
> Like Xml.load but the way lift does it to render stuff in it.
>
> I tried to find it in code but didn't succeed.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: SiteMap gives "No Navigation Defined."

2009-08-06 Thread pabraham

Actually, same thing doesn't happen.  If I change the third argument,
I get this as the title in my browser as well as the link in the site
map.

On 6 Aug, 20:51, pabraham  wrote:
> Same thing happens, i.e. I get "No Navigation Defined." and no title.
>
> On 6 Aug, 20:38, Naftoli Gugenheim  wrote:
>
> > Not sure why you're getting no nav, but I think you want to change the 
> > other Home - the first string is the id of the link.
>
> > -
>
> > pabraham wrote:
>
> > Hello there,
>
> > I've been looking at SiteMap and trying to get it to give me a page
> > title, based on the SiteMap section in the Lift book (PDF version).
> > Here's how I've tried.
>
> > Boot.scala
>
> >     // Build SiteMap
> >     val entries = Menu(Loc("Home", "index"::Nil, "Home")) :: Nil
> >     LiftRules.setSiteMap(SiteMap(entries:_*))
>
> > default.html
>
> >     
> >         ...
> >         
> >         ...
> >     
> >     
> >         ...
> >         
>
> > This works fine, and gives me "Home" as the title of my page.
>
> > Now I actually want a different title, so I change the Loc bit to Loc
> > ("abcdefg", "index"::Nil, "Home") and get "No Navigation Defined."
>
> > What am I doing wrong here?
>
> > Paul.

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



[Lift] Rendering dynamic templates

2009-08-06 Thread fbettag

Hi there,

i was just wondering how one would go about dynamifying templates?
Atm i store them on disk.

Is there any way to parse a template and execute all the lift:MyStuff
in that template?
Like Xml.load but the way lift does it to render stuff in it.

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



[Lift] Re: SiteMap gives "No Navigation Defined."

2009-08-06 Thread TylerWeir

No Nav Defined typically shows up for me, when I've got my DB
connection messed up.



On Aug 6, 3:51 pm, pabraham  wrote:
> Same thing happens, i.e. I get "No Navigation Defined." and no title.
>
> On 6 Aug, 20:38, Naftoli Gugenheim  wrote:
>
>
>
> > Not sure why you're getting no nav, but I think you want to change the 
> > other Home - the first string is the id of the link.
>
> > -
>
> > pabraham wrote:
>
> > Hello there,
>
> > I've been looking at SiteMap and trying to get it to give me a page
> > title, based on the SiteMap section in the Lift book (PDF version).
> > Here's how I've tried.
>
> > Boot.scala
>
> >     // Build SiteMap
> >     val entries = Menu(Loc("Home", "index"::Nil, "Home")) :: Nil
> >     LiftRules.setSiteMap(SiteMap(entries:_*))
>
> > default.html
>
> >     
> >         ...
> >         
> >         ...
> >     
> >     
> >         ...
> >         
>
> > This works fine, and gives me "Home" as the title of my page.
>
> > Now I actually want a different title, so I change the Loc bit to Loc
> > ("abcdefg", "index"::Nil, "Home") and get "No Navigation Defined."
>
> > What am I doing wrong here?
>
> > Paul.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: SiteMap gives "No Navigation Defined."

2009-08-06 Thread pabraham

Same thing happens, i.e. I get "No Navigation Defined." and no title.

On 6 Aug, 20:38, Naftoli Gugenheim  wrote:
> Not sure why you're getting no nav, but I think you want to change the other 
> Home - the first string is the id of the link.
>
> -
>
> pabraham wrote:
>
> Hello there,
>
> I've been looking at SiteMap and trying to get it to give me a page
> title, based on the SiteMap section in the Lift book (PDF version).
> Here's how I've tried.
>
> Boot.scala
>
>     // Build SiteMap
>     val entries = Menu(Loc("Home", "index"::Nil, "Home")) :: Nil
>     LiftRules.setSiteMap(SiteMap(entries:_*))
>
> default.html
>
>     
>         ...
>         
>         ...
>     
>     
>         ...
>         
>
> This works fine, and gives me "Home" as the title of my page.
>
> Now I actually want a different title, so I change the Loc bit to Loc
> ("abcdefg", "index"::Nil, "Home") and get "No Navigation Defined."
>
> What am I doing wrong here?
>
> Paul.

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



[Lift] Re: How do I create a function that takes MetaMappers?

2009-08-06 Thread Ross Mellgren

Naftoli's suggestion is good, but I think your problem now is that  
User is not <: LongKeyedMapper, it's <: KeyedMapper. Here's one that  
compiles:

object Test {
 def findAll[T](m: KeyedMetaMapper[_, T]) = m.findAll

 def test {
 val users: List[User] = findAll(User)
 users
 }
}

On Aug 6, 2009, at 3:39 PM, jon wrote:

>
> Thanks Naftoli,
>
> is this what you mean?
>
> def findAll[T <: LongKeyedMapper[T]] (metaObject:
> LongKeyedMetaMapper[T]): List[T] = {
>   metaObject.findAll
> }
> **val users:List[User] = findAll[User](User)
>
> still get **-> type arguments [com.udorse.lift.model.User] do not
> conform to method findAll's type parameter bounds [T <:
> net.liftweb.mapper.LongKeyedMapper[T]]
>
> On Aug 6, 3:30 pm, Naftoli Gugenheim  wrote:
>> Pull M out as a type parameter and just declare the value parameter  
>> to be whatever M means.
>>
>> -
>>
>> Ross Mellgren wrote:
>>
>> What complaint does the compiler have?
>>
>> -Ross
>>
>> On Aug 6, 2009, at 2:06 PM, jon wrote:
>>
>>
>>
>>
>>
>>> I'd like to do something like
>>
>>> def findAll[T <: LongKeyedMapper[T],M <: LongKeyedMetaMapper[T]]
>>> (metaObject: M): List[T] = {
>>>   metaObject.findAll
>>> }
>>
>>> val users:List[User] = findAll(User)
>>> val foos:List[Foo] = findAll(Foo)
>>
>>> But the compiler won't have it.
>
> >


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



[Lift] Re: How do I create a function that takes MetaMappers?

2009-08-06 Thread jon

Thanks Naftoli,

is this what you mean?

 def findAll[T <: LongKeyedMapper[T]] (metaObject:
LongKeyedMetaMapper[T]): List[T] = {
   metaObject.findAll
 }
 **val users:List[User] = findAll[User](User)

still get **-> type arguments [com.udorse.lift.model.User] do not
conform to method findAll's type parameter bounds [T <:
net.liftweb.mapper.LongKeyedMapper[T]]

On Aug 6, 3:30 pm, Naftoli Gugenheim  wrote:
> Pull M out as a type parameter and just declare the value parameter to be 
> whatever M means.
>
> -
>
> Ross Mellgren wrote:
>
> What complaint does the compiler have?
>
> -Ross
>
> On Aug 6, 2009, at 2:06 PM, jon wrote:
>
>
>
>
>
> > I'd like to do something like
>
> >     def findAll[T <: LongKeyedMapper[T],M <: LongKeyedMetaMapper[T]]
> > (metaObject: M): List[T] = {
> >       metaObject.findAll
> >     }
>
> >     val users:List[User] = findAll(User)
> >     val foos:List[Foo] = findAll(Foo)
>
> > But the compiler won't have it.

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



[Lift] Re: SiteMap gives "No Navigation Defined."

2009-08-06 Thread Naftoli Gugenheim

Not sure why you're getting no nav, but I think you want to change the other 
Home - the first string is the id of the link.

-
pabraham wrote:


Hello there,

I've been looking at SiteMap and trying to get it to give me a page
title, based on the SiteMap section in the Lift book (PDF version).
Here's how I've tried.

Boot.scala

// Build SiteMap
val entries = Menu(Loc("Home", "index"::Nil, "Home")) :: Nil
LiftRules.setSiteMap(SiteMap(entries:_*))

default.html


...

...


...


This works fine, and gives me "Home" as the title of my page.

Now I actually want a different title, so I change the Loc bit to Loc
("abcdefg", "index"::Nil, "Home") and get "No Navigation Defined."

What am I doing wrong here?

Paul.



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



[Lift] Re: How do I create a function that takes MetaMappers?

2009-08-06 Thread jon

val users:List[User] = findAll(User)
--> inferred type arguments [Nothing,object com.x.lift.model.User] do
not conform to method findAll's type parameter bounds [T <:
net.liftweb.mapper.LongKeyedMapper[T],M <:
 net.liftweb.mapper.LongKeyedMetaMapper[T]]

if i change to:
val users:List[User] = findAll[User,User](User)
--> type arguments [com.x.lift.model.User,com.x.lift.model.User] do
not conform to method findAll's type parameter bounds [T <:
net.liftweb.mapper.LongKeyedMapper[T],M <:
 net.liftweb.mapper.LongKeyedMetaMapper[T]]

thanks,

jon

On Aug 6, 3:12 pm, Ross Mellgren  wrote:
> What complaint does the compiler have?
>
> -Ross
>
> On Aug 6, 2009, at 2:06 PM, jon wrote:
>
>
>
>
>
> > I'd like to do something like
>
> >     def findAll[T <: LongKeyedMapper[T],M <: LongKeyedMetaMapper[T]]
> > (metaObject: M): List[T] = {
> >       metaObject.findAll
> >     }
>
> >     val users:List[User] = findAll(User)
> >     val foos:List[Foo] = findAll(Foo)
>
> > But the compiler won't have it.

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



[Lift] SiteMap gives "No Navigation Defined."

2009-08-06 Thread pabraham

Hello there,

I've been looking at SiteMap and trying to get it to give me a page
title, based on the SiteMap section in the Lift book (PDF version).
Here's how I've tried.

Boot.scala

// Build SiteMap
val entries = Menu(Loc("Home", "index"::Nil, "Home")) :: Nil
LiftRules.setSiteMap(SiteMap(entries:_*))

default.html


...

...


...


This works fine, and gives me "Home" as the title of my page.

Now I actually want a different title, so I change the Loc bit to Loc
("abcdefg", "index"::Nil, "Home") and get "No Navigation Defined."

What am I doing wrong here?

Paul.

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



[Lift] Re: How do I create a function that takes MetaMappers?

2009-08-06 Thread Naftoli Gugenheim

Pull M out as a type parameter and just declare the value parameter to be 
whatever M means.

-
Ross Mellgren wrote:


What complaint does the compiler have?

-Ross

On Aug 6, 2009, at 2:06 PM, jon wrote:

>
> I'd like to do something like
>
> def findAll[T <: LongKeyedMapper[T],M <: LongKeyedMetaMapper[T]]
> (metaObject: M): List[T] = {
>   metaObject.findAll
> }
>
> val users:List[User] = findAll(User)
> val foos:List[Foo] = findAll(Foo)
>
> But the compiler won't have it.
>
> >




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



[Lift] Re: Db.addLogFunc

2009-08-06 Thread marius d.

Probably building our own wrappers would be more lightweight then 3-rd
party. Jus' guessing

Br's,
Marius

On Aug 6, 9:58 pm, Derek Chen-Becker  wrote:
> Well, I started looking at it and determined that the only way for us to
> truly log the queries would be to essentially make our own wrappers over
> Statement and PreparedStatement. There are projects (log4jdbc, notably) that
> already do this, and in a transparent manner. I'm not sure that adding a
> whole bunch of SQL logging directly to Lift is better than leveraging some
> existing libraries to do it.
>
> Derek
>
> On Thu, Aug 6, 2009 at 11:03 AM, marius d.  wrote:
>
> > Yeah we're aware of that. That is based on toString application which
> > is JDBC driver dependent. I think Derek started some work on this to
> > correct this behavior. Derek ?
>
> > Br's,
> > Marius
>
> > On Aug 6, 8:01 pm, jon  wrote:
> > > Hi,
>
> > > I have the following in boot:
> > >   DB.addLogFunc((query, len) => Log.info("The query: "+query+" took
> > > "+len+" milliseconds"))
>
> > > I was expecting the query parameter to be sql, but it's actually some
> > > sort of guid
>
> > > "INFO - The query: 6839c016-0122-f09a-9c96-003844e8 took 5
> > > milliseconds"
>
> > > Any ideas?
> > > I'm running with derby.
>
> > > Thanks,
>
> > > Jon
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: How do I create a function that takes MetaMappers?

2009-08-06 Thread Ross Mellgren

What complaint does the compiler have?

-Ross

On Aug 6, 2009, at 2:06 PM, jon wrote:

>
> I'd like to do something like
>
> def findAll[T <: LongKeyedMapper[T],M <: LongKeyedMetaMapper[T]]
> (metaObject: M): List[T] = {
>   metaObject.findAll
> }
>
> val users:List[User] = findAll(User)
> val foos:List[Foo] = findAll(Foo)
>
> But the compiler won't have it.
>
> >


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



[Lift] Re: SOAP web services?

2009-08-06 Thread Derek Chen-Becker
As far as I know there aren't any Scala-specific SOAP libs, so it's probably
simplest to use on of the Java ones to create the stubs and then just use
those from Scala. If I'm wrong and there are some Scala SOAP libs out there,
I'd love to know about them.

Derek

On Thu, Aug 6, 2009 at 9:26 AM, Jacek Furmankiewicz wrote:

>
> I was reading through the Lift book PDF and it mentions only REST-
> style web services.
>
> In our case, we need to look at re-implementing a set of existing SOAP
> web services (is there anything like 'wsdl2scala' anywhere?).
>
> I would appreciate any best practices and suggestions for implementing
> SOAP web services in the context of a larger Lift app (and Scala in
> general).
>
> >
>

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



[Lift] Re: Db.addLogFunc

2009-08-06 Thread Derek Chen-Becker
Well, I started looking at it and determined that the only way for us to
truly log the queries would be to essentially make our own wrappers over
Statement and PreparedStatement. There are projects (log4jdbc, notably) that
already do this, and in a transparent manner. I'm not sure that adding a
whole bunch of SQL logging directly to Lift is better than leveraging some
existing libraries to do it.

Derek

On Thu, Aug 6, 2009 at 11:03 AM, marius d.  wrote:

>
> Yeah we're aware of that. That is based on toString application which
> is JDBC driver dependent. I think Derek started some work on this to
> correct this behavior. Derek ?
>
>
> Br's,
> Marius
>
> On Aug 6, 8:01 pm, jon  wrote:
> > Hi,
> >
> > I have the following in boot:
> >   DB.addLogFunc((query, len) => Log.info("The query: "+query+" took
> > "+len+" milliseconds"))
> >
> > I was expecting the query parameter to be sql, but it's actually some
> > sort of guid
> >
> > "INFO - The query: 6839c016-0122-f09a-9c96-003844e8 took 5
> > milliseconds"
> >
> > Any ideas?
> > I'm running with derby.
> >
> > Thanks,
> >
> > Jon
> >
>

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



[Lift] How do I create a function that takes MetaMappers?

2009-08-06 Thread jon

I'd like to do something like

 def findAll[T <: LongKeyedMapper[T],M <: LongKeyedMetaMapper[T]]
(metaObject: M): List[T] = {
   metaObject.findAll
 }

 val users:List[User] = findAll(User)
 val foos:List[Foo] = findAll(Foo)

But the compiler won't have it.

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



[Lift] Re: Title function

2009-08-06 Thread Derek Chen-Becker
I don't think I understand what you're getting at. The other option is to
use the Title LocParam. Given the code that I already wrote, you could do
something like:

Menu(Loc("Edit", List("edit"), "Edit", Hidden, Title(ignore =>
Text(Info.toEdit map ("Edit " + _.name) openOr "No item to edit!")))

The "ignore" parameter for the Title LocParam is used if you subclass Loc
and use type-safe parameters.

Derek

On Thu, Aug 6, 2009 at 11:05 AM, Naftoli Gugenheim wrote:

> Are you showing me a way for Title to access this information? In this case
> Info is the original snippet class? Is this a way to access Info.title
> outside of the instance of Info?
> What would be ideal, at least in a certain sense, is if there would be some
> way for the Loc to access the snippet instance and/or modify the transformed
> xml that it is about to serve.
> The next best option would be for all the title snippets to pass their
> calculated title through some "global" (object/module) method so that the
> snippets would generate their specific title and have the title modified in
> a global way too.
> The simplest option is just to repeat the common title code everywhere.
>
>
> On Thu, Aug 6, 2009 at 10:15 AM, Derek Chen-Becker 
> wrote:
>
>> Putting it in an "object" won't work, since you probably want the title to
>> be done per-request.  To clarify what I'm saying, here's a small example of
>> how I would set the title for an edit page:
>>
>> First, the template:
>>
>> 
>>   
>> 
>>   
>>
>>   
>> Type stuff here:
>> 
>> 
>>   
>> 
>>
>> Then the snippet class:
>>
>> class Info {
>>   object toEdit extends RequestVar[Box[InfoStuff]](Empty)
>>
>>   def title(ignore : NodeSeq) : NodeSeq = Text(toEdit map ("Edit " +
>> _.name) openOr "No item to edit!")
>>
>>   def edit (xhtml : NodeSeq) : NodeSeq = ...
>> }
>>
>> This assumes that whatever page is redirecting to the edit page will set
>> the RequestVar, something like:
>>
>> S.redirectTo("/edit", () => Info.toEdit(Full(someInfoStuffInstance)))
>>
>> Does that make sense?
>>
>> Derek
>>
>>
>> On Wed, Aug 5, 2009 at 11:14 AM, Naftoli Gugenheim 
>> wrote:
>>
>>>
>>> You mean the snippet should put its new/edit flag somewhere that the
>>> Title can read, like a top level object? Then it doesn't need to be an
>>> AnyVar because it can be set on every request, if Title is processed after
>>> the snippet in each request--and if not then I don't see how a RequestVar
>>> etc. would work.
>>> Seems like it may be more work than the other way, though.
>>> By the way I sent corrected message afterward--my question was not about
>>> LocParams but of the items of type ParamType.
>>>
>>> -
>>> Derek Chen-Becker wrote:
>>>
>>> If you're just looking for a way to programmatically set the title,
>>> getting
>>> into LocParam might be a little bit of overkill. It's probably simpler to
>>> set up your own SessionVars or RequestVars and access them from the Title
>>> closure:
>>>
>>>
>>> http://scala-tools.org/scaladocs/liftweb/1.0/net/liftweb/sitemap/Loc/Title.html
>>>
>>> Derek
>>>
>>> On Wed, Aug 5, 2009 at 9:45 AM, Naftoli Gugenheim >> >wrote:
>>>
>>> >
>>> >
>>> > -
>>> > Naftoli Gugenheim wrote:
>>> >
>>> > So what I'm not clear on now is the input to Title. What is a LocParam,
>>> and
>>> > how do you you use loc params? What is forceParam, defaultParams,
>>> param, and
>>> > foundParam? And in any case how can Title know the value of the
>>> registered
>>> > StatefulSnippet's newOrEdit state?
>>> > Thanks!
>>> >
>>> > -
>>> > David Pollak wrote:
>>> >
>>> > On Tue, Aug 4, 2009 at 12:47 PM, Naftoli Gugenheim <
>>> naftoli...@gmail.com
>>> > >wrote:
>>> >
>>> > > Maybe my setup is atypical then :)
>>> > > My default.html is does not have a title tag; instead each view has
>>> its
>>> > > own, relying on head merge.
>>> > > I don't know if originally I had it in default using lift:Menu.title
>>> or
>>> > > not, but the difficulty with that would be that some pages can be
>>> used to
>>> > > edit or add a new item, and the title needs to reflect that.
>>> >
>>> >
>>> > Because the Title() case class takes a function, you can have it do all
>>> > forms of stuff including looking to the current user, whether you're
>>> > editing, and "do the right thing".
>>> >
>>> >
>>> > >
>>> > > So either (1) I need a way that the value of Menu.title will depend
>>> on
>>> > data
>>> > > in various StatefulSnippets; or (2) make the title ambiguous
>>> (add/edit
>>> > > neutral); or (3) leave the titles in the views and process them with
>>> a
>>> > > function somehow; or (4) put a snippet in the title of every view to
>>> get
>>> > the
>>> > > user.
>>> > >
>>> > >
>>> > >
>>> > > -
>>> > > David Pollak wrote:
>>> > >
>>> > > On Sun, Aug 2, 2009 at 4:35 PM, Naftoli Gugenheim <
>>> naftoli...@gmail.com
>>> > > >wrote:
>>> > >
>>> > > >
>>> > > > How does 

[Lift] Re: Title function

2009-08-06 Thread Naftoli Gugenheim
Are you showing me a way for Title to access this information? In this case
Info is the original snippet class? Is this a way to access Info.title
outside of the instance of Info?
What would be ideal, at least in a certain sense, is if there would be some
way for the Loc to access the snippet instance and/or modify the transformed
xml that it is about to serve.
The next best option would be for all the title snippets to pass their
calculated title through some "global" (object/module) method so that the
snippets would generate their specific title and have the title modified in
a global way too.
The simplest option is just to repeat the common title code everywhere.

On Thu, Aug 6, 2009 at 10:15 AM, Derek Chen-Becker wrote:

> Putting it in an "object" won't work, since you probably want the title to
> be done per-request.  To clarify what I'm saying, here's a small example of
> how I would set the title for an edit page:
>
> First, the template:
>
> 
>   
> 
>   
>
>   
> Type stuff here:
> 
> 
>   
> 
>
> Then the snippet class:
>
> class Info {
>   object toEdit extends RequestVar[Box[InfoStuff]](Empty)
>
>   def title(ignore : NodeSeq) : NodeSeq = Text(toEdit map ("Edit " +
> _.name) openOr "No item to edit!")
>
>   def edit (xhtml : NodeSeq) : NodeSeq = ...
> }
>
> This assumes that whatever page is redirecting to the edit page will set
> the RequestVar, something like:
>
> S.redirectTo("/edit", () => Info.toEdit(Full(someInfoStuffInstance)))
>
> Does that make sense?
>
> Derek
>
>
> On Wed, Aug 5, 2009 at 11:14 AM, Naftoli Gugenheim 
> wrote:
>
>>
>> You mean the snippet should put its new/edit flag somewhere that the Title
>> can read, like a top level object? Then it doesn't need to be an AnyVar
>> because it can be set on every request, if Title is processed after the
>> snippet in each request--and if not then I don't see how a RequestVar etc.
>> would work.
>> Seems like it may be more work than the other way, though.
>> By the way I sent corrected message afterward--my question was not about
>> LocParams but of the items of type ParamType.
>>
>> -
>> Derek Chen-Becker wrote:
>>
>> If you're just looking for a way to programmatically set the title,
>> getting
>> into LocParam might be a little bit of overkill. It's probably simpler to
>> set up your own SessionVars or RequestVars and access them from the Title
>> closure:
>>
>>
>> http://scala-tools.org/scaladocs/liftweb/1.0/net/liftweb/sitemap/Loc/Title.html
>>
>> Derek
>>
>> On Wed, Aug 5, 2009 at 9:45 AM, Naftoli Gugenheim > >wrote:
>>
>> >
>> >
>> > -
>> > Naftoli Gugenheim wrote:
>> >
>> > So what I'm not clear on now is the input to Title. What is a LocParam,
>> and
>> > how do you you use loc params? What is forceParam, defaultParams, param,
>> and
>> > foundParam? And in any case how can Title know the value of the
>> registered
>> > StatefulSnippet's newOrEdit state?
>> > Thanks!
>> >
>> > -
>> > David Pollak wrote:
>> >
>> > On Tue, Aug 4, 2009 at 12:47 PM, Naftoli Gugenheim <
>> naftoli...@gmail.com
>> > >wrote:
>> >
>> > > Maybe my setup is atypical then :)
>> > > My default.html is does not have a title tag; instead each view has
>> its
>> > > own, relying on head merge.
>> > > I don't know if originally I had it in default using lift:Menu.title
>> or
>> > > not, but the difficulty with that would be that some pages can be used
>> to
>> > > edit or add a new item, and the title needs to reflect that.
>> >
>> >
>> > Because the Title() case class takes a function, you can have it do all
>> > forms of stuff including looking to the current user, whether you're
>> > editing, and "do the right thing".
>> >
>> >
>> > >
>> > > So either (1) I need a way that the value of Menu.title will depend on
>> > data
>> > > in various StatefulSnippets; or (2) make the title ambiguous (add/edit
>> > > neutral); or (3) leave the titles in the views and process them with a
>> > > function somehow; or (4) put a snippet in the title of every view to
>> get
>> > the
>> > > user.
>> > >
>> > >
>> > >
>> > > -
>> > > David Pollak wrote:
>> > >
>> > > On Sun, Aug 2, 2009 at 4:35 PM, Naftoli Gugenheim <
>> naftoli...@gmail.com
>> > > >wrote:
>> > >
>> > > >
>> > > > How does the Title LocParam work?
>> > >
>> > >
>> > > The Title case class has a function that converts the current object
>> > > associated with the Loc into a String representing the title of the
>> page
>> > > represented by the Loc.
>> > >
>> > >
>> > > >
>> > > > Is there a way to modify all titles to e.g. include the logged in
>> > user's
>> > > > name, without having to edit all the views?
>> > >
>> > >
>> > > The  tag is typically defined in the default template.  You
>> could
>> > > include a snippet in the  tag that would contain the user's
>> name.
>> >  I
>> > > would see this as separate from the title of the specific page
>> 

[Lift] Re: Db.addLogFunc

2009-08-06 Thread marius d.

Yeah we're aware of that. That is based on toString application which
is JDBC driver dependent. I think Derek started some work on this to
correct this behavior. Derek ?


Br's,
Marius

On Aug 6, 8:01 pm, jon  wrote:
> Hi,
>
> I have the following in boot:
>   DB.addLogFunc((query, len) => Log.info("The query: "+query+" took
> "+len+" milliseconds"))
>
> I was expecting the query parameter to be sql, but it's actually some
> sort of guid
>
> "INFO - The query: 6839c016-0122-f09a-9c96-003844e8 took 5
> milliseconds"
>
> Any ideas?
> I'm running with derby.
>
> Thanks,
>
> Jon
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Db.addLogFunc

2009-08-06 Thread jon

Hi,

I have the following in boot:
  DB.addLogFunc((query, len) => Log.info("The query: "+query+" took
"+len+" milliseconds"))

I was expecting the query parameter to be sql, but it's actually some
sort of guid

"INFO - The query: 6839c016-0122-f09a-9c96-003844e8 took 5
milliseconds"

Any ideas?
I'm running with derby.

Thanks,

Jon




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



[Lift] Re: New features

2009-08-06 Thread Naftoli Gugenheim
In your use case it can only be Long and User. But there has to be a type
parameter because other people might have a String key and a Request mapper.
And the contents of ManyToMany have to be type safe to enforce their
consistency with however the user of ManyToMany wants them to use it.So I
think what you want is that the compiler should figure out that since you're
using it with a KeyedMapper[Long, User], which is ManyToMany's T <:
KeyedMapper[K,T], and ManyToMany extends KeyedMapper[K,T] and it has a self
type of T, and therefore it would be a compiler error to write anything
besides Long and User, therefore you must want to use Long and User and they
should be inferred.
I could certainly hear that, although I'm not much of a type theorist. So
feel free to open an enhancement ticket on Scala's Trac! :)
If I understood correctly...


On Thu, Aug 6, 2009 at 12:43 PM, glenn  wrote:

>
> Naftoli,
>
> As I said at the outset, this is really beyond my expertise. But I
> think it's too
> broad and maybe, even unnecessary. In my example, K can only be one
> type,
> Long, and T can only be of type User. Anything else, and the compiler
> can't be
> guaranteed to catch it, but try running the application and you get
> things like
> stack overflow errors.
>
> How you would fix this is beyond me. All you can really do, at this
> point, is
> make sure to include these kinds of restrictions in the docs.
>
> Glenn...
>
> On Aug 6, 9:33 am, Naftoli Gugenheim  wrote:
> > It's too broad, or it's too restrictive/unnecessary? I'm confused, you
> seem
> > to imply both.If it's too broad, tell me why. But if you want to know why
> it
> > needs the type parameter, it's because it has to use the type parameter
> in
> > its implentation -- just count how many times its source code uses it!
> And
> > if you want to know why the compiler can't infer it or be told to infer
> > it... that's another issue.
> > But if passing a type that creates a conflicting inheritance causes a
> > compiler crash, that's not something I can help. :)
> > Regards.
> >
> > On Thu, Aug 6, 2009 at 12:26 PM, glenn  wrote:
> >
> > > Naftoli,
> >
> > > At the risk of discussing something obviously beyond my pay grade,
> > > isn't the real issue Scala traits
> > > and the use of parameterized types. The ManyToMany trait is defined
> > > as:
> >
> > > trait ManyToMany[K,T<:KeyedMapper[K, T]]
> >
> > > But this isn't really correct,is it, the parameter is too broad, and
> > > that leads to a lot of the confusion and results in the need for
> > > unnecessary documentation. When you think about it, why all the
> > > duplication? Why do I need to
> > > write my User entity as:
> >
> > > class User extends MegaProtoUser[User] with ManyToMany[Long,User]
> >
> > > when we all know that this would be much cleaner:
> >
> > > class User extends MegaProtoUser[User] with ManyToMany.
> >
> > > But traits aren't like interfaces. They have implementation and would
> > > need to know something about
> > > the parent class they are attached to - and how would you accomplish
> > > that (reflection, maybe). This is
> > > more a Scala issue than a Lift one, I think.
> >
> > > Glenn...
> >
> > > On Aug 5, 8:24 pm, Naftoli Gugenheim  wrote:
> > > > Building causes a stack overflow?
> > > > So the question is, is it the resident compiler or plain scalac also
> > > crashes? Or just the presentation compiler? What do you see in the
> error log
> > > view or file?
> > > > I get compiler crashes very often when doing fancy mapper type
> related
> > > tricks.
> >
> > > > -
> >
> > > > glenn wrote:
> >
> > > > Naftoli,
> >
> > > > Hate to do this to you, but I'm getting the following error using
> > > > ManyToMany for Users to Roles:
> >
> > > > Message: java.lang.RuntimeException: Broken join
> > > > scala.Predef$.error(Predef.scala:76)
> >
> > > net.liftweb.mapper.ManyToMany$MappedManyToMany$$anonfun$children$1$
> > > > $anonfun$apply$1.apply(ManyToMany.scala:54)
> >
> > > net.liftweb.mapper.ManyToMany$MappedManyToMany$$anonfun$children$1$
> > > > $anonfun$apply$1.apply(ManyToMany.scala:54)
> > > > net.liftweb.util.EmptyBox.openOr(Box.scala:372)
> > > >
> net.liftweb.mapper.ManyToMany$MappedManyToMany$$anonfun$children
> > > > $1.apply(ManyToMany.scala:54)
> > > >
> net.liftweb.mapper.ManyToMany$MappedManyToMany$$anonfun$children
> > > > $1.apply(ManyToMany.scala:54)
> > > > scala.List.map(List.scala:812)
> > > > net.liftweb.mapper.ManyToMany$MappedManyToMany.children
> > > > (ManyToMany.scala:54)
> > > > net.liftweb.mapper.ManyToMany$MappedManyToMany.elements
> > > > (ManyToMany.scala:96)
> > > > scala.Seq$class.flatMap(Seq.scala:293)
> > > > net.liftweb.mapper.ManyToMany$MappedManyToMany.flatMap
> > > > (ManyToMany.scala:44)
> >
> > > >  def edit(ns: NodeSeq): NodeSeq = {
> > > > val theUser = view.entity
> > > > val addRole = TheBindParam("insert", view.snippet.link("edit", ()
> 

[Lift] Re: New features

2009-08-06 Thread glenn

Naftoli,

As I said at the outset, this is really beyond my expertise. But I
think it's too
broad and maybe, even unnecessary. In my example, K can only be one
type,
Long, and T can only be of type User. Anything else, and the compiler
can't be
guaranteed to catch it, but try running the application and you get
things like
stack overflow errors.

How you would fix this is beyond me. All you can really do, at this
point, is
make sure to include these kinds of restrictions in the docs.

Glenn...

On Aug 6, 9:33 am, Naftoli Gugenheim  wrote:
> It's too broad, or it's too restrictive/unnecessary? I'm confused, you seem
> to imply both.If it's too broad, tell me why. But if you want to know why it
> needs the type parameter, it's because it has to use the type parameter in
> its implentation -- just count how many times its source code uses it! And
> if you want to know why the compiler can't infer it or be told to infer
> it... that's another issue.
> But if passing a type that creates a conflicting inheritance causes a
> compiler crash, that's not something I can help. :)
> Regards.
>
> On Thu, Aug 6, 2009 at 12:26 PM, glenn  wrote:
>
> > Naftoli,
>
> > At the risk of discussing something obviously beyond my pay grade,
> > isn't the real issue Scala traits
> > and the use of parameterized types. The ManyToMany trait is defined
> > as:
>
> > trait ManyToMany[K,T<:KeyedMapper[K, T]]
>
> > But this isn't really correct,is it, the parameter is too broad, and
> > that leads to a lot of the confusion and results in the need for
> > unnecessary documentation. When you think about it, why all the
> > duplication? Why do I need to
> > write my User entity as:
>
> > class User extends MegaProtoUser[User] with ManyToMany[Long,User]
>
> > when we all know that this would be much cleaner:
>
> > class User extends MegaProtoUser[User] with ManyToMany.
>
> > But traits aren't like interfaces. They have implementation and would
> > need to know something about
> > the parent class they are attached to - and how would you accomplish
> > that (reflection, maybe). This is
> > more a Scala issue than a Lift one, I think.
>
> > Glenn...
>
> > On Aug 5, 8:24 pm, Naftoli Gugenheim  wrote:
> > > Building causes a stack overflow?
> > > So the question is, is it the resident compiler or plain scalac also
> > crashes? Or just the presentation compiler? What do you see in the error log
> > view or file?
> > > I get compiler crashes very often when doing fancy mapper type related
> > tricks.
>
> > > -
>
> > > glenn wrote:
>
> > > Naftoli,
>
> > > Hate to do this to you, but I'm getting the following error using
> > > ManyToMany for Users to Roles:
>
> > > Message: java.lang.RuntimeException: Broken join
> > >         scala.Predef$.error(Predef.scala:76)
>
> > net.liftweb.mapper.ManyToMany$MappedManyToMany$$anonfun$children$1$
> > > $anonfun$apply$1.apply(ManyToMany.scala:54)
>
> > net.liftweb.mapper.ManyToMany$MappedManyToMany$$anonfun$children$1$
> > > $anonfun$apply$1.apply(ManyToMany.scala:54)
> > >         net.liftweb.util.EmptyBox.openOr(Box.scala:372)
> > >         net.liftweb.mapper.ManyToMany$MappedManyToMany$$anonfun$children
> > > $1.apply(ManyToMany.scala:54)
> > >         net.liftweb.mapper.ManyToMany$MappedManyToMany$$anonfun$children
> > > $1.apply(ManyToMany.scala:54)
> > >         scala.List.map(List.scala:812)
> > >         net.liftweb.mapper.ManyToMany$MappedManyToMany.children
> > > (ManyToMany.scala:54)
> > >         net.liftweb.mapper.ManyToMany$MappedManyToMany.elements
> > > (ManyToMany.scala:96)
> > >         scala.Seq$class.flatMap(Seq.scala:293)
> > >         net.liftweb.mapper.ManyToMany$MappedManyToMany.flatMap
> > > (ManyToMany.scala:44)
>
> > >  def edit(ns: NodeSeq): NodeSeq = {
> > >     val theUser = view.entity
> > >     val addRole = TheBindParam("insert", view.snippet.link("edit", ()
> > > => theUser.roles += new Role, Text(S?("Add Role"
>
> > >     bind("user", ns,
> > >          "firstname" -> text(theUser.firstName.is, theUser.firstName
> > > (_), ("size","20")),
> > >          "lastname" -> text(theUser.lastName.is,theUser.lastName(_),
> > > ("size", "30")),
> > >          "roles" -> theUser.roles.flatMap{role =>
> > >               bind("role", ns,
> > >                   "name" -> role.name.toForm,
> > >                   "remove" -> SHtml.submit(S?("Remove"), ()=>
> > > theUser.roles -= role)
> > >               )
> > >           },
> > >          addRole,
> > >          "submit" -> SHtml.submit(S?("Save"), ()=>view.save)
> > >          )
> > >     }
>
> > > The offending code seems to be the line: "roles" ->
> > > theUser.roles.flatMap{
> > > in the above bind method when I click on the addRole link.
>
> > > Here's my User class:
>
> > > class User extends MegaProtoUser[User] with ManyToMany[Long,User]{
> > >   def getSingleton = User // what's the "meta" server
>
> > >    object roles
> > >     extends MappedManyToMany(UserRole, UserRole.user, Us

[Lift] Re: New features

2009-08-06 Thread Naftoli Gugenheim
It's too broad, or it's too restrictive/unnecessary? I'm confused, you seem
to imply both.If it's too broad, tell me why. But if you want to know why it
needs the type parameter, it's because it has to use the type parameter in
its implentation -- just count how many times its source code uses it! And
if you want to know why the compiler can't infer it or be told to infer
it... that's another issue.
But if passing a type that creates a conflicting inheritance causes a
compiler crash, that's not something I can help. :)
Regards.


On Thu, Aug 6, 2009 at 12:26 PM, glenn  wrote:

>
> Naftoli,
>
> At the risk of discussing something obviously beyond my pay grade,
> isn't the real issue Scala traits
> and the use of parameterized types. The ManyToMany trait is defined
> as:
>
> trait ManyToMany[K,T<:KeyedMapper[K, T]]
>
> But this isn't really correct,is it, the parameter is too broad, and
> that leads to a lot of the confusion and results in the need for
> unnecessary documentation. When you think about it, why all the
> duplication? Why do I need to
> write my User entity as:
>
> class User extends MegaProtoUser[User] with ManyToMany[Long,User]
>
> when we all know that this would be much cleaner:
>
> class User extends MegaProtoUser[User] with ManyToMany.
>
> But traits aren't like interfaces. They have implementation and would
> need to know something about
> the parent class they are attached to - and how would you accomplish
> that (reflection, maybe). This is
> more a Scala issue than a Lift one, I think.
>
> Glenn...
>
>
> On Aug 5, 8:24 pm, Naftoli Gugenheim  wrote:
> > Building causes a stack overflow?
> > So the question is, is it the resident compiler or plain scalac also
> crashes? Or just the presentation compiler? What do you see in the error log
> view or file?
> > I get compiler crashes very often when doing fancy mapper type related
> tricks.
> >
> > -
> >
> > glenn wrote:
> >
> > Naftoli,
> >
> > Hate to do this to you, but I'm getting the following error using
> > ManyToMany for Users to Roles:
> >
> > Message: java.lang.RuntimeException: Broken join
> > scala.Predef$.error(Predef.scala:76)
> >
> net.liftweb.mapper.ManyToMany$MappedManyToMany$$anonfun$children$1$
> > $anonfun$apply$1.apply(ManyToMany.scala:54)
> >
> net.liftweb.mapper.ManyToMany$MappedManyToMany$$anonfun$children$1$
> > $anonfun$apply$1.apply(ManyToMany.scala:54)
> > net.liftweb.util.EmptyBox.openOr(Box.scala:372)
> > net.liftweb.mapper.ManyToMany$MappedManyToMany$$anonfun$children
> > $1.apply(ManyToMany.scala:54)
> > net.liftweb.mapper.ManyToMany$MappedManyToMany$$anonfun$children
> > $1.apply(ManyToMany.scala:54)
> > scala.List.map(List.scala:812)
> > net.liftweb.mapper.ManyToMany$MappedManyToMany.children
> > (ManyToMany.scala:54)
> > net.liftweb.mapper.ManyToMany$MappedManyToMany.elements
> > (ManyToMany.scala:96)
> > scala.Seq$class.flatMap(Seq.scala:293)
> > net.liftweb.mapper.ManyToMany$MappedManyToMany.flatMap
> > (ManyToMany.scala:44)
> >
> >  def edit(ns: NodeSeq): NodeSeq = {
> > val theUser = view.entity
> > val addRole = TheBindParam("insert", view.snippet.link("edit", ()
> > => theUser.roles += new Role, Text(S?("Add Role"
> >
> > bind("user", ns,
> >  "firstname" -> text(theUser.firstName.is, theUser.firstName
> > (_), ("size","20")),
> >  "lastname" -> text(theUser.lastName.is,theUser.lastName(_),
> > ("size", "30")),
> >  "roles" -> theUser.roles.flatMap{role =>
> >   bind("role", ns,
> >   "name" -> role.name.toForm,
> >   "remove" -> SHtml.submit(S?("Remove"), ()=>
> > theUser.roles -= role)
> >   )
> >   },
> >  addRole,
> >  "submit" -> SHtml.submit(S?("Save"), ()=>view.save)
> >  )
> > }
> >
> > The offending code seems to be the line: "roles" ->
> > theUser.roles.flatMap{
> > in the above bind method when I click on the addRole link.
> >
> > Here's my User class:
> >
> > class User extends MegaProtoUser[User] with ManyToMany[Long,User]{
> >   def getSingleton = User // what's the "meta" server
> >
> >object roles
> > extends MappedManyToMany(UserRole, UserRole.user, UserRole.role,
> > Role)
> >
> > }
> >
> > What am I doing wrong? You can see how difficult it is to slog through
> > this code, let alone just
> > trying to explain the problem so I can get help.
> >
> > On Aug 5, 9:57 am, Naftoli Gugenheim  wrote:
> >
> > > I'll try.
> > > By the way, as per my correction, you can implement list the regular
> way without ModelView, and just use ModelSnippet's load function in your
> edit link or button, passing it the User instance.
> >
> > > -
> >
> > > glenn wrote:
> >
> > > Naftoli,
> >
> > > I fixed my code per your comments and now I can edit and remove users
> > > from a list, as long as I populate the list with

[Lift] Re: Alternate part of view

2009-08-06 Thread Naftoli Gugenheim
Here's some view xhtml:
>
> 

Client 









Client 










And here's some snippet code:

> xhtml.bind("req",

  "noClient" -> noClient _,

  "client" -> hasClient _,

  ...

)

def noClient(xhtml: NodeSeq) = {

  var clientQuery: String = ""

  def queryClient {

 ...

  }

  client match {

case None =>

  xhtml.bind("client",

"query" -> keepAttrs(SHtml.text(clientQuery, clientQuery = _)),

"set" -> SHtml.submit(?(">"), ()=>queryClient)

  )

case Some(_) =>

  NodeSeq.Empty

  }

}


So both alternatives are always bound to a NodeSeq=>NodeSeq function, and
both functions have to check if client is None or a Some, and always one
function returns NodeSeq.Empty and the other one something useful.
So my question is not, "how can I do xxx," but, "is there a 'DRY'er or more
concise way to do it."
In another place I used a slightly different technique:

> val emptyFn = (ns: NodeSeq) => NodeSeq.Empty

def noLocationKind = (ns: NodeSeq) => ...

def hasLocationKind(kind: LocKind#Value) = (ns:NodeSeq) => ...

ns.bind("nlt",

//"name" -> {(ns:NodeSeq)=>Text("foo")},

"locKind" -> lkOpt.map(hasLocationKind).getOrElse(emptyFn),

"noLocKind" -> (if(lkOpt==None) noLocationKind else emptyFn)

).bind("nlt","name"->nlt.name.is)

Where lkOpt is the value that can be None or a Some. Instead of letting the
functions check None/Some, I check outside the function. But it still seems
that in theory it could be simplified.
chooseTemplate doesn't solve the problem that the alternative NodeSeq has to
be transformed to NodeSeq.Empty.
P.S. Notice that I'm using my implicit to call bind on the NodeSeq :)
P.P.S If you look closely, there's another problem that I had. For some
reason the first "name" -> ... was getting ignored, and it only worked in
the second bind.
Thanks!





On Thu, Aug 6, 2009 at 10:49 AM, David Pollak  wrote:

> I really need to see the resulting view code that you'd like to see
> depending on the conditions.
>
> On Thu, Aug 6, 2009 at 7:47 AM, Naftoli Gugenheim wrote:
>
>>
>> No, I meant that this pattern of parts of the view being alternatives to
>> each other repeats, in other words the view has several pairs of
>> alternatives.
>
>
> I don't understand why the example doesn't allow for alternatives that
> repeat.
>
>
>>
>>
>> -
>> David Pollak wrote:
>>
>> On Wed, Aug 5, 2009 at 8:44 PM, Naftoli Gugenheim > >wrote:
>>
>> >
>> > What's the smartest / most concise way to achieve the following in the
>> > corresponding view xhtml and snippet code:
>> > Parts of the view have to change, depending on whether something is set.
>> > For example, in the area where you select the client, if the client is
>> None,
>> > then it displays an interface to select a client. If it's set to a Some
>> then
>> > it displays the client's details with a button to unset it. This pattern
>> is
>> > repeated.
>> > My current strategy is to have two elements, req:noClient and
>> req:client,
>> > which have different xhtml contents. Then in the snippet I bind them to
>> two
>> > NodeSeq functions, one that binds useful contents when the client is
>> None
>> > and returns NodeSeq.Empty otherwise; and another function that binds
>> when
>> > it's a Some and returns Empty otherwise. However, it seems to be
>> somewhat
>> > redundant in theory.
>> > So does anyone have a better way of switching view parts?
>>
>>
>> If it's repeated, then  the part that you need.
>>
>> 
>>  
>>  
>> 
>>
>>
>>
>> >
>> > Thanks.
>> >
>> >
>> >
>> > >
>> >
>>
>>
>> --
>> Lift, the simply functional web framework http://liftweb.net
>> Beginning Scala http://www.apress.com/book/view/1430219890
>> Follow me: http://twitter.com/dpp
>> Git some: http://github.com/dpp
>>
>>
>>
>>
>>
>
>
> --
> Lift, the simply functional web framework http://liftweb.net
> Beginning Scala http://www.apress.com/book/view/1430219890
> Follow me: http://twitter.com/dpp
> Git some: http://github.com/dpp
>
> >
>

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



[Lift] Re: New features

2009-08-06 Thread glenn

Naftoli,

At the risk of discussing something obviously beyond my pay grade,
isn't the real issue Scala traits
and the use of parameterized types. The ManyToMany trait is defined
as:

trait ManyToMany[K,T<:KeyedMapper[K, T]]

But this isn't really correct,is it, the parameter is too broad, and
that leads to a lot of the confusion and results in the need for
unnecessary documentation. When you think about it, why all the
duplication? Why do I need to
write my User entity as:

class User extends MegaProtoUser[User] with ManyToMany[Long,User]

when we all know that this would be much cleaner:

class User extends MegaProtoUser[User] with ManyToMany.

But traits aren't like interfaces. They have implementation and would
need to know something about
the parent class they are attached to - and how would you accomplish
that (reflection, maybe). This is
more a Scala issue than a Lift one, I think.

Glenn...


On Aug 5, 8:24 pm, Naftoli Gugenheim  wrote:
> Building causes a stack overflow?
> So the question is, is it the resident compiler or plain scalac also crashes? 
> Or just the presentation compiler? What do you see in the error log view or 
> file?
> I get compiler crashes very often when doing fancy mapper type related tricks.
>
> -
>
> glenn wrote:
>
> Naftoli,
>
> Hate to do this to you, but I'm getting the following error using
> ManyToMany for Users to Roles:
>
> Message: java.lang.RuntimeException: Broken join
>         scala.Predef$.error(Predef.scala:76)
>         net.liftweb.mapper.ManyToMany$MappedManyToMany$$anonfun$children$1$
> $anonfun$apply$1.apply(ManyToMany.scala:54)
>         net.liftweb.mapper.ManyToMany$MappedManyToMany$$anonfun$children$1$
> $anonfun$apply$1.apply(ManyToMany.scala:54)
>         net.liftweb.util.EmptyBox.openOr(Box.scala:372)
>         net.liftweb.mapper.ManyToMany$MappedManyToMany$$anonfun$children
> $1.apply(ManyToMany.scala:54)
>         net.liftweb.mapper.ManyToMany$MappedManyToMany$$anonfun$children
> $1.apply(ManyToMany.scala:54)
>         scala.List.map(List.scala:812)
>         net.liftweb.mapper.ManyToMany$MappedManyToMany.children
> (ManyToMany.scala:54)
>         net.liftweb.mapper.ManyToMany$MappedManyToMany.elements
> (ManyToMany.scala:96)
>         scala.Seq$class.flatMap(Seq.scala:293)
>         net.liftweb.mapper.ManyToMany$MappedManyToMany.flatMap
> (ManyToMany.scala:44)
>
>  def edit(ns: NodeSeq): NodeSeq = {
>     val theUser = view.entity
>     val addRole = TheBindParam("insert", view.snippet.link("edit", ()
> => theUser.roles += new Role, Text(S?("Add Role"
>
>     bind("user", ns,
>          "firstname" -> text(theUser.firstName.is, theUser.firstName
> (_), ("size","20")),
>          "lastname" -> text(theUser.lastName.is,theUser.lastName(_),
> ("size", "30")),
>          "roles" -> theUser.roles.flatMap{role =>
>               bind("role", ns,
>                   "name" -> role.name.toForm,
>                   "remove" -> SHtml.submit(S?("Remove"), ()=>
> theUser.roles -= role)
>               )
>           },
>          addRole,
>          "submit" -> SHtml.submit(S?("Save"), ()=>view.save)
>          )
>     }
>
> The offending code seems to be the line: "roles" ->
> theUser.roles.flatMap{
> in the above bind method when I click on the addRole link.
>
> Here's my User class:
>
> class User extends MegaProtoUser[User] with ManyToMany[Long,User]{
>   def getSingleton = User // what's the "meta" server
>
>    object roles
>     extends MappedManyToMany(UserRole, UserRole.user, UserRole.role,
> Role)
>
> }
>
> What am I doing wrong? You can see how difficult it is to slog through
> this code, let alone just
> trying to explain the problem so I can get help.
>
> On Aug 5, 9:57 am, Naftoli Gugenheim  wrote:
>
> > I'll try.
> > By the way, as per my correction, you can implement list the regular way 
> > without ModelView, and just use ModelSnippet's load function in your edit 
> > link or button, passing it the User instance.
>
> > -
>
> > glenn wrote:
>
> > Naftoli,
>
> > I fixed my code per your comments and now I can edit and remove users
> > from a list, as long as I populate the list with
> > ModelView instances, as you said. As for the docs, this step was not
> > clear to me at all. I just assumed that the list was
> > just populated with User entities and the view in the ModelSnippet was
> > instantiated with the selected User on each request.
>
> > It sounds like your plate is pretty full, so I won't expect much, but
> > sometime soon, could you provide an example, or improved
> > docs, for using TableEditor and its related ItemsList trait.
>
> > Thanks for all.
>
> > Glenn...
>
> > On Aug 5, 9:18 am, Naftoli Gugenheim  wrote:
>
> > > Correction: ModelSnippet.load takes the actual Mapper instance, not the 
> > > ModelView wrapper.
>
> > > -
>
> > > Naftoli Gugenheim wrote:
>
> > > To answer your immediate question, the listing 

[Lift] SOAP web services?

2009-08-06 Thread Jacek Furmankiewicz

I was reading through the Lift book PDF and it mentions only REST-
style web services.

In our case, we need to look at re-implementing a set of existing SOAP
web services (is there anything like 'wsdl2scala' anywhere?).

I would appreciate any best practices and suggestions for implementing
SOAP web services in the context of a larger Lift app (and Scala in
general).

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



[Lift] Re: Alternate part of view

2009-08-06 Thread David Pollak
I really need to see the resulting view code that you'd like to see
depending on the conditions.

On Thu, Aug 6, 2009 at 7:47 AM, Naftoli Gugenheim wrote:

>
> No, I meant that this pattern of parts of the view being alternatives to
> each other repeats, in other words the view has several pairs of
> alternatives.


I don't understand why the example doesn't allow for alternatives that
repeat.


>
>
> -
> David Pollak wrote:
>
> On Wed, Aug 5, 2009 at 8:44 PM, Naftoli Gugenheim  >wrote:
>
> >
> > What's the smartest / most concise way to achieve the following in the
> > corresponding view xhtml and snippet code:
> > Parts of the view have to change, depending on whether something is set.
> > For example, in the area where you select the client, if the client is
> None,
> > then it displays an interface to select a client. If it's set to a Some
> then
> > it displays the client's details with a button to unset it. This pattern
> is
> > repeated.
> > My current strategy is to have two elements, req:noClient and req:client,
> > which have different xhtml contents. Then in the snippet I bind them to
> two
> > NodeSeq functions, one that binds useful contents when the client is None
> > and returns NodeSeq.Empty otherwise; and another function that binds when
> > it's a Some and returns Empty otherwise. However, it seems to be somewhat
> > redundant in theory.
> > So does anyone have a better way of switching view parts?
>
>
> If it's repeated, then  the part that you need.
>
> 
>  
>  
> 
>
>
>
> >
> > Thanks.
> >
> >
> >
> > >
> >
>
>
> --
> Lift, the simply functional web framework http://liftweb.net
> Beginning Scala http://www.apress.com/book/view/1430219890
> Follow me: http://twitter.com/dpp
> Git some: http://github.com/dpp
>
>
>
> >
>


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

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



[Lift] Re: Alternate part of view

2009-08-06 Thread Naftoli Gugenheim

No, I meant that this pattern of parts of the view being alternatives to each 
other repeats, in other words the view has several pairs of alternatives.

-
David Pollak wrote:

On Wed, Aug 5, 2009 at 8:44 PM, Naftoli Gugenheim wrote:

>
> What's the smartest / most concise way to achieve the following in the
> corresponding view xhtml and snippet code:
> Parts of the view have to change, depending on whether something is set.
> For example, in the area where you select the client, if the client is None,
> then it displays an interface to select a client. If it's set to a Some then
> it displays the client's details with a button to unset it. This pattern is
> repeated.
> My current strategy is to have two elements, req:noClient and req:client,
> which have different xhtml contents. Then in the snippet I bind them to two
> NodeSeq functions, one that binds useful contents when the client is None
> and returns NodeSeq.Empty otherwise; and another function that binds when
> it's a Some and returns Empty otherwise. However, it seems to be somewhat
> redundant in theory.
> So does anyone have a better way of switching view parts?


If it's repeated, then  the part that you need.


  
  




>
> Thanks.
>
>
>
> >
>


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



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



[Lift] IE8 and single-field forms

2009-08-06 Thread Ryan Donahue

Apparently if your form has only one text field (input tag w/
type=text) and one button tag, IE8 does not include the button as a
field in the post, but only includes the text field.  Here's the IE8
bug report:
https://connect.microsoft.com/IE/feedback/ViewFeedback.aspx?FeedbackID=389736

The result is that my function that is bound to the button is not
called when processing the post.  I've worked around it by adding
another input tag of type=text and style=display:none (hidden field
didn't fix it).

Anyway, just wanted to post a heads up and see if anybody else has
come across this.

The relevant code is below.

Template:


  
Confirm Email Address
First, we need to confirm your email address so we know it's
yours.
Email Address:

  



Snippet:

//note that my SForm.button is just the same as SHtml.submit but I use
a button instead of input w/ type=submit

  def sendConfirmation(xhtml:NodeSeq) : NodeSeq = {

def doConfirm() : Any = {
  if (email.is.length > 0) {
try {
  MemberSystem.confirmEmailAddress(email.is)
  notice("Your confirmation email will be sent in a few
moments.")
  hideForms.set(true)
}
catch {
  case MemberSystem.InvalidEmailAddressException(msg) =>
error("The email address you provided "+msg)
  case MemberSystem.EmailAddressAlreadyInUseException =>
error("The email address you provided is already being
used by another member")
  case _ =>
error("We were unable to send to this email address,
please try another")
}
  }
  else { error ("Email address is required") ; Empty}
}

if (!hideForms.is)
  bind("signup", xhtml,
   "email" -> FocusOnLoad(SForm.text(email.is, email(_))),
   "submit" -> SForm.button("Send Confirmation", doConfirm))
else Nil

  }


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



[Lift] Re: Title function

2009-08-06 Thread Derek Chen-Becker
Putting it in an "object" won't work, since you probably want the title to
be done per-request.  To clarify what I'm saying, here's a small example of
how I would set the title for an edit page:

First, the template:


  

  

  
Type stuff here:


  


Then the snippet class:

class Info {
  object toEdit extends RequestVar[Box[InfoStuff]](Empty)

  def title(ignore : NodeSeq) : NodeSeq = Text(toEdit map ("Edit " + _.name)
openOr "No item to edit!")

  def edit (xhtml : NodeSeq) : NodeSeq = ...
}

This assumes that whatever page is redirecting to the edit page will set the
RequestVar, something like:

S.redirectTo("/edit", () => Info.toEdit(Full(someInfoStuffInstance)))

Does that make sense?

Derek

On Wed, Aug 5, 2009 at 11:14 AM, Naftoli Gugenheim wrote:

>
> You mean the snippet should put its new/edit flag somewhere that the Title
> can read, like a top level object? Then it doesn't need to be an AnyVar
> because it can be set on every request, if Title is processed after the
> snippet in each request--and if not then I don't see how a RequestVar etc.
> would work.
> Seems like it may be more work than the other way, though.
> By the way I sent corrected message afterward--my question was not about
> LocParams but of the items of type ParamType.
>
> -
> Derek Chen-Becker wrote:
>
> If you're just looking for a way to programmatically set the title, getting
> into LocParam might be a little bit of overkill. It's probably simpler to
> set up your own SessionVars or RequestVars and access them from the Title
> closure:
>
>
> http://scala-tools.org/scaladocs/liftweb/1.0/net/liftweb/sitemap/Loc/Title.html
>
> Derek
>
> On Wed, Aug 5, 2009 at 9:45 AM, Naftoli Gugenheim  >wrote:
>
> >
> >
> > -
> > Naftoli Gugenheim wrote:
> >
> > So what I'm not clear on now is the input to Title. What is a LocParam,
> and
> > how do you you use loc params? What is forceParam, defaultParams, param,
> and
> > foundParam? And in any case how can Title know the value of the
> registered
> > StatefulSnippet's newOrEdit state?
> > Thanks!
> >
> > -
> > David Pollak wrote:
> >
> > On Tue, Aug 4, 2009 at 12:47 PM, Naftoli Gugenheim  > >wrote:
> >
> > > Maybe my setup is atypical then :)
> > > My default.html is does not have a title tag; instead each view has its
> > > own, relying on head merge.
> > > I don't know if originally I had it in default using lift:Menu.title or
> > > not, but the difficulty with that would be that some pages can be used
> to
> > > edit or add a new item, and the title needs to reflect that.
> >
> >
> > Because the Title() case class takes a function, you can have it do all
> > forms of stuff including looking to the current user, whether you're
> > editing, and "do the right thing".
> >
> >
> > >
> > > So either (1) I need a way that the value of Menu.title will depend on
> > data
> > > in various StatefulSnippets; or (2) make the title ambiguous (add/edit
> > > neutral); or (3) leave the titles in the views and process them with a
> > > function somehow; or (4) put a snippet in the title of every view to
> get
> > the
> > > user.
> > >
> > >
> > >
> > > -
> > > David Pollak wrote:
> > >
> > > On Sun, Aug 2, 2009 at 4:35 PM, Naftoli Gugenheim <
> naftoli...@gmail.com
> > > >wrote:
> > >
> > > >
> > > > How does the Title LocParam work?
> > >
> > >
> > > The Title case class has a function that converts the current object
> > > associated with the Loc into a String representing the title of the
> page
> > > represented by the Loc.
> > >
> > >
> > > >
> > > > Is there a way to modify all titles to e.g. include the logged in
> > user's
> > > > name, without having to edit all the views?
> > >
> > >
> > > The  tag is typically defined in the default template.  You
> could
> > > include a snippet in the  tag that would contain the user's
> name.
> >  I
> > > would see this as separate from the title of the specific page referred
> > to
> > > by the Loc.Title.
> > >
> > >
> > > >
> > > >
> > > > >
> > > >
> > >
> > >
> > > --
> > > Lift, the simply functional web framework http://liftweb.net
> > > Beginning Scala http://www.apress.com/book/view/1430219890
> > > Follow me: http://twitter.com/dpp
> > > Git some: http://github.com/dpp
> > >
> > > >
> > >
> >
> >
> > --
> > Lift, the simply functional web framework http://liftweb.net
> > Beginning Scala http://www.apress.com/book/view/1430219890
> > Follow me: http://twitter.com/dpp
> > Git some: http://github.com/dpp
> >
> > >
> >
>
>
>
> >
>

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

[Lift] Re: More than one in HTML file

2009-08-06 Thread Timothy Perrett


Haha yeah... With-param has had somewhat of a chequered past! Its here to
stay for the time being though so don't worry about using it.

Cheers, Tim

On 06/08/2009 13:48, "marius d."  wrote:

> 
> 
> 
> On Aug 6, 3:46 pm, pabraham  wrote:
>> Thanks everyone.  I can get things to work now using > param ...>
>> 
>> However, I found a post[1] by DPP that says that 
>> is deprecated.  Is this true?
> 
> We tried to deprecate it a little while ago but AFAIK it's not
> deprecated anymore.
> 
>> 
>> Regards,
>> 
>> Paul.
>> 
>> [1]http://article.gmane.org/gmane.comp.web.lift/820
>> 
>> On Aug 5, 10:55 pm, Timothy Perrett  wrote:
>> 
>>> Marius is right, use with-param... That's the correct solution here.
>> 
>>> Cheers, Tim
>> 
>>> On 05/08/2009 22:19, "pabraham"  wrote:
>> 
 I've added  to my index.html file and now get:
>> 
 XML Parsing Error: junk after document element
 Location:http://192.168.96.150:8080/
 Line Number 113, Column 1:http://liftweb.net/";
 xmlns="http://www.w3.org/1999/xhtml";>
 ^
>> 
 Any ideas?
>> 
 In the meantime I can look at .
>> 
 Paul.
>> 
 On 5 Aug, 22:08, Naftoli Gugenheim  wrote:
> XML documents need to have a single top-level element. Surround the whole
> index.html with lift:children.
>> 
> -
>> 
> pabraham wrote:
>> 
> Hello there,
>> 
> Is it possible for an HTML file to have more than one lift:surround
> tag?
>> 
> For example, default.html contains
>> 
> ...
> 
> ...
> 
> ...
>> 
> My index.html contains
>> 
> 
>   This is some content
> 
> 
>   This is some content in the sidebar
> 
>> 
> From my fruitless attempts, it seems that the answer to my question is
> no, but is there any way that I can get this sort of thing to work?
>> 
> Thanks.
>> 
> Paul.
> > 
> 



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



[Lift] Re: More than one in HTML file

2009-08-06 Thread David Pollak
On Thu, Aug 6, 2009 at 5:48 AM, marius d.  wrote:

>
>
>
> On Aug 6, 3:46 pm, pabraham  wrote:
> > Thanks everyone.  I can get things to work now using  > param ...>
> >
> > However, I found a post[1] by DPP that says that 
> > is deprecated.  Is this true?
>
> We tried to deprecate it a little while ago but AFAIK it's not
> deprecated anymore.


I dislike it and don't see a reason for it.  Others do.  I lose. ;-)


>
>
> >
> > Regards,
> >
> > Paul.
> >
> > [1]http://article.gmane.org/gmane.comp.web.lift/820
> >
> > On Aug 5, 10:55 pm, Timothy Perrett  wrote:
> >
> > > Marius is right, use with-param... That's the correct solution here.
> >
> > > Cheers, Tim
> >
> > > On 05/08/2009 22:19, "pabraham"  wrote:
> >
> > > > I've added  to my index.html file and now get:
> >
> > > > XML Parsing Error: junk after document element
> > > > Location:http://192.168.96.150:8080/
> > > > Line Number 113, Column 1:http://liftweb.net/";
> > > > xmlns="http://www.w3.org/1999/xhtml";>
> > > > ^
> >
> > > > Any ideas?
> >
> > > > In the meantime I can look at .
> >
> > > > Paul.
> >
> > > > On 5 Aug, 22:08, Naftoli Gugenheim  wrote:
> > > >> XML documents need to have a single top-level element. Surround the
> whole
> > > >> index.html with lift:children.
> >
> > > >> -
> >
> > > >> pabraham wrote:
> >
> > > >> Hello there,
> >
> > > >> Is it possible for an HTML file to have more than one lift:surround
> > > >> tag?
> >
> > > >> For example, default.html contains
> >
> > > >> ...
> > > >> 
> > > >> ...
> > > >> 
> > > >> ...
> >
> > > >> My index.html contains
> >
> > > >> 
> > > >>   This is some content
> > > >> 
> > > >> 
> > > >>   This is some content in the sidebar
> > > >> 
> >
> > > >> From my fruitless attempts, it seems that the answer to my question
> is
> > > >> no, but is there any way that I can get this sort of thing to work?
> >
> > > >> Thanks.
> >
> > > >> Paul.
> >
>


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

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



[Lift] Re: Alternate part of view

2009-08-06 Thread David Pollak
On Wed, Aug 5, 2009 at 8:44 PM, Naftoli Gugenheim wrote:

>
> What's the smartest / most concise way to achieve the following in the
> corresponding view xhtml and snippet code:
> Parts of the view have to change, depending on whether something is set.
> For example, in the area where you select the client, if the client is None,
> then it displays an interface to select a client. If it's set to a Some then
> it displays the client's details with a button to unset it. This pattern is
> repeated.
> My current strategy is to have two elements, req:noClient and req:client,
> which have different xhtml contents. Then in the snippet I bind them to two
> NodeSeq functions, one that binds useful contents when the client is None
> and returns NodeSeq.Empty otherwise; and another function that binds when
> it's a Some and returns Empty otherwise. However, it seems to be somewhat
> redundant in theory.
> So does anyone have a better way of switching view parts?


If it's repeated, then  the part that you need.


  
  




>
> Thanks.
>
>
>
> >
>


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

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



[Lift] Re: More than one in HTML file

2009-08-06 Thread marius d.



On Aug 6, 3:46 pm, pabraham  wrote:
> Thanks everyone.  I can get things to work now using  param ...>
>
> However, I found a post[1] by DPP that says that 
> is deprecated.  Is this true?

We tried to deprecate it a little while ago but AFAIK it's not
deprecated anymore.

>
> Regards,
>
> Paul.
>
> [1]http://article.gmane.org/gmane.comp.web.lift/820
>
> On Aug 5, 10:55 pm, Timothy Perrett  wrote:
>
> > Marius is right, use with-param... That's the correct solution here.
>
> > Cheers, Tim
>
> > On 05/08/2009 22:19, "pabraham"  wrote:
>
> > > I've added  to my index.html file and now get:
>
> > > XML Parsing Error: junk after document element
> > > Location:http://192.168.96.150:8080/
> > > Line Number 113, Column 1:http://liftweb.net/";
> > > xmlns="http://www.w3.org/1999/xhtml";>
> > > ^
>
> > > Any ideas?
>
> > > In the meantime I can look at .
>
> > > Paul.
>
> > > On 5 Aug, 22:08, Naftoli Gugenheim  wrote:
> > >> XML documents need to have a single top-level element. Surround the whole
> > >> index.html with lift:children.
>
> > >> -
>
> > >> pabraham wrote:
>
> > >> Hello there,
>
> > >> Is it possible for an HTML file to have more than one lift:surround
> > >> tag?
>
> > >> For example, default.html contains
>
> > >> ...
> > >> 
> > >> ...
> > >> 
> > >> ...
>
> > >> My index.html contains
>
> > >> 
> > >>   This is some content
> > >> 
> > >> 
> > >>   This is some content in the sidebar
> > >> 
>
> > >> From my fruitless attempts, it seems that the answer to my question is
> > >> no, but is there any way that I can get this sort of thing to work?
>
> > >> Thanks.
>
> > >> Paul.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: More than one in HTML file

2009-08-06 Thread pabraham


Firefox 3.5.2

Funnily enough, I can't right click to view source, but Ctrl+U works.

The first lines are:



http://liftweb.net/"; xmlns="http://www.w3.org/1999/
xhtml">

I don't see anything funny there.

Paul.


On Aug 5, 10:23 pm, Naftoli Gugenheim  wrote:
> Which browser gives that error? What do you see in View Source?
>
> -
>
> pabraham wrote:
>
> I've added  to my index.html file and now get:
>
> XML Parsing Error: junk after document element
> Location:http://192.168.96.150:8080/
> Line Number 113, Column 1:http://liftweb.net/";
> xmlns="http://www.w3.org/1999/xhtml";>
> ^
>
> Any ideas?
>
> In the meantime I can look at .
>
> Paul.
>
> On 5 Aug, 22:08, Naftoli Gugenheim  wrote:
>
> > XML documents need to have a single top-level element. Surround the whole 
> > index.html with lift:children.
>
> > -
>
> > pabraham wrote:
>
> > Hello there,
>
> > Is it possible for an HTML file to have more than one lift:surround
> > tag?
>
> > For example, default.html contains
>
> > ...
> > 
> > ...
> > 
> > ...
>
> > My index.html contains
>
> > 
> >   This is some content
> > 
> > 
> >   This is some content in the sidebar
> > 
>
> > From my fruitless attempts, it seems that the answer to my question is
> > no, but is there any way that I can get this sort of thing to work?
>
> > Thanks.
>
> > Paul.

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



[Lift] Re: More than one in HTML file

2009-08-06 Thread pabraham

Thanks everyone.  I can get things to work now using 

However, I found a post[1] by DPP that says that 
is deprecated.  Is this true?

Regards,

Paul.

[1] http://article.gmane.org/gmane.comp.web.lift/820


On Aug 5, 10:55 pm, Timothy Perrett  wrote:
> Marius is right, use with-param... That's the correct solution here.
>
> Cheers, Tim
>
> On 05/08/2009 22:19, "pabraham"  wrote:
>
>
>
> > I've added  to my index.html file and now get:
>
> > XML Parsing Error: junk after document element
> > Location:http://192.168.96.150:8080/
> > Line Number 113, Column 1:http://liftweb.net/";
> > xmlns="http://www.w3.org/1999/xhtml";>
> > ^
>
> > Any ideas?
>
> > In the meantime I can look at .
>
> > Paul.
>
> > On 5 Aug, 22:08, Naftoli Gugenheim  wrote:
> >> XML documents need to have a single top-level element. Surround the whole
> >> index.html with lift:children.
>
> >> -
>
> >> pabraham wrote:
>
> >> Hello there,
>
> >> Is it possible for an HTML file to have more than one lift:surround
> >> tag?
>
> >> For example, default.html contains
>
> >> ...
> >> 
> >> ...
> >> 
> >> ...
>
> >> My index.html contains
>
> >> 
> >>   This is some content
> >> 
> >> 
> >>   This is some content in the sidebar
> >> 
>
> >> From my fruitless attempts, it seems that the answer to my question is
> >> no, but is there any way that I can get this sort of thing to work?
>
> >> Thanks.
>
> >> Paul.

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



[Lift] Re: Asynchronous Javascript problem

2009-08-06 Thread Channing Walton

I've added a much simpler example too, see simple.html
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---