Re: [Lift] Re: Multi-Database Transactions

2009-12-09 Thread Jeppe Nejsum Madsen
On Wed, Dec 9, 2009 at 5:05 AM, David Pollak
feeder.of.the.be...@gmail.com wrote:
 I think what you want is the Lift JTA module:

 http://github.com/dpp/liftweb/tree/master/lift-modules/lift-jta/

I think the OP wanted to avoid XA transactions. But of course, if data
integriity is important this is the right way to go.

I haven't looked at lift-jta. Does it provide something else besides
hooking into JTA that would be useful in this scenario?

/Jeppe

--

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




Re: [Lift] LiftConsole and JPA

2009-12-09 Thread Janico Greifenberg
I had excluded JTA in the pom.xml, because I copied the dependencies
from the JPADemo example. After I removed that exclusion, the console
works, so the practical problem is solved.
I'm still a bit confused, however, why I need JTA when I use
RESOURCE_LOCAL as transaction-type. And why does it work under jetty,
but not in the console?

So long
Janico

On Tue, Dec 8, 2009 at 9:59 PM, Derek Chen-Becker dchenbec...@gmail.com wrote:
 It looks like the JTA jar isn't being added to the classpath for the
 LiftConsole runner. I've never touched scala:console, so I'm not sure what
 you would need to do to make it work. Off the top of my head, you might need
 to put the dependencies for JPA into the plugin config, but I'm not
 positive.

 Derek

 On Tue, Dec 8, 2009 at 1:16 PM, Janico Greifenberg j...@acm.org wrote:

 Hi,
 I've started to experiment with a Lift project that uses JPA for
 persistence. While it works just fine in the web application run with
 mvn jetty:run, I cannot use the model classes from the LiftConsole
 (mvn scala:console -DmainConsole=LiftConsole). When I try for example

 Model.find(classOf[Article], 1)

 I get the following error:

 java.lang.ClassNotFoundException: javax.transaction.SystemException
        at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:315)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:250)
        at java.lang.Clas...

 Model is the EntityManager that I created accorting to chapter 10 from
 the Lift book. Article is an entity class and 1 is an id that exists
 in the database.

 I'm using lift version 1.1-M7 and the following persistence.xml

 persistence
   persistence-unit name=jpa-dossier transaction-type=RESOURCE_LOCAL
      properties
         property name=hibernate.dialect
 value=org.hibernate.dialect.MySQLDialect/
         property name=hibernate.connection.driver_class
 value=com.mysql.jdbc.Driver/
         property name=hibernate.connection.url
 value=jdbc:mysql://localhost/dossier/
         property name=hibernate.max_fetch_depth value=3/
         property name=hibernate.show_sql value=true /
         property name=hibernate.hbm2ddl.auto value=update /property
                name=hibernate.connection.username value=***
 /property
        property name=hibernate.connection.password
 value=***/property
      /properties
   /persistence-unit
 /persistence

 Is there something that I need to initialize to get this to work?

 So long
 Janico

 --

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




-- 
http://jgre.org

--

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




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

2009-12-09 Thread DMB
 Because you're sick and tired of maintaining other peoples 
 EJB/Struts/whatever

You'll be just as sick and tired of maintaining other people's (and
your own) Scala code in six to nine months, except you'll be doing it
for less money and the code will be in flux all the time. The solution
to the sick and tired issue is to have a life outside of work. :-)

 That sounds more like an enterprise mindset to me.

To me this sounds more like common sense. Programming is a social
activity, and things just work better if more than a few devs on the
team understand the language you're coding in. It also helps to give
the developers as little rope as productively possible, otherwise you
will see people using insane combinations of the most obscure features
just to prove to themselves they can use those features. Seen it
happen with C++ in the past quite often. Folks would learn templates,
get excited, and come up with the most complicated design possible.
You'd just sit there staring at the code in the debugger and go WTF
was he trying to do here? Sure, it's generic as hell, but no one will
ever use its genericness, and bugs take much longer to fix all of a
sudden.

That's why e.g. Google uses only C++, Java and Python. Heck, David
mentioned it took him months to really figure out Scala, and I'm
pretty sure he's better than your average dev by a good margin. It
would probably take him all of 20 minutes to figure out Groovy, and a
day to learn Python. OK, maybe a couple of days, at a leisurely pace.

 But the choice of implementation platform/language is seldom the cause
 of startup failure.but I guess that's for another forum :-)

That's probably because they tend to pick less exotic stuff. PHP, RoR,
Pylons, Grails. This is not to say that you can't build a successful
startup with Lift -- it's 100% feasible, no question about it. I'm
just saying that a lot of the folks you hire will be crushed by the
cognitive load required to learn both a radically new (and rather
complex) language and a web framework that represents a significant
departure from all the imperative stuff they're used to.

--

You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@googlegroups.com.
To unsubscribe from 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-09 Thread Timothy Perrett
I simply could not disagree more on this point. You forget that there was a 
time when RoR was *very* exotic... you might have heard of a little startup 
called 37 signals? ;-)

Imperative to functional is a shift, but most developers (bar the lazy ones) 
usually enjoy a mental challenge. All the developers and real-life lift users 
that I met at Devoxx this year had a serious buzz about both Scala and Lift... 
I think you underestimate people: given the right support and warm feeling 
you'll be surprised what your average developer can achieve. In essence, 
thats what we do over here... we don't have as detailed docs as rails (yet!) 
for instance, but we have a super smart community that is amazingly helpful to 
everyone. I know if i were a startup, those would certainly be qualities in a 
tooling community that would carry a lot of weight in my book (not to mention 
lift and scala are technically awesome)

Cheers, Tim

On 9 Dec 2009, at 09:47, DMB wrote:

 That's probably because they tend to pick less exotic stuff. PHP, RoR,
 Pylons, Grails. This is not to say that you can't build a successful
 startup with Lift -- it's 100% feasible, no question about it. I'm
 just saying that a lot of the folks you hire will be crushed by the
 cognitive load required to learn both a radically new (and rather
 complex) language and a web framework that represents a significant
 departure from all the imperative stuff they're used to.

--

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

object Config{
  def error(xs) = {
S.error(xs)
fadeOutErrors(5 seconds, 1 second)
  }
}

and call Config.error(xs) instead of S.error(xs)

or something similar. I'm sure someone can come up with a more elegant
solution than this. Just the first thing that popped into my head.

- Philippe

On Tue, Dec 8, 2009 at 2:26 PM, Xuefeng Wu ben...@gmail.com wrote:
 I think It's better I could configure it, but not code every where.
 On Tue, Dec 8, 2009 at 9:23 PM, Marius marius.dan...@gmail.com wrote:

 Yes you need to send down fadeOut... call

 def myFunc: JsCmd = {
  // do some DB stuff
  vmyMapper.validate match {
    case Nil = Noop
    case xs = S.error(xs); fadeOutErrors(5 seconds, 1 second)
  }

 }
 On Dec 8, 3:01 pm, Xuefeng Wu ben...@gmail.com wrote:
  Yes, I do something like
   // do the DB stuff
   vmyMapper.validate match {
     case Nil =
     case xs = S.error(xs)
  }
 
  But I should always add fadeOutErrors(5 seconds, 1 second)?
 
  I want lift highlight every error/notice information.
 
 
 
  On Tue, Dec 8, 2009 at 5:56 PM, Marius marius.dan...@gmail.com wrote:
   Are you using field validate into an Ajax context or not? If not using
   something like:
 
   def howdy = {
      S.error(howdy error)
      spanHello there/span ++
      head{Script(OnLoad(fadeOutErrors(5 seconds, 1 second)))}
      /head
    }
 
   from your snippet should be ok.
 
   If you are using validate from an Ajax invocation, then you just need
   to return fadeOutErrors(5 seconds, 1 second) from your Ajax function.
 
   So I guess your ajax function would looks something like:
 
   def myDBAjax: JsCmd = {
 
    // do the DB stuff
    val errors = myMapper.validate
    S.error(errors)
     fadeOutErrors(5 seconds, 1 second)
   }
 
   Br's,
   Marius
 
   On Dec 8, 10:53 am, Xuefeng Wu ben...@gmail.com wrote:
But I use field validate, the notice and error are wrap by lift.
Should I
append fadeOutErrors(5 seconds, 1 second)?
 
On Tue, Dec 8, 2009 at 4:50 PM, Marius marius.dan...@gmail.com
wrote:
 You don't need to configure anything in boot.
 
 Assume this is an Ajax function:
 
  def howdy: JsCmd = {
    S.error(howdy error)
    fadeOutErrors(5 seconds, 1 second)
  }
 
  ... in your snippet you can say:
 
  SHtml.a(Text(Click me)(howdy _)
 
  If you want to fade out errors in a page and not via Ajax you can
 use this:
 
  def howdy = {
    S.error(howdy error)
    spanHello there/span ++
    head{Script(OnLoad(fadeOutErrors(5 seconds, 1 second)))}
    /head
  }
 
  which basically says after the page is rendered that after 5
 seconds
 the error notices will be faded out.
 
 Br's,
 Marius
 
 On Dec 8, 9:50 am, Xuefeng Wu ben...@gmail.com wrote:
  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/972562da2.
 ..
 
   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
  
   liftweb%2bunsubscr...@googlegroups.comliftweb%252bunsubscr...@googlegroups.com
 

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

Re: [Lift] Re: highlight the lift notices in some seconds

2009-12-09 Thread Xuefeng Wu
It's not make sense for my project.
I separate business  transaction from UI logic.
When create or update business model will occur notice or error,
and then do something for UI by the business transaction

for example:
business:
def MyBusinessTransaction(v: String) : Option[MyModel] = {
  val myModel = MyModel.create.title(v)
  myModel.validate match {
  case Nil = {myModel.save();Some(myModel)}
  case xs = {S.error(xs);None}
  }
}


Snippet
def doSomething(): JsCmd = MyBusinessTransaction(v) match {
case Some(v) = //do something for UI, such as replace the old value
case None = //notice what's wrong. *I could code ** fadeOutErrors(5
seconds, 1 second) if want, but should I code every where?*
}


Or there're any other practice for separate business from UI?


On Wed, Dec 9, 2009 at 7:45 PM, Philippe Monnaie philippe.monn...@gmail.com
 wrote:

 You could try:

 object Config{
  def error(xs) = {
 S.error(xs)
fadeOutErrors(5 seconds, 1 second)
  }
 }

 and call Config.error(xs) instead of S.error(xs)

 or something similar. I'm sure someone can come up with a more elegant
 solution than this. Just the first thing that popped into my head.

 - Philippe

 On Tue, Dec 8, 2009 at 2:26 PM, Xuefeng Wu ben...@gmail.com wrote:
  I think It's better I could configure it, but not code every where.
  On Tue, Dec 8, 2009 at 9:23 PM, Marius marius.dan...@gmail.com wrote:
 
  Yes you need to send down fadeOut... call
 
  def myFunc: JsCmd = {
   // do some DB stuff
   vmyMapper.validate match {
 case Nil = Noop
 case xs = S.error(xs); fadeOutErrors(5 seconds, 1 second)
   }
 
  }
  On Dec 8, 3:01 pm, Xuefeng Wu ben...@gmail.com wrote:
   Yes, I do something like
// do the DB stuff
vmyMapper.validate match {
  case Nil =
  case xs = S.error(xs)
   }
  
   But I should always add fadeOutErrors(5 seconds, 1 second)?
  
   I want lift highlight every error/notice information.
  
  
  
   On Tue, Dec 8, 2009 at 5:56 PM, Marius marius.dan...@gmail.com
 wrote:
Are you using field validate into an Ajax context or not? If not
 using
something like:
  
def howdy = {
   S.error(howdy error)
   spanHello there/span ++
   head{Script(OnLoad(fadeOutErrors(5 seconds, 1 second)))}
   /head
 }
  
from your snippet should be ok.
  
If you are using validate from an Ajax invocation, then you just
 need
to return fadeOutErrors(5 seconds, 1 second) from your Ajax
 function.
  
So I guess your ajax function would looks something like:
  
def myDBAjax: JsCmd = {
  
 // do the DB stuff
 val errors = myMapper.validate
 S.error(errors)
  fadeOutErrors(5 seconds, 1 second)
}
  
Br's,
Marius
  
On Dec 8, 10:53 am, Xuefeng Wu ben...@gmail.com wrote:
 But I use field validate, the notice and error are wrap by lift.
 Should I
 append fadeOutErrors(5 seconds, 1 second)?
  
 On Tue, Dec 8, 2009 at 4:50 PM, Marius marius.dan...@gmail.com
 wrote:
  You don't need to configure anything in boot.
  
  Assume this is an Ajax function:
  
   def howdy: JsCmd = {
 S.error(howdy error)
 fadeOutErrors(5 seconds, 1 second)
   }
  
   ... in your snippet you can say:
  
   SHtml.a(Text(Click me)(howdy _)
  
   If you want to fade out errors in a page and not via Ajax you
 can
  use this:
  
   def howdy = {
 S.error(howdy error)
 spanHello there/span ++
 head{Script(OnLoad(fadeOutErrors(5 seconds, 1 second)))}
 /head
   }
  
   which basically says after the page is rendered that after 5
  seconds
  the error notices will be faded out.
  
  Br's,
  Marius
  
  On Dec 8, 9:50 am, Xuefeng Wu ben...@gmail.com wrote:
   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/972562da2.
  ..
  
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
   

Re: [Lift] Re: highlight the lift notices in some seconds

2009-12-09 Thread Xuefeng Wu
Hello Marius,

I have an other question about S.error.
When I use: S.error(can not delete this department.)

I get:
try{jQuery(#lift__noticesContainer__).each(function(i) {this.innerHTML =
divErrorullican not delete./li/ul /div;});} catch (e) {}

What I want this
try{jQuery(#*lift__noticesContainer___error*).each(function(i)
{this.innerHTML = divErrorullican not delete./li/ul /div;});}
catch (e) {}

Why it's lift__noticesContainer__ but not lift__noticesContainer___error?

Did I miss something?



On Tue, Dec 8, 2009 at 9:23 PM, Marius marius.dan...@gmail.com wrote:

 Yes you need to send down fadeOut... call

 def myFunc: JsCmd = {
  // do some DB stuff
  vmyMapper.validate match {
case Nil = Noop
case xs = S.error(xs); fadeOutErrors(5 seconds, 1 second)
  }

 }
 On Dec 8, 3:01 pm, Xuefeng Wu ben...@gmail.com wrote:
  Yes, I do something like
   // do the DB stuff
   vmyMapper.validate match {
 case Nil =
 case xs = S.error(xs)
  }
 
  But I should always add fadeOutErrors(5 seconds, 1 second)?
 
  I want lift highlight every error/notice information.
 
 
 
  On Tue, Dec 8, 2009 at 5:56 PM, Marius marius.dan...@gmail.com wrote:
   Are you using field validate into an Ajax context or not? If not using
   something like:
 
   def howdy = {
  S.error(howdy error)
  spanHello there/span ++
  head{Script(OnLoad(fadeOutErrors(5 seconds, 1 second)))}
  /head
}
 
   from your snippet should be ok.
 
   If you are using validate from an Ajax invocation, then you just need
   to return fadeOutErrors(5 seconds, 1 second) from your Ajax function.
 
   So I guess your ajax function would looks something like:
 
   def myDBAjax: JsCmd = {
 
// do the DB stuff
val errors = myMapper.validate
S.error(errors)
 fadeOutErrors(5 seconds, 1 second)
   }
 
   Br's,
   Marius
 
   On Dec 8, 10:53 am, Xuefeng Wu ben...@gmail.com wrote:
But I use field validate, the notice and error are wrap by lift.
 Should I
append fadeOutErrors(5 seconds, 1 second)?
 
On Tue, Dec 8, 2009 at 4:50 PM, Marius marius.dan...@gmail.com
 wrote:
 You don't need to configure anything in boot.
 
 Assume this is an Ajax function:
 
  def howdy: JsCmd = {
S.error(howdy error)
fadeOutErrors(5 seconds, 1 second)
  }
 
  ... in your snippet you can say:
 
  SHtml.a(Text(Click me)(howdy _)
 
  If you want to fade out errors in a page and not via Ajax you can
 use this:
 
  def howdy = {
S.error(howdy error)
spanHello there/span ++
head{Script(OnLoad(fadeOutErrors(5 seconds, 1 second)))}
/head
  }
 
  which basically says after the page is rendered that after 5
 seconds
 the error notices will be faded out.
 
 Br's,
 Marius
 
 On Dec 8, 9:50 am, Xuefeng Wu ben...@gmail.com wrote:
  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/972562da2.
 ..
 
   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
 liftweb%2bunsubscr...@googlegroups.comliftweb%252bunsubscr...@googlegroups.com
 
   liftweb%2bunsubscr...@googlegroups.comliftweb%252bunsubscr...@googlegroups.com
 liftweb%252bunsubscr...@googlegroups.comliftweb%25252bunsubscr...@googlegroups.com
 
 
 liftweb%2bunsubscr...@googlegroups.comliftweb%252bunsubscr...@googlegroups.com
 liftweb%252bunsubscr...@googlegroups.comliftweb%25252bunsubscr...@googlegroups.com
 
   liftweb%252bunsubscr...@googlegroups.comliftweb%25252bunsubscr...@googlegroups.com
 liftweb%25252bunsubscr...@googlegroups.comliftweb%2525252bunsubscr...@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
 

Re: [Lift] Re: Multi-Database Transactions

2009-12-09 Thread David Pollak
On Wed, Dec 9, 2009 at 12:09 AM, Jeppe Nejsum Madsen je...@ingolfs.dkwrote:

 On Wed, Dec 9, 2009 at 5:05 AM, David Pollak
 feeder.of.the.be...@gmail.com wrote:
  I think what you want is the Lift JTA module:
 
  http://github.com/dpp/liftweb/tree/master/lift-modules/lift-jta/

 I think the OP wanted to avoid XA transactions. But of course, if data
 integriity is important this is the right way to go.

 I haven't looked at lift-jta. Does it provide something else besides
 hooking into JTA that would be useful in this scenario?


Dunno... it's Jonas's brainchild. ;-)




 /Jeppe

 --

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





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

--

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




Re: [Lift] lift-stamped - Traits for logging changes MetaMapper-Records

2009-12-09 Thread David Pollak
On Tue, Dec 8, 2009 at 6:33 PM, Franz Bettag fr...@bett.ag wrote:

 Hi guys,

 thanks to this great community i could finish a project today which i
 found worth to be made available public.

 The topic says it all, check it out at
 https://github.com/fbettag/lift-stamped/

 Tell me what you guys think!


Thank you for contributing back to the community!



 best regards

 --

 You received this message because you are subscribed to the Google Groups
 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: highlight the lift notices in some seconds

2009-12-09 Thread David Pollak
I think this particular use case is very interesting.  There should be a
flexible (LiftRules or in the Msgs snippet) mechanism for making this
behavior flexible... doing it for all users, doing it on a user-by-user
basis.

Please open a ticket at http://github.com/dpp/liftweb/issues referencing
this thread and we'll add the feature.

Thanks!

On Wed, Dec 9, 2009 at 4:56 AM, Xuefeng Wu ben...@gmail.com wrote:

 It's not make sense for my project.
 I separate business  transaction from UI logic.
 When create or update business model will occur notice or error,
 and then do something for UI by the business transaction

 for example:
 business:
 def MyBusinessTransaction(v: String) : Option[MyModel] = {
   val myModel = MyModel.create.title(v)
   myModel.validate match {
   case Nil = {myModel.save();Some(myModel)}
   case xs = {S.error(xs);None}
   }
 }


 Snippet
 def doSomething(): JsCmd = MyBusinessTransaction(v) match {
 case Some(v) = //do something for UI, such as replace the old value
 case None = //notice what's wrong. *I could code ** fadeOutErrors(5
 seconds, 1 second) if want, but should I code every where?*
 }


 Or there're any other practice for separate business from UI?


 On Wed, Dec 9, 2009 at 7:45 PM, Philippe Monnaie 
 philippe.monn...@gmail.com wrote:

 You could try:

 object Config{
  def error(xs) = {
 S.error(xs)
fadeOutErrors(5 seconds, 1 second)
  }
 }

 and call Config.error(xs) instead of S.error(xs)

 or something similar. I'm sure someone can come up with a more elegant
 solution than this. Just the first thing that popped into my head.

 - Philippe

 On Tue, Dec 8, 2009 at 2:26 PM, Xuefeng Wu ben...@gmail.com wrote:
  I think It's better I could configure it, but not code every where.
  On Tue, Dec 8, 2009 at 9:23 PM, Marius marius.dan...@gmail.com wrote:
 
  Yes you need to send down fadeOut... call
 
  def myFunc: JsCmd = {
   // do some DB stuff
   vmyMapper.validate match {
 case Nil = Noop
 case xs = S.error(xs); fadeOutErrors(5 seconds, 1 second)
   }
 
  }
  On Dec 8, 3:01 pm, Xuefeng Wu ben...@gmail.com wrote:
   Yes, I do something like
// do the DB stuff
vmyMapper.validate match {
  case Nil =
  case xs = S.error(xs)
   }
  
   But I should always add fadeOutErrors(5 seconds, 1 second)?
  
   I want lift highlight every error/notice information.
  
  
  
   On Tue, Dec 8, 2009 at 5:56 PM, Marius marius.dan...@gmail.com
 wrote:
Are you using field validate into an Ajax context or not? If not
 using
something like:
  
def howdy = {
   S.error(howdy error)
   spanHello there/span ++
   head{Script(OnLoad(fadeOutErrors(5 seconds, 1 second)))}
   /head
 }
  
from your snippet should be ok.
  
If you are using validate from an Ajax invocation, then you just
 need
to return fadeOutErrors(5 seconds, 1 second) from your Ajax
 function.
  
So I guess your ajax function would looks something like:
  
def myDBAjax: JsCmd = {
  
 // do the DB stuff
 val errors = myMapper.validate
 S.error(errors)
  fadeOutErrors(5 seconds, 1 second)
}
  
Br's,
Marius
  
On Dec 8, 10:53 am, Xuefeng Wu ben...@gmail.com wrote:
 But I use field validate, the notice and error are wrap by lift.
 Should I
 append fadeOutErrors(5 seconds, 1 second)?
  
 On Tue, Dec 8, 2009 at 4:50 PM, Marius marius.dan...@gmail.com
 wrote:
  You don't need to configure anything in boot.
  
  Assume this is an Ajax function:
  
   def howdy: JsCmd = {
 S.error(howdy error)
 fadeOutErrors(5 seconds, 1 second)
   }
  
   ... in your snippet you can say:
  
   SHtml.a(Text(Click me)(howdy _)
  
   If you want to fade out errors in a page and not via Ajax you
 can
  use this:
  
   def howdy = {
 S.error(howdy error)
 spanHello there/span ++
 head{Script(OnLoad(fadeOutErrors(5 seconds, 1 second)))}
 /head
   }
  
   which basically says after the page is rendered that after 5
  seconds
  the error notices will be faded out.
  
  Br's,
  Marius
  
  On Dec 8, 9:50 am, Xuefeng Wu ben...@gmail.com wrote:
   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/972562da2.
  ..
  
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

[Lift] rest service

2009-12-09 Thread Niels Boldt
Hi,

What is the best way to create a rest service in lift that support both xml
and json.

Are there any tools to use besides lift-json. The end result of my service
call will be a pojo object that is grabbed from a database and should be
transformed to the appropriate output.

I hoped to do that in a generic way, whether it is xml, json or something
third

Best Regards
Niels

-- 
BinaryConstructors ApS
Vestergade 10a, 4th
1456 Kbh K
Denmark
phone: +4528138757
web: http://www.binaryconstructors.dk
mail: n...@binaryconstructors.dk
skype: nielsboldt

--

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


On Dec 9, 3:41 pm, Xuefeng Wu ben...@gmail.com wrote:
 Hello Marius,

 I have an other question about S.error.
 When I use: S.error(can not delete this department.)

 I get:
 try{jQuery(#lift__noticesContainer__).each(function(i) {this.innerHTML =
 divErrorullican not delete./li/ul /div;});} catch (e) {}

 What I want this
 try{jQuery(#*lift__noticesContainer___error*).each(function(i)
 {this.innerHTML = divErrorullican not delete./li/ul /div;});}
 catch (e) {}

 Why it's lift__noticesContainer__ but not lift__noticesContainer___error?

 Did I miss something?

lift__noticesContainer__ is the reserved container name for notices
that are not bound to element ID's. However when you call S.error(xs)
where xs is a List[FieldError] those messages are bound to the ID
contained by FieldError.uniqueFieldId.

Are you using lift:msgs or lift:msg snippet?

If you are using lift:msgs that this will render all errors,
warnings and notices. The distinction between them is given by
error_class, warning_class or notice_class

If you are using lift:msg id=my-id/  then this will render only
messages bound this my-id. Therefore only FieldError that have
uniqueFieldId=my-id.

So if you have a form like:

Name: input type=text/lift:msg id=name-id/
Age: input type=textlift:msg id=age-id/

In this way you can set selectively set messages for fields that fail
to validate. For lift:msg you can also specify errorClass,
warningClass or noticeClass attributes to set CSS classes. But
obviously you can also set styles by id.





 On Tue, Dec 8, 2009 at 9:23 PM, Marius marius.dan...@gmail.com wrote:
  Yes you need to send down fadeOut... call

  def myFunc: JsCmd = {
   // do some DB stuff
   vmyMapper.validate match {
     case Nil = Noop
     case xs = S.error(xs); fadeOutErrors(5 seconds, 1 second)
   }

  }
  On Dec 8, 3:01 pm, Xuefeng Wu ben...@gmail.com wrote:
   Yes, I do something like
    // do the DB stuff
    vmyMapper.validate match {
      case Nil =
      case xs = S.error(xs)
   }

   But I should always add fadeOutErrors(5 seconds, 1 second)?

   I want lift highlight every error/notice information.

   On Tue, Dec 8, 2009 at 5:56 PM, Marius marius.dan...@gmail.com wrote:
Are you using field validate into an Ajax context or not? If not using
something like:

def howdy = {
   S.error(howdy error)
   spanHello there/span ++
   head{Script(OnLoad(fadeOutErrors(5 seconds, 1 second)))}
   /head
 }

from your snippet should be ok.

If you are using validate from an Ajax invocation, then you just need
to return fadeOutErrors(5 seconds, 1 second) from your Ajax function.

So I guess your ajax function would looks something like:

def myDBAjax: JsCmd = {

 // do the DB stuff
 val errors = myMapper.validate
 S.error(errors)
  fadeOutErrors(5 seconds, 1 second)
}

Br's,
Marius

On Dec 8, 10:53 am, Xuefeng Wu ben...@gmail.com wrote:
 But I use field validate, the notice and error are wrap by lift.
  Should I
 append fadeOutErrors(5 seconds, 1 second)?

 On Tue, Dec 8, 2009 at 4:50 PM, Marius marius.dan...@gmail.com
  wrote:
  You don't need to configure anything in boot.

  Assume this is an Ajax function:

   def howdy: JsCmd = {
     S.error(howdy error)
     fadeOutErrors(5 seconds, 1 second)
   }

   ... in your snippet you can say:

   SHtml.a(Text(Click me)(howdy _)

   If you want to fade out errors in a page and not via Ajax you can
  use this:

   def howdy = {
     S.error(howdy error)
     spanHello there/span ++
     head{Script(OnLoad(fadeOutErrors(5 seconds, 1 second)))}
     /head
   }

   which basically says after the page is rendered that after 5
  seconds
  the error notices will be faded out.

  Br's,
  Marius

  On Dec 8, 9:50 am, Xuefeng Wu ben...@gmail.com wrote:
   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/972562da2.
  ..

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

Re: [Lift] LiftConsole and JPA

2009-12-09 Thread Derek Chen-Becker
I'm not sure why the console would need JTA, especially if you've set things
to RESOURCE_LOCAL. If you could send a full stack trace of the exception
that might help pinpoint it.

Derek

On Wed, Dec 9, 2009 at 2:35 AM, Janico Greifenberg
jgre...@googlemail.comwrote:

 I had excluded JTA in the pom.xml, because I copied the dependencies
 from the JPADemo example. After I removed that exclusion, the console
 works, so the practical problem is solved.
 I'm still a bit confused, however, why I need JTA when I use
 RESOURCE_LOCAL as transaction-type. And why does it work under jetty,
 but not in the console?

 So long
 Janico

 On Tue, Dec 8, 2009 at 9:59 PM, Derek Chen-Becker dchenbec...@gmail.com
 wrote:
  It looks like the JTA jar isn't being added to the classpath for the
  LiftConsole runner. I've never touched scala:console, so I'm not sure
 what
  you would need to do to make it work. Off the top of my head, you might
 need
  to put the dependencies for JPA into the plugin config, but I'm not
  positive.
 
  Derek
 
  On Tue, Dec 8, 2009 at 1:16 PM, Janico Greifenberg j...@acm.org wrote:
 
  Hi,
  I've started to experiment with a Lift project that uses JPA for
  persistence. While it works just fine in the web application run with
  mvn jetty:run, I cannot use the model classes from the LiftConsole
  (mvn scala:console -DmainConsole=LiftConsole). When I try for example
 
  Model.find(classOf[Article], 1)
 
  I get the following error:
 
  java.lang.ClassNotFoundException: javax.transaction.SystemException
 at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
 at java.security.AccessController.doPrivileged(Native Method)
 at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:315)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:250)
 at java.lang.Clas...
 
  Model is the EntityManager that I created accorting to chapter 10 from
  the Lift book. Article is an entity class and 1 is an id that exists
  in the database.
 
  I'm using lift version 1.1-M7 and the following persistence.xml
 
  persistence
persistence-unit name=jpa-dossier
 transaction-type=RESOURCE_LOCAL
   properties
  property name=hibernate.dialect
  value=org.hibernate.dialect.MySQLDialect/
  property name=hibernate.connection.driver_class
  value=com.mysql.jdbc.Driver/
  property name=hibernate.connection.url
  value=jdbc:mysql://localhost/dossier/
  property name=hibernate.max_fetch_depth value=3/
  property name=hibernate.show_sql value=true /
  property name=hibernate.hbm2ddl.auto value=update
 /property
 name=hibernate.connection.username value=***
  /property
 property name=hibernate.connection.password
  value=***/property
   /properties
/persistence-unit
  /persistence
 
  Is there something that I need to initialize to get this to work?
 
  So long
  Janico
 
  --
 
  You received this message because you are subscribed to the Google
 Groups
  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.
 



 --
 http://jgre.org

 --

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




--

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




[Lift] Re: lift-stamped - Traits for logging changes MetaMapper-Records

2009-12-09 Thread Franz Bettag
Hello Xuefeng,

you should take a look at the source. It is done via an ActionLog
model which stores every change.
It doesn't log *WHAT* has changed *yet*, but it is on my todo list.

best regards

On 9 Dez., 08:16, Xuefeng Wu ben...@gmail.com wrote:
 That's great!

 What's more,
 I'm not sure whether every model need
 creator/createDate,lastUpdator/lastUpdateDate?
 I want to have a Action Log, which could record user activities.
 Any model change history or change object could restore from action log

 Did any one do something about this?



 On Wed, Dec 9, 2009 at 10:33 AM, Franz Bettag fr...@bett.ag wrote:
  Hi guys,

  thanks to this great community i could finish a project today which i
  found worth to be made available public.

  The topic says it all, check it out at
 https://github.com/fbettag/lift-stamped/

  Tell me what you guys think!

  best regards

  --

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

2009-12-09 Thread Jeppe Nejsum Madsen
Niels Boldt nielsbo...@gmail.com writes:

 Hi,

 What is the best way to create a rest service in lift that support both xml
 and json.

 Are there any tools to use besides lift-json. The end result of my service
 call will be a pojo object that is grabbed from a database and should be
 transformed to the appropriate output.

 I hoped to do that in a generic way, whether it is xml, json or something
 third

Not sure what your main problem (REST api part or obj-response) is but:

The API part goes something like this:

LiftRules.dispatch.append {
  case Req(api :: thing :: Nil, json, GetRequest) = // function that 
returns a Box[LiftResponse]
}

so you can create different functions based on the request suffix (ie
json/xml) and return appropriate responses.

The Lift ORM, Mapper, recently got an asJSON method to return contents of
an object as JSON (it uses lift-json).

I'm not aware of any Scala/Lift generic XML serialization stuff, but you
can use any Java lib for this. For one-off XML structures, it's very
simple to create the XML inline in Scala

/Jeppe

--

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




Re: [Lift] rest service

2009-12-09 Thread David Pollak
HarryH posted some very interesting REST services stuff in his Lift preso (I
learned a thing or two):
http://docs.google.com/present/view?id=dcbpz3ck_24f3v83ggz

On Wed, Dec 9, 2009 at 7:48 AM, Jeppe Nejsum Madsen je...@ingolfs.dkwrote:

 Niels Boldt nielsbo...@gmail.com writes:

  Hi,
 
  What is the best way to create a rest service in lift that support both
 xml
  and json.
 
  Are there any tools to use besides lift-json. The end result of my
 service
  call will be a pojo object that is grabbed from a database and should be
  transformed to the appropriate output.
 
  I hoped to do that in a generic way, whether it is xml, json or something
  third

 Not sure what your main problem (REST api part or obj-response) is but:

 The API part goes something like this:

 LiftRules.dispatch.append {
  case Req(api :: thing :: Nil, json, GetRequest) = // function that
 returns a Box[LiftResponse]
 }

 so you can create different functions based on the request suffix (ie
 json/xml) and return appropriate responses.

 The Lift ORM, Mapper, recently got an asJSON method to return contents of
 an object as JSON (it uses lift-json).

 I'm not aware of any Scala/Lift generic XML serialization stuff, but you
 can use any Java lib for this. For one-off XML structures, it's very
 simple to create the XML inline in Scala

 /Jeppe

 --

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





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

--

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




[Lift] Re: Multi-Database Transactions

2009-12-09 Thread deadfolk
As Jeppe says, I'm avoiding XA..

This is because when we tried it in a Java project, we had a problem
where connections were dropped over time and no new ones could be
created.  Luckily this never got past our test system.  We were unable
to recreate it and so could never verify any fix.

After that, we decided not to rely on any transaction 'magic'.  If
it's broke, we need to be able to fix it ourselves.  Our requirements
are pretty simple, so I think we can do what was suggested here, and
add any addidional logic ourselves.  Anything crossing both DBs would
be stats related, and so losing the occasional row would not be an
issue.


On Dec 9, 1:56 pm, David Pollak feeder.of.the.be...@gmail.com wrote:
 On Wed, Dec 9, 2009 at 12:09 AM, Jeppe Nejsum Madsen je...@ingolfs.dkwrote:

  On Wed, Dec 9, 2009 at 5:05 AM, David Pollak
  feeder.of.the.be...@gmail.com wrote:
   I think what you want is the Lift JTA module:

  http://github.com/dpp/liftweb/tree/master/lift-modules/lift-jta/

  I think the OP wanted to avoid XA transactions. But of course, if data
  integriity is important this is the right way to go.

  I haven't looked at lift-jta. Does it provide something else besides
  hooking into JTA that would be useful in this scenario?

 Dunno... it's Jonas's brainchild. ;-)





  /Jeppe

  --

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

 --
 Lift, the simply functional web 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] I was giving a short interview for JavaBooks.org about Lift Scala

2009-12-09 Thread Derek Chen-Becker
Great interview! Your crappy English is better than some Americans I've
heard speak, so don't sweat it :)

Derek

On Mon, Dec 7, 2009 at 12:59 AM, Marius marius.dan...@gmail.com wrote:

 Hi,

 After a long day I ended up giving this interview.

 http://vimeo.com/7986506

 Br's,
 Marius

 P.S. Please forgive my crappy English.

 --

 You received this message because you are subscribed to the Google Groups
 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] I was giving a short interview for JavaBooks.org about Lift Scala

2009-12-09 Thread David Pollak
On Wed, Dec 9, 2009 at 9:11 AM, Derek Chen-Becker dchenbec...@gmail.comwrote:

 Great interview! Your crappy English is better than some Americans I've
 heard speak, so don't sweat it :)


And your hand gestures are strangely similar to mine... it was fun to watch
you.



 Derek


 On Mon, Dec 7, 2009 at 12:59 AM, Marius marius.dan...@gmail.com wrote:

 Hi,

 After a long day I ended up giving this interview.

 http://vimeo.com/7986506

 Br's,
 Marius

 P.S. Please forgive my crappy English.

 --

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

2009-12-09 Thread Janico Greifenberg
The stack trace is attached.

So long
Janico

On Wed, Dec 9, 2009 at 4:05 PM, Derek Chen-Becker dchenbec...@gmail.com wrote:
 I'm not sure why the console would need JTA, especially if you've set things
 to RESOURCE_LOCAL. If you could send a full stack trace of the exception
 that might help pinpoint it.

 Derek

 On Wed, Dec 9, 2009 at 2:35 AM, Janico Greifenberg jgre...@googlemail.com
 wrote:

 I had excluded JTA in the pom.xml, because I copied the dependencies
 from the JPADemo example. After I removed that exclusion, the console
 works, so the practical problem is solved.
 I'm still a bit confused, however, why I need JTA when I use
 RESOURCE_LOCAL as transaction-type. And why does it work under jetty,
 but not in the console?

 So long
 Janico

 On Tue, Dec 8, 2009 at 9:59 PM, Derek Chen-Becker dchenbec...@gmail.com
 wrote:
  It looks like the JTA jar isn't being added to the classpath for the
  LiftConsole runner. I've never touched scala:console, so I'm not sure
  what
  you would need to do to make it work. Off the top of my head, you might
  need
  to put the dependencies for JPA into the plugin config, but I'm not
  positive.
 
  Derek
 
  On Tue, Dec 8, 2009 at 1:16 PM, Janico Greifenberg j...@acm.org wrote:
 
  Hi,
  I've started to experiment with a Lift project that uses JPA for
  persistence. While it works just fine in the web application run with
  mvn jetty:run, I cannot use the model classes from the LiftConsole
  (mvn scala:console -DmainConsole=LiftConsole). When I try for example
 
  Model.find(classOf[Article], 1)
 
  I get the following error:
 
  java.lang.ClassNotFoundException: javax.transaction.SystemException
         at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:315)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:250)
         at java.lang.Clas...
 
  Model is the EntityManager that I created accorting to chapter 10 from
  the Lift book. Article is an entity class and 1 is an id that exists
  in the database.
 
  I'm using lift version 1.1-M7 and the following persistence.xml
 
  persistence
    persistence-unit name=jpa-dossier
  transaction-type=RESOURCE_LOCAL
       properties
          property name=hibernate.dialect
  value=org.hibernate.dialect.MySQLDialect/
          property name=hibernate.connection.driver_class
  value=com.mysql.jdbc.Driver/
          property name=hibernate.connection.url
  value=jdbc:mysql://localhost/dossier/
          property name=hibernate.max_fetch_depth value=3/
          property name=hibernate.show_sql value=true /
          property name=hibernate.hbm2ddl.auto value=update
  /property
                 name=hibernate.connection.username value=***
  /property
         property name=hibernate.connection.password
  value=***/property
       /properties
    /persistence-unit
  /persistence
 
  Is there something that I need to initialize to get this to work?
 
  So long
  Janico
 
  --
 
  You received this message because you are subscribed to the Google
  Groups
  Lift group.
  To post to this group, send email to lift...@googlegroups.com.
  To unsubscribe from 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.
 



 --
 http://jgre.org

 --

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



 --

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




-- 
http://jgre.org

--

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




jta-exception.out
Description: Binary data


[Lift] Re: I was giving a short interview for JavaBooks.org about Lift Scala

2009-12-09 Thread Marius
lol

On Dec 9, 7:13 pm, David Pollak feeder.of.the.be...@gmail.com wrote:
 On Wed, Dec 9, 2009 at 9:11 AM, Derek Chen-Becker 
 dchenbec...@gmail.comwrote:

  Great interview! Your crappy English is better than some Americans I've
  heard speak, so don't sweat it :)

 And your hand gestures are strangely similar to mine... it was fun to watch
 you.





  Derek

  On Mon, Dec 7, 2009 at 12:59 AM, Marius marius.dan...@gmail.com wrote:

  Hi,

  After a long day I ended up giving this interview.

 http://vimeo.com/7986506

  Br's,
  Marius

  P.S. Please forgive my crappy English.

  --

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

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

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

--

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




Re: [Lift] Next Lift version will be 2.0

2009-12-09 Thread Heiko Seeberger
Indrajit,

Sorry for the very late reply :-(

2009/12/7 Indrajit Raychaudhuri indraj...@gmail.com

 Grand stuff!


Thank you!


 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.


Definitely yes!


 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?


+1

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] re: what changes would need to be made so LIFT can work with HTML5

2009-12-09 Thread Alex Boisvert
Just to follow-up on this, I've now added a new built-in snippet in master
that sets the HTML5 DOCTYPE on the Lift response, just add this snippet
anywhere in your template for pages you want to be delivered as HTML5,

lift:html5/

cheers,
alex


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



 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.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] Next Lift version will be 2.0

2009-12-09 Thread Indrajit Raychaudhuri

On 09/12/09 11:01 PM, Heiko Seeberger wrote:
 Indrajit,

 Sorry for the very late reply :-(

 2009/12/7 Indrajit Raychaudhuri indraj...@gmail.com
 mailto:indraj...@gmail.com

 Grand stuff!


 Thank you!

 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.


 Definitely yes!

 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?


 +1

Wonderful! I'll circulate an update once I publish the 'all new' 2.x 
branch after M8.


 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 lift...@googlegroups.com.
 To unsubscribe from 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: Documentation for 1.1

2009-12-09 Thread Randinn
I'm sorry I didn't reply to this earlier. Yes, I am looking for docs
so I can keep my newbie questions to a minimum. I know I can ask
anything here but I'd rather see you all moving Lift forward then
dealing with my simplistic questions.

On Dec 8, 10:50 am, Timothy Perrett timo...@getintheloop.eu wrote:
 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 
  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] Welcome Peter Robinett to the Lift committers

2009-12-09 Thread David Pollak
Folks,

Please join me in welcoming Peter Robinett to the Lift committers.  Peter's
been active on the Lift list helping people and asking questions (a great
combo.)  As Peter's project has progressed, he's developed artifacts that he
is looking to contribute to Lift and I for one am looking forward to
enhancements (e.g., to the flot stuff) as well as other stuff that he's got
in his bag of tricks. ;-)

Welcome Peter!

Thanks,

David

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

--

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




Re: [Lift] LiftConsole and JPA

2009-12-09 Thread Derek Chen-Becker
The exception is being thrown by Hibernate:

java.lang.NoClassDefFoundError: javax/transaction/SystemException
at
org.hibernate.ejb.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:39)
at
org.hibernate.ejb.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:34)


For whatever reason, Hibernate wants to load JTA even though your
persistence unit is marked RESOURCE_LOCAL. This seems like a bug in
Hibernate. All that ScalaJPA does is try to create the EM, but the creation
should be controlled entirely by the persistence.xml metadata.

Derek

On Wed, Dec 9, 2009 at 10:21 AM, Janico Greifenberg
jgre...@googlemail.comwrote:

 The stack trace is attached.

 So long
 Janico

 On Wed, Dec 9, 2009 at 4:05 PM, Derek Chen-Becker dchenbec...@gmail.com
 wrote:
  I'm not sure why the console would need JTA, especially if you've set
 things
  to RESOURCE_LOCAL. If you could send a full stack trace of the exception
  that might help pinpoint it.
 
  Derek
 
  On Wed, Dec 9, 2009 at 2:35 AM, Janico Greifenberg 
 jgre...@googlemail.com
  wrote:
 
  I had excluded JTA in the pom.xml, because I copied the dependencies
  from the JPADemo example. After I removed that exclusion, the console
  works, so the practical problem is solved.
  I'm still a bit confused, however, why I need JTA when I use
  RESOURCE_LOCAL as transaction-type. And why does it work under jetty,
  but not in the console?
 
  So long
  Janico
 
  On Tue, Dec 8, 2009 at 9:59 PM, Derek Chen-Becker 
 dchenbec...@gmail.com
  wrote:
   It looks like the JTA jar isn't being added to the classpath for the
   LiftConsole runner. I've never touched scala:console, so I'm not sure
   what
   you would need to do to make it work. Off the top of my head, you
 might
   need
   to put the dependencies for JPA into the plugin config, but I'm not
   positive.
  
   Derek
  
   On Tue, Dec 8, 2009 at 1:16 PM, Janico Greifenberg j...@acm.org
 wrote:
  
   Hi,
   I've started to experiment with a Lift project that uses JPA for
   persistence. While it works just fine in the web application run with
   mvn jetty:run, I cannot use the model classes from the LiftConsole
   (mvn scala:console -DmainConsole=LiftConsole). When I try for example
  
   Model.find(classOf[Article], 1)
  
   I get the following error:
  
   java.lang.ClassNotFoundException: javax.transaction.SystemException
  at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
  at java.security.AccessController.doPrivileged(Native Method)
  at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
  at java.lang.ClassLoader.loadClass(ClassLoader.java:315)
  at java.lang.ClassLoader.loadClass(ClassLoader.java:250)
  at java.lang.Clas...
  
   Model is the EntityManager that I created accorting to chapter 10
 from
   the Lift book. Article is an entity class and 1 is an id that exists
   in the database.
  
   I'm using lift version 1.1-M7 and the following persistence.xml
  
   persistence
 persistence-unit name=jpa-dossier
   transaction-type=RESOURCE_LOCAL
properties
   property name=hibernate.dialect
   value=org.hibernate.dialect.MySQLDialect/
   property name=hibernate.connection.driver_class
   value=com.mysql.jdbc.Driver/
   property name=hibernate.connection.url
   value=jdbc:mysql://localhost/dossier/
   property name=hibernate.max_fetch_depth value=3/
   property name=hibernate.show_sql value=true /
   property name=hibernate.hbm2ddl.auto value=update
   /property
  name=hibernate.connection.username value=***
   /property
  property name=hibernate.connection.password
   value=***/property
/properties
 /persistence-unit
   /persistence
  
   Is there something that I need to initialize to get this to work?
  
   So long
   Janico
  
   --
  
   You received this message because you are subscribed to the Google
   Groups
   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.
  
 
 
 
  --
  http://jgre.org
 
  --
 
  You received this message because you are subscribed to the Google
 Groups
  Lift group.
  To post to this group, send email to lift...@googlegroups.com.
  To unsubscribe from this group, send email to
  

Re: [Lift] Welcome Peter Robinett to the Lift committers

2009-12-09 Thread Derek Chen-Becker
Welcome Peter!

On Wed, Dec 9, 2009 at 3:08 PM, David Pollak
feeder.of.the.be...@gmail.comwrote:

 Folks,

 Please join me in welcoming Peter Robinett to the Lift committers.  Peter's
 been active on the Lift list helping people and asking questions (a great
 combo.)  As Peter's project has progressed, he's developed artifacts that he
 is looking to contribute to Lift and I for one am looking forward to
 enhancements (e.g., to the flot stuff) as well as other stuff that he's got
 in his bag of tricks. ;-)

 Welcome Peter!

 Thanks,

 David

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

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


--

You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@googlegroups.com.
To unsubscribe from 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-09 Thread David Pollak
On Mon, Dec 7, 2009 at 9:14 PM, Xuefeng Wu ben...@gmail.com wrote:

 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.


Without understanding how  def *doCompetenceB*(xhtml: NodeSeq,msg:
String,competence: Competence): NodeSeq = { is called as part of the Ajax
callback, I can't give you any advice.  Sorry.



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

 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)},
  

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

2009-12-09 Thread Xuefeng Wu
doCompetenceB render a button which user click and will pop a dialog for
create a competence.
*The competence have category property, I want this pop dialog know the
category which user already selected from the category tree.
*
On Thu, Dec 10, 2009 at 7:19 AM, David Pollak feeder.of.the.be...@gmail.com
 wrote:



 On Mon, Dec 7, 2009 at 9:14 PM, Xuefeng Wu ben...@gmail.com wrote:

 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.


 Without understanding how  def *doCompetenceB*(xhtml: NodeSeq,msg:
 String,competence: Competence): NodeSeq = { is called as part of the Ajax
 callback, I can't give you any advice.  Sorry.



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

 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(() = {
   

[Lift] Understanding SessionVars and Objects

2009-12-09 Thread johncch
Hi,

I'm trying to understand the implementation of MetaMegaProtoUser,
reading the code, there are a couple of conceptual questions that I'd
like to ask.

I understand object as a singleton class, or perhaps vaguely similar
to a static class (as in Java) so I'm wondering why is, in the
MetaMegaProtoUser trait, the curUserId an object.

In the sense, perhaps I can imagine an object inside an object is
simple a singleton within a singleton, but the confusion kinda arises
when it extends SessionVar. From my understanding of the functionality
of SessionVars, it actually keeps the user logged in across sessions.
So, I'm trying to understand how does a singleton in a singleton keeps
the log in information safe? If I have multiple users on the site at
the same time, why is the value not overwritten?

I suspect this is related to the deficiency in my knowledge in how
sessions are actually implemented, but please bear with me..

So, I look at the loggedIn_? method that is constantly called on the
User object, it actually looks at currentUserId.isDefined, so I assume
that the currentUserId, once set via the login method will persist
throughout the session. How is that achieved? Is there a method at the
beginning of lift's lifecycle that sets this variable via looking at
the session information?

Lastly, I'd like to ask where is the remove() method defined on the
curUserId private object? I've looked at the implementation of
SessionVar and AnyVar and I couldn't seem to find it.

I'm hacking on a small-ish project and it's been a fun and frustrating
journey so far. Love the framework, it makes doing things very
flexible and easy, but the flexibility of the language is kinda
daunting.. sometimes it really makes my brain hurt. But will try
harder!

regards,
CH

--

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

2009-12-09 Thread Ross Mellgren
On Dec 9, 2009, at 8:44 PM, johncch wrote:

 Hi,
 
 I'm trying to understand the implementation of MetaMegaProtoUser,
 reading the code, there are a couple of conceptual questions that I'd
 like to ask.
 
 I understand object as a singleton class, or perhaps vaguely similar
 to a static class (as in Java) so I'm wondering why is, in the
 MetaMegaProtoUser trait, the curUserId an object.
 
 In the sense, perhaps I can imagine an object inside an object is
 simple a singleton within a singleton, but the confusion kinda arises
 when it extends SessionVar. From my understanding of the functionality
 of SessionVars, it actually keeps the user logged in across sessions.
 So, I'm trying to understand how does a singleton in a singleton keeps
 the log in information safe? If I have multiple users on the site at
 the same time, why is the value not overwritten?

SessionVars are kind of like thread local variables. They have an internal 
name (which is guaranteed to be unique and is maintained by Lift) which is 
used to check in a dictionary the session keeps around with the values of each 
SessionVar for the current session.

When you access a SessionVar with myVar.is (or myVar.get, or using the 
implicit) under the covers it obtains the current session from a thread local 
variable in S (I believe, maybe it's in LiftSession) and then looks for the 
value for the variable in the current session. If not found, it executes the 
initializer to pick an initial value.

Similarly, when you set a SessionVar with myVar.set the same kind of thing 
happens except it stores the value you give it in the session.

So, the singleton within a singleton is essentially only keeping that unique 
name you don't need to know about.

 I suspect this is related to the deficiency in my knowledge in how
 sessions are actually implemented, but please bear with me..
 
 So, I look at the loggedIn_? method that is constantly called on the
 User object, it actually looks at currentUserId.isDefined, so I assume
 that the currentUserId, once set via the login method will persist
 throughout the session. How is that achieved? Is there a method at the
 beginning of lift's lifecycle that sets this variable via looking at
 the session information?

curUserId is set via the mechanism I describe earlier in MetaMetaProtoUser's 
login handling.

 Lastly, I'd like to ask where is the remove() method defined on the
 curUserId private object? I've looked at the implementation of
 SessionVar and AnyVar and I couldn't seem to find it.

It's on AnyVar. Finding where a method is implemented is made alot easier by 
using the vscaladocs and checking the Inherited box at the bottom right of 
each page. Here's a direct link to the lift-webkit docs (1.1-SNAPSHOT):

http://www.scala-tools.org/mvnsites-snapshots/liftweb/lift-webkit/scaladocs/index.html

 By the way, if you're not using 1.1-SNAPSHOT (soon to be 2.0-SNAPSHOT), you 
definitely should. It's leagues ahead of 1.0 and tends to be stable.


 I'm hacking on a small-ish project and it's been a fun and frustrating
 journey so far. Love the framework, it makes doing things very
 flexible and easy, but the flexibility of the language is kinda
 daunting.. sometimes it really makes my brain hurt. But will try
 harder!

Good! If you get stuck always feel free to ask questions on the mailing list. 
We like helping.

-Ross

--

You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@googlegroups.com.
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.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-09 Thread David Pollak
On Wed, Dec 9, 2009 at 5:35 PM, Xuefeng Wu ben...@gmail.com wrote:

 doCompetenceB render a button which user click and will pop a dialog for
 create a competence.
 *The competence have category property, I want this pop dialog know the
 category which user already selected from the category tree.*


That doesn't explain how it's called.  English is a weak way to describe
things.  The best way is a small, runnable example (mvn jetty:run) created
as a public GitHub project.  I can fork it and make it work the right way
for you.


 *
 *

 On Thu, Dec 10, 2009 at 7:19 AM, David Pollak 
 feeder.of.the.be...@gmail.com wrote:



 On Mon, Dec 7, 2009 at 9:14 PM, Xuefeng Wu ben...@gmail.com wrote:

 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.


 Without understanding how  def *doCompetenceB*(xhtml: NodeSeq,msg:
 String,competence: Competence): NodeSeq = { is called as part of the Ajax
 callback, I can't give you any advice.  Sorry.



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

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

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

2009-12-09 Thread Xuefeng Wu
That's great!
Thank you for your help.

On Thu, Dec 10, 2009 at 11:06 AM, David Pollak 
feeder.of.the.be...@gmail.com wrote:



 On Wed, Dec 9, 2009 at 5:35 PM, Xuefeng Wu ben...@gmail.com wrote:

 doCompetenceB render a button which user click and will pop a dialog for
 create a competence.
 *The competence have category property, I want this pop dialog know the
 category which user already selected from the category tree.*


 That doesn't explain how it's called.  English is a weak way to describe
 things.  The best way is a small, runnable example (mvn jetty:run) created
 as a public GitHub project.  I can fork it and make it work the right way
 for you.


 *
 *

 On Thu, Dec 10, 2009 at 7:19 AM, David Pollak 
 feeder.of.the.be...@gmail.com wrote:



 On Mon, Dec 7, 2009 at 9:14 PM, Xuefeng Wu ben...@gmail.com wrote:

 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.


 Without understanding how  def *doCompetenceB*(xhtml: NodeSeq,msg:
 String,competence: Competence): NodeSeq = { is called as part of the Ajax
 callback, I can't give you any advice.  Sorry.



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

 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 

[Lift] Multi-Ćolumn MappedField

2009-12-09 Thread Joern
Hi there,

I want to create a MappedField, which has one column as Type Long and
another column as Type Boolean, but I don't know, what I should put
into dbFieldClass and/or targetSQLType. If I look at MappedPassword
for example, I just see classOf[String] or Types.VARCHAR, which
somehow makes sense, because all columns of the MappedPassword are
Strings. How can I create such a MappedField ?

Or maybe there is a completely different and/or better way to approach
my problem:
I have two tables (A and B), which are represented by my own mapper
classes having IdPK.
In a third table (let's call it C), I want to reference an instance of
A or B in table C. As mentioned above, I want to say for example that
Boolean false means look in table A for the Long (=index) and true
- look in table B.

Any tips, pointers or links to more documentation about multi-column
mappedfields? :)

Thanks,
Joern

--

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

2009-12-09 Thread johncch
Thanks for the explanation!

 SessionVars are kind of like thread local variables. They have an internal 
 name (which is guaranteed to be unique and is maintained by Lift) which is 
 used to check in a dictionary the session keeps around with the values of 
 each SessionVar for the current session.

 When you access a SessionVar with myVar.is (or myVar.get, or using the 
 implicit) under the covers it obtains the current session from a thread local 
 variable in S (I believe, maybe it's in LiftSession) and then looks for the 
 value for the variable in the current session. If not found, it executes the 
 initializer to pick an initial value.

 Similarly, when you set a SessionVar with myVar.set the same kind of thing 
 happens except it stores the value you give it in the session.

 So, the singleton within a singleton is essentially only keeping that unique 
 name you don't need to know about.


Is the object found via reflection? It's really interesting to me
actually I'd like to know how it really works under the cover.

Another small-ish question that I wanted to ask.. my textareas are
swallowing up html tags (actually converting them to gt) somewhere
between clicking the save button and displaying them. Is there any
part of the code that does the escaping? I'm trying to look for it..

The scaladocs seem to be blank. Is there some sort of bug in the build
process?

Thanks

--

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




Re: [Lift] Open discussion on Lift Name Calling practices

2009-12-09 Thread Kris Nuttycombe
On Tue, Dec 1, 2009 at 1:43 PM, Jim Barrows jim.barr...@gmail.com wrote:
 Lift is getting very large.  We've got singular names as lists, and plural
 names that aren't lists.  We've got people calling roses red flowers, spades
 diamonds and other mass chaos.  Well, it's not that bad, but you get the
 idea.  This is an attempt to come up with a series of standard names to make
 working in lift easier, not only for the committers, but also (and more
 importantly) for you folks using it on a day to day basis.

 Achieving this means that there must be two things, a set of rules for
 naming conventions, and a process to make sure everyone is following those
 rules, and changing things when we mess it up.

 This thread is for discussing the process.  I'll be starting another thread
 to discuss the rules, as well as another thread to discuss current names
 that we want to change.
 As always, if you don't speak up, you're not dissenting, and we welcome your
 views and ideas on how to do this!

 1) Goal discussion (closes 8 Dec 09)
 2) Identify changes, and put the list on the wiki (closes 15 Jan 10)
 3) Convert the list to github tickets.  This includes discussing setting
 priorities etc, assessing impacts etc etc to go into the ticket. (closes 29
 Jan 10)
 4) Committers can then work the tickets into their own workflows, and
 everything would then follow the normal commit workflow from there.
 (committers work according to priority and impact etc)
 5) Naming becomes a part of the normal review board process.  However, if a
 committer thinks that the Name Caller needs to look at it earlier, or is
 having a hard time with naming something, by all means send an email.  (
 date we add this to the process 29 Jan 10)
 6) As we find things we missed, or better names, we work them through the
 github ticket and review system. ( date we add this to the process 29 Jan
 10)

 --
 James A Barrows

The timeline looks good to me, with the exception of the fact that
we've already passed the first milestone!

With respect to goals, I have a few general suggestions.

1) Remove ambiguity wherever possible! There are a number of places
where very similar names are used to refer to utterly different
things.
2) As an aide removing ambiguity, consider outlawing or eliminating
extremely generic names, or else establish a single way in which a
given name will be used across Lift. Examples are Field, Info, Holder,
etc.
3) Avoid making the name of the return type part of the name of the
method. The types should tell the story as much as possible, except in
the case where multiple methods varying only in return type would
exist (illegal overloads)
4) Prefer Scala-style accessors and mutators.

I also am attaching a start at some names I see as suboptimal from
S.scala, but since this thread isn't really for discussion of
individual naming issues (and such a thread doesn't yet exist) I
thought I'd go ahead and present my suggestions as a strawman for
format and what type of changes might be considered.

Kris

--

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


module: lift-util 
file: src/main/scala/net/liftweb/util/JsonCmd.scala
ResponseInfoHolder = ResponseMetadata

module: lift-webkit 
file: src/main/scala/net/liftweb/http/S.scala
RewriteHolder = NamedRewrite
DispatchHolder = NamedDispatch
CookieHolder = Cookies
(\w+)HighLevelSessionDispatcher = \1SessionDispatcher (No LowLevel???)
? = % or $ (printf, jsp - what's the inspiration for ? as 
localization/formatting?)
(\w+)_? = is\1 (underscore is used for enough things in Scala, let's not make 
method names harder to read)
getHeader = getResponseHeader
getDocType = docType (change return type from tuple to case class with 
sematically significant names?)
setDocType = docType_=
addCleanupFunc = onCleanup
functionLifespan_= parameter type Boolean = Lifespan (sealed trait Lifespan; 
case object Session extends Lifespan; case object Request extends Lifespan)
functionLifespan_? = functionLifespan
attrs = snippetAttrs; return type should be something more informative than 
List[(Either[String, (String, String)], String)] 
prefixedAttrsToMap = snippetAttrMap 
prefixedAttrsToMetadata = snippetAttrMetadata
mapToAttrs: Move to one of the util classes? No state dependencies in this 
one...

getSessionAttribute(s: String) = containerSessionAttribute (to avoid confusion 
with LiftSession) where containerSessionAttribute is a local object as defined 
below
setSessionAttribute(s: String, v: String) = containerSessionAttribute(s: 
String) = v; see below
object containerSessionAttribute {
  def apply(name: String) = containerSession.flatMap(_.attribute(name) match 
{case s: String = Full(s) case _ = Empty})
  def update(name: String, 

Re: [Lift] New Lift release process wiki page

2009-12-09 Thread Heiko Seeberger
David,

I do not understand the naming convention Lift_x_version. Is this
something like Lift_x_2.0 or Lift_2.0 or ...?

git checkout -b Lift_x_version

Maybe it is possible to find a better symbol, e.g.
Lift_MAJOR.MINOR[.MICRO][-QUALIFIER] with QUALIFIER something like
M8? Anyway, could you please write up some examples in the Wiki?

Thanks,

Heiko

2009/12/10 David Pollak feeder.of.the.be...@gmail.com

 http://wiki.github.com/dpp/liftweb/committer-release-process

 Please note the branch vs. tag change in the process.

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

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




-- 
Heiko Seeberger

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: Welcome Peter Robinett to the Lift committers

2009-12-09 Thread Marius
Welcome Peter !!

On Dec 10, 12:08 am, David Pollak feeder.of.the.be...@gmail.com
wrote:
 Folks,

 Please join me in welcoming Peter Robinett to the Lift committers.  Peter's
 been active on the Lift list helping people and asking questions (a great
 combo.)  As Peter's project has progressed, he's developed artifacts that he
 is looking to contribute to Lift and I for one am looking forward to
 enhancements (e.g., to the flot stuff) as well as other stuff that he's got
 in his bag of tricks. ;-)

 Welcome Peter!

 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.