[Lift] Documentation for 1.1

2009-12-07 Thread Randinn
I am writing here to get a dialog going about the changes from 1.0 to
1.1. I mistakenly filed a ticket on the subject but was wondering if
there could be some documentation done with all of the new/changed
features in 1.1. Most of the time the changes and additions are
mentioned here but there are times that a feature is added and it's
only talked about when someone asks about it. I was wondering if a
current commiter or possibly bring one on board with the idea of
fleshing out the documentation.

--

You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@googlegroups.com.
To unsubscribe from 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] Next Lift version will be 2.0

2009-12-07 Thread Heiko Seeberger
Lifters,

Maybe you followed the discussion about the versioning policy for Lift. The
committers finally decided to have a well defined versioning policy which
you can take from here:
http://wiki.github.com/dpp/liftweb/about-versioning-policy.

Following this policy the next Lift version will be 2.0, not 1.1, because
there are numerous changes and enhancements breaking the source
compatibility. As soon as we change the version numbers in the Maven POMs,
we will let you know via the lift-announce mailing list.

Best regards,

Heiko

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

--

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




Re: [Lift] seeing JVM BUG(s) - cancelling interestOps==0

2009-12-07 Thread Xuefeng Wu
Hi David,
   Thank you for your reply.

On Mon, Dec 7, 2009 at 2:27 PM, David Pollak
feeder.of.the.be...@gmail.comwrote:



 On Sun, Dec 6, 2009 at 10:21 PM, Xuefeng Wu ben...@gmail.com wrote:

 Hi,

 I always find the information from console:  seeing JVM BUG(s) -
 cancelling interestOps==0

 What's the reason?

 I use jetty 6.1.21, and I'm afraid it will cause serious error if I deploy
 the liftweb app in IBM WAS(WebSphere  App Server)


 http://dev.eclipse.org/mhonarc/lists/jetty-commit/msg00154.html

 Looks like Jetty is detecting and working around a bug in the JVM:
 http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6403933



 --
 Scala中文社区:  http://groups.google.com/group/scalacn

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




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

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




-- 
Scala中文社区:  http://groups.google.com/group/scalacn

--

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




Re: [Lift] Next Lift version will be 2.0

2009-12-07 Thread Timothy Perrett
Heiko,

This is great - can you work with IRC to arrange a time to changes the poms to 
2.0-SNAPSHOT?

Cheers, Tim

On 7 Dec 2009, at 08:32, Heiko Seeberger wrote:

 Lifters,
 
 Maybe you followed the discussion about the versioning policy for Lift. The 
 committers finally decided to have a well defined versioning policy which you 
 can take from here: 
 http://wiki.github.com/dpp/liftweb/about-versioning-policy.
 
 Following this policy the next Lift version will be 2.0, not 1.1, because 
 there are numerous changes and enhancements breaking the source 
 compatibility. As soon as we change the version numbers in the Maven POMs, we 
 will let you know via the lift-announce mailing list.
 
 Best regards,
 
 Heiko
 
 My job: weiglewilczek.com
 My blog: heikoseeberger.name
 Follow me: twitter.com/hseeberger
 OSGi on Scala: scalamodules.org
 Lift, the simply functional web framework: liftweb.net
 
 --
 
 You received this message because you are subscribed to the Google Groups 
 Lift group.
 To post to this group, send email to lift...@googlegroups.com.
 To unsubscribe from this group, send email to 
 liftweb+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/liftweb?hl=en.

--

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




Re: [Lift] Documentation for 1.1

2009-12-07 Thread Timothy Perrett
Randinn,

This is already slated for 1.1/2.0 release... dont worry we are getting to it 
:-)

Cheers, Tim

On 7 Dec 2009, at 08:09, Randinn wrote:

 I am writing here to get a dialog going about the changes from 1.0 to
 1.1. I mistakenly filed a ticket on the subject but was wondering if
 there could be some documentation done with all of the new/changed
 features in 1.1. Most of the time the changes and additions are
 mentioned here but there are times that a feature is added and it's
 only talked about when someone asks about it. I was wondering if a
 current commiter or possibly bring one on board with the idea of
 fleshing out the documentation.
 
 --
 
 You received this message because you are subscribed to the Google Groups 
 Lift group.
 To post to this group, send email to lift...@googlegroups.com.
 To unsubscribe from this group, send email to 
 liftweb+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/liftweb?hl=en.
 
 
 

--

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




[Lift] How do I go about implementing my own auth?

2009-12-07 Thread DMB
Basically here's what I want to accomplish:
1. I want the user to login through a simple form on /index.html -
this is the only unprotected page on the site. User does not have a
user name, the only field is a password.
2. I want to store the user role (along with some other state data) in
the user session
3. If user tries to access any page other than index.html, I want to
redirect to /index.html

After stumbling for a while due to scarcity of documentation, I have
done the following:

In Boot.scala:

LiftRules.httpAuthProtectedResource.prepend {
case ParsePath(index :: Nil, html, true, false) =
Empty
case _ = Full(AuthRole(admin))
}

LiftRules.authentication = SessionAuthentication()

InSessionAuthentication.scala:

case class SessionAuthentication extends HttpAuthentication {

def verified_? = { case(req) = {
// TODO: Prefetch from DB here
true
}
}
}

It is my understanding that this should not ask for auth at all. In
reality, it doesn't ask for auth on /index.html, but DOES ask for
Basic auth (through a browser popup) on any other page.

What am I doing wrong, and how do I make it right?

--

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




Re: [Lift] Managing templates with associated snippets?

2009-12-07 Thread Ilya Sergey
Hi Liam.

To the best of my knowledge, there is no any plugin for IntelliJ which
supports some Lift-specific functionality.
So it would be great if one stated what kind of Lift support must be present
in the working Scala plugin.

Cheers!
Ilya

2009/12/6 Liam Clarke ml.cyre...@gmail.com

 Hi all,

 I'm quite new to Lift, just working my way through a basic web-app
 using the book, and my background is Django for fun, and Wicket at
 work, so I'm probably writing code that resembles both of those, but
 isn't necessarily ideal for Lift.

 I was just wondering about how experienced Lift users manage their
 snippets and templates - do you, as a matter of course break them down
 into components, where one template corresponds to one snippet method
 call, like Wicket's panels, or is it normal to only separate out
 repeatedly used snippet templates, and just inline the one-use ones?

 I'm asking because I note that I changed the prefix used on the inner
 children of a template, my binding in the snippet will break, so
 there's a tight coupling there, which is fine, but I just want to be
 able to represent that coupling in my code's structure, sorta like how
 a Wicket component's mark-up has the same name as the class and occurs
 right beside it in the package.

 Also, I'm using Intellij IDEA 8, which is near seamless with the Scala
 and Maven support, but is there any additional Lift specific plugins
 about for Intellij? I can't find any, but I figure there might be an
 early alpha about - I only really want one for making Intellij aware
 of the template/snippet bindings.

 Thanks in advance,

 Liam Clarke

 --

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




--

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




[Lift] Re: Documentation for 1.1

2009-12-07 Thread TylerWeir
Something like This Week in Lift master would help.
http://suitmymind.com/blog/2009/01/22/this-week-in-edge-cappuccino/

On Dec 7, 5:55 am, Timothy Perrett timo...@getintheloop.eu wrote:
 Randinn,

 This is already slated for 1.1/2.0 release... dont worry we are getting to it 
 :-)

 Cheers, Tim

 On 7 Dec 2009, at 08:09, Randinn wrote:



  I am writing here to get a dialog going about the changes from 1.0 to
  1.1. I mistakenly filed a ticket on the subject but was wondering if
  there could be some documentation done with all of the new/changed
  features in 1.1. Most of the time the changes and additions are
  mentioned here but there are times that a feature is added and it's
  only talked about when someone asks about it. I was wondering if a
  current commiter or possibly bring one on board with the idea of
  fleshing out the documentation.

  --

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

--

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




[Lift] Re: (Maybe it's a bug ?) About the Schedule's execute counts in the ActorComet

2009-12-07 Thread Neil.Lv

   I think maybe it's a bug ~?

   Btw, Does anybody know how to convert the CometActor to LiftActor.

   And how the write the render method and use the ActorPing.schedule
(this, Tick, 10 seconds)
in LiftActor.

   Thanks for any suggestion!

Cheers,
  Neil
###
package com.liftcode.comet

import net.liftweb._
import http._
import js._
import JsCmds._
import net.liftweb.common._
import net.liftweb.util._
import Helpers._
import net.liftweb.http._
import _root_.scala.xml._
import scala.actors._
import scala.collection.mutable.Queue
import net.liftweb.http.SessionVar

case class Foo(getValue: String)

object FooManager {
  private var foos: List[Foo] = Nil
  def getFoos: List[Foo] = synchronized {
println(  foos size:  + foos.size)
foos ::= Foo(System.currentTimeMillis.toString)
foos
  }

}

class MyComet extends CometActor {

  override def defaultPrefix = Full(auth)

  private var foos = FooManager.getFoos

  def createDisplay(foos:List[Foo]):NodeSeq = {
span id=gotable
{
  for {foo - foos} yield trtd{foo.getValue}/td/tr
}

/table/span
  }

  def render = { bind(foo - createDisplay(foos)) }

  override def localSetup = {
println(  localSetup:  )
super.localSetup
this ! Tick
  }

  override def lowPriority = {
case Tick = {
println(   Tick )
  foos = FooManager.getFoos
  reRender(false)
  ActorPing.schedule(this, Tick, 10 seconds)
}
  }

}

case object Tick
###

On Dec 7, 9:40 pm, Neil.Lv anim...@gmail.com wrote:
   Here is the server log,

 ###
 INFO - Service request (GET) /comet_request/27036331510/b0iubsv7usc1
 took 0 Mill
 iseconds
 INFO - Service request (GET) /comet_request/24195135706/1geup5f5uelih
 took 0 Mil
 liseconds
 INFO - Service request (GET) /comet_request/15421125743/b0iubsv7usc1
 took 0 Mill
 iseconds
 INFO - Service request (GET) /comet_request/4886038816/b0iubsv7usc1
 took 15 Mill
 iseconds
 INFO - Service request (GET) /comet_request/70554035677/b0iubsv7usc1
 took 0 Mill
 iseconds
 INFO - Service request (GET) /comet_request/80058340958/b0iubsv7usc1
 took 0 Mill
 iseconds
 INFO - Service request (GET) /comet_request/16073680948/b0iubsv7usc1
 took 0 Mill
 iseconds
 INFO - Service request (GET) /comet_request/48475840285/b0iubsv7usc1
 took 16 Mil
 liseconds
 ###

    I set the time is 10 seconds, but here is wrong.

    Does anybody know about the issue ?

 Cheers,
   Neil

 On Dec 4, 3:00 pm, Neil.Lv anim...@gmail.com wrote:

  Hi all,

     Here is an example code that about the ActorComet.

  ###
  package com.liftcode.comet

  import net.liftweb._
  import http._
  import js._
  import JsCmds._
  import net.liftweb.common._
  import net.liftweb.util._
  import Helpers._
  import net.liftweb.http._
  import _root_.scala.xml._
  import scala.actors._
  import scala.collection.mutable.Queue
  import net.liftweb.http.SessionVar

  case class Foo(getValue: String)

  object FooManager {
    private var foos: List[Foo] = Nil
    def getFoos: List[Foo] = synchronized {
  println(  foos size:  + foos.size)
      foos ::= Foo(System.currentTimeMillis.toString)
      foos
    }

  }

  class MyComet extends CometActor {

    override def defaultPrefix = Full(auth)

    private var foos = FooManager.getFoos

    def createDisplay(foos:List[Foo]):NodeSeq = {
      span id=gotable
      {
        for {foo - foos} yield trtd{foo.getValue}/td/tr
      }

      /table/span
    }

    def render = { bind(foo - createDisplay(foos)) }

    override def localSetup = {
  println(  localSetup:  )
      super.localSetup
      this ! Tick
    }

    override def lowPriority = {
      case Tick = {
  println(   Tick )
        foos = FooManager.getFoos
        reRender(false)
        ActorPing.schedule(this, Tick, 10 seconds)
      }
    }

  }

  case object Tick
  ###

     When i run  mvn jetty:run  to start the server, and type 
  thehttp://localhost:8080inthe browser.
  The result will be like this, the println(   Tick ) method
  only execute 1 time every 10 seconds.

  ###
  INFO - Service request (GET) /comet_request/50054201120/farmqqw03xkm
  took 46 Mil
  liseconds
     Tick 
    foos size: 2
  INFO - Service request (GET) /comet_request/87077494133/farmqqw03xkm
  took 8625 M
  ###

     Then i don't close the browser, and Ctrl+C stop the jetty server,
  and  mvn jetty:run  restart the server, the result will be like this:
  The  println(   Tick ) method will be execute 3 times every
  10 seconds.

  ###
  INFO - Service request (GET) /comet_request/74875169086/farmqqw03xkm
  took 0 Mill
  iseconds
    foos size: 8
    localSetup:
     Tick 
    foos size: 9
  INFO - Service request (GET) / took 109 Milliseconds
    foos size: 10
    localSetup:
     Tick 
    foos size: 11
  INFO - Service request (GET) / took 31 Milliseconds
  ###

     I don't know what's wrong with it .
     If when you stop the 

[Lift] Re: How do I go about implementing my own auth?

2009-12-07 Thread Marius


On Dec 7, 1:09 pm, DMB combust...@gmail.com wrote:
 Basically here's what I want to accomplish:
 1. I want the user to login through a simple form on /index.html -
 this is the only unprotected page on the site. User does not have a
 user name, the only field is a password.
 2. I want to store the user role (along with some other state data) in
 the user session
 3. If user tries to access any page other than index.html, I want to
 redirect to /index.html

 After stumbling for a while due to scarcity of documentation, I have
 done the following:

 In Boot.scala:

         LiftRules.httpAuthProtectedResource.prepend {
             case ParsePath(index :: Nil, html, true, false) =
 Empty
             case _ = Full(AuthRole(admin))
         }

         LiftRules.authentication = SessionAuthentication()

 InSessionAuthentication.scala:

 case class SessionAuthentication extends HttpAuthentication {

     def verified_? = { case(req) = {
                 // TODO: Prefetch from DB here
                 true
             }
     }

 }

 It is my understanding that this should not ask for auth at all. In
 reality, it doesn't ask for auth on /index.html, but DOES ask for
 Basic auth (through a browser popup) on any other page.

 What am I doing wrong, and how do I make it right?

Your are seeing the browser's credentials popup because of :

  def unauthorizedResponse: UnauthorizedResponse = UnauthorizedResponse
(realm)

from HttpAuthentication trait. You can override this and subclass
UnauthorizedResponse with your own LiftResponse if you want other type
of response than 401. You can also protect your resources using
HttpAuthProtected LocParam that you can use when you specify your
SiteMap in the Loc construction.

This is one approach.

Another one, probably more suitable for login forms, is to look into
Mapper support for that (I think it's called MetaMegaProtoUser ? )

--

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




Re: [Lift] Next Lift version will be 2.0

2009-12-07 Thread David Pollak
Heiko,

Thank you for shepherding this issue through and giving us a sane and well
defined naming process.

Thanks,

David

On Mon, Dec 7, 2009 at 12:32 AM, Heiko Seeberger 
heiko.seeber...@googlemail.com wrote:

 Lifters,

 Maybe you followed the discussion about the versioning policy for Lift. The
 committers finally decided to have a well defined versioning policy which
 you can take from here:
 http://wiki.github.com/dpp/liftweb/about-versioning-policy.

 Following this policy the next Lift version will be 2.0, not 1.1, because
 there are numerous changes and enhancements breaking the source
 compatibility. As soon as we change the version numbers in the Maven POMs,
 we will let you know via the lift-announce mailing list.

 Best regards,

 Heiko

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

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




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

--

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




[Lift] re: error when using maven to create LIFT project

2009-12-07 Thread James Black
For some reason I am having an error while trying to create my project. It
appears I need a JPA project, as this project will have many tables
involved, but I get the same error when I try:
lift-archetype-jpa-basic
   -blank
-basic
-blank

I have also tried -Dversion=1.1-SNAPSHOT, but that also didn't work.

If it matters here is the result for
mvn -v
Apache Maven 2.2.0 (r788681; 2009-06-26 09:04:01-0400)
Java version: 1.6.0_16
Java home: C:\Program Files\Java\jdk1.6.0_16\jre
Default locale: en_US, platform encoding: Cp1252
OS name: windows vista version: 6.0 arch: amd64 Family: windows

mvn archetype:generate -U -B -DarchetypeRepository=
http://scala-tools.org/repo-snapshots -DremoteRepositories=
http://scala-tools.org/repo-snapshots -DarchetypeGroupId=net.liftweb
-DarchetypeArtifactId=lift-archetype-jpa-basic
-DarchetypeVersion=1.1-SNAPSHOT -DgroupId=jblack.resumeapp.lift
-DartifactId=ResumeApp -Dversion=1.0-SNAPSHOT

[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'archetype'.
[INFO] org.apache.maven.plugins: checking for updates from central
[INFO] org.codehaus.mojo: checking for updates from central
[INFO] artifact org.apache.maven.plugins:maven-archetype-plugin: checking
for updates from central
[INFO]

[INFO] Building Maven Default Project
[INFO]task-segment: [archetype:generate] (aggregator-style)
[INFO]

[INFO] Preparing archetype:generate
[INFO] No goals needed for project - skipping
[INFO] Setting property: classpath.resource.loader.class =
'org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader'.
[INFO] Setting property: velocimacro.messages.on = 'false'.
[INFO] Setting property: resource.loader = 'classpath'.
[INFO] Setting property: resource.manager.logwhenfound = 'false'.
[INFO] [archetype:generate {execution: default-cli}]
[INFO] Generating project in Batch mode
[INFO] Archetype defined by properties
[INFO] snapshot net.liftweb:lift-archetype-jpa-basic:1.1-SNAPSHOT: checking
for updates from lift-archetype-jpa-basic-repo
Downloading:
http://scala-tools.org/repo-snapshots/net/liftweb/lift-archetype-jpa-basic/1.1-SNAPSHOT/lift-archetype-jpa-basic-1.1-SNAPSHOT.jar
[WARNING] PT Don't override file C:\Users\owner\workspace\ResumeApp\pom.xml
[INFO]

[INFO] BUILD SUCCESSFUL
[INFO]

[INFO] Total time: 9 seconds
[INFO] Finished at: Mon Dec 07 10:07:13 EST 2009
[INFO] Final Memory: 15M/106M
[INFO]


--

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




Re: [Lift] re: error when using maven to create LIFT project

2009-12-07 Thread Indrajit Raychaudhuri
James,

1. For the kind of application you have in mind you can use either 
mapper or jpa. So either lift-archetype-basic or 
lift-archetype-jpa-basic would do.

2. You have indeed used the right command and have created the project 
successfully. Next up:

(a) You should see the ResumeApp directory containing your project. Move 
to that directory and execute mvn install. This should compile package 
and install the application (including the two packages spa and web that 
resides inside).

(b) Once done, move to the sub-directory web and execute mvn jetty:run.

(c) Finally, visit the url http://localhost:9090/ and profit!

Cheers, Indrajit

On 07/12/09 8:45 PM, James Black wrote:
 For some reason I am having an error while trying to create my project.
 It appears I need a JPA project, as this project will have many tables
 involved, but I get the same error when I try:
 lift-archetype-jpa-basic
 -blank
  -basic
  -blank

 I have also tried -Dversion=1.1-SNAPSHOT, but that also didn't work.

 If it matters here is the result for
 mvn -v
 Apache Maven 2.2.0 (r788681; 2009-06-26 09:04:01-0400)
 Java version: 1.6.0_16
 Java home: C:\Program Files\Java\jdk1.6.0_16\jre
 Default locale: en_US, platform encoding: Cp1252
 OS name: windows vista version: 6.0 arch: amd64 Family: windows

 mvn archetype:generate -U -B
 -DarchetypeRepository=http://scala-tools.org/repo-snapshots
 -DremoteRepositories=http://scala-tools.org/repo-snapshots
 -DarchetypeGroupId=net.liftweb
 -DarchetypeArtifactId=lift-archetype-jpa-basic
 -DarchetypeVersion=1.1-SNAPSHOT -DgroupId=jblack.resumeapp.lift
 -DartifactId=ResumeApp -Dversion=1.0-SNAPSHOT

 [INFO] Scanning for projects...
 [INFO] Searching repository for plugin with prefix: 'archetype'.
 [INFO] org.apache.maven.plugins: checking for updates from central
 [INFO] org.codehaus.mojo: checking for updates from central
 [INFO] artifact org.apache.maven.plugins:maven-archetype-plugin:
 checking for updates from central
 [INFO]
 
 [INFO] Building Maven Default Project
 [INFO]task-segment: [archetype:generate] (aggregator-style)
 [INFO]
 
 [INFO] Preparing archetype:generate
 [INFO] No goals needed for project - skipping
 [INFO] Setting property: classpath.resource.loader.class =
 'org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader'.
 [INFO] Setting property: velocimacro.messages.on = 'false'.
 [INFO] Setting property: resource.loader = 'classpath'.
 [INFO] Setting property: resource.manager.logwhenfound = 'false'.
 [INFO] [archetype:generate {execution: default-cli}]
 [INFO] Generating project in Batch mode
 [INFO] Archetype defined by properties
 [INFO] snapshot net.liftweb:lift-archetype-jpa-basic:1.1-SNAPSHOT:
 checking for updates from lift-archetype-jpa-basic-repo
 Downloading:
 http://scala-tools.org/repo-snapshots/net/liftweb/lift-archetype-jpa-basic/1.1-SNAPSHOT/lift-archetype-jpa-basic-1.1-SNAPSHOT.jar
 [WARNING] PT Don't override file C:\Users\owner\workspace\ResumeApp\pom.xml
 [INFO]
 
 [INFO] BUILD SUCCESSFUL
 [INFO]
 
 [INFO] Total time: 9 seconds
 [INFO] Finished at: Mon Dec 07 10:07:13 EST 2009
 [INFO] Final Memory: 15M/106M
 [INFO]
 

 --

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

--

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




Re: [Lift] re: error when using maven to create LIFT project

2009-12-07 Thread James Black
Thank you.

 This is a change, at least from what I have been doing.

Before I would run the generate command.
Then cd into my directory and do,  'mvn jetty:run'
I didn't have to do 'mvn install', but now I know.

Thank you very much.

On Mon, Dec 7, 2009 at 10:34 AM, Indrajit Raychaudhuri
indraj...@gmail.comwrote:

 James,

 1. For the kind of application you have in mind you can use either
 mapper or jpa. So either lift-archetype-basic or
 lift-archetype-jpa-basic would do.

 2. You have indeed used the right command and have created the project
 successfully. Next up:

 (a) You should see the ResumeApp directory containing your project. Move
 to that directory and execute mvn install. This should compile package
 and install the application (including the two packages spa and web that
 resides inside).

 (b) Once done, move to the sub-directory web and execute mvn jetty:run.

 (c) Finally, visit the url http://localhost:9090/ and profit!

 Cheers, Indrajit

 On 07/12/09 8:45 PM, James Black wrote:
  For some reason I am having an error while trying to create my project.
  It appears I need a JPA project, as this project will have many tables
  involved, but I get the same error when I try:
  lift-archetype-jpa-basic
  -blank
   -basic
   -blank
 
  I have also tried -Dversion=1.1-SNAPSHOT, but that also didn't work.
 
  If it matters here is the result for
  mvn -v
  Apache Maven 2.2.0 (r788681; 2009-06-26 09:04:01-0400)
  Java version: 1.6.0_16
  Java home: C:\Program Files\Java\jdk1.6.0_16\jre
  Default locale: en_US, platform encoding: Cp1252
  OS name: windows vista version: 6.0 arch: amd64 Family: windows
 
  mvn archetype:generate -U -B
  -DarchetypeRepository=http://scala-tools.org/repo-snapshots
  -DremoteRepositories=http://scala-tools.org/repo-snapshots
  -DarchetypeGroupId=net.liftweb
  -DarchetypeArtifactId=lift-archetype-jpa-basic
  -DarchetypeVersion=1.1-SNAPSHOT -DgroupId=jblack.resumeapp.lift
  -DartifactId=ResumeApp -Dversion=1.0-SNAPSHOT
 
  [INFO] Scanning for projects...
  [INFO] Searching repository for plugin with prefix: 'archetype'.
  [INFO] org.apache.maven.plugins: checking for updates from central
  [INFO] org.codehaus.mojo: checking for updates from central
  [INFO] artifact org.apache.maven.plugins:maven-archetype-plugin:
  checking for updates from central
  [INFO]
  
  [INFO] Building Maven Default Project
  [INFO]task-segment: [archetype:generate] (aggregator-style)
  [INFO]
  
  [INFO] Preparing archetype:generate
  [INFO] No goals needed for project - skipping
  [INFO] Setting property: classpath.resource.loader.class =
  'org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader'.
  [INFO] Setting property: velocimacro.messages.on = 'false'.
  [INFO] Setting property: resource.loader = 'classpath'.
  [INFO] Setting property: resource.manager.logwhenfound = 'false'.
  [INFO] [archetype:generate {execution: default-cli}]
  [INFO] Generating project in Batch mode
  [INFO] Archetype defined by properties
  [INFO] snapshot net.liftweb:lift-archetype-jpa-basic:1.1-SNAPSHOT:
  checking for updates from lift-archetype-jpa-basic-repo
  Downloading:
 
 http://scala-tools.org/repo-snapshots/net/liftweb/lift-archetype-jpa-basic/1.1-SNAPSHOT/lift-archetype-jpa-basic-1.1-SNAPSHOT.jar
  [WARNING] PT Don't override file
 C:\Users\owner\workspace\ResumeApp\pom.xml
  [INFO]
  
  [INFO] BUILD SUCCESSFUL
  [INFO]
  
  [INFO] Total time: 9 seconds
  [INFO] Finished at: Mon Dec 07 10:07:13 EST 2009
  [INFO] Final Memory: 15M/106M
  [INFO]
  
 
  --
 
  You received this message because you are subscribed to the Google
  Groups Lift group.
  To post to this group, send email to lift...@googlegroups.com.
  To unsubscribe from this group, send email to
  liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com
 .
  For more options, visit this group at
  http://groups.google.com/group/liftweb?hl=en.

 --

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




--

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

[Lift] Re: Race conditions / database transaction isolation levels

2009-12-07 Thread cody koeninger


On Dec 6, 9:16 pm, Alex Boisvert alex.boisv...@gmail.com wrote:
 Lift's mapper doesn't change the default isolation level of your
 connections, nor does it make explicit use of pessimistic concurrency
 control.
 Anything beyond that we can probably implement, we just need a good
 reason...

 alex


Isn't the possibility of interleaved HTTP requests a sufficient
reason?  E.g. administrator editing a field near the same time a
customer is.  Unless the orm is writing everything it reads, even
changing transaction isolation to serializable won't prevent certain
types of race conditions.

It seems like having the option to lock an entity when loading it from
the database (implemented as select ... for update) would be useful.
I haven't used Rails much, but that's my understanding of what
ActiveRecord offers.

--

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




Re: [Lift] Re: Race conditions / database transaction isolation levels

2009-12-07 Thread Alex Boisvert
On Mon, Dec 7, 2009 at 8:02 AM, cody koeninger c...@koeninger.org wrote:



 On Dec 6, 9:16 pm, Alex Boisvert alex.boisv...@gmail.com wrote:
  Lift's mapper doesn't change the default isolation level of your
  connections, nor does it make explicit use of pessimistic concurrency
  control.
  Anything beyond that we can probably implement, we just need a good
  reason...
 
  alex


 Isn't the possibility of interleaved HTTP requests a sufficient
 reason?  E.g. administrator editing a field near the same time a
 customer is.  Unless the orm is writing everything it reads, even
 changing transaction isolation to serializable won't prevent certain
 types of race conditions.

 It seems like having the option to lock an entity when loading it from
 the database (implemented as select ... for update) would be useful.
 I haven't used Rails much, but that's my understanding of what
 ActiveRecord offers.


Yes, definitely, it would be useful in some cases.I should have been
more clear.  When I said we just need a good reason I meant we just need
somebody who has a real need for this feature.

alex

--

You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@googlegroups.com.
To unsubscribe from 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: Newbie on Lift Scala: Build in class source code?

2009-12-07 Thread itsjar
thanks again to the guys who put their efforts in answering questions
here.
I'll try a different approach this time.

Let's hope I get somewhere since our decision whether we will use lift
or not will depends on this.

On Dec 7, 4:23 am, Alex Boisvert alex.boisv...@gmail.com wrote:
 Part of the source for these objects is automatically created when you
 generate your lift app using the Maven archetype.   For example, you'll find
 the source to the User class unde
 src/main/scala/com/liftworkshop/model/User.scala.

 For classes that are part of the framework, such as MegaProtoUser etc.
 you'll find the source on Github athttp://github.com/dpp/liftweb/and more
 specifically look at ProtoUser.scala 
 underhttp://github.com/dpp/liftweb/tree/master/lift-persistence/lift-mappe
 Also be sure to select the branch of Lift that you are using in order to
 avoid confusion.

 Good luck and keep asking question ;)
 alex

 On Sun, Dec 6, 2009 at 3:54 PM, itsjar its...@gmail.com wrote:
  Hi,

  I'm considering building a web application with my software
  engineering group in Lift.
  However when I started with lift I was surprised that I received a
  whole log in / sign up website by
  just using the MegaProtoUser.
  This was at first sight fun, but I started wondering (and I'm pretty
  sure my professor will say the same): Do I really know what I just
  did?.

  So I decided to try and rebuild the Log in / Sign up thing from
  scratch by using my own plain objects.
  Ive been working on that for 2 days and It's been s frustrating.

  I've been reading the lift book... Tutorials.. but all of them start
  with the MegaProtoUser.
  In 1.5 days time I only managed to make an index (signup) page with a
  username/password field and a button which then redirects to a new
  page.

  Let me tell you in advance, I am totally new to Web developing.

  Problems I have right now:
    - I have no idea if my code actually created a User in my database
  and I have no idea how to check it...
    - I have no idea how to log in a user. I saw code in the sample
  programs that compare the current logged in user with other users by
  using a select statement. However retrieving the current user is based
  upon the MegaProtoUser. I wonder how this is done behind my back since
  I have no idea how to keep a variable of a 'logged in user' which
  stays active across all pages..

  Because of these problems I thought it might be useful to see the
  source code of the classes..
  Is it possible to see the scala source code of these classes?

  Thanks,
  itsjar

  --

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



--

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




Re: [Lift] Re: Newbie on Lift Scala: Build in class source code?

2009-12-07 Thread David Pollak
On Mon, Dec 7, 2009 at 9:14 AM, itsjar its...@gmail.com wrote:

 thanks again to the guys who put their efforts in answering questions
 here.
 I'll try a different approach this time.


I would suggest building the To Do app as a first step:
http://liftweb.net/docs/getting_started/mod_master.html

You'll get a lot of exposure to Lift in bite-sized chunks.  Once you've gone
through the demo, then you can move on to other things, including building
your own authentication system.

Why do I suggest this?  (1) Learning Scala's syntax and some of Scala's
idioms gives you better grounding for understanding ProtoUser (2) seeing how
to build simple Mapper classes will give you a better understanding of the
more complex ones (3) walking before you run helps you to not fall down and
skin your knees.

But we are here... the whole 1,500+ member Lift community.  We take newbies
very seriously and want to help them because we know that they'll help other
newbies one day.

Thanks,

David



 Let's hope I get somewhere since our decision whether we will use lift
 or not will depends on this.

 On Dec 7, 4:23 am, Alex Boisvert alex.boisv...@gmail.com wrote:
  Part of the source for these objects is automatically created when you
  generate your lift app using the Maven archetype.   For example, you'll
 find
  the source to the User class unde
  src/main/scala/com/liftworkshop/model/User.scala.
 
  For classes that are part of the framework, such as MegaProtoUser etc.
  you'll find the source on Github athttp://github.com/dpp/liftweb/andmore
  specifically look at ProtoUser.scala underhttp://
 github.com/dpp/liftweb/tree/master/lift-persistence/lift-mappe
  Also be sure to select the branch of Lift that you are using in order to
  avoid confusion.
 
  Good luck and keep asking question ;)
  alex
 
  On Sun, Dec 6, 2009 at 3:54 PM, itsjar its...@gmail.com wrote:
   Hi,
 
   I'm considering building a web application with my software
   engineering group in Lift.
   However when I started with lift I was surprised that I received a
   whole log in / sign up website by
   just using the MegaProtoUser.
   This was at first sight fun, but I started wondering (and I'm pretty
   sure my professor will say the same): Do I really know what I just
   did?.
 
   So I decided to try and rebuild the Log in / Sign up thing from
   scratch by using my own plain objects.
   Ive been working on that for 2 days and It's been s frustrating.
 
   I've been reading the lift book... Tutorials.. but all of them start
   with the MegaProtoUser.
   In 1.5 days time I only managed to make an index (signup) page with a
   username/password field and a button which then redirects to a new
   page.
 
   Let me tell you in advance, I am totally new to Web developing.
 
   Problems I have right now:
 - I have no idea if my code actually created a User in my database
   and I have no idea how to check it...
 - I have no idea how to log in a user. I saw code in the sample
   programs that compare the current logged in user with other users by
   using a select statement. However retrieving the current user is based
   upon the MegaProtoUser. I wonder how this is done behind my back since
   I have no idea how to keep a variable of a 'logged in user' which
   stays active across all pages..
 
   Because of these problems I thought it might be useful to see the
   source code of the classes..
   Is it possible to see the scala source code of these classes?
 
   Thanks,
   itsjar
 
   --
 
   You received this message because you are subscribed to the Google
 Groups
   Lift group.
   To post to this group, send email to lift...@googlegroups.com.
   To unsubscribe from this group, send email to
   liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com
 liftweb%2bunsubscr...@googlegroups.comliftweb%252bunsubscr...@googlegroups.com
 
   .
   For more options, visit this group at
  http://groups.google.com/group/liftweb?hl=en.
 
 

 --

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





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

--

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




Re: [Lift] Re: How can one bind value-less attributes?

2009-12-07 Thread Alex Boisvert
On Sun, Dec 6, 2009 at 8:28 PM, David Pollak
feeder.of.the.be...@gmail.comwrote:


 On Sun, Dec 6, 2009 at 7:25 PM, Alex Boisvert alex.boisv...@gmail.comwrote:

 Using the latest and greatest (master branch), I can't reproduce the
 MatchError but I can reproduce the issue with the attribute being generated
 if the value is null.


 How about adding a Box alternative rather than perpetuating a paradigm
 based on null?


Yes, that's better.  I'll do that.

[Side diatribe:  Can't wait for a working scala.NotNull so we can implicitly
convert (non-null) literal values to Some() or Full() instance and reduce
verbosity]

alex

--

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




Re: [Lift] Re: How can one bind value-less attributes?

2009-12-07 Thread David Pollak
On Mon, Dec 7, 2009 at 9:22 AM, Alex Boisvert alex.boisv...@gmail.comwrote:

 On Sun, Dec 6, 2009 at 8:28 PM, David Pollak 
 feeder.of.the.be...@gmail.com wrote:


 On Sun, Dec 6, 2009 at 7:25 PM, Alex Boisvert alex.boisv...@gmail.comwrote:

 Using the latest and greatest (master branch), I can't reproduce the
 MatchError but I can reproduce the issue with the attribute being generated
 if the value is null.


 How about adding a Box alternative rather than perpetuating a paradigm
 based on null?


 Yes, that's better.  I'll do that.

 [Side diatribe:  Can't wait for a working scala.NotNull so we can
 implicitly convert (non-null) literal values to Some() or Full() instance
 and reduce verbosity]



Mmmm sweet tasty NotNull.




 alex

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




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

--

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




Re: [Lift] Re: How can one bind value-less attributes?

2009-12-07 Thread Ross Mellgren
I looked at adding a Box variant, but it wasn't a strictly speaking  
trivial change since calcValue on BindParam is of type NodeSeq. I  
guess it could become Box[NodeSeq] and then when binding at element  
positions convert that to NodeSeq.Empty, but I also have had the need  
(which I've worked around) to be able to replace a single bound  
attribute with multiple result attributes, so I was thinking that it  
would be best to allow AttrBindParams to generate MetaData, not just a  
value.

I had written some code to play with this idea, but I didn't get too  
far because I was busy and needed feedback from other committers. I  
can return it to working tonight if there's interest.

-Ross

On Dec 7, 2009, at 12:22 PM, Alex Boisvert wrote:

 On Sun, Dec 6, 2009 at 8:28 PM, David Pollak feeder.of.the.be...@gmail.com 
  wrote:

 On Sun, Dec 6, 2009 at 7:25 PM, Alex Boisvert  
 alex.boisv...@gmail.com wrote:
 Using the latest and greatest (master branch), I can't reproduce the  
 MatchError but I can reproduce the issue with the attribute being  
 generated if the value is null.

 How about adding a Box alternative rather than perpetuating a  
 paradigm based on null?

 Yes, that's better.  I'll do that.

 [Side diatribe:  Can't wait for a working scala.NotNull so we can  
 implicitly convert (non-null) literal values to Some() or Full()  
 instance and reduce verbosity]

 alex

 --

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

--

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




[Lift] Re: (Maybe it's a bug ?) About the Schedule's execute counts in the ActorComet

2009-12-07 Thread Neil.Lv
 Hi David,

   The demo is sent to you, please check it.

   Thanks !

Cheers,
  Neil

On Dec 7, 10:26 pm, David Pollak feeder.of.the.be...@gmail.com
wrote:
 On Mon, Dec 7, 2009 at 5:45 AM, Neil.Lv anim...@gmail.com wrote:

    I think maybe it's a bug ~?

    Btw, Does anybody know how to convert the CometActor to LiftActor.

 A CometActor is a subclass of LiftActor

 If you can package up a complete simple implementation of the problem (an
 app I can run with mvn jetty:run), I'll take a look at it.





    And how the write the render method and use the ActorPing.schedule
  (this, Tick, 10 seconds)
  in LiftActor.

    Thanks for any suggestion!

  Cheers,
   Neil
  ###
  package com.liftcode.comet

  import net.liftweb._
  import http._
  import js._
  import JsCmds._
  import net.liftweb.common._
  import net.liftweb.util._
  import Helpers._
  import net.liftweb.http._
  import _root_.scala.xml._
  import scala.actors._
  import scala.collection.mutable.Queue
  import net.liftweb.http.SessionVar

  case class Foo(getValue: String)

  object FooManager {
   private var foos: List[Foo] = Nil
   def getFoos: List[Foo] = synchronized {
  println(  foos size:  + foos.size)
     foos ::= Foo(System.currentTimeMillis.toString)
     foos
   }

  }

  class MyComet extends CometActor {

   override def defaultPrefix = Full(auth)

   private var foos = FooManager.getFoos

   def createDisplay(foos:List[Foo]):NodeSeq = {
     span id=gotable
     {
       for {foo - foos} yield trtd{foo.getValue}/td/tr
     }

     /table/span
   }

   def render = { bind(foo - createDisplay(foos)) }

   override def localSetup = {
  println(  localSetup:  )
     super.localSetup
     this ! Tick
   }

   override def lowPriority = {
     case Tick = {
  println(   Tick )
       foos = FooManager.getFoos
       reRender(false)
       ActorPing.schedule(this, Tick, 10 seconds)
     }
   }

  }

  case object Tick
  ###

  On Dec 7, 9:40 pm, Neil.Lv anim...@gmail.com wrote:
     Here is the server log,

   ###
   INFO - Service request (GET) /comet_request/27036331510/b0iubsv7usc1
   took 0 Mill
   iseconds
   INFO - Service request (GET) /comet_request/24195135706/1geup5f5uelih
   took 0 Mil
   liseconds
   INFO - Service request (GET) /comet_request/15421125743/b0iubsv7usc1
   took 0 Mill
   iseconds
   INFO - Service request (GET) /comet_request/4886038816/b0iubsv7usc1
   took 15 Mill
   iseconds
   INFO - Service request (GET) /comet_request/70554035677/b0iubsv7usc1
   took 0 Mill
   iseconds
   INFO - Service request (GET) /comet_request/80058340958/b0iubsv7usc1
   took 0 Mill
   iseconds
   INFO - Service request (GET) /comet_request/16073680948/b0iubsv7usc1
   took 0 Mill
   iseconds
   INFO - Service request (GET) /comet_request/48475840285/b0iubsv7usc1
   took 16 Mil
   liseconds
   ###

      I set the time is 10 seconds, but here is wrong.

      Does anybody know about the issue ?

   Cheers,
     Neil

   On Dec 4, 3:00 pm, Neil.Lv anim...@gmail.com wrote:

Hi all,

   Here is an example code that about the ActorComet.

###
package com.liftcode.comet

import net.liftweb._
import http._
import js._
import JsCmds._
import net.liftweb.common._
import net.liftweb.util._
import Helpers._
import net.liftweb.http._
import _root_.scala.xml._
import scala.actors._
import scala.collection.mutable.Queue
import net.liftweb.http.SessionVar

case class Foo(getValue: String)

object FooManager {
  private var foos: List[Foo] = Nil
  def getFoos: List[Foo] = synchronized {
println(  foos size:  + foos.size)
    foos ::= Foo(System.currentTimeMillis.toString)
    foos
  }

}

class MyComet extends CometActor {

  override def defaultPrefix = Full(auth)

  private var foos = FooManager.getFoos

  def createDisplay(foos:List[Foo]):NodeSeq = {
    span id=gotable
    {
      for {foo - foos} yield trtd{foo.getValue}/td/tr
    }

    /table/span
  }

  def render = { bind(foo - createDisplay(foos)) }

  override def localSetup = {
println(  localSetup:  )
    super.localSetup
    this ! Tick
  }

  override def lowPriority = {
    case Tick = {
println(   Tick )
      foos = FooManager.getFoos
      reRender(false)
      ActorPing.schedule(this, Tick, 10 seconds)
    }
  }

}

case object Tick
###

   When i run  mvn jetty:run  to start the server, and type
  thehttp://localhost:8080inthebrowser.
The result will be like this, the println(   Tick ) method
only execute 1 time every 10 seconds.

###
INFO - Service request (GET) /comet_request/50054201120/farmqqw03xkm
took 46 Mil
liseconds
   Tick 
  foos size: 2
INFO - Service request (GET) /comet_request/87077494133/farmqqw03xkm
took 8625 M
###

   Then i don't 

Re: [Lift] Next Lift version will be 2.0

2009-12-07 Thread Indrajit Raychaudhuri
Heiko,

Grand stuff!

Indeed, I was wondering if we could sync this up with the Round 2 of 
Refactoring exercise 
(http://groups.google.com/group/liftweb/browse_thread/thread/450a3e741999b5df). 
New structure, new version.

I am working on this refactoring in a private copy and am planning to 
publish the branch once M8 is out (assuming original schedule of 2 weeks 
from 27th Nov). Would this work with you?

Cheers, Indrajit


On 07/12/09 4:23 PM, Timothy Perrett wrote:
 Heiko,

 This is great - can you work with IRC to arrange a time to changes the
 poms to 2.0-SNAPSHOT?

 Cheers, Tim

 On 7 Dec 2009, at 08:32, Heiko Seeberger wrote:

 Lifters,

 Maybe you followed the discussion about the versioning policy for
 Lift. The committers finally decided to have a well defined versioning
 policy which you can take from here:
 http://wiki.github.com/dpp/liftweb/about-versioning-policy.

 Following this policy the next Lift version will be 2.0, not 1.1,
 because there are numerous changes and enhancements breaking the
 source compatibility. As soon as we change the version numbers in the
 Maven POMs, we will let you know via the lift-announce mailing list.

 Best regards,

 Heiko

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

 --

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

 --

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

--

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




[Lift] S.class

2009-12-07 Thread itsjar
Hi,

I've been diving into the S class to learn and I just tried to
add some functions of it in a snippet to see if it works.
   The weird thing is (which is probably not weird but doesn't seem
intuitive to me)
   that adding S.location in a snippet gives me an error message
error: value location is not a member of object net.liftweb.http.S
   Why can't I reach that member?

Second: is there a better way to print debug messages? Right now I
just add them to a snippet.

Thanks,
Itsjar

--

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




Re: [Lift] Re: How can one bind value-less attributes?

2009-12-07 Thread Ross Mellgren
Sha-bam

http://github.com/dpp/liftweb/issues/#issue/229

-Ross

On Dec 7, 2009, at 12:43 PM, David Pollak wrote:

 Is there a ticket for this?  I'm in ticket-closing mode today ;-)

 On Mon, Dec 7, 2009 at 9:29 AM, Ross Mellgren dri...@gmail.com  
 wrote:
 I looked at adding a Box variant, but it wasn't a strictly speaking  
 trivial change since calcValue on BindParam is of type NodeSeq. I  
 guess it could become Box[NodeSeq] and then when binding at element  
 positions convert that to NodeSeq.Empty, but I also have had the  
 need (which I've worked around) to be able to replace a single bound  
 attribute with multiple result attributes, so I was thinking that it  
 would be best to allow AttrBindParams to generate MetaData, not just  
 a value.

 I had written some code to play with this idea, but I didn't get too  
 far because I was busy and needed feedback from other committers. I  
 can return it to working tonight if there's interest.

 -Ross

 On Dec 7, 2009, at 12:22 PM, Alex Boisvert wrote:

 On Sun, Dec 6, 2009 at 8:28 PM, David Pollak feeder.of.the.be...@gmail.com 
  wrote:

 On Sun, Dec 6, 2009 at 7:25 PM, Alex Boisvert alex.boisv...@gmail.com 
  wrote:
 Using the latest and greatest (master branch), I can't reproduce  
 the MatchError but I can reproduce the issue with the attribute  
 being generated if the value is null.

 How about adding a Box alternative rather than perpetuating a  
 paradigm based on null?

 Yes, that's better.  I'll do that.

 [Side diatribe:  Can't wait for a working scala.NotNull so we can  
 implicitly convert (non-null) literal values to Some() or Full()  
 instance and reduce verbosity]

 alex

 --

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


 --

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



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

 --

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

--

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




[Lift] Login progamatically

2009-12-07 Thread stephanos
Hi,

where would I look for a login()-method to login a specific user on
boot up (in development mode)?
(Aggregated this could save me a few minutes every day *g*)

Cheers,
stephanos

--

You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@googlegroups.com.
To unsubscribe from 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: Login progamatically

2009-12-07 Thread stephanos
it just occured to me that I can simply override my is logged in-
condition:

val ifIsLoggedIn = Props.mode match {
case Development = If (true _, )
case _ = If(User.loggedIn_? _, You must be logged in!)
}

yet this only works for explicitly hidden/disabled functionality based
on this condition.

On Dec 7, 7:09 pm, stephanos stephan.beh...@googlemail.com wrote:
 Hi,

 where would I look for a login()-method to login a specific user on
 boot up (in development mode)?
 (Aggregated this could save me a few minutes every day *g*)

 Cheers,
 stephanos

--

You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@googlegroups.com.
To unsubscribe from 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: S.class

2009-12-07 Thread itsjar
Never mind, I've solved it myself.
Thanks

On Dec 7, 6:56 pm, itsjar its...@gmail.com wrote:
 Hi,

 I've been diving into the S class to learn and I just tried to
 add some functions of it in a snippet to see if it works.
    The weird thing is (which is probably not weird but doesn't seem
 intuitive to me)
    that adding S.location in a snippet gives me an error message
 error: value location is not a member of object net.liftweb.http.S
    Why can't I reach that member?

 Second: is there a better way to print debug messages? Right now I
 just add them to a snippet.

 Thanks,
 Itsjar

--

You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@googlegroups.com.
To unsubscribe from 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 go about implementing my own auth?

2009-12-07 Thread DMB
I'm using neither Mapper (JPA is used instead) nor SiteMap. Thanks for
the explanation, I'll try this today.

On Dec 7, 6:14 am, Marius marius.dan...@gmail.com wrote:
 On Dec 7, 1:09 pm, DMB combust...@gmail.com wrote:



  Basically here's what I want to accomplish:
  1. I want the user to login through a simple form on /index.html -
  this is the only unprotected page on the site. User does not have a
  user name, the only field is a password.
  2. I want to store the user role (along with some other state data) in
  the user session
  3. If user tries to access any page other than index.html, I want to
  redirect to /index.html

  After stumbling for a while due to scarcity of documentation, I have
  done the following:

  In Boot.scala:

          LiftRules.httpAuthProtectedResource.prepend {
              case ParsePath(index :: Nil, html, true, false) =
  Empty
              case _ = Full(AuthRole(admin))
          }

          LiftRules.authentication = SessionAuthentication()

  InSessionAuthentication.scala:

  case class SessionAuthentication extends HttpAuthentication {

      def verified_? = { case(req) = {
                  // TODO: Prefetch from DB here
                  true
              }
      }

  }

  It is my understanding that this should not ask for auth at all. In
  reality, it doesn't ask for auth on /index.html, but DOES ask for
  Basic auth (through a browser popup) on any other page.

  What am I doing wrong, and how do I make it right?

 Your are seeing the browser's credentials popup because of :

   def unauthorizedResponse: UnauthorizedResponse = UnauthorizedResponse
 (realm)

 from HttpAuthentication trait. You can override this and subclass
 UnauthorizedResponse with your own LiftResponse if you want other type
 of response than 401. You can also protect your resources using
 HttpAuthProtected LocParam that you can use when you specify your
 SiteMap in the Loc construction.

 This is one approach.

 Another one, probably more suitable for login forms, is to look into
 Mapper support for that (I think it's called MetaMegaProtoUser ? )

--

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




Re: [Lift] Re: How do I go about implementing my own auth?

2009-12-07 Thread John Goodsen
can you embed a (shared) username in the form and submit the password it
using the default Lift User authentication?

On Mon, Dec 7, 2009 at 2:19 PM, DMB combust...@gmail.com wrote:

 I'm using neither Mapper (JPA is used instead) nor SiteMap. Thanks for
 the explanation, I'll try this today.

 On Dec 7, 6:14 am, Marius marius.dan...@gmail.com wrote:
  On Dec 7, 1:09 pm, DMB combust...@gmail.com wrote:
 
 
 
   Basically here's what I want to accomplish:
   1. I want the user to login through a simple form on /index.html -
   this is the only unprotected page on the site. User does not have a
   user name, the only field is a password.
   2. I want to store the user role (along with some other state data) in
   the user session
   3. If user tries to access any page other than index.html, I want to
   redirect to /index.html
 
   After stumbling for a while due to scarcity of documentation, I have
   done the following:
 
   In Boot.scala:
 
   LiftRules.httpAuthProtectedResource.prepend {
   case ParsePath(index :: Nil, html, true, false) =
   Empty
   case _ = Full(AuthRole(admin))
   }
 
   LiftRules.authentication = SessionAuthentication()
 
   InSessionAuthentication.scala:
 
   case class SessionAuthentication extends HttpAuthentication {
 
   def verified_? = { case(req) = {
   // TODO: Prefetch from DB here
   true
   }
   }
 
   }
 
   It is my understanding that this should not ask for auth at all. In
   reality, it doesn't ask for auth on /index.html, but DOES ask for
   Basic auth (through a browser popup) on any other page.
 
   What am I doing wrong, and how do I make it right?
 
  Your are seeing the browser's credentials popup because of :
 
def unauthorizedResponse: UnauthorizedResponse = UnauthorizedResponse
  (realm)
 
  from HttpAuthentication trait. You can override this and subclass
  UnauthorizedResponse with your own LiftResponse if you want other type
  of response than 401. You can also protect your resources using
  HttpAuthProtected LocParam that you can use when you specify your
  SiteMap in the Loc construction.
 
  This is one approach.
 
  Another one, probably more suitable for login forms, is to look into
  Mapper support for that (I think it's called MetaMegaProtoUser ? )

 --

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





-- 
John Goodsen RADSoft / Better Software Faster
jgood...@radsoft.comLean/Agile/XP/Scrum Coaching and Training
http://www.radsoft.com  Ruby on Rails and Java Solutions

--

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




Re: [Lift] Re: Login progamatically

2009-12-07 Thread David Pollak
If you're using MegaProtoUser, in your User object:

override def autologinFunc = if (Props.devMode) Full(() =
{User.find(1).foreach(User.LogUserIn)}) else Empty

On Mon, Dec 7, 2009 at 10:17 AM, stephanos stephan.beh...@googlemail.comwrote:

 it just occured to me that I can simply override my is logged in-
 condition:

 val ifIsLoggedIn = Props.mode match {
case Development = If (true _, )
case _ = If(User.loggedIn_? _, You must be logged in!)
}

 yet this only works for explicitly hidden/disabled functionality based
 on this condition.

 On Dec 7, 7:09 pm, stephanos stephan.beh...@googlemail.com wrote:
  Hi,
 
  where would I look for a login()-method to login a specific user on
  boot up (in development mode)?
  (Aggregated this could save me a few minutes every day *g*)
 
  Cheers,
  stephanos

 --

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





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

--

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




Re: [Lift] Re: Race conditions / database transaction isolation levels

2009-12-07 Thread David Pollak
On Mon, Dec 7, 2009 at 8:54 AM, Alex Boisvert alex.boisv...@gmail.comwrote:

 On Mon, Dec 7, 2009 at 8:02 AM, cody koeninger c...@koeninger.org wrote:



 On Dec 6, 9:16 pm, Alex Boisvert alex.boisv...@gmail.com wrote:
  Lift's mapper doesn't change the default isolation level of your
  connections, nor does it make explicit use of pessimistic concurrency
  control.
  Anything beyond that we can probably implement, we just need a good
  reason...
 
  alex


 Isn't the possibility of interleaved HTTP requests a sufficient
 reason?  E.g. administrator editing a field near the same time a
 customer is.  Unless the orm is writing everything it reads, even
 changing transaction isolation to serializable won't prevent certain
 types of race conditions.

 It seems like having the option to lock an entity when loading it from
 the database (implemented as select ... for update) would be useful.
 I haven't used Rails much, but that's my understanding of what
 ActiveRecord offers.


 Yes, definitely, it would be useful in some cases.I should have been
 more clear.  When I said we just need a good reason I meant we just need
 somebody who has a real need for this feature.


Feel free to open a ticket.  We prioritize work for production sites (or
sites that are destined for production).  If you meet that criteria, please
add this to the ticket so we can decide on what the priority is.



 alex

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




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

--

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




Re: [Lift] How to configure two database connection in Lift?

2009-12-07 Thread David Pollak
I've put together some sample code that describes how to access multiple
databases from a single Lift app.  It's enclosed.

First, you need to identify different ConnectionIdentifiers for each
connection:

package com.liftcode.model

import net.liftweb._
import mapper._

case object CatConnectionIdentifier extends ConnectionIdentifier {
  def jndiName: String = cat
}

case object DogConnectionIdentifier extends ConnectionIdentifier {
  def jndiName: String = dog
}

Tell your Mapper classes what their default DB is:

package com.liftcode.model

import net.liftweb._
import mapper._


class Cat extends LongKeyedMapper[Cat] with IdPK {
  def getSingleton = Cat

  object name extends MappedString(this, 64)
}

object Cat extends Cat with LongKeyedMetaMapper[Cat] {
  override def dbDefaultConnectionIdentifier = CatConnectionIdentifier
}

class Dog extends LongKeyedMapper[Dog] with IdPK {
  def getSingleton = Dog

  object name extends MappedString(this, 64)
}

object Dog extends Dog with LongKeyedMetaMapper[Dog] {
  override def dbDefaultConnectionIdentifier = DogConnectionIdentifier
}


You need to hook the ConnectionIdentifiers up to the actual databases... in
Boot:

DB.defineConnectionManager(DefaultConnectionIdentifier,
   new StandardDBVendor(Props.get(db.driver)
openOr org.h2.Driver,
Props.get(db.url)
openOr jdbc:h2:lift_proto.db,
Props.get(db.user),
Props.get(db.password)))

DB.defineConnectionManager(CatConnectionIdentifier,
   new StandardDBVendor(Props.get(db.driver)
openOr org.h2.Driver,
Props.get(db.url)
openOr jdbc:h2:lift_cat.db,
Props.get(db.user),
Props.get(db.password)))

DB.defineConnectionManager(DogConnectionIdentifier,
   new StandardDBVendor(Props.get(db.driver)
openOr org.h2.Driver,
Props.get(db.url)
openOr jdbc:h2:lift_dog.db,
Props.get(db.user),
Props.get(db.password)))

And Schemify based on the correct identifier:

Schemifier.schemify(true, Log.infoF _, DefaultConnectionIdentifier,
User)
Schemifier.schemify(true, Log.infoF _, CatConnectionIdentifier, Cat)
Schemifier.schemify(true, Log.infoF _, DogConnectionIdentifier, Dog)

And finally make sure that the transactions are wrapped correctly:

S.addAround(DB.buildLoanWrapper(List(DefaultConnectionIdentifier,
DogConnectionIdentifier, CatConnectionIdentifier)))


Cats will come from the Cat DB, dogs from the Dog DB.

It's possible to get shardy with this setup as well, but this should
suffice.

Thanks,

David


On Sat, Dec 5, 2009 at 9:47 PM, Neil.Lv anim...@gmail.com wrote:

 Hi all,

  I want to use two databases, but i don't know how to configure it.

  Does anybody know that how to configure two database connection in
 Lift?


 1:
  I add two ConnectionIdentifier in the Boot.class
 ###
 object OneDB extends ConnectionIdentifier {

  def jndiName = one

 }

 object TwoDB extends ConnectionIdentifier {

  def jndiName = two

 }
 ###

 2: In the User model

   How can i write the code in the method,
 ###
  override def dbCalculateConnectionIdentifier = {
Two
  }
 ###

  Thanks for any suggestion!

 Cheers,
  Neil

 --

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





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

--

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




twofer.tgz
Description: GNU Zip compressed data


Re: [Lift] Re: Sharing data between snippet functions during a single HTTP request

2009-12-07 Thread David Pollak
On Sun, Dec 6, 2009 at 5:44 AM, Alex Black a...@alexblack.ca wrote:

  We made this change for Lift 1.1.  So, if you're using 1.1, the same
  instance of a snippet should be used for a given HTTP request.

 Hi David, I've just switch from Lift 1.0 to Lift 1.1-M6, do you think
 this change is in M6?


Yes.

Snippet:

class HelloWorld {
  lazy val date: Box[Date] = DependencyFactory.inject[Date] // inject the
date

  val random = randomString(20)

  def howdy(in: NodeSeq): NodeSeq =
  Helpers.bind(b, in, time - date.map(d = Text(d.toString)))

  def dog: NodeSeq = bString is {random}/b

  def cat: NodeSeq = bFrom cat String is {random}/b

}



View:

lift:surround with=default at=content
  h2Welcome to your project!/h2
   lift:helloWorld.howdy
spanWelcome to iscached at b:time//span
  /lift:helloWorld.howdy
/p

p Dog sez lift:HelloWorld.dog//p

p Cat sez lift:HelloWorld.cat//p

/lift:surround


Browser:

Welcome to your project!




Welcome to iscached at Mon Dec 07 12:26:41 PST 2009






 Dog sez String is 4G2NRM4TBGCJBYNGFCUF




 Cat sez From cat String is 4G2NRM4TBGCJBYNGFCUF

Works as advertised and has been in the code since at least M6.

Thanks,

David



 It doesn't seem to be... I have many calls to my
 snippet for a particular page, and I put a println statement in the
 body of the snippet, and it gets called 18 times each request!

 - Alex


 
 
 
   I'd imagine lift could even generate a requestVar representing each
   snippet for the developers, allowing snippets in a given HTTP request
   to access each other easily.
 
  I don't think this is technically possible within the bounds of the type
  system.
 
 
 
 
 
   On Nov 20, 11:09 am, Ross Mellgren dri...@gmail.com wrote:
RequestVar is the standard way of doing this. For example
 
object MySharedInformation {
 object myData extends RequestVar[List[Thing]](loadThings)
 //   ^^^  ^^
 //Type of thing to store  How to initialize
variable first time it's accessed
 
 private def loadThings: List[Thing] = ...
 
}
 
class Snippet1 {
 import MySharedInformation.myData
 def render(ns: NodeSeq): NodeSeq = {
 myData.is.map(thing = { ... })
 }
 
}
 
class Snippet2 {
 import MySharedInformation.myData
 ...
 
}
 
The lifetime of the value is during the current request processing
 and
any AJAX calls related to it.
 
If you really want to initialize it in a snippet, then use a Box with
a RequestVar, like this:
 
object MySharedInformation {
 object myData extends RequestVar[Box[List[Thing]]](Empty)
 
}
 
class LoaderSnippet {
 import MySharedInformation.myData
 def render(ns: NodeSeq): NodeSeq = {
 myData.set(Full(...))
 }
 
}
 
class ReaderSnippet {
 import MySharedInformation.myData
 def render(ns: NodeSeq): NodeSeq = {
 // If the data has not been loaded, default to an empty list
 val data = myData.is.openOr(Nil)
 ...
 }
 
}
 
class OtherReaderSnippet {
 import MySharedInformation.myData
 def render(ns: NodeSeq): NodeSeq = {
 // Do two entirely different things if the data has versus
has not been loaded
 myData.is match {
 case Full(data) = // do something when the data has
 been
loaded
 case _ = // do something when the data has not been
 loaded
 }
 }
 
}
 
HTH,
-Ross
 
On Nov 20, 2009, at 10:59 AM, Alex Black wrote:
 
 I've got a template page, say foobar.html, that makes a number of
 calls to functions in a snippet, e.g. mysnippet.foo1,
 mysnippet.foo2,
 mysnippet.foo3.
 
 I'd like to do some initial work in foo1, e.g. retrieve some data
 and
 do some work on it, then in foo2 and foo3 display parts of that
 data.
 
 Whats the easiest way to do this? I think I misunderstood the lift
 book:
 
 That means that for each request, Lift creates a new instance of
 the
 snippet class to execute. Any changes you make to instance
 variables
 will be discarded after the request is processed.
 
 I thought this meant that for a given HTTP request, there would be
 one
 (and only one) instance of my snippet, so I could call several of
 its
 methods and they could all access the snippet's member variables,
 which would then be discarded at the end of the request.
 
 Am I going about this wrong? should I only have one snippet
 function
 per template?
 
 Thx
 
 - Alex
 
 --
 
 You received this message because you are subscribed to the Google
 Groups Lift group.
 To post to this group, send email to lift...@googlegroups.com.
 To unsubscribe from this group, send email to
   

[Lift] Re: Sharing data between snippet functions during a single HTTP request

2009-12-07 Thread harryh
Another strategy, different from what Ross suggests, that I have found
useful in some circumstances.  In the view do this:

lift:YourPage
  page:firstsection
firstsection:username/
firstsection:foo/
  /page:firstsection

  page:secondsection
secondsection:username/
secondsection:foo/
  /page:secondsection
/lift:YourPage

Then

class YourPage extends RenderSnippet {
  def render(xhtml: NodeSeq) = {
val user = User.currentUser

def firstSection(xhtml: NodeSeq) = {
  val foo = whatever
  bind(firstsection, xhtml, username - user.name, foo -
foo.name)
}

def secondSection(xhtml: NodeSeq) = {
  val bar = whatever
  bind(firstsection, xhtml, username - user.name, bar -
bar.name)
}

bind(page, xhtml, firstsection - firstSection _,
secondSection - secondSection)
  }
}

--

You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@googlegroups.com.
To unsubscribe from 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: Sharing data between snippet functions during a single HTTP request

2009-12-07 Thread Alex Black
That looks like a great idea, thanks Harry, I didn't know you could
next stuff like that.

On Dec 7, 3:39 pm, harryh har...@gmail.com wrote:
 Another strategy, different from what Ross suggests, that I have found
 useful in some circumstances.  In the view do this:

 lift:YourPage
   page:firstsection
     firstsection:username/
     firstsection:foo/
   /page:firstsection

   page:secondsection
     secondsection:username/
     secondsection:foo/
   /page:secondsection
 /lift:YourPage

 Then

 class YourPage extends RenderSnippet {
   def render(xhtml: NodeSeq) = {
     val user = User.currentUser

     def firstSection(xhtml: NodeSeq) = {
       val foo = whatever
       bind(firstsection, xhtml, username - user.name, foo -
 foo.name)
     }

     def secondSection(xhtml: NodeSeq) = {
       val bar = whatever
       bind(firstsection, xhtml, username - user.name, bar -
 bar.name)
     }

     bind(page, xhtml, firstsection - firstSection _,
 secondSection - secondSection)
   }

 }

--

You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@googlegroups.com.
To unsubscribe from 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: Sharing data between snippet functions during a single HTTP request

2009-12-07 Thread Alex Black
Hi David,

I just tried something similar out.
1. I created a blank 1.0 lift project
2. I updated the pom file to reference lift-1.1M6
3. I added a line to the hello world snippet in its body:
println(Constructor)
4. I modified index.html to call the snippet twice.
5. I then launched the web server (mvn jetty:run) and accessed the
main page once via a browser

The line println(Constructor) gets called twice, I expected it just
to get called once.

Am I doing something wrong? Your test is not exactly the same as the
problem I described, I described the constructor getting called 18
times, I haven't yet verified whether or not the data is shared.

and here is the output:

[INFO] Started Jetty Server
[INFO] Starting scanner at interval of 5 seconds.
Constructor
Constructor
INFO - Service request (GET) / took 393 Milliseconds
INFO - Service request (GET) /classpath/jquery.js took 39 Milliseconds
INFO - Service request (GET) /ajax_request/
liftAjax.js;jsessionid=11x3vru6uimmg took 11 Milliseconds
INFO - Service request (GET) /favicon.ico took 6 Milliseconds
INFO - Service request (POST) /ajax_request/F318697140471TRN/ took 11
Milliseconds
INFO - Service request (POST) /ajax_request/F318697140471TRN/ took 1
Milliseconds

Snippet code:

package com.liftcode.hello.snippet

class HelloWorld {
  println(Constructor)

  def howdy = spanWelcome to hello-lift at {new
_root_.java.util.Date}/span
}

index.html:

lift:surround with=default at=content
h2Welcome to your project!/h2
plift:helloWorld.howdy //p
plift:helloWorld.howdy //p
/lift:surround

Here is the pom.xml:

project xmlns=http://maven.apache.org/POM/4.0.0; xmlns:xsi=http://
www.w3.org/2001/XMLSchema-instance xsi:schemaLocation=http://
maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd;
  modelVersion4.0.0/modelVersion
  groupIdcom.liftcode.hello/groupId
  artifactIdhello-lift/artifactId
  version1.0-SNAPSHOT/version
  packagingwar/packaging
  namehello-lift/name
  inceptionYear2007/inceptionYear
  properties
scala.version2.7.3/scala.version
  /properties

  repositories
repository
  idscala-tools.org/id
  nameScala-Tools Maven2 Repository/name
  urlhttp://scala-tools.org/repo-releases/url
/repository
  /repositories

  pluginRepositories
pluginRepository
  idscala-tools.org/id
  nameScala-Tools Maven2 Repository/name
  urlhttp://scala-tools.org/repo-releases/url
/pluginRepository
  /pluginRepositories

  dependencies
dependency
  groupIdorg.scala-lang/groupId
  artifactIdscala-library/artifactId
  version${scala.version}/version
/dependency
dependency
  groupIdnet.liftweb/groupId
  artifactIdlift-util/artifactId
  version1.1-M6/version
/dependency
dependency
  groupIdnet.liftweb/groupId
  artifactIdlift-webkit/artifactId
  version1.1-M6/version
/dependency
dependency
  groupIdjavax.servlet/groupId
  artifactIdservlet-api/artifactId
  version2.5/version
  scopeprovided/scope
/dependency
dependency
  groupIdjunit/groupId
  artifactIdjunit/artifactId
  version4.5/version
  scopetest/scope
/dependency
dependency
  groupIdorg.mortbay.jetty/groupId
  artifactIdjetty/artifactId
  version[6.1.6,)/version
  scopetest/scope
/dependency
!-- for LiftConsole --
dependency
  groupIdorg.scala-lang/groupId
  artifactIdscala-compiler/artifactId
  version${scala.version}/version
  scopetest/scope
/dependency
  /dependencies

  build
sourceDirectorysrc/main/scala/sourceDirectory
testSourceDirectorysrc/test/scala/testSourceDirectory
plugins
  plugin
groupIdorg.scala-tools/groupId
artifactIdmaven-scala-plugin/artifactId
executions
  execution
goals
  goalcompile/goal
  goaltestCompile/goal
/goals
  /execution
/executions
configuration
  scalaVersion${scala.version}/scalaVersion
/configuration
  /plugin
  plugin
groupIdorg.mortbay.jetty/groupId
artifactIdmaven-jetty-plugin/artifactId
configuration
  contextPath//contextPath
  scanIntervalSeconds5/scanIntervalSeconds
/configuration
  /plugin
  plugin
groupIdnet.sf.alchim/groupId
artifactIdyuicompressor-maven-plugin/artifactId
executions
  execution
goals
  goalcompress/goal
/goals
  /execution
/executions
configuration
  nosuffixtrue/nosuffix
/configuration
  /plugin
  plugin
groupIdorg.apache.maven.plugins/groupId
artifactIdmaven-eclipse-plugin/artifactId
configuration
  downloadSourcestrue/downloadSources
  excludes
excludeorg.scala-lang:scala-library/exclude
  /excludes
  

Re: [Lift] Managing templates with associated snippets?

2009-12-07 Thread David Pollak
Liam,

Right now, there's no best practices for snippet/template integration.  If
you or anyone else has good ideas on this or desired IDE integration, please
post them.

Thanks,

David

On Sun, Dec 6, 2009 at 3:02 AM, Liam Clarke ml.cyre...@gmail.com wrote:

 Hi all,

 I'm quite new to Lift, just working my way through a basic web-app
 using the book, and my background is Django for fun, and Wicket at
 work, so I'm probably writing code that resembles both of those, but
 isn't necessarily ideal for Lift.

 I was just wondering about how experienced Lift users manage their
 snippets and templates - do you, as a matter of course break them down
 into components, where one template corresponds to one snippet method
 call, like Wicket's panels, or is it normal to only separate out
 repeatedly used snippet templates, and just inline the one-use ones?

 I'm asking because I note that I changed the prefix used on the inner
 children of a template, my binding in the snippet will break, so
 there's a tight coupling there, which is fine, but I just want to be
 able to represent that coupling in my code's structure, sorta like how
 a Wicket component's mark-up has the same name as the class and occurs
 right beside it in the package.

 Also, I'm using Intellij IDEA 8, which is near seamless with the Scala
 and Maven support, but is there any additional Lift specific plugins
 about for Intellij? I can't find any, but I figure there might be an
 early alpha about - I only really want one for making Intellij aware
 of the template/snippet bindings.

 Thanks in advance,

 Liam Clarke

 --

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





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

--

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




[Lift] Re: Race conditions / database transaction isolation levels

2009-12-07 Thread cody koeninger


On Dec 7, 1:54 pm, David Pollak feeder.of.the.be...@gmail.com wrote:
 Feel free to open a ticket.  We prioritize work for production sites (or
 sites that are destined for production).  If you meet that criteria, please
 add this to the ticket so we can decide on what the priority is.


Thanks, that's totally fair.  If we end up going with lift for this
upcoming project, I'll open a ticket.  Just wanted to make sure I
wasn't misunderstanding / missing some concurrency control options.

--

You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@googlegroups.com.
To unsubscribe from 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 go about implementing my own auth?

2009-12-07 Thread DMB
SiteMap is out of the question. I don't need it at all on my site, by
design.
I like the way this is done in RoR: you can basically say:

before_filter :authorize, :except = :login

And it will call authorize for all top level methods in the
controller class except login. Not that any of this is applicable in
Lift, but I like this very simple, declarative approach. The current
auth infrastructure in Lift requires quite a bit of head scratching
the second you try to do something custom.

On Dec 7, 11:25 am, Timothy Perrett timo...@getintheloop.eu wrote:
 Ok, lets step back... I really, really wouldnt use the built in auth stuff 
 for forms... its sole purpose in life (and lift!) is for basic auth as per 
 the HTTP RFCs. If you want basic auth, then thats fine, but i think the way 
 you are subclassing HttpAuthentication is wrong for purpose.

 If you want login, do one of two things:

 - use SiteMap (IMHO, this is the most appropriate route)
 - create a custom rewrite / dispatcher combo

 You could look at MegaProtoUser, but personally, i'm not a huge fan of that 
 approach and prefer to craft my own. That being said, a lot of people use it 
 and it saves a lot of time.

 Cheers, Tim

 On 7 Dec 2009, at 14:14, Marius wrote:



  On Dec 7, 1:09 pm, DMB combust...@gmail.com wrote:
  Basically here's what I want to accomplish:
  1. I want the user to login through a simple form on /index.html -
  this is the only unprotected page on the site. User does not have a
  user name, the only field is a password.
  2. I want to store the user role (along with some other state data) in
  the user session
  3. If user tries to access any page other than index.html, I want to
  redirect to /index.html

  After stumbling for a while due to scarcity of documentation, I have
  done the following:

  In Boot.scala:

          LiftRules.httpAuthProtectedResource.prepend {
              case ParsePath(index :: Nil, html, true, false) =
  Empty
              case _ = Full(AuthRole(admin))
          }

          LiftRules.authentication = SessionAuthentication()

  InSessionAuthentication.scala:

  case class SessionAuthentication extends HttpAuthentication {

      def verified_? = { case(req) = {
                  // TODO: Prefetch from DB here
                  true
              }
      }

  }

  It is my understanding that this should not ask for auth at all. In
  reality, it doesn't ask for auth on /index.html, but DOES ask for
  Basic auth (through a browser popup) on any other page.

  What am I doing wrong, and how do I make it right?

  Your are seeing the browser's credentials popup because of :

   def unauthorizedResponse: UnauthorizedResponse = UnauthorizedResponse
  (realm)

  from HttpAuthentication trait. You can override this and subclass
  UnauthorizedResponse with your own LiftResponse if you want other type
  of response than 401. You can also protect your resources using
  HttpAuthProtected LocParam that you can use when you specify your
  SiteMap in the Loc construction.

  This is one approach.

  Another one, probably more suitable for login forms, is to look into
  Mapper support for that (I think it's called MetaMegaProtoUser ? )

  --

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

--

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




[Lift] Re: Mapper - JObject bridge

2009-12-07 Thread glenn
David,

I couldn't find encodeAsJSON_! on MetaMapper in the Lift source on
github.
Where is this code checked in?

Glenn

On Dec 2, 1:15 pm, David Pollak feeder.of.the.be...@gmail.com wrote:
 Folks (HarryH -- this means you),

 I've just checked in code on the dpp_issue_213 that does Mapper - JObject
 bridging using the awesome lift-json library.

 The methods on MetaMapper:
 protected def encodeAsJSON_! (toEncode: A): JsonAST.JObject
 protected def decodeFromJSON_!(json: JsonAST.JObject): A

 Implement the bridge.  They are protected and have a _! in their name
 because they are *dangerous* in that data can be exposed on the JSON object
 that you might not want exposed and these methods should be used with
 extreme caution.

 An example of usage can be found in the MapperSpecs:

 object SampleModel extends SampleModel with KeyedMetaMapper[Long,
 SampleModel] {
   def encodeAsJson(in: SampleModel): JsonAST.JObject = encodeAsJSON_!(in)
   def buildFromJson(json: JsonAST.JObject): SampleModel =
 decodeFromJSON_!(json)

 }

 class SampleModel extends KeyedMapper[Long, SampleModel] {
   def getSingleton = SampleModel // what's the meta server
   def primaryKeyField = id

   object id extends MappedLongIndex(this)
   object firstName extends MappedString(this, 32)
   object moose extends MappedNullableLong(this)
   object notNull extends MappedString(this, 32) {
     override def dbNotNull_? = true
   }

   def encodeAsJson(): JsonAST.JObject = SampleModel.encodeAsJson(this)

 }

 So, you can use this mechanism to serialize a Mapper object to JSON, shovel
 the object into memcached and then pull it out, mutate a field and save the
 object back to the database (although connection identifier is lost, so if
 you are sharding your database, this will not work).

 Please give it a try, give me feedback.  I'll put it on review board
 tomorrow after any feedback and get it into Lift.

 Thanks,

 David

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

--

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




Re: [Lift] Re: How do I go about implementing my own auth?

2009-12-07 Thread David Pollak
On Mon, Dec 7, 2009 at 1:32 PM, DMB combust...@gmail.com wrote:

 SiteMap is out of the question. I don't need it at all on my site, by
 design.


If you claimed I don't need controllers by design in an RoR site, then
your example would not work.

SiteMap is the access control mechanism for Lift.  If you don't like it, as
Marius pointed out, you can do a use a Dispatch to intercept the requests.

So, you've got two mechanisms, both as declarative as the Rails example
you've given.


 I like the way this is done in RoR: you can basically say:

 before_filter :authorize, :except = :login

 And it will call authorize for all top level methods in the
 controller class except login. Not that any of this is applicable in
 Lift, but I like this very simple, declarative approach. The current
 auth infrastructure in Lift requires quite a bit of head scratching
 the second you try to do something custom.

 On Dec 7, 11:25 am, Timothy Perrett timo...@getintheloop.eu wrote:
  Ok, lets step back... I really, really wouldnt use the built in auth
 stuff for forms... its sole purpose in life (and lift!) is for basic auth as
 per the HTTP RFCs. If you want basic auth, then thats fine, but i think the
 way you are subclassing HttpAuthentication is wrong for purpose.
 
  If you want login, do one of two things:
 
  - use SiteMap (IMHO, this is the most appropriate route)
  - create a custom rewrite / dispatcher combo
 
  You could look at MegaProtoUser, but personally, i'm not a huge fan of
 that approach and prefer to craft my own. That being said, a lot of people
 use it and it saves a lot of time.
 
  Cheers, Tim
 
  On 7 Dec 2009, at 14:14, Marius wrote:
 
 
 
   On Dec 7, 1:09 pm, DMB combust...@gmail.com wrote:
   Basically here's what I want to accomplish:
   1. I want the user to login through a simple form on /index.html -
   this is the only unprotected page on the site. User does not have a
   user name, the only field is a password.
   2. I want to store the user role (along with some other state data) in
   the user session
   3. If user tries to access any page other than index.html, I want to
   redirect to /index.html
 
   After stumbling for a while due to scarcity of documentation, I have
   done the following:
 
   In Boot.scala:
 
   LiftRules.httpAuthProtectedResource.prepend {
   case ParsePath(index :: Nil, html, true, false) =
   Empty
   case _ = Full(AuthRole(admin))
   }
 
   LiftRules.authentication = SessionAuthentication()
 
   InSessionAuthentication.scala:
 
   case class SessionAuthentication extends HttpAuthentication {
 
   def verified_? = { case(req) = {
   // TODO: Prefetch from DB here
   true
   }
   }
 
   }
 
   It is my understanding that this should not ask for auth at all. In
   reality, it doesn't ask for auth on /index.html, but DOES ask for
   Basic auth (through a browser popup) on any other page.
 
   What am I doing wrong, and how do I make it right?
 
   Your are seeing the browser's credentials popup because of :
 
def unauthorizedResponse: UnauthorizedResponse = UnauthorizedResponse
   (realm)
 
   from HttpAuthentication trait. You can override this and subclass
   UnauthorizedResponse with your own LiftResponse if you want other type
   of response than 401. You can also protect your resources using
   HttpAuthProtected LocParam that you can use when you specify your
   SiteMap in the Loc construction.
 
   This is one approach.
 
   Another one, probably more suitable for login forms, is to look into
   Mapper support for that (I think it's called MetaMegaProtoUser ? )
 
   --
 
   You received this message because you are subscribed to the Google
 Groups Lift group.
   To post to this group, send email to lift...@googlegroups.com.
   To unsubscribe from this group, send email to
 liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com
 .
   For more options, visit this group athttp://
 groups.google.com/group/liftweb?hl=en.

 --

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





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

--

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




Re: [Lift] Re: Sharing data between snippet functions during a single HTTP request

2009-12-07 Thread David Pollak
On Mon, Dec 7, 2009 at 12:50 PM, Alex Black a...@alexblack.ca wrote:

 Hi David,

 I just tried something similar out.
 1. I created a blank 1.0 lift project


How about starting with a Lift 1.1 project?


 2. I updated the pom file to reference lift-1.1M6


Did you update the version of Scala?


 3. I added a line to the hello world snippet in its body:
 println(Constructor)
 4. I modified index.html to call the snippet twice.
 5. I then launched the web server (mvn jetty:run) and accessed the
 main page once via a browser

 The line println(Constructor) gets called twice, I expected it just
 to get called once.


And Lift may choose to instantiate a snippet instance more than once for a
given request.  But, there is just one instance used across all the requests
to the named snippet for the balance of the call.


 Am I doing something wrong? Your test is not exactly the same as the
 problem I described, I described the constructor getting called 18
 times, I haven't yet verified whether or not the data is shared.


What is the issue with the constructor being called repeatedly?



 and here is the output:

 [INFO] Started Jetty Server
 [INFO] Starting scanner at interval of 5 seconds.
 Constructor
 Constructor
 INFO - Service request (GET) / took 393 Milliseconds
 INFO - Service request (GET) /classpath/jquery.js took 39 Milliseconds
 INFO - Service request (GET) /ajax_request/
 liftAjax.js;jsessionid=11x3vru6uimmg took 11 Milliseconds
 INFO - Service request (GET) /favicon.ico took 6 Milliseconds
 INFO - Service request (POST) /ajax_request/F318697140471TRN/ took 11
 Milliseconds
 INFO - Service request (POST) /ajax_request/F318697140471TRN/ took 1
 Milliseconds

 Snippet code:

 package com.liftcode.hello.snippet

 class HelloWorld {
  println(Constructor)

  def howdy = spanWelcome to hello-lift at {new
 _root_.java.util.Date}/span
 }

 index.html:

 lift:surround with=default at=content
h2Welcome to your project!/h2
 plift:helloWorld.howdy //p
plift:helloWorld.howdy //p
 /lift:surround

 Here is the pom.xml:

 project xmlns=http://maven.apache.org/POM/4.0.0; xmlns:xsi=http://
 www.w3.org/2001/XMLSchema-instance xsi:schemaLocation=http://
 maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd;
  modelVersion4.0.0/modelVersion
  groupIdcom.liftcode.hello/groupId
  artifactIdhello-lift/artifactId
  version1.0-SNAPSHOT/version
  packagingwar/packaging
  namehello-lift/name
  inceptionYear2007/inceptionYear
  properties
scala.version2.7.3/scala.version
  /properties

  repositories
repository
  idscala-tools.org/id
  nameScala-Tools Maven2 Repository/name
  urlhttp://scala-tools.org/repo-releases/url
/repository
  /repositories

  pluginRepositories
pluginRepository
  idscala-tools.org/id
  nameScala-Tools Maven2 Repository/name
  urlhttp://scala-tools.org/repo-releases/url
/pluginRepository
  /pluginRepositories

  dependencies
dependency
  groupIdorg.scala-lang/groupId
  artifactIdscala-library/artifactId
  version${scala.version}/version
/dependency
dependency
  groupIdnet.liftweb/groupId
  artifactIdlift-util/artifactId
  version1.1-M6/version
/dependency
dependency
  groupIdnet.liftweb/groupId
  artifactIdlift-webkit/artifactId
  version1.1-M6/version
/dependency
dependency
  groupIdjavax.servlet/groupId
  artifactIdservlet-api/artifactId
  version2.5/version
  scopeprovided/scope
/dependency
dependency
  groupIdjunit/groupId
  artifactIdjunit/artifactId
  version4.5/version
  scopetest/scope
/dependency
dependency
  groupIdorg.mortbay.jetty/groupId
  artifactIdjetty/artifactId
  version[6.1.6,)/version
  scopetest/scope
/dependency
!-- for LiftConsole --
dependency
  groupIdorg.scala-lang/groupId
  artifactIdscala-compiler/artifactId
  version${scala.version}/version
  scopetest/scope
/dependency
  /dependencies

  build
sourceDirectorysrc/main/scala/sourceDirectory
testSourceDirectorysrc/test/scala/testSourceDirectory
plugins
  plugin
groupIdorg.scala-tools/groupId
artifactIdmaven-scala-plugin/artifactId
executions
  execution
goals
  goalcompile/goal
  goaltestCompile/goal
/goals
  /execution
/executions
configuration
  scalaVersion${scala.version}/scalaVersion
/configuration
  /plugin
  plugin
groupIdorg.mortbay.jetty/groupId
artifactIdmaven-jetty-plugin/artifactId
configuration
  contextPath//contextPath
  scanIntervalSeconds5/scanIntervalSeconds
/configuration
  /plugin
  plugin
groupIdnet.sf.alchim/groupId
artifactIdyuicompressor-maven-plugin/artifactId
executions
  execution
goals
   

Re: [Lift] Next Lift version will be 2.0

2009-12-07 Thread Josh Suereth
Heiko,

Just curious what the difference between Major and Minor truly is as both
can break source/binary compatibility?   My feeling here is that sticking to
strick source-compatibility for minor releases is actually a bonus.

The other question I have is about deprecations.   What's your plan for
handling these?   When can deprecated features be removed, etc.   That might
feed into the source-compatibility issues in minor versions.

I think this is great stuff!  Whatever is decided here will help shape the
future of the Scala community's versioning, so I hope you don't mind my
pestering ;)

- Josh

On Mon, Dec 7, 2009 at 12:41 PM, Indrajit Raychaudhuri
indraj...@gmail.comwrote:

 Heiko,

 Grand stuff!

 Indeed, I was wondering if we could sync this up with the Round 2 of
 Refactoring exercise
 (
 http://groups.google.com/group/liftweb/browse_thread/thread/450a3e741999b5df
 ).
 New structure, new version.

 I am working on this refactoring in a private copy and am planning to
 publish the branch once M8 is out (assuming original schedule of 2 weeks
 from 27th Nov). Would this work with you?

 Cheers, Indrajit


 On 07/12/09 4:23 PM, Timothy Perrett wrote:
  Heiko,
 
  This is great - can you work with IRC to arrange a time to changes the
  poms to 2.0-SNAPSHOT?
 
  Cheers, Tim
 
  On 7 Dec 2009, at 08:32, Heiko Seeberger wrote:
 
  Lifters,
 
  Maybe you followed the discussion about the versioning policy for
  Lift. The committers finally decided to have a well defined versioning
  policy which you can take from here:
  http://wiki.github.com/dpp/liftweb/about-versioning-policy.
 
  Following this policy the next Lift version will be 2.0, not 1.1,
  because there are numerous changes and enhancements breaking the
  source compatibility. As soon as we change the version numbers in the
  Maven POMs, we will let you know via the lift-announce mailing list.
 
  Best regards,
 
  Heiko
 
  My job: weiglewilczek.com http://weiglewilczek.com/
  My blog: heikoseeberger.name http://heikoseeberger.name/
  Follow me: twitter.com/hseeberger http://twitter.com/hseeberger
  OSGi on Scala: scalamodules.org http://scalamodules.org/
  Lift, the simply functional web framework: liftweb.net
  http://liftweb.net/
 
  --
 
  You received this message because you are subscribed to the Google
  Groups Lift group.
  To post to this group, send email to liftweb@googlegroups.com
  mailto:liftweb@googlegroups.com.
  To unsubscribe from this group, send email to
  liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com
  mailto:liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com
 .
  For more options, visit this group at
  http://groups.google.com/group/liftweb?hl=en.
 
  --
 
  You received this message because you are subscribed to the Google
  Groups Lift group.
  To post to this group, send email to lift...@googlegroups.com.
  To unsubscribe from this group, send email to
  liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com
 .
  For more options, visit this group at
  http://groups.google.com/group/liftweb?hl=en.

 --

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




--

You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@googlegroups.com.
To unsubscribe from 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: Sharing data between snippet functions during a single HTTP request

2009-12-07 Thread Alex Black
 How about starting with a Lift 1.1 project?

I'll give it a try. I was mimicking how I tried to upgrade my 1.0
project.

 Did you update the version of Scala?

Nope, it is a 2.7.3 in the pom.

Just now I updated it to 2.7.7, re-ran, and saw the same behaviour.

 What is the issue with the constructor being called repeatedly?

In my test the constructor is getting called with every snippet method
call from the same page.

Given that you'd described only one snippet is used for all those
calls, let me put the question back to you: why is the constructor
being called 18 times when once would have sufficed?




  and here is the output:

  [INFO] Started Jetty Server
  [INFO] Starting scanner at interval of 5 seconds.
  Constructor
  Constructor
  INFO - Service request (GET) / took 393 Milliseconds
  INFO - Service request (GET) /classpath/jquery.js took 39 Milliseconds
  INFO - Service request (GET) /ajax_request/
  liftAjax.js;jsessionid=11x3vru6uimmg took 11 Milliseconds
  INFO - Service request (GET) /favicon.ico took 6 Milliseconds
  INFO - Service request (POST) /ajax_request/F318697140471TRN/ took 11
  Milliseconds
  INFO - Service request (POST) /ajax_request/F318697140471TRN/ took 1
  Milliseconds

  Snippet code:

  package com.liftcode.hello.snippet

  class HelloWorld {
   println(Constructor)

   def howdy = spanWelcome to hello-lift at {new
  _root_.java.util.Date}/span
  }

  index.html:

  lift:surround with=default at=content
                 h2Welcome to your project!/h2
                  plift:helloWorld.howdy //p
                 plift:helloWorld.howdy //p
  /lift:surround

  Here is the pom.xml:

  project xmlns=http://maven.apache.org/POM/4.0.0; xmlns:xsi=http://
 www.w3.org/2001/XMLSchema-instance xsi:schemaLocation=http://
  maven.apache.org/POM/4.0.0http://maven.apache.org/maven-v4_0_0.xsd;
   modelVersion4.0.0/modelVersion
   groupIdcom.liftcode.hello/groupId
   artifactIdhello-lift/artifactId
   version1.0-SNAPSHOT/version
   packagingwar/packaging
   namehello-lift/name
   inceptionYear2007/inceptionYear
   properties
     scala.version2.7.3/scala.version
   /properties

   repositories
     repository
       idscala-tools.org/id
       nameScala-Tools Maven2 Repository/name
       urlhttp://scala-tools.org/repo-releases/url
     /repository
   /repositories

   pluginRepositories
     pluginRepository
       idscala-tools.org/id
       nameScala-Tools Maven2 Repository/name
       urlhttp://scala-tools.org/repo-releases/url
     /pluginRepository
   /pluginRepositories

   dependencies
     dependency
       groupIdorg.scala-lang/groupId
       artifactIdscala-library/artifactId
       version${scala.version}/version
     /dependency
     dependency
       groupIdnet.liftweb/groupId
       artifactIdlift-util/artifactId
       version1.1-M6/version
     /dependency
     dependency
       groupIdnet.liftweb/groupId
       artifactIdlift-webkit/artifactId
       version1.1-M6/version
     /dependency
     dependency
       groupIdjavax.servlet/groupId
       artifactIdservlet-api/artifactId
       version2.5/version
       scopeprovided/scope
     /dependency
     dependency
       groupIdjunit/groupId
       artifactIdjunit/artifactId
       version4.5/version
       scopetest/scope
     /dependency
     dependency
       groupIdorg.mortbay.jetty/groupId
       artifactIdjetty/artifactId
       version[6.1.6,)/version
       scopetest/scope
     /dependency
     !-- for LiftConsole --
     dependency
       groupIdorg.scala-lang/groupId
       artifactIdscala-compiler/artifactId
       version${scala.version}/version
       scopetest/scope
     /dependency
   /dependencies

   build
     sourceDirectorysrc/main/scala/sourceDirectory
     testSourceDirectorysrc/test/scala/testSourceDirectory
     plugins
       plugin
         groupIdorg.scala-tools/groupId
         artifactIdmaven-scala-plugin/artifactId
         executions
           execution
             goals
               goalcompile/goal
               goaltestCompile/goal
             /goals
           /execution
         /executions
         configuration
           scalaVersion${scala.version}/scalaVersion
         /configuration
       /plugin
       plugin
         groupIdorg.mortbay.jetty/groupId
         artifactIdmaven-jetty-plugin/artifactId
         configuration
           contextPath//contextPath
           scanIntervalSeconds5/scanIntervalSeconds
         /configuration
       /plugin
       plugin
         groupIdnet.sf.alchim/groupId
         artifactIdyuicompressor-maven-plugin/artifactId
         executions
           execution
             goals
               goalcompress/goal
             /goals
           /execution
         /executions
         configuration
           nosuffixtrue/nosuffix
         /configuration
       /plugin
       plugin
         groupIdorg.apache.maven.plugins/groupId
         artifactIdmaven-eclipse-plugin/artifactId
         configuration
           

Re: [Lift] Re: Sharing data between snippet functions during a single HTTP request

2009-12-07 Thread David Pollak
On Mon, Dec 7, 2009 at 2:23 PM, Alex Black a...@alexblack.ca wrote:

  How about starting with a Lift 1.1 project?

 I'll give it a try. I was mimicking how I tried to upgrade my 1.0
 project.

  Did you update the version of Scala?

 Nope, it is a 2.7.3 in the pom.

 Just now I updated it to 2.7.7, re-ran, and saw the same behaviour.

  What is the issue with the constructor being called repeatedly?

 In my test the constructor is getting called with every snippet method
 call from the same page.

 Given that you'd described only one snippet is used for all those
 calls, let me put the question back to you: why is the constructor
 being called 18 times when once would have sufficed?


If there is an actual issue, then identify it.  Throwing questions back at
me doesn't really engender a lot of motivation for me to help.



 
 
 
   and here is the output:
 
   [INFO] Started Jetty Server
   [INFO] Starting scanner at interval of 5 seconds.
   Constructor
   Constructor
   INFO - Service request (GET) / took 393 Milliseconds
   INFO - Service request (GET) /classpath/jquery.js took 39 Milliseconds
   INFO - Service request (GET) /ajax_request/
   liftAjax.js;jsessionid=11x3vru6uimmg took 11 Milliseconds
   INFO - Service request (GET) /favicon.ico took 6 Milliseconds
   INFO - Service request (POST) /ajax_request/F318697140471TRN/ took 11
   Milliseconds
   INFO - Service request (POST) /ajax_request/F318697140471TRN/ took 1
   Milliseconds
 
   Snippet code:
 
   package com.liftcode.hello.snippet
 
   class HelloWorld {
println(Constructor)
 
def howdy = spanWelcome to hello-lift at {new
   _root_.java.util.Date}/span
   }
 
   index.html:
 
   lift:surround with=default at=content
  h2Welcome to your project!/h2
   plift:helloWorld.howdy //p
  plift:helloWorld.howdy //p
   /lift:surround
 
   Here is the pom.xml:
 
   project xmlns=http://maven.apache.org/POM/4.0.0; xmlns:xsi=http://
  www.w3.org/2001/XMLSchema-instance xsi:schemaLocation=http://
   maven.apache.org/POM/4.0.0http://maven.apache.org/maven-v4_0_0.xsd;
modelVersion4.0.0/modelVersion
groupIdcom.liftcode.hello/groupId
artifactIdhello-lift/artifactId
version1.0-SNAPSHOT/version
packagingwar/packaging
namehello-lift/name
inceptionYear2007/inceptionYear
properties
  scala.version2.7.3/scala.version
/properties
 
repositories
  repository
idscala-tools.org/id
nameScala-Tools Maven2 Repository/name
urlhttp://scala-tools.org/repo-releases/url
  /repository
/repositories
 
pluginRepositories
  pluginRepository
idscala-tools.org/id
nameScala-Tools Maven2 Repository/name
urlhttp://scala-tools.org/repo-releases/url
  /pluginRepository
/pluginRepositories
 
dependencies
  dependency
groupIdorg.scala-lang/groupId
artifactIdscala-library/artifactId
version${scala.version}/version
  /dependency
  dependency
groupIdnet.liftweb/groupId
artifactIdlift-util/artifactId
version1.1-M6/version
  /dependency
  dependency
groupIdnet.liftweb/groupId
artifactIdlift-webkit/artifactId
version1.1-M6/version
  /dependency
  dependency
groupIdjavax.servlet/groupId
artifactIdservlet-api/artifactId
version2.5/version
scopeprovided/scope
  /dependency
  dependency
groupIdjunit/groupId
artifactIdjunit/artifactId
version4.5/version
scopetest/scope
  /dependency
  dependency
groupIdorg.mortbay.jetty/groupId
artifactIdjetty/artifactId
version[6.1.6,)/version
scopetest/scope
  /dependency
  !-- for LiftConsole --
  dependency
groupIdorg.scala-lang/groupId
artifactIdscala-compiler/artifactId
version${scala.version}/version
scopetest/scope
  /dependency
/dependencies
 
build
  sourceDirectorysrc/main/scala/sourceDirectory
  testSourceDirectorysrc/test/scala/testSourceDirectory
  plugins
plugin
  groupIdorg.scala-tools/groupId
  artifactIdmaven-scala-plugin/artifactId
  executions
execution
  goals
goalcompile/goal
goaltestCompile/goal
  /goals
/execution
  /executions
  configuration
scalaVersion${scala.version}/scalaVersion
  /configuration
/plugin
plugin
  groupIdorg.mortbay.jetty/groupId
  artifactIdmaven-jetty-plugin/artifactId
  configuration
contextPath//contextPath
scanIntervalSeconds5/scanIntervalSeconds
  /configuration
/plugin
plugin
  groupIdnet.sf.alchim/groupId
  artifactIdyuicompressor-maven-plugin/artifactId
  executions
execution
  

[Lift] Re: Sharing data between snippet functions during a single HTTP request

2009-12-07 Thread Alex Black
Its not causing me any issue at the moment, just figured it'd be
faster/more correct to call the constructor just once if only one
instance was needed.

- Alex

On Dec 7, 5:25 pm, David Pollak feeder.of.the.be...@gmail.com wrote:
 On Mon, Dec 7, 2009 at 2:23 PM, Alex Black a...@alexblack.ca wrote:
   How about starting with a Lift 1.1 project?

  I'll give it a try. I was mimicking how I tried to upgrade my 1.0
  project.

   Did you update the version of Scala?

  Nope, it is a 2.7.3 in the pom.

  Just now I updated it to 2.7.7, re-ran, and saw the same behaviour.

   What is the issue with the constructor being called repeatedly?

  In my test the constructor is getting called with every snippet method
  call from the same page.

  Given that you'd described only one snippet is used for all those
  calls, let me put the question back to you: why is the constructor
  being called 18 times when once would have sufficed?

 If there is an actual issue, then identify it.  Throwing questions back at
 me doesn't really engender a lot of motivation for me to help.



and here is the output:

[INFO] Started Jetty Server
[INFO] Starting scanner at interval of 5 seconds.
Constructor
Constructor
INFO - Service request (GET) / took 393 Milliseconds
INFO - Service request (GET) /classpath/jquery.js took 39 Milliseconds
INFO - Service request (GET) /ajax_request/
liftAjax.js;jsessionid=11x3vru6uimmg took 11 Milliseconds
INFO - Service request (GET) /favicon.ico took 6 Milliseconds
INFO - Service request (POST) /ajax_request/F318697140471TRN/ took 11
Milliseconds
INFO - Service request (POST) /ajax_request/F318697140471TRN/ took 1
Milliseconds

Snippet code:

package com.liftcode.hello.snippet

class HelloWorld {
 println(Constructor)

 def howdy = spanWelcome to hello-lift at {new
_root_.java.util.Date}/span
}

index.html:

lift:surround with=default at=content
               h2Welcome to your project!/h2
                plift:helloWorld.howdy //p
               plift:helloWorld.howdy //p
/lift:surround

Here is the pom.xml:

project xmlns=http://maven.apache.org/POM/4.0.0; xmlns:xsi=http://
   www.w3.org/2001/XMLSchema-instance xsi:schemaLocation=http://
maven.apache.org/POM/4.0.0http://maven.apache.org/maven-v4_0_0.xsd;
 modelVersion4.0.0/modelVersion
 groupIdcom.liftcode.hello/groupId
 artifactIdhello-lift/artifactId
 version1.0-SNAPSHOT/version
 packagingwar/packaging
 namehello-lift/name
 inceptionYear2007/inceptionYear
 properties
   scala.version2.7.3/scala.version
 /properties

 repositories
   repository
     idscala-tools.org/id
     nameScala-Tools Maven2 Repository/name
     urlhttp://scala-tools.org/repo-releases/url
   /repository
 /repositories

 pluginRepositories
   pluginRepository
     idscala-tools.org/id
     nameScala-Tools Maven2 Repository/name
     urlhttp://scala-tools.org/repo-releases/url
   /pluginRepository
 /pluginRepositories

 dependencies
   dependency
     groupIdorg.scala-lang/groupId
     artifactIdscala-library/artifactId
     version${scala.version}/version
   /dependency
   dependency
     groupIdnet.liftweb/groupId
     artifactIdlift-util/artifactId
     version1.1-M6/version
   /dependency
   dependency
     groupIdnet.liftweb/groupId
     artifactIdlift-webkit/artifactId
     version1.1-M6/version
   /dependency
   dependency
     groupIdjavax.servlet/groupId
     artifactIdservlet-api/artifactId
     version2.5/version
     scopeprovided/scope
   /dependency
   dependency
     groupIdjunit/groupId
     artifactIdjunit/artifactId
     version4.5/version
     scopetest/scope
   /dependency
   dependency
     groupIdorg.mortbay.jetty/groupId
     artifactIdjetty/artifactId
     version[6.1.6,)/version
     scopetest/scope
   /dependency
   !-- for LiftConsole --
   dependency
     groupIdorg.scala-lang/groupId
     artifactIdscala-compiler/artifactId
     version${scala.version}/version
     scopetest/scope
   /dependency
 /dependencies

 build
   sourceDirectorysrc/main/scala/sourceDirectory
   testSourceDirectorysrc/test/scala/testSourceDirectory
   plugins
     plugin
       groupIdorg.scala-tools/groupId
       artifactIdmaven-scala-plugin/artifactId
       executions
         execution
           goals
             goalcompile/goal
             goaltestCompile/goal
           /goals
         /execution
       /executions
       configuration
         scalaVersion${scala.version}/scalaVersion
       /configuration
     /plugin
     plugin
       groupIdorg.mortbay.jetty/groupId
       

[Lift] Re: How can one bind value-less attributes?

2009-12-07 Thread Alex Black
Thanks for the help on this guys, looks promising.

On Dec 7, 12:57 pm, Ross Mellgren dri...@gmail.com wrote:
 Sha-bam

 http://github.com/dpp/liftweb/issues/#issue/229

 -Ross

 On Dec 7, 2009, at 12:43 PM, David Pollak wrote:

  Is there a ticket for this?  I'm in ticket-closing mode today ;-)

  On Mon, Dec 7, 2009 at 9:29 AM, Ross Mellgren dri...@gmail.com  
  wrote:
  I looked at adding a Box variant, but it wasn't a strictly speaking  
  trivial change since calcValue on BindParam is of type NodeSeq. I  
  guess it could become Box[NodeSeq] and then when binding at element  
  positions convert that to NodeSeq.Empty, but I also have had the  
  need (which I've worked around) to be able to replace a single bound  
  attribute with multiple result attributes, so I was thinking that it  
  would be best to allow AttrBindParams to generate MetaData, not just  
  a value.

  I had written some code to play with this idea, but I didn't get too  
  far because I was busy and needed feedback from other committers. I  
  can return it to working tonight if there's interest.

  -Ross

  On Dec 7, 2009, at 12:22 PM, Alex Boisvert wrote:

  On Sun, Dec 6, 2009 at 8:28 PM, David Pollak feeder.of.the.be...@gmail.com
   wrote:

  On Sun, Dec 6, 2009 at 7:25 PM, Alex Boisvert alex.boisv...@gmail.com
   wrote:
  Using the latest and greatest (master branch), I can't reproduce  
  the MatchError but I can reproduce the issue with the attribute  
  being generated if the value is null.

  How about adding a Box alternative rather than perpetuating a  
  paradigm based on null?

  Yes, that's better.  I'll do that.

  [Side diatribe:  Can't wait for a working scala.NotNull so we can  
  implicitly convert (non-null) literal values to Some() or Full()  
  instance and reduce verbosity]

  alex

  --

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

  --

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

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

  --

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

--

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




[Lift] Re: Documentation for 1.1

2009-12-07 Thread Randinn
Great! Thank you for the heads-up.

On Dec 7, 9:55 pm, Timothy Perrett timo...@getintheloop.eu wrote:
 Randinn,

 This is already slated for 1.1/2.0 release... dont worry we are getting to it 
 :-)

 Cheers, Tim

 On 7 Dec 2009, at 08:09, Randinn wrote:

  I am writing here to get a dialog going about the changes from 1.0 to
  1.1. I mistakenly filed a ticket on the subject but was wondering if
  there could be some documentation done with all of the new/changed
  features in 1.1. Most of the time the changes and additions are
  mentioned here but there are times that a feature is added and it's
  only talked about when someone asks about it. I was wondering if a
  current commiter or possibly bring one on board with the idea of
  fleshing out the documentation.

  --

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

--

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




[Lift] Re: Documentation for 1.1

2009-12-07 Thread Randinn
A pretty good idea, a commiter makes a change or adds a feature then
post about it on a blog, that would make it easier for people to go
through and later on to be able to update the documentation.

On Dec 7, 10:53 pm, TylerWeir tyler.w...@gmail.com wrote:
 Something like This Week in Lift master would 
 help.http://suitmymind.com/blog/2009/01/22/this-week-in-edge-cappuccino/

 On Dec 7, 5:55 am, Timothy Perrett timo...@getintheloop.eu wrote:

  Randinn,

  This is already slated for 1.1/2.0 release... dont worry we are getting to 
  it :-)

  Cheers, Tim

  On 7 Dec 2009, at 08:09, Randinn wrote:

   I am writing here to get a dialog going about the changes from 1.0 to
   1.1. I mistakenly filed a ticket on the subject but was wondering if
   there could be some documentation done with all of the new/changed
   features in 1.1. Most of the time the changes and additions are
   mentioned here but there are times that a feature is added and it's
   only talked about when someone asks about it. I was wondering if a
   current commiter or possibly bring one on board with the idea of
   fleshing out the documentation.

   --

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

--

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




[Lift] Fwd: Watch Foursquare Lift talk live from NY

2009-12-07 Thread David Pollak
-- Forwarded message --
From: Dave Briccetti da...@davebsoft.com
Date: Mon, Dec 7, 2009 at 3:15 PM
Subject: Watch Foursquare Lift talk live from NY
To: Bay Area Scala Enthusiasts scala-b...@googlegroups.com


http://www.justin.tv/n8han

--

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





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

--

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




Re: [Lift] Re: Documentation for 1.1

2009-12-07 Thread Timothy Perrett
You are aware that our maven site automatically generates a list of  
changes in a given version? If any commiters adds something then they  
updates the changes.xml for just this reason.

Take a look at that and see if it is the kind of thing you would like?  
I'm not saying it's everything you could ask for, as I sense you want  
deeper docs in general - but as before, this is in hand.

Cheers, Tim

Sent from my iPhone

On 7 Dec 2009, at 23:01, Randinn rand...@gmail.com wrote:

 A pretty good idea, a commiter makes a change or adds a feature then
 post about it on a blog, that would make it easier for people to go
 through and later on to be able to update the documentation.

 On Dec 7, 10:53 pm, TylerWeir tyler.w...@gmail.com wrote:
 Something like This Week in Lift master would help.http:// 
 suitmymind.com/blog/2009/01/22/this-week-in-edge-cappuccino/

 On Dec 7, 5:55 am, Timothy Perrett timo...@getintheloop.eu wrote:

 Randinn,

 This is already slated for 1.1/2.0 release... dont worry we are  
 getting to it :-)

 Cheers, Tim

 On 7 Dec 2009, at 08:09, Randinn wrote:

 I am writing here to get a dialog going about the changes from  
 1.0 to
 1.1. I mistakenly filed a ticket on the subject but was wondering  
 if
 there could be some documentation done with all of the new/changed
 features in 1.1. Most of the time the changes and additions are
 mentioned here but there are times that a feature is added and it's
 only talked about when someone asks about it. I was wondering if a
 current commiter or possibly bring one on board with the idea of
 fleshing out the documentation.

 --

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

 --

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




--

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




[Lift] Re: Field validation

2009-12-07 Thread wstrange

After some experimenting I have field validation working with JSR 303
annotations. See:


http://wstrange.wordpress.com/2009/12/07/inline-field-validation-in-scalalift-using-jpa-and-jsr-303/




On Dec 5, 10:53 pm, wstrange warren.stra...@gmail.com wrote:
 After more experimenting ... I think this approach only works with
 Mapper/Record? It requires afieldid to be set, and validations
 errors to be set on that id ( e.g. S.error(mobilePhone, bad
 phone...) )

 Is there an example of how to do this using JPA and JSR 303 (aka
 Hibernate Validators)?

 On Dec 5, 6:38 pm, wstrange warren.stra...@gmail.com wrote:

  OK, figured it out.  This should be:

  bind(...
   mobilePhone - formField(Mobile Phone, SHtml.text
  (user.mobilePhone, user.mobilePhone = _) ),

  On Dec 5, 5:39 pm, wstrange warren.stra...@gmail.com wrote:

   Hi Alex

   Thank you so much for the tip.

   Just so I am clear (I am a  lift newbie), I assume I would call this
   function in my snippet:

   bind(..
   phoneNumber - formField(Phone Number, user.phoneNumber)
   )

   Is that the idea?

   On Dec 4, 5:06 pm, Alex Siman aleksandr.si...@gmail.com wrote:

Checkout my code, especially parts with cssClass.

        import net.liftweb.http.S._
        import net.liftweb.http.SHtml._

        // input can be SHtml.text
        def formField(label: String, input: Elem): NodeSeq = {
                val fixedLabel = label match {
                        case  = 
                        case s: String = s + :
                }

                val id = (input \ @id).toString
                val messageList = messagesById(id)(errors)
                val hasMessages = messageList.size  0
                val cssClass = if (hasMessages) ErrorField else 
                val messages = messageList match {
                        case list: List[NodeSeq] if hasMessages = {
                                ul{messageList.map(m = 
li{m}/li)}/ul
                        }
                        case _ = Nil
                }

                table class={cssClass} style=width: 100%;
                        tr
                                td style=text-align: right; 
vertical-align: top; width: 10em;
                                        b{fixedLabel}/bnbsp;
                                /td
                                td style=text-align: left;
                                        {input}{messages}
                                /td
                        /tr
                /table
        }

On 4 дек, 23:22, wstrange warren.stra...@gmail.com wrote:

 I have searched the archives, but the answer is not immediately clear
 to me...

 How does one providefieldvalidationfeedback on a form (e.g. turn
 the phone numberfieldred if an error is made in data entry)? The
 S.error approach of collecting all the errors into one big message
 seems unwieldy, and does not give the user very good feedback.   I am
 using JPA if that makes any difference.

 Any tips would be appreciated

--

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




Re: [Lift] Sharing data between snippet functions during a single HTTP request

2009-12-07 Thread Xuefeng Wu
Hi ,

When I use RequestVar get the message: RequestVar ... was set but not
read

My code like this:
object MyMgr {
  ...
  Loc.Snippet(myFoo,myFoo)
 ...
   object myId extends RequestVar[Long](0)

   def myFoo(xhtml: NodeSeq): NodeSeq = {

def selectNode = {

myId .set(vId)

}

   bind(,xhtml,
 node-a(() = selectNode, Text(nodeName))
)
   }

}

the RequestVar must be used at Class?

On Sat, Nov 21, 2009 at 12:09 AM, Ross Mellgren dri...@gmail.com wrote:

 RequestVar is the standard way of doing this. For example

 object MySharedInformation {
 object myData extends RequestVar[List[Thing]](loadThings)
 //   ^^^  ^^
 //Type of thing to store  How to initialize
 variable first time it's accessed

 private def loadThings: List[Thing] = ...
 }

 class Snippet1 {
 import MySharedInformation.myData
 def render(ns: NodeSeq): NodeSeq = {
 myData.is.map(thing = { ... })
 }
 }

 class Snippet2 {
 import MySharedInformation.myData
 ...
 }

 The lifetime of the value is during the current request processing and
 any AJAX calls related to it.

 If you really want to initialize it in a snippet, then use a Box with
 a RequestVar, like this:

 object MySharedInformation {
 object myData extends RequestVar[Box[List[Thing]]](Empty)
 }

 class LoaderSnippet {
 import MySharedInformation.myData
 def render(ns: NodeSeq): NodeSeq = {
 myData.set(Full(...))
 }
 }

 class ReaderSnippet {
 import MySharedInformation.myData
 def render(ns: NodeSeq): NodeSeq = {
 // If the data has not been loaded, default to an empty list
 val data = myData.is.openOr(Nil)
 ...
 }
 }

 class OtherReaderSnippet {
 import MySharedInformation.myData
 def render(ns: NodeSeq): NodeSeq = {
 // Do two entirely different things if the data has versus
 has not been loaded
 myData.is match {
 case Full(data) = // do something when the data has been
 loaded
 case _ = // do something when the data has not been loaded
 }
 }
 }

 HTH,
 -Ross


 On Nov 20, 2009, at 10:59 AM, Alex Black wrote:

  I've got a template page, say foobar.html, that makes a number of
  calls to functions in a snippet, e.g. mysnippet.foo1, mysnippet.foo2,
  mysnippet.foo3.
 
  I'd like to do some initial work in foo1, e.g. retrieve some data and
  do some work on it, then in foo2 and foo3 display parts of that data.
 
  Whats the easiest way to do this? I think I misunderstood the lift
  book:
 
  That means that for each request, Lift creates a new instance of the
  snippet class to execute. Any changes you make to instance variables
  will be discarded after the request is processed.
 
  I thought this meant that for a given HTTP request, there would be one
  (and only one) instance of my snippet, so I could call several of its
  methods and they could all access the snippet's member variables,
  which would then be discarded at the end of the request.
 
  Am I going about this wrong? should I only have one snippet function
  per template?
 
  Thx
 
  - Alex
 
  --
 
  You received this message because you are subscribed to the Google
  Groups Lift group.
  To post to this group, send email to lift...@googlegroups.com.
  To unsubscribe from this group, send email to
 liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com
  .
  For more options, visit this group at
 http://groups.google.com/group/liftweb?hl=
  .
 
 

 --

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





-- 
Scala中文社区:  http://groups.google.com/group/scalacn

--

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




Re: [Lift] Sharing data between snippet functions during a single HTTP request

2009-12-07 Thread Ross Mellgren
I think that message is just informative, letting you know that you don't seem 
to be using the request var fully (perhaps due to typo, or code refactoring 
that made it unused, or something.)

I think it'll go away if you access the variable somewhere using myId.is.

-Ross

On Dec 7, 2009, at 9:02 PM, Xuefeng Wu wrote:

 Hi ,
 
 When I use RequestVar get the message: RequestVar ... was set but not read
 
 My code like this:
 object MyMgr {
   ...
   Loc.Snippet(myFoo,myFoo)
  ...
object myId extends RequestVar[Long](0)
 
def myFoo(xhtml: NodeSeq): NodeSeq = {
 
 def selectNode = {
 
 myId .set(vId)
 
 }
 
bind(,xhtml,
  node-a(() = selectNode, Text(nodeName))
 )
}
 
 }
 
 the RequestVar must be used at Class?
 
 On Sat, Nov 21, 2009 at 12:09 AM, Ross Mellgren dri...@gmail.com wrote:
 RequestVar is the standard way of doing this. For example
 
 object MySharedInformation {
 object myData extends RequestVar[List[Thing]](loadThings)
 //   ^^^  ^^
 //Type of thing to store  How to initialize
 variable first time it's accessed
 
 private def loadThings: List[Thing] = ...
 }
 
 class Snippet1 {
 import MySharedInformation.myData
 def render(ns: NodeSeq): NodeSeq = {
 myData.is.map(thing = { ... })
 }
 }
 
 class Snippet2 {
 import MySharedInformation.myData
 ...
 }
 
 The lifetime of the value is during the current request processing and
 any AJAX calls related to it.
 
 If you really want to initialize it in a snippet, then use a Box with
 a RequestVar, like this:
 
 object MySharedInformation {
 object myData extends RequestVar[Box[List[Thing]]](Empty)
 }
 
 class LoaderSnippet {
 import MySharedInformation.myData
 def render(ns: NodeSeq): NodeSeq = {
 myData.set(Full(...))
 }
 }
 
 class ReaderSnippet {
 import MySharedInformation.myData
 def render(ns: NodeSeq): NodeSeq = {
 // If the data has not been loaded, default to an empty list
 val data = myData.is.openOr(Nil)
 ...
 }
 }
 
 class OtherReaderSnippet {
 import MySharedInformation.myData
 def render(ns: NodeSeq): NodeSeq = {
 // Do two entirely different things if the data has versus
 has not been loaded
 myData.is match {
 case Full(data) = // do something when the data has been
 loaded
 case _ = // do something when the data has not been loaded
 }
 }
 }
 
 HTH,
 -Ross
 
 
 On Nov 20, 2009, at 10:59 AM, Alex Black wrote:
 
  I've got a template page, say foobar.html, that makes a number of
  calls to functions in a snippet, e.g. mysnippet.foo1, mysnippet.foo2,
  mysnippet.foo3.
 
  I'd like to do some initial work in foo1, e.g. retrieve some data and
  do some work on it, then in foo2 and foo3 display parts of that data.
 
  Whats the easiest way to do this? I think I misunderstood the lift
  book:
 
  That means that for each request, Lift creates a new instance of the
  snippet class to execute. Any changes you make to instance variables
  will be discarded after the request is processed.
 
  I thought this meant that for a given HTTP request, there would be one
  (and only one) instance of my snippet, so I could call several of its
  methods and they could all access the snippet's member variables,
  which would then be discarded at the end of the request.
 
  Am I going about this wrong? should I only have one snippet function
  per template?
 
  Thx
 
  - Alex
 
  --
 
  You received this message because you are subscribed to the Google
  Groups Lift group.
  To post to this group, send email to lift...@googlegroups.com.
  To unsubscribe from this group, send email to 
  liftweb+unsubscr...@googlegroups.com
  .
  For more options, visit this group at 
  http://groups.google.com/group/liftweb?hl=
  .
 
 
 
 --
 
 You received this message because you are subscribed to the Google Groups 
 Lift group.
 To post to this group, send email to lift...@googlegroups.com.
 To unsubscribe from this group, send email to 
 liftweb+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/liftweb?hl=.
 
 
 
 
 
 -- 
 Scala中文社区:  http://groups.google.com/group/scalacn
 
 --
 
 You received this message because you are subscribed to the Google Groups 
 Lift group.
 To post to this group, send email to lift...@googlegroups.com.
 To unsubscribe from this group, send email to 
 liftweb+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/liftweb?hl=en.

--

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

Re: [Lift] Sharing data between snippet functions during a single HTTP request

2009-12-07 Thread Xuefeng Wu
I use myId.is but get nothing.
I don't know what I could do with the information.

On Tue, Dec 8, 2009 at 10:19 AM, Ross Mellgren dri...@gmail.com wrote:

 I think that message is just informative, letting you know that you don't
 seem to be using the request var fully (perhaps due to typo, or code
 refactoring that made it unused, or something.)

 I think it'll go away if you access the variable somewhere using myId.is.

 -Ross

 On Dec 7, 2009, at 9:02 PM, Xuefeng Wu wrote:

 Hi ,

 When I use RequestVar get the message: RequestVar ... was set but not
 read

 My code like this:
 object MyMgr {
   ...
   Loc.Snippet(myFoo,myFoo)
  ...
object myId extends RequestVar[Long](0)

def myFoo(xhtml: NodeSeq): NodeSeq = {
 
 def selectNode = {

 myId .set(vId)

 }
 
bind(,xhtml,
  node-a(() = selectNode, Text(nodeName))
 )
}

 }

 the RequestVar must be used at Class?

 On Sat, Nov 21, 2009 at 12:09 AM, Ross Mellgren dri...@gmail.com wrote:

 RequestVar is the standard way of doing this. For example

 object MySharedInformation {
 object myData extends RequestVar[List[Thing]](loadThings)
 //   ^^^  ^^
 //Type of thing to store  How to initialize
 variable first time it's accessed

 private def loadThings: List[Thing] = ...
 }

 class Snippet1 {
 import MySharedInformation.myData
 def render(ns: NodeSeq): NodeSeq = {
 myData.is.map(thing = { ... })
 }
 }

 class Snippet2 {
 import MySharedInformation.myData
 ...
 }

 The lifetime of the value is during the current request processing and
 any AJAX calls related to it.

 If you really want to initialize it in a snippet, then use a Box with
 a RequestVar, like this:

 object MySharedInformation {
 object myData extends RequestVar[Box[List[Thing]]](Empty)
 }

 class LoaderSnippet {
 import MySharedInformation.myData
 def render(ns: NodeSeq): NodeSeq = {
 myData.set(Full(...))
 }
 }

 class ReaderSnippet {
 import MySharedInformation.myData
 def render(ns: NodeSeq): NodeSeq = {
 // If the data has not been loaded, default to an empty list
 val data = myData.is.openOr(Nil)
 ...
 }
 }

 class OtherReaderSnippet {
 import MySharedInformation.myData
 def render(ns: NodeSeq): NodeSeq = {
 // Do two entirely different things if the data has versus
 has not been loaded
 myData.is match {
 case Full(data) = // do something when the data has been
 loaded
 case _ = // do something when the data has not been loaded
 }
 }
 }

 HTH,
 -Ross


 On Nov 20, 2009, at 10:59 AM, Alex Black wrote:

  I've got a template page, say foobar.html, that makes a number of
  calls to functions in a snippet, e.g. mysnippet.foo1, mysnippet.foo2,
  mysnippet.foo3.
 
  I'd like to do some initial work in foo1, e.g. retrieve some data and
  do some work on it, then in foo2 and foo3 display parts of that data.
 
  Whats the easiest way to do this? I think I misunderstood the lift
  book:
 
  That means that for each request, Lift creates a new instance of the
  snippet class to execute. Any changes you make to instance variables
  will be discarded after the request is processed.
 
  I thought this meant that for a given HTTP request, there would be one
  (and only one) instance of my snippet, so I could call several of its
  methods and they could all access the snippet's member variables,
  which would then be discarded at the end of the request.
 
  Am I going about this wrong? should I only have one snippet function
  per template?
 
  Thx
 
  - Alex
 
  --
 
  You received this message because you are subscribed to the Google
  Groups Lift group.
  To post to this group, send email to lift...@googlegroups.com.
  To unsubscribe from this group, send email to
 liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com
  .
  For more options, visit this group at
 http://groups.google.com/group/liftweb?hl=
  .
 
 

 --

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





 --
 Scala中文社区:  http://groups.google.com/group/scalacn

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


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

[Lift] Re: Fwd: Watch Foursquare Lift talk live from NY

2009-12-07 Thread Peter Robinett
If you missed the talk you can download it from the same link. It's a
good one.

One thing mentioned briefly in the talk that I'd like to know more
about is oAuth Server code. Is anyone working on that? How can I help?

Peter

On Dec 7, 3:16 pm, David Pollak feeder.of.the.be...@gmail.com wrote:
 -- Forwarded message --
 From: Dave Briccetti da...@davebsoft.com
 Date: Mon, Dec 7, 2009 at 3:15 PM
 Subject: Watch Foursquare Lift talk live from NY
 To: Bay Area Scala Enthusiasts scala-b...@googlegroups.com

 http://www.justin.tv/n8han

 --

 You received this message because you are subscribed to the Google Groups
 Bay Area Scala Enthusiasts group.
 To post to this group, send email to scala-b...@googlegroups.com.
 To unsubscribe from this group, send email to
 scala-base+unsubscr...@googlegroups.comscala-base%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group 
 athttp://groups.google.com/group/scala-base?hl=en.

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

--

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




Re: [Lift] Sharing data between snippet functions during a single HTTP request

2009-12-07 Thread Ross Mellgren
Well if you logically expected it to be read but it wasn't, it might indicate a 
bug to you or help in diagnosis.

I'm not sure I understand your reply fully -- when you added myId.is did the 
log message go away? If not, could you post your code?

-Ross

On Dec 7, 2009, at 9:39 PM, Xuefeng Wu wrote:

 I use myId.is but get nothing.
 I don't know what I could do with the information.
 
 On Tue, Dec 8, 2009 at 10:19 AM, Ross Mellgren dri...@gmail.com wrote:
 I think that message is just informative, letting you know that you don't 
 seem to be using the request var fully (perhaps due to typo, or code 
 refactoring that made it unused, or something.)
 
 I think it'll go away if you access the variable somewhere using myId.is.
 
 -Ross
 
 On Dec 7, 2009, at 9:02 PM, Xuefeng Wu wrote:
 
 Hi ,
 
 When I use RequestVar get the message: RequestVar ... was set but not 
 read
 
 My code like this:
 object MyMgr {
   ...
   Loc.Snippet(myFoo,myFoo)
  ...
object myId extends RequestVar[Long](0)
 
def myFoo(xhtml: NodeSeq): NodeSeq = {
 
 def selectNode = {
 
 myId .set(vId)
 
 }
 
bind(,xhtml,
  node-a(() = selectNode, Text(nodeName))
 )
}
 
 }
 
 the RequestVar must be used at Class?
 
 On Sat, Nov 21, 2009 at 12:09 AM, Ross Mellgren dri...@gmail.com wrote:
 RequestVar is the standard way of doing this. For example
 
 object MySharedInformation {
 object myData extends RequestVar[List[Thing]](loadThings)
 //   ^^^  ^^
 //Type of thing to store  How to initialize
 variable first time it's accessed
 
 private def loadThings: List[Thing] = ...
 }
 
 class Snippet1 {
 import MySharedInformation.myData
 def render(ns: NodeSeq): NodeSeq = {
 myData.is.map(thing = { ... })
 }
 }
 
 class Snippet2 {
 import MySharedInformation.myData
 ...
 }
 
 The lifetime of the value is during the current request processing and
 any AJAX calls related to it.
 
 If you really want to initialize it in a snippet, then use a Box with
 a RequestVar, like this:
 
 object MySharedInformation {
 object myData extends RequestVar[Box[List[Thing]]](Empty)
 }
 
 class LoaderSnippet {
 import MySharedInformation.myData
 def render(ns: NodeSeq): NodeSeq = {
 myData.set(Full(...))
 }
 }
 
 class ReaderSnippet {
 import MySharedInformation.myData
 def render(ns: NodeSeq): NodeSeq = {
 // If the data has not been loaded, default to an empty list
 val data = myData.is.openOr(Nil)
 ...
 }
 }
 
 class OtherReaderSnippet {
 import MySharedInformation.myData
 def render(ns: NodeSeq): NodeSeq = {
 // Do two entirely different things if the data has versus
 has not been loaded
 myData.is match {
 case Full(data) = // do something when the data has been
 loaded
 case _ = // do something when the data has not been loaded
 }
 }
 }
 
 HTH,
 -Ross
 
 
 On Nov 20, 2009, at 10:59 AM, Alex Black wrote:
 
  I've got a template page, say foobar.html, that makes a number of
  calls to functions in a snippet, e.g. mysnippet.foo1, mysnippet.foo2,
  mysnippet.foo3.
 
  I'd like to do some initial work in foo1, e.g. retrieve some data and
  do some work on it, then in foo2 and foo3 display parts of that data.
 
  Whats the easiest way to do this? I think I misunderstood the lift
  book:
 
  That means that for each request, Lift creates a new instance of the
  snippet class to execute. Any changes you make to instance variables
  will be discarded after the request is processed.
 
  I thought this meant that for a given HTTP request, there would be one
  (and only one) instance of my snippet, so I could call several of its
  methods and they could all access the snippet's member variables,
  which would then be discarded at the end of the request.
 
  Am I going about this wrong? should I only have one snippet function
  per template?
 
  Thx
 
  - Alex
 
  --
 
  You received this message because you are subscribed to the Google
  Groups Lift group.
  To post to this group, send email to lift...@googlegroups.com.
  To unsubscribe from this group, send email to 
  liftweb+unsubscr...@googlegroups.com
  .
  For more options, visit this group at 
  http://groups.google.com/group/liftweb?hl=
  .
 
 
 
 --
 
 You received this message because you are subscribed to the Google Groups 
 Lift group.
 To post to this group, send email to lift...@googlegroups.com.
 To unsubscribe from this group, send email to 
 liftweb+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/liftweb?hl=.
 
 
 
 
 
 -- 
 Scala中文社区:  http://groups.google.com/group/scalacn
 
 --
 
 You received this message because you are subscribed to the Google Groups 
 Lift group.
 To post 

[Lift] UTF-8 Characters

2009-12-07 Thread Peter Robinett
Hi all,

I just discovered that XHTML pages do not support all the character
entity references HTML does[1]. In my case that means switching from
deg; to ° in my Javascript file. This is fine except that I am now
getting a garbled character. My file is encoded in UTF-8 and Maven is
using UTF-8[2], so I'm stumped about why it is happening. I could just
switch to an HTML doctype but I'm interested in understanding
everything that's happening here. Any suggestions?

Peter

[1]: 
http://www.bubblefoundry.com/blog/2009/12/html-and-xml-character-encoding-gotchas-in-javascript/
[2]: 
http://maven.apache.org/plugins/maven-resources-plugin/examples/encoding.html

--

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




[Lift] Re: How do I go about implementing my own auth?

2009-12-07 Thread DMB
Hmm. I need to give it a try. I didn't realize it has such diverse
functionality.

On Dec 7, 1:38 pm, Marius marius.dan...@gmail.com wrote:
 I'm not really sure why you're saying that SiteMap is out of the
 question. Note that SiteMap does NOT equate with the Menu. You can use
 SiteMap to define navigation rules, security semantics, etc. SiteMap
 is much more then just a menu.

 But at the end of the day it's your choice.

 Br's,
 Marius

 On Dec 7, 11:32 pm, DMB combust...@gmail.com wrote:

  SiteMap is out of the question. I don't need it at all on my site, by
  design.
  I like the way this is done in RoR: you can basically say:

  before_filter :authorize, :except = :login

  And it will call authorize for all top level methods in the
  controller class except login. Not that any of this is applicable in
  Lift, but I like this very simple, declarative approach. The current
  auth infrastructure in Lift requires quite a bit of head scratching
  the second you try to do something custom.

  On Dec 7, 11:25 am, Timothy Perrett timo...@getintheloop.eu wrote:

   Ok, lets step back... I really, really wouldnt use the built in auth 
   stuff for forms... its sole purpose in life (and lift!) is for basic auth 
   as per the HTTP RFCs. If you want basic auth, then thats fine, but i 
   think the way you are subclassing HttpAuthentication is wrong for purpose.

   If you want login, do one of two things:

   - use SiteMap (IMHO, this is the most appropriate route)
   - create a custom rewrite / dispatcher combo

   You could look at MegaProtoUser, but personally, i'm not a huge fan of 
   that approach and prefer to craft my own. That being said, a lot of 
   people use it and it saves a lot of time.

   Cheers, Tim

   On 7 Dec 2009, at 14:14, Marius wrote:

On Dec 7, 1:09 pm, DMB combust...@gmail.com wrote:
Basically here's what I want to accomplish:
1. I want the user to login through a simple form on /index.html -
this is the only unprotected page on the site. User does not have a
user name, the only field is a password.
2. I want to store the user role (along with some other state data) in
the user session
3. If user tries to access any page other than index.html, I want to
redirect to /index.html

After stumbling for a while due to scarcity of documentation, I have
done the following:

In Boot.scala:

        LiftRules.httpAuthProtectedResource.prepend {
            case ParsePath(index :: Nil, html, true, false) =
Empty
            case _ = Full(AuthRole(admin))
        }

        LiftRules.authentication = SessionAuthentication()

InSessionAuthentication.scala:

case class SessionAuthentication extends HttpAuthentication {

    def verified_? = { case(req) = {
                // TODO: Prefetch from DB here
                true
            }
    }

}

It is my understanding that this should not ask for auth at all. In
reality, it doesn't ask for auth on /index.html, but DOES ask for
Basic auth (through a browser popup) on any other page.

What am I doing wrong, and how do I make it right?

Your are seeing the browser's credentials popup because of :

 def unauthorizedResponse: UnauthorizedResponse = UnauthorizedResponse
(realm)

from HttpAuthentication trait. You can override this and subclass
UnauthorizedResponse with your own LiftResponse if you want other type
of response than 401. You can also protect your resources using
HttpAuthProtected LocParam that you can use when you specify your
SiteMap in the Loc construction.

This is one approach.

Another one, probably more suitable for login forms, is to look into
Mapper support for that (I think it's called MetaMegaProtoUser ? )

--

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

--

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




Re: [Lift] Sharing data between snippet functions during a single HTTP request

2009-12-07 Thread Xuefeng Wu
My code :


object CompetenceMgr {

 Menu(Loc(Competence, List(competence, index), S.?(Competence),
ifIsLoggedIn,
 ...
 Loc.Snippet(buildCompetenceDicRows, buildCompetenceDicRows),
   Loc.Snippet(addCompetenceB, addCompetenceB),


private object *_categoryId *extends RequestVar[Long](0)

//build a competenceDic table
  def buildCompetenceDicRows(xhtml: NodeSeq): NodeSeq = {
... ...
def *makeCategoryRow*(r: Category) = {
 .
   def *categoryNode*: NodeSeq = {
   def categoryNodeLinkId = categoryNodeLinkId- + r.id
   def selectCategoryNode: JsCmd = {
* //here: set the _categoryId, but didn't work*
  _categoryId.set(r.id.is)
 ... ..
   }
 span id={categoryNodeLinkId} class='node_span'{a(() =
selectCategoryNode, Text(r.title.is))}/span
   }
   tr tdspan class=folder draggable droppable
 id={categoeryId}{categoryNode}/span/td/tr % (id - nodeId) %
(class - nodeClass)
}
def *buildCategoryRows*: NodeSeq = {
  val resourceData = Category.categoriesTreeList
  (empty /: resourceData)((l, r) = l ++ *makeCategoryRow*(r))
  }
 *buildCategoryRows*
  }

  //it's a button for create competence
 def *addCompetenceB*(xhtml: NodeSeq): NodeSeq = doCompetenceB(xhtml,add
Competence,null)
 //a button for create or edit competence
  def *doCompetenceB*(xhtml: NodeSeq,msg: String,competence: Competence):
NodeSeq = {
a(() = {
  *//here I try to get the categoryId if it selected.*
  val catId: Long = _categoryId.is
 S.runTemplate(List(competence,_competence)).
 map(ns = ModalDialog(doCompetenceEditor(ns,catId,competence)))
openOr
 Alert(Couldn't find _competence template)},
 Text(msg),class - button
  )
  }




On Tue, Dec 8, 2009 at 11:02 AM, Ross Mellgren dri...@gmail.com wrote:

 Well if you logically expected it to be read but it wasn't, it might
 indicate a bug to you or help in diagnosis.

 I'm not sure I understand your reply fully -- when you added myId.is did
 the log message go away? If not, could you post your code?

 -Ross

 On Dec 7, 2009, at 9:39 PM, Xuefeng Wu wrote:

 I use myId.is but get nothing.
 I don't know what I could do with the information.

 On Tue, Dec 8, 2009 at 10:19 AM, Ross Mellgren dri...@gmail.com wrote:

 I think that message is just informative, letting you know that you don't
 seem to be using the request var fully (perhaps due to typo, or code
 refactoring that made it unused, or something.)

 I think it'll go away if you access the variable somewhere using myId.is.

 -Ross

 On Dec 7, 2009, at 9:02 PM, Xuefeng Wu wrote:

 Hi ,

 When I use RequestVar get the message: RequestVar ... was set but not
 read

 My code like this:
 object MyMgr {
   ...
   Loc.Snippet(myFoo,myFoo)
  ...
object myId extends RequestVar[Long](0)

def myFoo(xhtml: NodeSeq): NodeSeq = {
 
 def selectNode = {

 myId .set(vId)

 }
 
bind(,xhtml,
  node-a(() = selectNode, Text(nodeName))
 )
}

 }

 the RequestVar must be used at Class?

 On Sat, Nov 21, 2009 at 12:09 AM, Ross Mellgren dri...@gmail.com wrote:

 RequestVar is the standard way of doing this. For example

 object MySharedInformation {
 object myData extends RequestVar[List[Thing]](loadThings)
 //   ^^^  ^^
 //Type of thing to store  How to initialize
 variable first time it's accessed

 private def loadThings: List[Thing] = ...
 }

 class Snippet1 {
 import MySharedInformation.myData
 def render(ns: NodeSeq): NodeSeq = {
 myData.is.map(thing = { ... })
 }
 }

 class Snippet2 {
 import MySharedInformation.myData
 ...
 }

 The lifetime of the value is during the current request processing and
 any AJAX calls related to it.

 If you really want to initialize it in a snippet, then use a Box with
 a RequestVar, like this:

 object MySharedInformation {
 object myData extends RequestVar[Box[List[Thing]]](Empty)
 }

 class LoaderSnippet {
 import MySharedInformation.myData
 def render(ns: NodeSeq): NodeSeq = {
 myData.set(Full(...))
 }
 }

 class ReaderSnippet {
 import MySharedInformation.myData
 def render(ns: NodeSeq): NodeSeq = {
 // If the data has not been loaded, default to an empty list
 val data = myData.is.openOr(Nil)
 ...
 }
 }

 class OtherReaderSnippet {
 import MySharedInformation.myData
 def render(ns: NodeSeq): NodeSeq = {
 // Do two entirely different things if the data has versus
 has not been loaded
 myData.is match {
 case Full(data) = // do something when the data has been
 loaded
 case _ = // do something when the data has not been loaded
 }
 }
 }

 HTH,
 -Ross


 

Re: [Lift] UTF-8 Characters

2009-12-07 Thread David Pollak
Peter,

My understanding is that JavaScript strings must be ASCII or escaped to
Unicode: \u4455 (or whatever the unicode character is for degrees).

Thanks,

David

On Mon, Dec 7, 2009 at 7:14 PM, Peter Robinett pe...@bubblefoundry.comwrote:

 Hi all,

 I just discovered that XHTML pages do not support all the character
 entity references HTML does[1]. In my case that means switching from
 deg; to ° in my Javascript file. This is fine except that I am now
 getting a garbled character. My file is encoded in UTF-8 and Maven is
 using UTF-8[2], so I'm stumped about why it is happening. I could just
 switch to an HTML doctype but I'm interested in understanding
 everything that's happening here. Any suggestions?

 Peter

 [1]:
 http://www.bubblefoundry.com/blog/2009/12/html-and-xml-character-encoding-gotchas-in-javascript/
 [2]:
 http://maven.apache.org/plugins/maven-resources-plugin/examples/encoding.html

 --

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





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

--

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




Re: [Lift] Re: Fwd: Watch Foursquare Lift talk live from NY

2009-12-07 Thread David Pollak
On Mon, Dec 7, 2009 at 6:59 PM, Peter Robinett pe...@bubblefoundry.comwrote:

 If you missed the talk you can download it from the same link. It's a
 good one.

 One thing mentioned briefly in the talk that I'd like to know more
 about is oAuth Server code. Is anyone working on that?


It's on my to-do list.


 How can I help?


Once I get the code into the repo, you're welcome/encouraged to make it
better.



 Peter

 On Dec 7, 3:16 pm, David Pollak feeder.of.the.be...@gmail.com wrote:
  -- Forwarded message --
  From: Dave Briccetti da...@davebsoft.com
  Date: Mon, Dec 7, 2009 at 3:15 PM
  Subject: Watch Foursquare Lift talk live from NY
  To: Bay Area Scala Enthusiasts scala-b...@googlegroups.com
 
  http://www.justin.tv/n8han
 
  --
 
  You received this message because you are subscribed to the Google Groups
  Bay Area Scala Enthusiasts group.
  To post to this group, send email to scala-b...@googlegroups.com.
  To unsubscribe from this group, send email to
  scala-base+unsubscr...@googlegroups.comscala-base%2bunsubscr...@googlegroups.com
 scala-base%2bunsubscr...@googlegroups.comscala-base%252bunsubscr...@googlegroups.com
 
  .
  For more options, visit this group athttp://
 groups.google.com/group/scala-base?hl=en.
 
  --
  Lift, the simply functional web frameworkhttp://liftweb.net
  Beginning Scalahttp://www.apress.com/book/view/1430219890
  Follow me:http://twitter.com/dpp
  Surf the harmonics

 --

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





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

--

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




Re: [Lift] Sharing data between snippet functions during a single HTTP request

2009-12-07 Thread Ross Mellgren
I'm sorry, I'm having trouble following your code, I think too much of the 
surrounding code and templates is missing for me to reason about why you would 
have a problem.

I set up a quick example app, so maybe the code from that will help you. It is 
here: 

http://github.com/Dridus/test-rqvarlog

If I understand you correctly, you're getting a log message like this one:
WARN - RequestVar test.snippet.HelloWorld$myVar$_ was set but not read

This message is from the code I posted:

package test.snippet

import _root_.scala.xml.NodeSeq
import _root_.net.liftweb.http.RequestVar
import _root_.net.liftweb.util.Helpers
import Helpers._

class HelloWorld {
object myVar extends RequestVar[Int](0)

def howdy(in: NodeSeq): NodeSeq = Helpers.bind(b, in, time - (new 
_root_.java.util.Date).toString)

def increment(in: NodeSeq): NodeSeq = {
myVar.set(myVar.is + 1)
divincrement called/div
}

def show(in: NodeSeq): NodeSeq = divshow called -- myVar.is { myVar.is 
}/div
}


lift:surround with=default at=content
h2Welcome to your project!/h2
p
  lift:helloWorld.howdy
spanWelcome to test-rqvarlog at b:time//span
  /lift:helloWorld.howdy

  lift:HelloWorld.increment /
  lift:HelloWorld.increment /
!--  lift:HelloWorld.show / --
/p
/lift:surround

If I uncomment the line with HelloWorld.show in the template, the log message 
goes away because myVar.is is called.

If you are still getting the message, then that should mean that you are not 
calling myVar.is in the same request.

HTH,
-Ross

On Dec 7, 2009, at 10:28 PM, Xuefeng Wu wrote:

 My code :
 
 
 object CompetenceMgr {
 
  Menu(Loc(Competence, List(competence, index), S.?(Competence), 
 ifIsLoggedIn,
 ...
  Loc.Snippet(buildCompetenceDicRows, 
 buildCompetenceDicRows), 
Loc.Snippet(addCompetenceB, addCompetenceB), 
 
 
 private object _categoryId extends RequestVar[Long](0)
 
 //build a competenceDic table
   def buildCompetenceDicRows(xhtml: NodeSeq): NodeSeq = {
 ... ...
 def makeCategoryRow(r: Category) = {
  .
def categoryNode: NodeSeq = {
  def categoryNodeLinkId = categoryNodeLinkId- + r.id
  def selectCategoryNode: JsCmd = {
//here: set the _categoryId, but didn't work
_categoryId.set(r.id.is)
   ... .. 
  }
  span id={categoryNodeLinkId} class='node_span'{a(() = 
 selectCategoryNode, Text(r.title.is))}/span
}
tr tdspan class=folder draggable droppable  
 id={categoeryId}{categoryNode}/span/td/tr % (id - nodeId) % 
 (class - nodeClass) 
 }
 def buildCategoryRows: NodeSeq = {
   val resourceData = Category.categoriesTreeList
   (empty /: resourceData)((l, r) = l ++ makeCategoryRow(r))
   }
  buildCategoryRows
   }
 
   //it's a button for create competence
  def addCompetenceB(xhtml: NodeSeq): NodeSeq = doCompetenceB(xhtml,add 
 Competence,null)
  //a button for create or edit competence
   def doCompetenceB(xhtml: NodeSeq,msg: String,competence: Competence): 
 NodeSeq = {
 a(() = {
   //here I try to get the categoryId if it selected.
   val catId: Long = _categoryId.is 
  S.runTemplate(List(competence,_competence)).
  map(ns = ModalDialog(doCompetenceEditor(ns,catId,competence))) 
 openOr
  Alert(Couldn't find _competence template)},
  Text(msg),class - button
   )
   }
 
  
 
 
 On Tue, Dec 8, 2009 at 11:02 AM, Ross Mellgren dri...@gmail.com wrote:
 Well if you logically expected it to be read but it wasn't, it might indicate 
 a bug to you or help in diagnosis.
 
 I'm not sure I understand your reply fully -- when you added myId.is did the 
 log message go away? If not, could you post your code?
 
 -Ross
 
 On Dec 7, 2009, at 9:39 PM, Xuefeng Wu wrote:
 
 I use myId.is but get nothing.
 I don't know what I could do with the information.
 
 On Tue, Dec 8, 2009 at 10:19 AM, Ross Mellgren dri...@gmail.com wrote:
 I think that message is just informative, letting you know that you don't 
 seem to be using the request var fully (perhaps due to typo, or code 
 refactoring that made it unused, or something.)
 
 I think it'll go away if you access the variable somewhere using myId.is.
 
 -Ross
 
 On Dec 7, 2009, at 9:02 PM, Xuefeng Wu wrote:
 
 Hi ,
 
 When I use RequestVar get the message: RequestVar ... was set but not 
 read
 
 My code like this:
 object MyMgr {
   ...
   Loc.Snippet(myFoo,myFoo)
  ...
object myId extends RequestVar[Long](0)
 
def myFoo(xhtml: NodeSeq): NodeSeq = {
 
 def selectNode = {
 
 myId .set(vId)
 
 }
 
bind(,xhtml,
  node-a(() = selectNode, 

Re: [Lift] re: what changes would need to be made so LIFT can work with HTML5

2009-12-07 Thread David Pollak
On Mon, Dec 7, 2009 at 3:49 PM, Alex Boisvert alex.boisv...@gmail.comwrote:

 On Sun, Dec 6, 2009 at 7:43 PM, James Black planiturth...@gmail.comwrote:

 I tried S.setDocType and got this error, using LIFT 1.0.1, with this bit
 of code in Boot.scala:
 class Boot {
   def boot {
 if (!DB.jndiJdbcConnAvailable_?)
   DB.defineConnectionManager(DefaultConnectionIdentifier, DBVendor)

   S.setDocType(Box(List(!DOCTYPE html)))


 Oh, and you can't use S.setDocType() in Boot.  You have to call it within
 the scope of a session, e.g., inside a snippet.


Anything that accesses S is on a session-by-session (on in this case
request-by-request) basis.

However, the ResponseInfo.docType partial function is that thing that vends
the docType.  Your best bet for changing the default of all pages is to do
the following in Boot.scala:

ResponseInfo.docType = {
  case _ if S.skipDocType = Empty
  case _ if S.getDocType._1 = S.getDocType._2
  case _ = Full(!DOCTYPE html)
}



 There are also other ways to set the docType, including providing it
 explicitly in a LiftResponse, overriding LiftRules.convertResponse, etc...

 alex

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




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

--

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




[Lift] Re: vscaladoc broken?

2009-12-07 Thread Indrajit Raychaudhuri
Tim,

A fix is up for review: http://reviewboard.liftweb.net/r/137/. This
resolved the scala:doc inconsistency among other things.

Cheers, Indrajit

On Nov 30, 11:42 pm, Indrajit Raychaudhuri indraj...@gmail.com
wrote:
 Short answer:
 Use mvn site for a couple of days to have the package link defs work,
 but ideally mvn scala:doc should be consistent. I'll fix that, give me
 a day or two please.

 Long answer:
 mvn site picks up plugin settings from reporting section and mvn
 scala:doc picks up plugin settings from build section. The trick
 (jvmArg -DpackageLinkDefs) is done in the maven-scala-plugin
 configuration in the reporting section. Per Maven's documentation build
 plugin settings (and thus config) should be picked up from their
 corresponding settings in reporting section (odd, but true). Strangely,
 that's happening for all the config elements except for jvmArgs/.
 So I'll go ahead and duplicate jvmArgs/ section in both places:report
 plugin and build plugin.

 Pain:
 Next up, you, or somebody else who is regularly doing mvn scala:doc
 locally (and want to stay offline) would find that with mvn site (or
 mvn scala:doc when the fix is in) you end up having the click thru to
 different package classes land up somewhere 
 inhttp://scala-tools.org/mvnsites-snapshots/ instead of local filesystem.
 This is because, by default vscaladoc.links.liftweb.baseurl is set 
 tohttp://scala-tools.org/mvnsites-snapshots/liftweb. Adjust this using
 -Dvscaladoc.links.liftweb.baseurl=local_lift_base during mvn site
 to circumvent that.

 Cheers, IRC

 On 30/11/09 7:00 PM, Timothy Perrett wrote:



  Hey :-)

  Yeah I did a mvn scala:doc - what should one run instead? mvn site?

  Cheers, Tim

  On 30 Nov 2009, at 13:16, Indrajit Raychaudhuri wrote:

  Tim,

  The scala-tools maven site honors the package link defs.

  Did you do scaladoc generation as part site build or as part of
  scala:doc?
  I am assuming you did the later. And quite likely the configuration
  for the jvmArgs (-DpackageLinkDefs in particular) isn't getting
  propagated from report plugin to build plugin. Please confirm if this
  is the case.

  Either way, please raise a ticket. I'll take a look tomorrow or day
  after.

  Cheers, Indrajit

  On Nov 30, 4:34 am, Timothy Perretttimo...@getintheloop.eu  wrote:
  Guys,

  Since IRC did the refactor on the vscaladoc package link defs, it
  appears that you can no longer click through classes that are not in
  that package. For example, clicking through to Box from any package
  other than lift-common does nothing from a usability perspective,
  I think this could be problematic for newbies as thats how a lot of
  people learn by hoping through class to class... if its fundamentally
  broken, we have a problem.

  IRC, can you fix this please?

  Cheers, Tim

  --

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

  --

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

--

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




Re: [Lift] Sharing data between snippet functions during a single HTTP request

2009-12-07 Thread Xuefeng Wu
Hi Ross,

Yes it's not in the same request.

My case is:
When user select a tree node, I want to store this nodeId and If user click
a button to create a child node, I want to get the selected node.

I use ModalDialog when user click the button to create now node.

On Tue, Dec 8, 2009 at 11:50 AM, Ross Mellgren dri...@gmail.com wrote:

 I'm sorry, I'm having trouble following your code, I think too much of the
 surrounding code and templates is missing for me to reason about why you
 would have a problem.

 I set up a quick example app, so maybe the code from that will help you. It
 is here:

 http://github.com/Dridus/test-rqvarlog

 If I understand you correctly, you're getting a log message like this one:
 WARN - RequestVar test.snippet.HelloWorld$myVar$_ was set but not read

 This message is from the code I posted:

 package test.snippet

 import _root_.scala.xml.NodeSeq
 import _root_.net.liftweb.http.RequestVar
 import _root_.net.liftweb.util.Helpers
 import Helpers._

 class HelloWorld {
 object myVar extends RequestVar[Int](0)

 def howdy(in: NodeSeq): NodeSeq = Helpers.bind(b, in, time - (new
 _root_.java.util.Date).toString)

 def increment(in: NodeSeq): NodeSeq = {
 myVar.set(myVar.is + 1)
 divincrement called/div
 }

 def show(in: NodeSeq): NodeSeq = divshow called -- myVar.is {
 myVar.is }/div
 }


 lift:surround with=default at=content
 h2Welcome to your project!/h2
 p
   lift:helloWorld.howdy
 spanWelcome to test-rqvarlog at b:time//span
   /lift:helloWorld.howdy

   lift:HelloWorld.increment /
   lift:HelloWorld.increment /
 !--  lift:HelloWorld.show / --
 /p
 /lift:surround

 If I uncomment the line with HelloWorld.show in the template, the log
 message goes away because myVar.is is called.

 If you are still getting the message, then that should mean that you are
 not calling myVar.is in the same request.

 HTH,
 -Ross

 On Dec 7, 2009, at 10:28 PM, Xuefeng Wu wrote:

 My code :


 object CompetenceMgr {

  Menu(Loc(Competence, List(competence, index), S.?(Competence),
 ifIsLoggedIn,
  ...
  Loc.Snippet(buildCompetenceDicRows, buildCompetenceDicRows),
Loc.Snippet(addCompetenceB, addCompetenceB),
 

 private object *_categoryId *extends RequestVar[Long](0)

 //build a competenceDic table
   def buildCompetenceDicRows(xhtml: NodeSeq): NodeSeq = {
 ... ...
 def *makeCategoryRow*(r: Category) = {
  .
def *categoryNode*: NodeSeq = {
def categoryNodeLinkId = categoryNodeLinkId- + r.id
def selectCategoryNode: JsCmd = {
 * //here: set the _categoryId, but didn't work*
   _categoryId.set(r.id.is)
  ... ..
}
  span id={categoryNodeLinkId} class='node_span'{a(() =
 selectCategoryNode, Text(r.title.is))}/span
}
tr tdspan class=folder draggable droppable
  id={categoeryId}{categoryNode}/span/td/tr % (id - nodeId) %
 (class - nodeClass)
 }
 def *buildCategoryRows*: NodeSeq = {
   val resourceData = Category.categoriesTreeList
   (empty /: resourceData)((l, r) = l ++ *makeCategoryRow*(r))
   }
  *buildCategoryRows*
   }

   //it's a button for create competence
  def *addCompetenceB*(xhtml: NodeSeq): NodeSeq = doCompetenceB(xhtml,add
 Competence,null)
  //a button for create or edit competence
   def *doCompetenceB*(xhtml: NodeSeq,msg: String,competence: Competence):
 NodeSeq = {
 a(() = {
   *//here I try to get the categoryId if it selected.*
   val catId: Long = _categoryId.is
  S.runTemplate(List(competence,_competence)).
  map(ns =
 ModalDialog(doCompetenceEditor(ns,catId,competence))) openOr
  Alert(Couldn't find _competence template)},
  Text(msg),class - button
   )
   }




 On Tue, Dec 8, 2009 at 11:02 AM, Ross Mellgren dri...@gmail.com wrote:

 Well if you logically expected it to be read but it wasn't, it might
 indicate a bug to you or help in diagnosis.

 I'm not sure I understand your reply fully -- when you added myId.is did
 the log message go away? If not, could you post your code?

 -Ross

 On Dec 7, 2009, at 9:39 PM, Xuefeng Wu wrote:

 I use myId.is but get nothing.
 I don't know what I could do with the information.

 On Tue, Dec 8, 2009 at 10:19 AM, Ross Mellgren dri...@gmail.com wrote:

 I think that message is just informative, letting you know that you don't
 seem to be using the request var fully (perhaps due to typo, or code
 refactoring that made it unused, or something.)

 I think it'll go away if you access the variable somewhere using myId.is
 .

 -Ross

 On Dec 7, 2009, at 9:02 PM, Xuefeng Wu wrote:

 Hi ,

 When I use RequestVar get the message: RequestVar ... was set but not
 read

 My code like this:
 object MyMgr {
   ...
   Loc.Snippet(myFoo,myFoo)
  ...
object myId extends RequestVar[Long](0)

def myFoo(xhtml: NodeSeq): 

Re: [Lift] Sharing data between snippet functions during a single HTTP request

2009-12-07 Thread Xuefeng Wu
My current solution is that when user select a tree node, I replace the add
button dependence on the node.


2009/12/8 Xuefeng Wu ben...@gmail.com

 Hi Ross,

 Yes it's not in the same request.

 My case is:
 When user select a tree node, I want to store this nodeId and If user click
 a button to create a child node, I want to get the selected node.

 I use ModalDialog when user click the button to create now node.

 On Tue, Dec 8, 2009 at 11:50 AM, Ross Mellgren dri...@gmail.com wrote:

 I'm sorry, I'm having trouble following your code, I think too much of the
 surrounding code and templates is missing for me to reason about why you
 would have a problem.

 I set up a quick example app, so maybe the code from that will help you.
 It is here:

 http://github.com/Dridus/test-rqvarlog

 If I understand you correctly, you're getting a log message like this one:
 WARN - RequestVar test.snippet.HelloWorld$myVar$_ was set but not read

 This message is from the code I posted:

 package test.snippet

 import _root_.scala.xml.NodeSeq
 import _root_.net.liftweb.http.RequestVar
 import _root_.net.liftweb.util.Helpers
 import Helpers._

 class HelloWorld {
 object myVar extends RequestVar[Int](0)

 def howdy(in: NodeSeq): NodeSeq = Helpers.bind(b, in, time - (new
 _root_.java.util.Date).toString)

 def increment(in: NodeSeq): NodeSeq = {
 myVar.set(myVar.is + 1)
 divincrement called/div
 }

 def show(in: NodeSeq): NodeSeq = divshow called -- myVar.is {
 myVar.is }/div
 }


 lift:surround with=default at=content
 h2Welcome to your project!/h2
 p
   lift:helloWorld.howdy
 spanWelcome to test-rqvarlog at b:time//span
   /lift:helloWorld.howdy

   lift:HelloWorld.increment /
   lift:HelloWorld.increment /
 !--  lift:HelloWorld.show / --
 /p
 /lift:surround

 If I uncomment the line with HelloWorld.show in the template, the log
 message goes away because myVar.is is called.

 If you are still getting the message, then that should mean that you are
 not calling myVar.is in the same request.

 HTH,
 -Ross

 On Dec 7, 2009, at 10:28 PM, Xuefeng Wu wrote:

 My code :


 object CompetenceMgr {

  Menu(Loc(Competence, List(competence, index), S.?(Competence),
 ifIsLoggedIn,
  ...
  Loc.Snippet(buildCompetenceDicRows, buildCompetenceDicRows),
Loc.Snippet(addCompetenceB, addCompetenceB),
 

 private object *_categoryId *extends RequestVar[Long](0)

 //build a competenceDic table
   def buildCompetenceDicRows(xhtml: NodeSeq): NodeSeq = {
 ... ...
 def *makeCategoryRow*(r: Category) = {
  .
def *categoryNode*: NodeSeq = {
def categoryNodeLinkId = categoryNodeLinkId- + r.id
def selectCategoryNode: JsCmd = {
 * //here: set the _categoryId, but didn't work*
   _categoryId.set(r.id.is)
  ... ..
}
  span id={categoryNodeLinkId} class='node_span'{a(() =
 selectCategoryNode, Text(r.title.is))}/span
}
tr tdspan class=folder draggable droppable
  id={categoeryId}{categoryNode}/span/td/tr % (id - nodeId) %
 (class - nodeClass)
 }
 def *buildCategoryRows*: NodeSeq = {
   val resourceData = Category.categoriesTreeList
   (empty /: resourceData)((l, r) = l ++ *makeCategoryRow*(r))
   }
  *buildCategoryRows*
   }

   //it's a button for create competence
  def *addCompetenceB*(xhtml: NodeSeq): NodeSeq = doCompetenceB(xhtml,add
 Competence,null)
  //a button for create or edit competence
   def *doCompetenceB*(xhtml: NodeSeq,msg: String,competence: Competence):
 NodeSeq = {
 a(() = {
   *//here I try to get the categoryId if it selected.*
   val catId: Long = _categoryId.is
  S.runTemplate(List(competence,_competence)).
  map(ns =
 ModalDialog(doCompetenceEditor(ns,catId,competence))) openOr
  Alert(Couldn't find _competence template)},
  Text(msg),class - button
   )
   }




 On Tue, Dec 8, 2009 at 11:02 AM, Ross Mellgren dri...@gmail.com wrote:

 Well if you logically expected it to be read but it wasn't, it might
 indicate a bug to you or help in diagnosis.

 I'm not sure I understand your reply fully -- when you added myId.is did
 the log message go away? If not, could you post your code?

 -Ross

 On Dec 7, 2009, at 9:39 PM, Xuefeng Wu wrote:

 I use myId.is but get nothing.
 I don't know what I could do with the information.

 On Tue, Dec 8, 2009 at 10:19 AM, Ross Mellgren dri...@gmail.com wrote:

 I think that message is just informative, letting you know that you
 don't seem to be using the request var fully (perhaps due to typo, or code
 refactoring that made it unused, or something.)

 I think it'll go away if you access the variable somewhere using
 myId.is.

 -Ross

 On Dec 7, 2009, at 9:02 PM, Xuefeng Wu wrote:

 Hi ,

 When I use RequestVar get the message: RequestVar ... was set but
 not read

 My 

Re: [Lift] Sharing data between snippet functions during a single HTTP request

2009-12-07 Thread David Pollak
On Mon, Dec 7, 2009 at 8:37 PM, Xuefeng Wu ben...@gmail.com wrote:

 Hi Ross,

 Yes it's not in the same request.


It's not the same request.  The code:
a(() = {
  *//here I try to get the categoryId if it selected.*
  val catId: Long = _categoryId.is
 S.runTemplate(List(competence,_competence)).
 map(ns = ModalDialog(doCompetenceEditor(ns,catId,competence)))
openOr
 Alert(Couldn't find _competence template)},
 Text(msg),class - button
  )

The function passed to a() is evaluated in a separate request.  It's
evaluated when the link is clicked and that's definitely a separate request.




 My case is:
 When user select a tree node, I want to store this nodeId and If user click
 a button to create a child node, I want to get the selected node.

 I use ModalDialog when user click the button to create now node.


 On Tue, Dec 8, 2009 at 11:50 AM, Ross Mellgren dri...@gmail.com wrote:

 I'm sorry, I'm having trouble following your code, I think too much of the
 surrounding code and templates is missing for me to reason about why you
 would have a problem.

 I set up a quick example app, so maybe the code from that will help you.
 It is here:

 http://github.com/Dridus/test-rqvarlog

 If I understand you correctly, you're getting a log message like this one:
 WARN - RequestVar test.snippet.HelloWorld$myVar$_ was set but not read

 This message is from the code I posted:

 package test.snippet

 import _root_.scala.xml.NodeSeq
 import _root_.net.liftweb.http.RequestVar
 import _root_.net.liftweb.util.Helpers
 import Helpers._

 class HelloWorld {
 object myVar extends RequestVar[Int](0)

 def howdy(in: NodeSeq): NodeSeq = Helpers.bind(b, in, time - (new
 _root_.java.util.Date).toString)

 def increment(in: NodeSeq): NodeSeq = {
 myVar.set(myVar.is + 1)
 divincrement called/div
 }

 def show(in: NodeSeq): NodeSeq = divshow called -- myVar.is {
 myVar.is }/div
 }


 lift:surround with=default at=content
 h2Welcome to your project!/h2
  p
   lift:helloWorld.howdy
 spanWelcome to test-rqvarlog at b:time//span
   /lift:helloWorld.howdy

   lift:HelloWorld.increment /
   lift:HelloWorld.increment /
 !--  lift:HelloWorld.show / --
 /p
 /lift:surround

 If I uncomment the line with HelloWorld.show in the template, the log
 message goes away because myVar.is is called.

 If you are still getting the message, then that should mean that you are
 not calling myVar.is in the same request.

 HTH,
 -Ross

 On Dec 7, 2009, at 10:28 PM, Xuefeng Wu wrote:

 My code :


 object CompetenceMgr {

  Menu(Loc(Competence, List(competence, index), S.?(Competence),
 ifIsLoggedIn,
  ...
  Loc.Snippet(buildCompetenceDicRows, buildCompetenceDicRows),
Loc.Snippet(addCompetenceB, addCompetenceB),
 

 private object *_categoryId *extends RequestVar[Long](0)

 //build a competenceDic table
   def buildCompetenceDicRows(xhtml: NodeSeq): NodeSeq = {
 ... ...
 def *makeCategoryRow*(r: Category) = {
  .
def *categoryNode*: NodeSeq = {
def categoryNodeLinkId = categoryNodeLinkId- + r.id
def selectCategoryNode: JsCmd = {
 * //here: set the _categoryId, but didn't work*
   _categoryId.set(r.id.is)
  ... ..
}
  span id={categoryNodeLinkId} class='node_span'{a(() =
 selectCategoryNode, Text(r.title.is))}/span
}
tr tdspan class=folder draggable droppable
  id={categoeryId}{categoryNode}/span/td/tr % (id - nodeId) %
 (class - nodeClass)
 }
 def *buildCategoryRows*: NodeSeq = {
   val resourceData = Category.categoriesTreeList
   (empty /: resourceData)((l, r) = l ++ *makeCategoryRow*(r))
}
  *buildCategoryRows*
   }

   //it's a button for create competence
  def *addCompetenceB*(xhtml: NodeSeq): NodeSeq = doCompetenceB(xhtml,add
 Competence,null)
  //a button for create or edit competence
   def *doCompetenceB*(xhtml: NodeSeq,msg: String,competence: Competence):
 NodeSeq = {
 a(() = {
   *//here I try to get the categoryId if it selected.*
   val catId: Long = _categoryId.is
  S.runTemplate(List(competence,_competence)).
  map(ns =
 ModalDialog(doCompetenceEditor(ns,catId,competence))) openOr
  Alert(Couldn't find _competence template)},
  Text(msg),class - button
   )
   }




 On Tue, Dec 8, 2009 at 11:02 AM, Ross Mellgren dri...@gmail.com wrote:

 Well if you logically expected it to be read but it wasn't, it might
 indicate a bug to you or help in diagnosis.

 I'm not sure I understand your reply fully -- when you added myId.is did
 the log message go away? If not, could you post your code?

 -Ross

 On Dec 7, 2009, at 9:39 PM, Xuefeng Wu wrote:

 I use myId.is but get nothing.
 I don't know what I could do with the information.

 On 

Re: [Lift] Sharing data between snippet functions during a single HTTP request

2009-12-07 Thread David Pollak
On Mon, Dec 7, 2009 at 8:46 PM, Xuefeng Wu ben...@gmail.com wrote:

 My current solution is that when user select a tree node, I replace the add
 button dependence on the node.


If you can create a very simple example of what you're trying to do, we can
help you debug the actual, runnable code.




 2009/12/8 Xuefeng Wu ben...@gmail.com

 Hi Ross,

 Yes it's not in the same request.

 My case is:
 When user select a tree node, I want to store this nodeId and If user
 click a button to create a child node, I want to get the selected node.

 I use ModalDialog when user click the button to create now node.

 On Tue, Dec 8, 2009 at 11:50 AM, Ross Mellgren dri...@gmail.com wrote:

 I'm sorry, I'm having trouble following your code, I think too much of
 the surrounding code and templates is missing for me to reason about why you
 would have a problem.

 I set up a quick example app, so maybe the code from that will help you.
 It is here:

 http://github.com/Dridus/test-rqvarlog

 If I understand you correctly, you're getting a log message like this
 one:
 WARN - RequestVar test.snippet.HelloWorld$myVar$_ was set but not read

 This message is from the code I posted:

 package test.snippet

 import _root_.scala.xml.NodeSeq
 import _root_.net.liftweb.http.RequestVar
 import _root_.net.liftweb.util.Helpers
 import Helpers._

 class HelloWorld {
 object myVar extends RequestVar[Int](0)

 def howdy(in: NodeSeq): NodeSeq = Helpers.bind(b, in, time -
 (new _root_.java.util.Date).toString)

 def increment(in: NodeSeq): NodeSeq = {
 myVar.set(myVar.is + 1)
 divincrement called/div
 }

 def show(in: NodeSeq): NodeSeq = divshow called -- myVar.is {
 myVar.is }/div
 }


 lift:surround with=default at=content
 h2Welcome to your project!/h2
  p
   lift:helloWorld.howdy
 spanWelcome to test-rqvarlog at b:time//span
   /lift:helloWorld.howdy

   lift:HelloWorld.increment /
   lift:HelloWorld.increment /
 !--  lift:HelloWorld.show / --
 /p
 /lift:surround

 If I uncomment the line with HelloWorld.show in the template, the log
 message goes away because myVar.is is called.

 If you are still getting the message, then that should mean that you are
 not calling myVar.is in the same request.

 HTH,
 -Ross

 On Dec 7, 2009, at 10:28 PM, Xuefeng Wu wrote:

 My code :


 object CompetenceMgr {

  Menu(Loc(Competence, List(competence, index), S.?(Competence),
 ifIsLoggedIn,
  ...
  Loc.Snippet(buildCompetenceDicRows, buildCompetenceDicRows),
Loc.Snippet(addCompetenceB, addCompetenceB),
 

 private object *_categoryId *extends RequestVar[Long](0)

 //build a competenceDic table
   def buildCompetenceDicRows(xhtml: NodeSeq): NodeSeq = {
 ... ...
 def *makeCategoryRow*(r: Category) = {
  .
def *categoryNode*: NodeSeq = {
def categoryNodeLinkId = categoryNodeLinkId- + r.id
def selectCategoryNode: JsCmd = {
 * //here: set the _categoryId, but didn't work*
   _categoryId.set(r.id.is)
  ... ..
}
  span id={categoryNodeLinkId} class='node_span'{a(() =
 selectCategoryNode, Text(r.title.is))}/span
}
tr tdspan class=folder draggable droppable
  id={categoeryId}{categoryNode}/span/td/tr % (id - nodeId) %
 (class - nodeClass)
 }
 def *buildCategoryRows*: NodeSeq = {
   val resourceData = Category.categoriesTreeList
   (empty /: resourceData)((l, r) = l ++ *makeCategoryRow*(r))
}
  *buildCategoryRows*
   }

   //it's a button for create competence
  def *addCompetenceB*(xhtml: NodeSeq): NodeSeq =
 doCompetenceB(xhtml,add Competence,null)
  //a button for create or edit competence
   def *doCompetenceB*(xhtml: NodeSeq,msg: String,competence:
 Competence): NodeSeq = {
 a(() = {
   *//here I try to get the categoryId if it selected.*
   val catId: Long = _categoryId.is
  S.runTemplate(List(competence,_competence)).
  map(ns =
 ModalDialog(doCompetenceEditor(ns,catId,competence))) openOr
  Alert(Couldn't find _competence template)},
  Text(msg),class - button
   )
   }




 On Tue, Dec 8, 2009 at 11:02 AM, Ross Mellgren dri...@gmail.com wrote:

 Well if you logically expected it to be read but it wasn't, it might
 indicate a bug to you or help in diagnosis.

 I'm not sure I understand your reply fully -- when you added myId.isdid 
 the log message go away? If not, could you post your code?

 -Ross

 On Dec 7, 2009, at 9:39 PM, Xuefeng Wu wrote:

 I use myId.is but get nothing.
 I don't know what I could do with the information.

 On Tue, Dec 8, 2009 at 10:19 AM, Ross Mellgren dri...@gmail.comwrote:

 I think that message is just informative, letting you know that you
 don't seem to be using the request var fully (perhaps due to typo, or code
 refactoring that made it unused, or something.)

 I think it'll go away if you 

Re: [Lift] Re: Newbie on Lift Scala: Build in class source code?

2009-12-07 Thread Jonathan Hoffman
Hi,

I've you're running against an h2 database, you can add the following to the 
end of your Boot.boot to launch the h2 web console when every you start up 
jetty.  It's a very simple web interface to the database, but super convenient 
(it will even launch your browser for you):

if (Props.devMode) {
  import org.h2.server.web.WebServer
  import _root_.org.h2.tools.Server
  import _root_.org.h2.util.StartBrowser
  val webServer = new WebServer()
  val server  = new Server(webServer, -webPort, 0)
  server.start
  DBVendor.newConnection(DefaultConnectionIdentifier).map(c= {
val url = webServer.addSession(c)
Log.info(H2 WebConsole at:\n + url)
StartBrowser.openURL(url)
  })
}

To start using h2, if you're not already:

add this to the dependencies section of your pom.xml:

dependency
groupIdcom.h2database/groupId
artifactIdh2/artifactId
version1.2.121/version
/dependency


And change this in Boot.scala:

from:   DB.defineConnectionManager(DefaultConnectionIdentifier, DBVendor)
to:
DB.defineConnectionManager(DefaultConnectionIdentifier,
new StandardDBVendor(Props.get(db.driver) openOr 
org.h2.Driver,
  Props.get(db.url) openOr jdbc:h2:lift_proto.db,
Props.get(db.user), Props.get(db.password)))

On Dec 7, 2009, at 12:21 PM, David Pollak wrote:

 
 
 On Mon, Dec 7, 2009 at 9:14 AM, itsjar its...@gmail.com wrote:
 thanks again to the guys who put their efforts in answering questions
 here.
 I'll try a different approach this time.
 
 I would suggest building the To Do app as a first step: 
 http://liftweb.net/docs/getting_started/mod_master.html
 
 You'll get a lot of exposure to Lift in bite-sized chunks.  Once you've gone 
 through the demo, then you can move on to other things, including building 
 your own authentication system.
 
 Why do I suggest this?  (1) Learning Scala's syntax and some of Scala's 
 idioms gives you better grounding for understanding ProtoUser (2) seeing how 
 to build simple Mapper classes will give you a better understanding of the 
 more complex ones (3) walking before you run helps you to not fall down and 
 skin your knees.
 
 But we are here... the whole 1,500+ member Lift community.  We take newbies 
 very seriously and want to help them because we know that they'll help other 
 newbies one day.
 
 Thanks,
 
 David
  
 
 Let's hope I get somewhere since our decision whether we will use lift
 or not will depends on this.
 
 On Dec 7, 4:23 am, Alex Boisvert alex.boisv...@gmail.com wrote:
  Part of the source for these objects is automatically created when you
  generate your lift app using the Maven archetype.   For example, you'll find
  the source to the User class unde
  src/main/scala/com/liftworkshop/model/User.scala.
 
  For classes that are part of the framework, such as MegaProtoUser etc.
  you'll find the source on Github athttp://github.com/dpp/liftweb/and more
  specifically look at ProtoUser.scala 
  underhttp://github.com/dpp/liftweb/tree/master/lift-persistence/lift-mappe
  Also be sure to select the branch of Lift that you are using in order to
  avoid confusion.
 
  Good luck and keep asking question ;)
  alex
 
  On Sun, Dec 6, 2009 at 3:54 PM, itsjar its...@gmail.com wrote:
   Hi,
 
   I'm considering building a web application with my software
   engineering group in Lift.
   However when I started with lift I was surprised that I received a
   whole log in / sign up website by
   just using the MegaProtoUser.
   This was at first sight fun, but I started wondering (and I'm pretty
   sure my professor will say the same): Do I really know what I just
   did?.
 
   So I decided to try and rebuild the Log in / Sign up thing from
   scratch by using my own plain objects.
   Ive been working on that for 2 days and It's been s frustrating.
 
   I've been reading the lift book... Tutorials.. but all of them start
   with the MegaProtoUser.
   In 1.5 days time I only managed to make an index (signup) page with a
   username/password field and a button which then redirects to a new
   page.
 
   Let me tell you in advance, I am totally new to Web developing.
 
   Problems I have right now:
 - I have no idea if my code actually created a User in my database
   and I have no idea how to check it...
 - I have no idea how to log in a user. I saw code in the sample
   programs that compare the current logged in user with other users by
   using a select statement. However retrieving the current user is based
   upon the MegaProtoUser. I wonder how this is done behind my back since
   I have no idea how to keep a variable of a 'logged in user' which
   stays active across all pages..
 
   Because of these problems I thought it might be useful to see the
   source code of the classes..
   Is it possible to see the scala source code of these classes?
 
   Thanks,
   itsjar
 
   --
 
   You received this message 

Re: [Lift] Re: Fwd: Watch Foursquare Lift talk live from NY

2009-12-07 Thread Mateo Barraza
I can't seem to be able to download the talk. Anyone else having problems?

M

On Mon, Dec 7, 2009 at 7:59 PM, Peter Robinett pe...@bubblefoundry.com wrote:
 If you missed the talk you can download it from the same link. It's a
 good one.

 One thing mentioned briefly in the talk that I'd like to know more
 about is oAuth Server code. Is anyone working on that? How can I help?

 Peter

 On Dec 7, 3:16 pm, David Pollak feeder.of.the.be...@gmail.com wrote:
 -- Forwarded message --
 From: Dave Briccetti da...@davebsoft.com
 Date: Mon, Dec 7, 2009 at 3:15 PM
 Subject: Watch Foursquare Lift talk live from NY
 To: Bay Area Scala Enthusiasts scala-b...@googlegroups.com

 http://www.justin.tv/n8han

 --

 You received this message because you are subscribed to the Google Groups
 Bay Area Scala Enthusiasts group.
 To post to this group, send email to scala-b...@googlegroups.com.
 To unsubscribe from this group, send email to
 scala-base+unsubscr...@googlegroups.comscala-base%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group 
 athttp://groups.google.com/group/scala-base?hl=en.

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

 --

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




--

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




Re: [Lift] Re: Fwd: Watch Foursquare Lift talk live from NY

2009-12-07 Thread David Pollak
On Mon, Dec 7, 2009 at 8:50 PM, Mateo Barraza mateo.barr...@gmail.comwrote:

 I can't seem to be able to download the talk. Anyone else having problems?


Yeah...  n8han's uploading the video elsewhere... we'll send around an URL
once we get one.



 M

 On Mon, Dec 7, 2009 at 7:59 PM, Peter Robinett pe...@bubblefoundry.com
 wrote:
  If you missed the talk you can download it from the same link. It's a
  good one.
 
  One thing mentioned briefly in the talk that I'd like to know more
  about is oAuth Server code. Is anyone working on that? How can I help?
 
  Peter
 
  On Dec 7, 3:16 pm, David Pollak feeder.of.the.be...@gmail.com wrote:
  -- Forwarded message --
  From: Dave Briccetti da...@davebsoft.com
  Date: Mon, Dec 7, 2009 at 3:15 PM
  Subject: Watch Foursquare Lift talk live from NY
  To: Bay Area Scala Enthusiasts scala-b...@googlegroups.com
 
  http://www.justin.tv/n8han
 
  --
 
  You received this message because you are subscribed to the Google
 Groups
  Bay Area Scala Enthusiasts group.
  To post to this group, send email to scala-b...@googlegroups.com.
  To unsubscribe from this group, send email to
  scala-base+unsubscr...@googlegroups.comscala-base%2bunsubscr...@googlegroups.com
 scala-base%2bunsubscr...@googlegroups.comscala-base%252bunsubscr...@googlegroups.com
 
  .
  For more options, visit this group athttp://
 groups.google.com/group/scala-base?hl=en.
 
  --
  Lift, the simply functional web frameworkhttp://liftweb.net
  Beginning Scalahttp://www.apress.com/book/view/1430219890
  Follow me:http://twitter.com/dpp
  Surf the harmonics
 
  --
 
  You received this message because you are subscribed to the Google Groups
 Lift group.
  To post to this group, send email to lift...@googlegroups.com.
  To unsubscribe from this group, send email to
 liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com
 .
  For more options, visit this group at
 http://groups.google.com/group/liftweb?hl=en.
 
 
 

 --

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





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

--

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




Re: [Lift] Sharing data between snippet functions during a single HTTP request

2009-12-07 Thread Xuefeng Wu
Hi David  Ross,

Thank you for your help,
I understand RequestVar now, which muse be used in the same request.

My case is that I have a tree and a separate button.
When use click the tree node, the separate button should know which node is
selected.

Right now I replace the separate button when use click the tree node and it
worked.
I don't want to use session and I think it's better not replace the button.
But I don't have idea how to do.

On Tue, Dec 8, 2009 at 12:49 PM, David Pollak feeder.of.the.be...@gmail.com
 wrote:



 On Mon, Dec 7, 2009 at 8:46 PM, Xuefeng Wu ben...@gmail.com wrote:

 My current solution is that when user select a tree node, I replace the
 add button dependence on the node.


 If you can create a very simple example of what you're trying to do, we can
 help you debug the actual, runnable code.




 2009/12/8 Xuefeng Wu ben...@gmail.com

 Hi Ross,

 Yes it's not in the same request.

 My case is:
 When user select a tree node, I want to store this nodeId and If user
 click a button to create a child node, I want to get the selected node.

 I use ModalDialog when user click the button to create now node.

 On Tue, Dec 8, 2009 at 11:50 AM, Ross Mellgren dri...@gmail.com wrote:

 I'm sorry, I'm having trouble following your code, I think too much of
 the surrounding code and templates is missing for me to reason about why 
 you
 would have a problem.

 I set up a quick example app, so maybe the code from that will help you.
 It is here:

 http://github.com/Dridus/test-rqvarlog

 If I understand you correctly, you're getting a log message like this
 one:
 WARN - RequestVar test.snippet.HelloWorld$myVar$_ was set but not read

 This message is from the code I posted:

 package test.snippet

 import _root_.scala.xml.NodeSeq
 import _root_.net.liftweb.http.RequestVar
 import _root_.net.liftweb.util.Helpers
 import Helpers._

 class HelloWorld {
 object myVar extends RequestVar[Int](0)

 def howdy(in: NodeSeq): NodeSeq = Helpers.bind(b, in, time -
 (new _root_.java.util.Date).toString)

 def increment(in: NodeSeq): NodeSeq = {
 myVar.set(myVar.is + 1)
 divincrement called/div
 }

 def show(in: NodeSeq): NodeSeq = divshow called -- myVar.is {
 myVar.is }/div
 }


 lift:surround with=default at=content
 h2Welcome to your project!/h2
  p
   lift:helloWorld.howdy
 spanWelcome to test-rqvarlog at b:time//span
   /lift:helloWorld.howdy

   lift:HelloWorld.increment /
   lift:HelloWorld.increment /
 !--  lift:HelloWorld.show / --
 /p
 /lift:surround

 If I uncomment the line with HelloWorld.show in the template, the log
 message goes away because myVar.is is called.

 If you are still getting the message, then that should mean that you are
 not calling myVar.is in the same request.

 HTH,
 -Ross

 On Dec 7, 2009, at 10:28 PM, Xuefeng Wu wrote:

 My code :


 object CompetenceMgr {

  Menu(Loc(Competence, List(competence, index), S.?(Competence),
 ifIsLoggedIn,
  ...
  Loc.Snippet(buildCompetenceDicRows, buildCompetenceDicRows),
Loc.Snippet(addCompetenceB, addCompetenceB),
 

 private object *_categoryId *extends RequestVar[Long](0)

 //build a competenceDic table
   def buildCompetenceDicRows(xhtml: NodeSeq): NodeSeq = {
 ... ...
 def *makeCategoryRow*(r: Category) = {
  .
def *categoryNode*: NodeSeq = {
def categoryNodeLinkId = categoryNodeLinkId- + r.id
def selectCategoryNode: JsCmd = {
 * //here: set the _categoryId, but didn't work*
   _categoryId.set(r.id.is)
  ... ..
}
  span id={categoryNodeLinkId} class='node_span'{a(() =
 selectCategoryNode, Text(r.title.is))}/span
}
tr tdspan class=folder draggable droppable
  id={categoeryId}{categoryNode}/span/td/tr % (id - nodeId) %
 (class - nodeClass)
 }
 def *buildCategoryRows*: NodeSeq = {
   val resourceData = Category.categoriesTreeList
   (empty /: resourceData)((l, r) = l ++ *makeCategoryRow*(r))
}
  *buildCategoryRows*
   }

   //it's a button for create competence
  def *addCompetenceB*(xhtml: NodeSeq): NodeSeq =
 doCompetenceB(xhtml,add Competence,null)
  //a button for create or edit competence
   def *doCompetenceB*(xhtml: NodeSeq,msg: String,competence:
 Competence): NodeSeq = {
 a(() = {
   *//here I try to get the categoryId if it selected.*
   val catId: Long = _categoryId.is
  S.runTemplate(List(competence,_competence)).
  map(ns =
 ModalDialog(doCompetenceEditor(ns,catId,competence))) openOr
  Alert(Couldn't find _competence template)},
  Text(msg),class - button
   )
   }




 On Tue, Dec 8, 2009 at 11:02 AM, Ross Mellgren dri...@gmail.comwrote:

 Well if you logically expected it to be read but it wasn't, it might
 indicate a bug to you or help in diagnosis.

 I'm not sure I understand your reply 

Re: [Lift] Re: Fwd: Watch Foursquare Lift talk live from NY

2009-12-07 Thread Xuefeng Wu
6:30 p.m. the time zone is -8:00?

On Tue, Dec 8, 2009 at 12:58 PM, David Pollak feeder.of.the.be...@gmail.com
 wrote:



 On Mon, Dec 7, 2009 at 8:50 PM, Mateo Barraza mateo.barr...@gmail.comwrote:

 I can't seem to be able to download the talk. Anyone else having problems?


 Yeah...  n8han's uploading the video elsewhere... we'll send around an URL
 once we get one.



 M

 On Mon, Dec 7, 2009 at 7:59 PM, Peter Robinett pe...@bubblefoundry.com
 wrote:
  If you missed the talk you can download it from the same link. It's a
  good one.
 
  One thing mentioned briefly in the talk that I'd like to know more
  about is oAuth Server code. Is anyone working on that? How can I help?
 
  Peter
 
  On Dec 7, 3:16 pm, David Pollak feeder.of.the.be...@gmail.com wrote:
  -- Forwarded message --
  From: Dave Briccetti da...@davebsoft.com
  Date: Mon, Dec 7, 2009 at 3:15 PM
  Subject: Watch Foursquare Lift talk live from NY
  To: Bay Area Scala Enthusiasts scala-b...@googlegroups.com
 
  http://www.justin.tv/n8han
 
  --
 
  You received this message because you are subscribed to the Google
 Groups
  Bay Area Scala Enthusiasts group.
  To post to this group, send email to scala-b...@googlegroups.com.
  To unsubscribe from this group, send email to
  scala-base+unsubscr...@googlegroups.comscala-base%2bunsubscr...@googlegroups.com
 scala-base%2bunsubscr...@googlegroups.comscala-base%252bunsubscr...@googlegroups.com
 
  .
  For more options, visit this group athttp://
 groups.google.com/group/scala-base?hl=en.
 
  --
  Lift, the simply functional web frameworkhttp://liftweb.net
  Beginning Scalahttp://www.apress.com/book/view/1430219890
  Follow me:http://twitter.com/dpp
  Surf the harmonics
 
  --
 
  You received this message because you are subscribed to the Google
 Groups Lift group.
  To post to this group, send email to lift...@googlegroups.com.
  To unsubscribe from this group, send email to
 liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com
 .
  For more options, visit this group at
 http://groups.google.com/group/liftweb?hl=en.
 
 
 

 --

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





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

 Follow me: http://twitter.com/dpp
 Surf the harmonics

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




-- 
Scala中文社区:  http://groups.google.com/group/scalacn

--

You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@googlegroups.com.
To unsubscribe from 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] highlight the lift notices in some seconds

2009-12-07 Thread Xuefeng Wu
Hi,

I want to highlight the lift notice and it will hide when timeout.
Should I code every request or only to config lift some where?

For example:
When use put items into the shopping cart, highlight the items some seconds
to notice the user.

-- 
Scala中文社区:  http://groups.google.com/group/scalacn

--

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




Re: [Lift] Next Lift version will be 2.0

2009-12-07 Thread Heiko Seeberger
2009/12/7 Josh Suereth joshua.suer...@gmail.com


 Just curious what the difference between Major and Minor truly is as both
 can break source/binary compatibility?   My feeling here is that sticking to
 strick source-compatibility for minor releases is actually a bonus.


Major changes (e.g. moving/renaming an API class, changing an API method's
signature, etc.) will break source compatibility for sure, i.e. for users
and implementers. Minor changes (e.g. adding an abstract method to an API
trait) will at maximum break source compatibility for implementers. So
from a user's perspective minor changes add new stuff which could be used
but do not break source compatibility, whereas major changes will require
changing the source code.

Examples: Renaming LiftRules to LiftConfig is a major change, adding a
second parameter to LiftRules.parseDate is also a major change. But adding a
second method LiftRules.parseDate is only a minor change (in this case even
binary compatibility should be given).

The other question I have is about deprecations.   What's your plan for
 handling these?   When can deprecated features be removed, etc.   That might
 feed into the source-compatibility issues in minor versions.


This is a good question and I do not have a plan yet ;-) As a first shot I
would say that deprecated features have to survive all minor changes (must
not break source compatibility for users) and maybe one major change. The
latter is the question we have to discuss ...


 I think this is great stuff!  Whatever is decided here will help shape the
 future of the Scala community's versioning, so I hope you don't mind my
 pestering ;)


Don't worry ;-)

Heiko

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

--

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




[Lift] Re: highlight the lift notices in some seconds

2009-12-07 Thread Marius
Please see this:
http://groups.google.com/group/liftweb/browse_thread/thread/972562da2c40ce88/ea30455fc11d4e1f?hl=enlnk=gstq=notice+fade#ea30455fc11d4e1f

If you are using Ajax, notices could easily fade out.

Br's,
Marius

On Dec 8, 8:02 am, Xuefeng Wu ben...@gmail.com wrote:
 Hi,

     I want to highlight the lift notice and it will hide when timeout.
 Should I code every request or only to config lift some where?

 For example:
 When use put items into the shopping cart, highlight the items some seconds
 to notice the user.

 --
 Scala中文社区:  http://groups.google.com/group/scalacn

--

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




Re: [Lift] Re: highlight the lift notices in some seconds

2009-12-07 Thread Xuefeng Wu
Yes, it's my wanted.
How could I configure it at boot?

On Tue, Dec 8, 2009 at 3:44 PM, Marius marius.dan...@gmail.com wrote:

 Please see this:

 http://groups.google.com/group/liftweb/browse_thread/thread/972562da2c40ce88/ea30455fc11d4e1f?hl=enlnk=gstq=notice+fade#ea30455fc11d4e1f

 If you are using Ajax, notices could easily fade out.

 Br's,
 Marius

 On Dec 8, 8:02 am, Xuefeng Wu ben...@gmail.com wrote:
  Hi,
 
  I want to highlight the lift notice and it will hide when timeout.
  Should I code every request or only to config lift some where?
 
  For example:
  When use put items into the shopping cart, highlight the items some
 seconds
  to notice the user.
 
  --
  Scala中文社区:  http://groups.google.com/group/scalacn

 --

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





-- 
Scala中文社区:  http://groups.google.com/group/scalacn

--

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