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

2009-12-08 Thread Jeppe Nejsum Madsen
cody koeninger c...@koeninger.org writes:

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

 alex


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

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

Personally, I think using select for update is a bad idea when dealing
with a UI. DB transactions should be as short as possible.

On some databases, a locked record inhibits any reads (depending on
isolation level of course) so the next user that comes in to view the
record will just hang until the transaction times out. 

And what happens when the editing user just closes the browser? The
record will not be unlocked until the session times out

A much better solution imo is to use optimistic locking.

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




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

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

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

--

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




[Lift] how to keep last submited form field value

2009-12-08 Thread Jarod Liu
I want the date field keep the last submited value.  I tried with
below code, but it's dosn't work. The date value(display in page)
awalys the date of today.

the form:
lift:mySnippet.form1 form=POST
f:date/
f:submit/
/lift:mySnippet.form1

MySnippet:

class MySnippet extends StatefulSnippet {
  val dfmt = new SimpleDateFormat(-MM-dd)
  var date =  dfmt.format(new Date)

 val dispatch: DispatchIt = {
case form1 = form1 _
  }

  def form1(in: NodeSeq): NodeSeq = {
bind(f, in,
 date - SHtml.text(date, date = _,
  class - datepicker),
 submit - SHtml.submit(submit, println(submit:  +
date))
)
  }

--

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

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

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

--

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




[Lift] Re: Char encoding problem using S.?

2009-12-08 Thread Jean-Adrien
Ah !

In fact the problem did not appear when I upgraded to 1.1-SNAPSHOT but
when I enabled maven resource filtering (which assumes all files use
UTF-8).
Anyway I'll look for a correct setting to have both ISO 8859-1
properties file and maven resource filtering enabled.


On Dec 8, 10:41 am, Jean-Adrien jean.vauc...@gmail.com wrote:
 Hello,

 I have a char encoding problem, using the localization feature of
 lift.
 I use the ? method of the S object in order to translate strings. The
 localized values are in a translate_fr.properties file in the
 resources of the project.

 Until I upgrade from lift 1.1-M6 to 1.1-SNAPSHOT everything was ok,
 but now it seems that the following happens:
 As specified in the java doc, the properties file is encoded using ISO
 8859-1. All xhtml templates in lift use UTF-8, and are interpreted in
 UTF-8 by the browser. But it seems that the the string loaded from
 properties file are badly translated to UTF-8 (?)

 I.e. é is 0xE9 in ISO 8859-1 and should turn when loaded in a String
 by java properties into the UTF-8 bytes 0xC3 0xA9. But it is
 interpreted some way in � (0x EF 0xBF 0xBD)

 I tried to encode my properties file in UTF-8 but I have the UTF
 encoding (0xC3 0xA9) interpreted in ISO 8859-1. é become é (famous
 French letter) in the webpage. Behaviour I understand since java loads
 properties String using ISO-8859-1 charset

 Does anyone observed the same ?

--

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

2009-12-08 Thread Timothy Perrett
Hi,

Can you send me a sample project offline that illustrates this problem? Its not 
one i've seen before and im a little confused why your getting this because we 
are leveraging the Java properties localisation under the hood for actual 
loading and parsing of strings. That is:

  private def ?!(str: String, resBundle: List[ResourceBundle]): String = 
resBundle.flatMap(r = tryo(r.getObject(str) match {
case s: String = Full(s)
case _ = Empty
  }).flatMap(s = s)).find(s = true) getOrElse {
LiftRules.localizationLookupFailureNotice.foreach(_(str, locale));
str
  }

As above, send me a project offline and i'll see if i can isolate the problem 
for you.

Cheers, Tim



On 8 Dec 2009, at 09:41, Jean-Adrien wrote:

 Hello,
 
 I have a char encoding problem, using the localization feature of
 lift.
 I use the ? method of the S object in order to translate strings. The
 localized values are in a translate_fr.properties file in the
 resources of the project.
 
 Until I upgrade from lift 1.1-M6 to 1.1-SNAPSHOT everything was ok,
 but now it seems that the following happens:
 As specified in the java doc, the properties file is encoded using ISO
 8859-1. All xhtml templates in lift use UTF-8, and are interpreted in
 UTF-8 by the browser. But it seems that the the string loaded from
 properties file are badly translated to UTF-8 (?)
 
 I.e. é is 0xE9 in ISO 8859-1 and should turn when loaded in a String
 by java properties into the UTF-8 bytes 0xC3 0xA9. But it is
 interpreted some way in � (0x EF 0xBF 0xBD)
 
 I tried to encode my properties file in UTF-8 but I have the UTF
 encoding (0xC3 0xA9) interpreted in ISO 8859-1. é become é (famous
 French letter) in the webpage. Behaviour I understand since java loads
 properties String using ISO-8859-1 charset
 
 Does anyone observed the same ?
 
 --
 
 You received this message because you are subscribed to the Google Groups 
 Lift group.
 To post to this group, send email to lift...@googlegroups.com.
 To unsubscribe from this group, send email to 
 liftweb+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/liftweb?hl=en.
 
 
 

--

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




Re: [Lift] Re: (Maven problem?) Char encoding problem using S.?

2009-12-08 Thread Timothy Perrett
Ahhh! That is interesting... i'd not thought of that :-)

You'll need to specify a proper encoding type for sure otherwise maven will 
just assume your platform default... for example, MacRoman. Perhaps IRC or Josh 
will be able to advise...

Cheers, Tim

On 8 Dec 2009, at 10:02, Jean-Adrien wrote:

 Ah !
 
 In fact the problem did not appear when I upgraded to 1.1-SNAPSHOT but
 when I enabled maven resource filtering (which assumes all files use
 UTF-8).
 Anyway I'll look for a correct setting to have both ISO 8859-1
 properties file and maven resource filtering enabled.
 
 
 On Dec 8, 10:41 am, Jean-Adrien jean.vauc...@gmail.com wrote:
 Hello,
 
 I have a char encoding problem, using the localization feature of
 lift.
 I use the ? method of the S object in order to translate strings. The
 localized values are in a translate_fr.properties file in the
 resources of the project.
 
 Until I upgrade from lift 1.1-M6 to 1.1-SNAPSHOT everything was ok,
 but now it seems that the following happens:
 As specified in the java doc, the properties file is encoded using ISO
 8859-1. All xhtml templates in lift use UTF-8, and are interpreted in
 UTF-8 by the browser. But it seems that the the string loaded from
 properties file are badly translated to UTF-8 (?)
 
 I.e. é is 0xE9 in ISO 8859-1 and should turn when loaded in a String
 by java properties into the UTF-8 bytes 0xC3 0xA9. But it is
 interpreted some way in � (0x EF 0xBF 0xBD)
 
 I tried to encode my properties file in UTF-8 but I have the UTF
 encoding (0xC3 0xA9) interpreted in ISO 8859-1. é become é (famous
 French letter) in the webpage. Behaviour I understand since java loads
 properties String using ISO-8859-1 charset
 
 Does anyone observed the same ?
 
 --
 
 You received this message because you are subscribed to the Google Groups 
 Lift group.
 To post to this group, send email to lift...@googlegroups.com.
 To unsubscribe from this group, send email to 
 liftweb+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/liftweb?hl=en.
 
 
 

--

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




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

2009-12-08 Thread Xuefeng Wu
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 message because you are subscribed to the Google Groups
 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] Re: (Maven problem?) Char encoding problem using S.?

2009-12-08 Thread David Bernard
you could select which file should be filtering, else every resources are
filtering and converted (to UTF-8)

/davidB

On Tue, Dec 8, 2009 at 11:18, Timothy Perrett timo...@getintheloop.euwrote:

 Ahhh! That is interesting... i'd not thought of that :-)

 You'll need to specify a proper encoding type for sure otherwise maven will
 just assume your platform default... for example, MacRoman. Perhaps IRC or
 Josh will be able to advise...

 Cheers, Tim

 On 8 Dec 2009, at 10:02, Jean-Adrien wrote:

  Ah !
 
  In fact the problem did not appear when I upgraded to 1.1-SNAPSHOT but
  when I enabled maven resource filtering (which assumes all files use
  UTF-8).
  Anyway I'll look for a correct setting to have both ISO 8859-1
  properties file and maven resource filtering enabled.
 
 
  On Dec 8, 10:41 am, Jean-Adrien jean.vauc...@gmail.com wrote:
  Hello,
 
  I have a char encoding problem, using the localization feature of
  lift.
  I use the ? method of the S object in order to translate strings. The
  localized values are in a translate_fr.properties file in the
  resources of the project.
 
  Until I upgrade from lift 1.1-M6 to 1.1-SNAPSHOT everything was ok,
  but now it seems that the following happens:
  As specified in the java doc, the properties file is encoded using ISO
  8859-1. All xhtml templates in lift use UTF-8, and are interpreted in
  UTF-8 by the browser. But it seems that the the string loaded from
  properties file are badly translated to UTF-8 (?)
 
  I.e. é is 0xE9 in ISO 8859-1 and should turn when loaded in a String
  by java properties into the UTF-8 bytes 0xC3 0xA9. But it is
  interpreted some way in � (0x EF 0xBF 0xBD)
 
  I tried to encode my properties file in UTF-8 but I have the UTF
  encoding (0xC3 0xA9) interpreted in ISO 8859-1. é become é (famous
  French letter) in the webpage. Behaviour I understand since java loads
  properties String using ISO-8859-1 charset
 
  Does anyone observed the same ?
 
  --
 
  You received this message because you are subscribed to the Google Groups
 Lift group.
  To post to this group, send email to lift...@googlegroups.com.
  To unsubscribe from this group, send email to
 liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com
 .
  For more options, visit this group at
 http://groups.google.com/group/liftweb?hl=en.
 
 
 

 --

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




--

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




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

2009-12-08 Thread Marius
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 message because you are subscribed to the Google Groups
  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] Re: highlight the lift notices in some seconds

2009-12-08 Thread Xuefeng Wu
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
 
 
 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
 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中文社区:  

[Lift] Re: Field validation

2009-12-08 Thread Alex Siman
Hi!

Cool to see me there:
* @author Alex Siman

You can also set attribute maxlength of HTML input tag based of JPA
size anno. See http://www.w3schools.com/TAGS/att_input_maxlength.asp

Checkout full code for more ideas. You can create more generic
architecture and wrap existent JPA entities with methods for printing
entity fields to HTML:

package xxx.snippet

import scala.xml._

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

import xxx.model._

class AdminProduct {
// Holder to store entered values for Product between requests.
object Product extends RequestVar[Gift](new Gift())
Product.is.requestObject = Product
println(AdminProduct: Product.is.requestObject = Product)

def render(xhtml: Group): NodeSeq = {
println(-- AdminProduct.render())

def doSubmit() = {
println( AdminProduct.doSubmit())
// Do smth... Ex open/close JPA session
println( AdminProduct.doSubmit())

val valid = Product.is.validate
val product = Product.is
if (!valid) {
S.error(Form has errors.)
} else {
val msg = (AdminProduct.doSubmit: Product 
saved: { +
product.title +  @ $ + product.price 
+ })
println(msg)
notice(msg)
redirectTo(/checkout/product/saved)
}
}

println(-- AdminProduct.render())

// Request scoped.
bind(product, xhtml,
title - Product.is.titleToForm(),
price - Product.is.descToForm(),
desc - Product.is.priceToForm(),
submit - Product.is.formField(, submit(Save, 
doSubmit)))
}
}

package xxx.model

import scala.xml._

import net.liftweb.http.SHtml._
import net.liftweb.http.S._
import net.liftweb.util.Helpers._
import net.liftweb.http.RequestVar
import net.liftweb.http.LiftSession._

case class Gift() {
var title = 
var desc = 
var price = 0.0

val titleId = title
val descId = desc
val priceId = price

var requestObject: RequestVar[Gift] = null

private def getProduct() = {
requestObject.is
}

def validate(): Boolean = {
var valid = true
// TODO: Replace by JPA validators.
title match {
case  = {
valid = false
error(titleId, Title required.)
}
case _ =
}
desc match {
case _ =
}
// TODO: Price must be converted to Double/BigDecimal etc.
price match {
case 0.0 = {
valid = false
error(priceId, Price required.)
error(priceId, Price must be  $0.)
}
case 100.0 = {
valid = false
error(priceId, Price must be  $100.)
}
case _ =
}
valid
}

def formField(label: String, input: Elem): NodeSeq = {
// ... Body from prev. email.
}

def titleToForm() = {
formField(Title, text(title, getProduct().title = _, (id,
titleId)))
}

def descToForm() = {
formField(Description, textarea(desc, getProduct().desc = _,
(id, descId)))
}

def priceToForm() = {
formField(Price, text(price, getProduct().price = _, (id,
priceId)))
}

// TODO: Also there can be more complex method:
//def toForm() = {...}
}

On 8 дек, 02:20, wstrange warren.stra...@gmail.com wrote:
 After some experimenting I have field validation working with JSR 303
 annotations. See:

 http://wstrange.wordpress.com/2009/12/07/inline-field-validation-in-s...

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



  After more experimenting ... I think this approach only works with
  Mapper/Record? It requires afieldid to be set, and validations
  errors to be set on that id ( e.g. S.error(mobilePhone, bad
  phone...) )

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

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

   OK, figured it out.  This should be:

   bind(...
    mobilePhone - 

[Lift] Re: Field validation

2009-12-08 Thread Alex Siman
Also take a look at JPA example from Lift sources:
http://github.com/dpp/liftweb/tree/master/lift-examples/JPADemo/

On 8 дек, 02:20, wstrange warren.stra...@gmail.com wrote:
 After some experimenting I have field validation working with JSR 303
 annotations. See:

 http://wstrange.wordpress.com/2009/12/07/inline-field-validation-in-s...

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



  After more experimenting ... I think this approach only works with
  Mapper/Record? It requires afieldid to be set, and validations
  errors to be set on that id ( e.g. S.error(mobilePhone, bad
  phone...) )

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

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

   OK, figured it out.  This should be:

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

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

Hi Alex

Thank you so much for the tip.

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

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

Is that the idea?

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

 Checkout my code, especially parts with cssClass.

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

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

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

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

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

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

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

  Any tips would be appreciated

--

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




[Lift] By default DB.buildLoanWrapper is eager (Jeppe, please read)

2009-12-08 Thread David Pollak
Folks,

A month or so ago, I made the DB.buildLoanWrapper lazy.  While it provided a
request-duration transaction, it did not actually pull the JDBC connection
from the pool until the first request for the JDBC connection.  This led to
some problems.  Basically:

object MySnippet {
  def render = synchronized {
... do a query in here
  }
}

If some threads acquired the JDBC connection before invoking the snippet
while others acquired the JDBC connection inside the synchronized (note it's
an object) render method, there could be a deadlock caused by JDBC pool
starvation.  This is unexpected and not likely to manifest unless you've got
a non-trivial number of threads servicing requests.

To avoid this unexpected situation, I returned DB.buildLoanWrapper to being
eager, but you (and by you, I mean Jeppe), can also call
DB.buildLoanWrapper(false) which will have the newer, lazy behavior.

Additionally, the default thread pool manager in Lift (ProtoDBVendor) will
allow temporary pool expansion.  If there are no connections available after
waiting 50ms, the pool will be temporarily expanded.  This also works around
the above mentioned deadlock issue.  The temporary expansion can be disabled
by override protected def allowTemporaryPoolExpansion = false

Thanks,

David

PS -- We're getting close to M8.  Please test the current SNAPSHOT and
report any anomalies.


-- 
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] It's time to test SNAPSHOT (the future Milestone 8) **IMPORTANT**

2009-12-08 Thread David Pollak
Folks,

We are nearing the Lift 1.1 Milestone 8 release.  The code (except for bug
fixes) that's going to be in M8 is currently in SNAPSHOT.

Please do a mvn -U clean install on your project and test heartily against
SNAPSHOT.  Please report any defects ASAP to the Lift list (and subsequently
open tickets).  We'd like M8 to be as clean and stable as M6 and your
testing help is necessary to achieve that goal.

Thanks,

David

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

--

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




Re: [Lift] Re: (Maven problem?) Char encoding problem using S.?

2009-12-08 Thread Indrajit Raychaudhuri
Good catch! I'll take a look.

Jean, can you please send a zip of your project (just enough to recreate 
the scenario, no sensitive code necessary)?

Cheers, Indrajit


On 08/12/09 3:48 PM, Timothy Perrett wrote:
 Ahhh! That is interesting... i'd not thought of that :-)

 You'll need to specify a proper encoding type for sure otherwise maven will 
 just assume your platform default... for example, MacRoman. Perhaps IRC or 
 Josh will be able to advise...

 Cheers, Tim

 On 8 Dec 2009, at 10:02, Jean-Adrien wrote:

 Ah !

 In fact the problem did not appear when I upgraded to 1.1-SNAPSHOT but
 when I enabled maven resource filtering (which assumes all files use
 UTF-8).
 Anyway I'll look for a correct setting to have both ISO 8859-1
 properties file and maven resource filtering enabled.


 On Dec 8, 10:41 am, Jean-Adrienjean.vauc...@gmail.com  wrote:
 Hello,

 I have a char encoding problem, using the localization feature of
 lift.
 I use the ? method of the S object in order to translate strings. The
 localized values are in a translate_fr.properties file in the
 resources of the project.

 Until I upgrade from lift 1.1-M6 to 1.1-SNAPSHOT everything was ok,
 but now it seems that the following happens:
 As specified in the java doc, the properties file is encoded using ISO
 8859-1. All xhtml templates in lift use UTF-8, and are interpreted in
 UTF-8 by the browser. But it seems that the the string loaded from
 properties file are badly translated to UTF-8 (?)

 I.e. é is 0xE9 in ISO 8859-1 and should turn when loaded in a String
 by java properties into the UTF-8 bytes 0xC3 0xA9. But it is
 interpreted some way in � (0x EF 0xBF 0xBD)

 I tried to encode my properties file in UTF-8 but I have the UTF
 encoding (0xC3 0xA9) interpreted in ISO 8859-1. é become é (famous
 French letter) in the webpage. Behaviour I understand since java loads
 properties String using ISO-8859-1 charset

 Does anyone observed the same ?

 --

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




 --

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



--

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




Re: [Lift] Re: (Maven problem?) Char encoding problem using S.?

2009-12-08 Thread David Pollak
On Tue, Dec 8, 2009 at 6:27 AM, Indrajit Raychaudhuri
indraj...@gmail.comwrote:

 Good catch! I'll take a look.

 Jean, can you please send a zip of your project (just enough to recreate
 the scenario, no sensitive code necessary)?


And perhaps something that we can add as a test to the Lift build process.
;-)


 Cheers, Indrajit


 On 08/12/09 3:48 PM, Timothy Perrett wrote:
  Ahhh! That is interesting... i'd not thought of that :-)
 
  You'll need to specify a proper encoding type for sure otherwise maven
 will just assume your platform default... for example, MacRoman. Perhaps IRC
 or Josh will be able to advise...
 
  Cheers, Tim
 
  On 8 Dec 2009, at 10:02, Jean-Adrien wrote:
 
  Ah !
 
  In fact the problem did not appear when I upgraded to 1.1-SNAPSHOT but
  when I enabled maven resource filtering (which assumes all files use
  UTF-8).
  Anyway I'll look for a correct setting to have both ISO 8859-1
  properties file and maven resource filtering enabled.
 
 
  On Dec 8, 10:41 am, Jean-Adrienjean.vauc...@gmail.com  wrote:
  Hello,
 
  I have a char encoding problem, using the localization feature of
  lift.
  I use the ? method of the S object in order to translate strings. The
  localized values are in a translate_fr.properties file in the
  resources of the project.
 
  Until I upgrade from lift 1.1-M6 to 1.1-SNAPSHOT everything was ok,
  but now it seems that the following happens:
  As specified in the java doc, the properties file is encoded using ISO
  8859-1. All xhtml templates in lift use UTF-8, and are interpreted in
  UTF-8 by the browser. But it seems that the the string loaded from
  properties file are badly translated to UTF-8 (?)
 
  I.e. é is 0xE9 in ISO 8859-1 and should turn when loaded in a String
  by java properties into the UTF-8 bytes 0xC3 0xA9. But it is
  interpreted some way in � (0x EF 0xBF 0xBD)
 
  I tried to encode my properties file in UTF-8 but I have the UTF
  encoding (0xC3 0xA9) interpreted in ISO 8859-1. é become é (famous
  French letter) in the webpage. Behaviour I understand since java loads
  properties String using ISO-8859-1 charset
 
  Does anyone observed the same ?
 
  --
 
  You received this message because you are subscribed to the Google
 Groups Lift group.
  To post to this group, send email to lift...@googlegroups.com.
  To unsubscribe from this group, send email to
 liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com
 .
  For more options, visit this group at
 http://groups.google.com/group/liftweb?hl=en.
 
 
 
 
  --
 
  You received this message because you are subscribed to the Google Groups
 Lift group.
  To post to this group, send email to lift...@googlegroups.com.
  To unsubscribe from this group, send email to
 liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com
 .
  For more options, visit this group at
 http://groups.google.com/group/liftweb?hl=en.
 
 

 --

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





-- 
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: 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: (Maven problem?) Char encoding problem using S.?

2009-12-08 Thread Indrajit Raychaudhuri


On Dec 8, 7:31 pm, David Pollak feeder.of.the.be...@gmail.com wrote:
 On Tue, Dec 8, 2009 at 6:27 AM, Indrajit Raychaudhuri
 indraj...@gmail.comwrote:

  Good catch! I'll take a look.

  Jean, can you please send a zip of your project (just enough to recreate
  the scenario, no sensitive code necessary)?

 And perhaps something that we can add as a test to the Lift build process.
 ;-)


Yes, indeed. Let me first find the culprit behind this ;)





  Cheers, Indrajit

  On 08/12/09 3:48 PM, Timothy Perrett wrote:
   Ahhh! That is interesting... i'd not thought of that :-)

   You'll need to specify a proper encoding type for sure otherwise maven
  will just assume your platform default... for example, MacRoman. Perhaps IRC
  or Josh will be able to advise...

   Cheers, Tim

   On 8 Dec 2009, at 10:02, Jean-Adrien wrote:

   Ah !

   In fact the problem did not appear when I upgraded to 1.1-SNAPSHOT but
   when I enabled maven resource filtering (which assumes all files use
   UTF-8).
   Anyway I'll look for a correct setting to have both ISO 8859-1
   properties file and maven resource filtering enabled.

   On Dec 8, 10:41 am, Jean-Adrienjean.vauc...@gmail.com  wrote:
   Hello,

   I have a char encoding problem, using the localization feature of
   lift.
   I use the ? method of the S object in order to translate strings. The
   localized values are in a translate_fr.properties file in the
   resources of the project.

   Until I upgrade from lift 1.1-M6 to 1.1-SNAPSHOT everything was ok,
   but now it seems that the following happens:
   As specified in the java doc, the properties file is encoded using ISO
   8859-1. All xhtml templates in lift use UTF-8, and are interpreted in
   UTF-8 by the browser. But it seems that the the string loaded from
   properties file are badly translated to UTF-8 (?)

   I.e. é is 0xE9 in ISO 8859-1 and should turn when loaded in a String
   by java properties into the UTF-8 bytes 0xC3 0xA9. But it is
   interpreted some way in � (0x EF 0xBF 0xBD)

   I tried to encode my properties file in UTF-8 but I have the UTF
   encoding (0xC3 0xA9) interpreted in ISO 8859-1. é become é (famous
   French letter) in the webpage. Behaviour I understand since java loads
   properties String using ISO-8859-1 charset

   Does anyone observed the same ?

   --

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

   --

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

  --

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

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

--

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




Re: [Lift] how to keep last submited form field value

2009-12-08 Thread Alex Boisvert
You should use a SessionVar or a stateful snippet.

Here's how you would use a SessionVar,

object lastSubmittedDate extends SessionVar[Date](new Date)

...
bind(...,
date - SHtml.text(lastSubmittedDate.is, lastSubmittedDate(_),
 class - datepicker),

alex

On Tue, Dec 8, 2009 at 1:42 AM, Jarod Liu liuyuan...@gmail.com wrote:

 I want the date field keep the last submited value.  I tried with
 below code, but it's dosn't work. The date value(display in page)
 awalys the date of today.

 the form:
 lift:mySnippet.form1 form=POST
f:date/
f:submit/
 /lift:mySnippet.form1

 MySnippet:

 class MySnippet extends StatefulSnippet {
  val dfmt = new SimpleDateFormat(-MM-dd)
  var date =  dfmt.format(new Date)

  val dispatch: DispatchIt = {
case form1 = form1 _
  }

  def form1(in: NodeSeq): NodeSeq = {
bind(f, in,
 date - SHtml.text(date, date = _,
  class - datepicker),
 submit - SHtml.submit(submit, println(submit:  +
 date))
)
  }

 --

 You received this message because you are subscribed to the Google Groups
 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] How can bind more than one element in the render method in CometActor ?

2009-12-08 Thread Neil.Lv
Hi all,

   How can bind more than one element in the render method in
CometActor ?

   The msg1 is an
###
class TestComet extends CometActor {
  override def defaultPrefix = Full(info)
  ...
  def render = { bind(One   - span1/span,
 Two   - span2/span,
 Three - span3/span,
 Four  - span4/span,
 Five  - span5/span,
 Six   - span6/span ) }
  ...
}
###

  And in the index.html page
###
...
lift:comet type=TestComet
  info:One/
/lift:comet
span/span
lift:comet type=TestComet
  info:Two/
/lift:comet
span/span
lift:comet type=TestComet
  info:Three
/lift:comet
span/span
lift:comet type=TestComet
  info:Four
/lift:comet
...
###

  And these four comet all show the same result  span3/span,
not 1, 2, 3, 4, 5, 6 

  I don't know what's wrong with it ?

  Dose anybody know what's the problem with this render metho?

  Thanks for any help.

Cheers,
  Neil

--

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




[Lift] Re: How can bind more than one element in the render method in CometActor ?

2009-12-08 Thread Neil.Lv

  BTW, when the partialUpdate method is called , the result is
correct.

  But when refreshing the browser or open a new browser, the result
also is 3,

Cheers,
  Neil

On Dec 9, 12:44 am, Neil.Lv anim...@gmail.com wrote:
 Hi all,

    How can bind more than one element in the render method in
 CometActor ?

    The msg1 is an
 ###
 class TestComet extends CometActor {
   override def defaultPrefix = Full(info)
   ...
   def render = { bind(One   - span1/span,
                              Two   - span2/span,
                              Three - span3/span,
                              Four  - span4/span,
                              Five  - span5/span,
                              Six   - span6/span ) }
   ...}

 ###

   And in the index.html page
 ###
 ...
 lift:comet type=TestComet
   info:One/
 /lift:comet
 span/span
 lift:comet type=TestComet
   info:Two/
 /lift:comet
 span/span
 lift:comet type=TestComet
   info:Three
 /lift:comet
 span/span
 lift:comet type=TestComet
   info:Four
 /lift:comet
 ...
 ###

   And these four comet all show the same result  span3/span,
 not 1, 2, 3, 4, 5, 6 

   I don't know what's wrong with it ?

   Dose anybody know what's the problem with this render metho?

   Thanks for any help.

 Cheers,
   Neil

--

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




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

2009-12-08 Thread Marius
You can vote up or down here :)

http://www.dzone.com/links/video_interview_with_marius_danciu_author_of_the.html

Br's,
Marius

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




[Lift] Re: Multi-Database Transactions

2009-12-08 Thread deadfolk
Hi Jeppe - thanks for your response.

So, am I correct in saying that I just need to do something like
this?  (not tested code - just an approximation)

//Assuming fooDb and barDb are some form of connection wrapper...

S.addAround(List(new LoanWrapper {
  def apply[T](f: = T): T = {
fooDb.begin
barDb.begin
try {
  val result = f
  barDb.commit
  fooDb.commit
  result
}
catch {
  case e = {
barDb.rollback
fooDb.rollback
  }
}
  }
}))

On Dec 2, 11:56 am, Jeppe Nejsum Madsen je...@ingolfs.dk wrote:
 deadfolk deadf...@gmail.com writes:

 [...]

  I'll likely be using plain JDBC or JPA.  What would be my options in
  Lift?  Can I get a list of connections and just use a filter (or
  equivalent) to begin/commit/rollback on each within every request?
  I've done some searching, but I've not found anything relating to the
  use of multiple databases.

  Any advice/pointers would be very much appreciated.

 Lift already supports wrapping the request with code. e.g I have    

 S.addAround(DB.buildLoanWrapper)

 in Boot.scala which wraps a transaction around the request.

 I haven't tried multiple databases, but it should be trivial (famous
 last words :-) to extend this to also work in this scenario (when you
 don't want XA transactions)

 This is for Mapper, the Lift ORM, I assume JPA can be made to work in
 similar ways...

 /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] A question on radio button

2009-12-08 Thread Derek Chen-Becker
Off the top of my head, I don't think that SHtml.radio supports putting
attributes on just one of the items. This seems like a reasonable thing to
want, so please open a ticket.

Derek

On Tue, Dec 1, 2009 at 10:45 PM, sunanda sunanda.pa...@gmail.com wrote:

 Hi,

 I have got two radio button fields(Yes,No)


 In my form I need to display an input field onclick of the button
 Yes  else the field needs to be hidden.
 How can I achieve this inside the form.

 Regards,
 Sunanda


 --

 You received this message because you are subscribed to the Google Groups
 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: Race conditions / database transaction isolation levels

2009-12-08 Thread cody koeninger


On Dec 8, 2:19 am, Jeppe Nejsum Madsen je...@ingolfs.dk wrote:

 record will not be unlocked until the session times out

I thought it was stated above that the transaction is scoped to the
request by default, not the session?


 A much better solution imo is to use optimistic locking.

I'm not going to disagree with you there.

However, are the lift devs really interested in spending time
implementing an optimistic locking system?  As it stands, if I
actually need data consistency with Lift, it looks like the choice is
JPA.  An optional pessimistic lock would make mapper a more realistic
choice, and the implementation should be pretty blunt in terms of
complexity (and drawbacks as you noted).

--

You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@googlegroups.com.
To unsubscribe from 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-08 Thread harryh
My slide deck (for any that are interested) can be found here:

http://docs.google.com/present/view?id=dcbpz3ck_24f3v83ggz

-harryh

On Dec 8, 12:19 am, Xuefeng Wu ben...@gmail.com wrote:
 6:30 p.m. the time zone is -8:00?

 On Tue, Dec 8, 2009 at 12:58 PM, David Pollak feeder.of.the.be...@gmail.com



  wrote:

  On Mon, Dec 7, 2009 at 8:50 PM, Mateo Barraza 
  mateo.barr...@gmail.comwrote:

  I can't seem to be able to download the talk. Anyone else having problems?

  Yeah...  n8han's uploading the video elsewhere... we'll send around an URL
  once we get one.

  M

  On Mon, Dec 7, 2009 at 7:59 PM, Peter Robinett pe...@bubblefoundry.com
  wrote:
   If you missed the talk you can download it from the same link. It's a
   good one.

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

   Peter

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

  http://www.justin.tv/n8han

   --

   You received this message because you are subscribed to the Google
  Groups
   Bay Area Scala Enthusiasts group.
   To post to this group, send email to scala-b...@googlegroups.com.
   To unsubscribe from this group, send email to
   scala-base+unsubscr...@googlegroups.comscala-base%2bunsubscr...@googlegroups.com
  scala-base%2bunsubscr...@googlegroups.comscala-base%252bunsubscr...@googlegroups.com

   .
   For more options, visit this group athttp://
  groups.google.com/group/scala-base?hl=en.

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

   --

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

  --

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

  --
  Lift, the simply functional web frameworkhttp://liftweb.net
  Beginning Scalahttp://www.apress.com/book/view/1430219890

  Follow me:http://twitter.com/dpp
  Surf the harmonics

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

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

--

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




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

2009-12-08 Thread Marius
Very nice stuff !

On Dec 8, 8:58 pm, harryh har...@gmail.com wrote:
 My slide deck (for any that are interested) can be found here:

 http://docs.google.com/present/view?id=dcbpz3ck_24f3v83ggz

 -harryh

 On Dec 8, 12:19 am, Xuefeng Wu ben...@gmail.com wrote:

  6:30 p.m. the time zone is -8:00?

  On Tue, Dec 8, 2009 at 12:58 PM, David Pollak feeder.of.the.be...@gmail.com

   wrote:

   On Mon, Dec 7, 2009 at 8:50 PM, Mateo Barraza 
   mateo.barr...@gmail.comwrote:

   I can't seem to be able to download the talk. Anyone else having 
   problems?

   Yeah...  n8han's uploading the video elsewhere... we'll send around an URL
   once we get one.

   M

   On Mon, Dec 7, 2009 at 7:59 PM, Peter Robinett pe...@bubblefoundry.com
   wrote:
If you missed the talk you can download it from the same link. It's a
good one.

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

Peter

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

   http://www.justin.tv/n8han

--

You received this message because you are subscribed to the Google
   Groups
Bay Area Scala Enthusiasts group.
To post to this group, send email to scala-b...@googlegroups.com.
To unsubscribe from this group, send email to
scala-base+unsubscr...@googlegroups.comscala-base%2bunsubscr...@googlegroups.com
   scala-base%2bunsubscr...@googlegroups.comscala-base%252bunsubscr...@googlegroups.com

.
For more options, visit this group athttp://
   groups.google.com/group/scala-base?hl=en.

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

--

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

   --

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

   --
   Lift, the simply functional web frameworkhttp://liftweb.net
   Beginning Scalahttp://www.apress.com/book/view/1430219890

   Follow me:http://twitter.com/dpp
   Surf the harmonics

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

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

--

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




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

2009-12-08 Thread Peter Robinett
On Dec 7, 7:36 pm, David Pollak feeder.of.the.be...@gmail.com wrote:
 On Mon, Dec 7, 2009 at 6:59 PM, Peter Robinett pe...@bubblefoundry.comwrote:

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

 It's on my to-do list.

This is something we'll need at EQUAL Networks within a month or two.
Do you think you'll get to it within that time period? I'm happy to
take a stab at it first, though I know it's not trivial (I've only
written oAuth clients, not servers).

Peter

--

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

2009-12-08 Thread Jeppe Nejsum Madsen
deadfolk deadf...@gmail.com writes:

 Hi Jeppe - thanks for your response.

 So, am I correct in saying that I just need to do something like
 this?  (not tested code - just an approximation)

 //Assuming fooDb and barDb are some form of connection wrapper...

 S.addAround(List(new LoanWrapper {
   def apply[T](f: = T): T = {
 fooDb.begin
 barDb.begin
 try {
   val result = f
   barDb.commit
   fooDb.commit
   result
 }
 catch {
   case e = {
 barDb.rollback
 fooDb.rollback
   }
 }
   }
 }))

Something like that yes :-)

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




[Lift] Re: UTF-8 Characters

2009-12-08 Thread Peter Robinett
Thanks, David, \u00B0 did it.

Peter

On Dec 7, 7:35 pm, David Pollak feeder.of.the.be...@gmail.com wrote:
 Peter,

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

 Thanks,

 David

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



  Hi all,

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

  Peter

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

  --

  You received this message because you are subscribed to the Google Groups
  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] Re: Multi-Database Transactions

2009-12-08 Thread Alex Boisvert
On Tue, Dec 8, 2009 at 11:57 AM, Jeppe Nejsum Madsen je...@ingolfs.dkwrote:

 deadfolk deadf...@gmail.com writes:

  Hi Jeppe - thanks for your response.
 
  So, am I correct in saying that I just need to do something like
  this?  (not tested code - just an approximation)
 
  //Assuming fooDb and barDb are some form of connection wrapper...
 
  S.addAround(List(new LoanWrapper {
def apply[T](f: = T): T = {
  fooDb.begin
  barDb.begin
  try {
val result = f
barDb.commit
fooDb.commit
result
  }
  catch {
case e = {
  barDb.rollback
  fooDb.rollback
}
  }
}
  }))

 Something like that yes :-)



... with automatic transaction retries, and very verbose error messages if
one transaction commits and not the other? :)

alex

--

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




Re: [Lift] Foreign Key constraints are not created by schemify

2009-12-08 Thread Derek Chen-Becker
OK, I've run into a snag. Schemifier does support foreign key creation, as
do most of the database vendors. The ManyToMany Mapper support, however,
seems to expect no foreign key constraints, since it's explicitly testing
broken refs in the ManyToManySpecs tests:

  ManyToMany should {
skip broken joins in children in {
  setupDB
  val person = createPerson
  person.companies.joins.length must_== 10
  person.companies.all.length must_== 8
}
...

I wonder if we should have FK generation be a configuration parameter for
schemify. I could change the code so that the default schemify method
continues to generate DDL without FK  constraints, but add a second schemify
method that takes a boolean parameter controlling whether FKs are generated.
That, coupled with the DriverType.supportsForeignKeys_?, would allow people
to add FKs if they want. Thoughts?

Derek

On Sun, Dec 6, 2009 at 5:40 PM, Derek Chen-Becker dchenbec...@gmail.comwrote:

 Absolutely. I have a PG 8.0, 8.1 and 8.3 instance set up for testing on my
 home box because of the last time I made a PG-related change.

 Derek


 On Thu, Dec 3, 2009 at 2:48 PM, David Pollak 
 feeder.of.the.be...@gmail.com wrote:



 On Thu, Dec 3, 2009 at 1:47 PM, Derek Chen-Becker 
 dchenbec...@gmail.comwrote:

 I agree on both points (foreign keys and documentation). Please open a
 ticket asking for proper foreign key support and I'll work on it next week.


 Please make sure it works on PG 8.0/8.1 as there is at least 1 Lift app in
 production against 8.0


 Derek


 On Wed, Dec 2, 2009 at 6:05 PM, Julian Backes 
 julianbac...@googlemail.com wrote:

 Hi Derek,

  It's been a long time since I looked at that particular code, so I may
  have misspoke. Having said that, if it's currently disabled in the
  driver I'm not sure why and I would want to review it before saying
 that
  it works properly in all cases.
 I think the problem here is that the user expects (like I did) foreign
 keys to be created if he uses mapper classes referencing other mapper
 classes. This behaviour should at least be mentioned somewhere in the
 documentation (btw, the documentation is in my opinion the biggest
 problems of Lift at the moment).
 I think, using a relational database without foreign keys is somehow not
 very useful because you never really know whether you have referential
 integrity...
 It would be great if you looked at the code and enabled it. This would
 really be an improvement for the mapper stuff in Lift 1.1

 Julian

 --

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



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




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

 --
 You received this message because you are subscribed to the Google Groups
 Lift group.

 To post to this group, send email to lift...@googlegroups.com.
 To unsubscribe from this group, send email to
 liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/liftweb?hl=en.




--

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




Re: [Lift] how to keep last submited form field value

2009-12-08 Thread Derek Chen-Becker
I think he might just mean the last submitted value for this particular form
instance, in which case you want a RequestVar, not a SessionVar.

On Tue, Dec 8, 2009 at 8:22 AM, Alex Boisvert alex.boisv...@gmail.comwrote:

 You should use a SessionVar or a stateful snippet.

 Here's how you would use a SessionVar,

 object lastSubmittedDate extends SessionVar[Date](new Date)

 ...
 bind(...,
 date - SHtml.text(lastSubmittedDate.is, lastSubmittedDate(_),
  class - datepicker),

 alex


 On Tue, Dec 8, 2009 at 1:42 AM, Jarod Liu liuyuan...@gmail.com wrote:

 I want the date field keep the last submited value.  I tried with
 below code, but it's dosn't work. The date value(display in page)
 awalys the date of today.

 the form:
 lift:mySnippet.form1 form=POST
f:date/
f:submit/
 /lift:mySnippet.form1

 MySnippet:

 class MySnippet extends StatefulSnippet {
  val dfmt = new SimpleDateFormat(-MM-dd)
  var date =  dfmt.format(new Date)

  val dispatch: DispatchIt = {
case form1 = form1 _
  }

  def form1(in: NodeSeq): NodeSeq = {
bind(f, in,
 date - SHtml.text(date, date = _,
  class - datepicker),
 submit - SHtml.submit(submit, println(submit:  +
 date))
)
  }

 --

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



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


--

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




Re: [Lift] By default DB.buildLoanWrapper is eager (Jeppe, please read)

2009-12-08 Thread Jeppe Nejsum Madsen
David Pollak feeder.of.the.be...@gmail.com writes:

 Folks,

 A month or so ago, I made the DB.buildLoanWrapper lazy.  While it provided a
 request-duration transaction, it did not actually pull the JDBC connection
 from the pool until the first request for the JDBC connection.  This led to
 some problems.  Basically:

 object MySnippet {
   def render = synchronized {
 ... do a query in here
   }
 }

 If some threads acquired the JDBC connection before invoking the snippet
 while others acquired the JDBC connection inside the synchronized (note it's
 an object) render method, there could be a deadlock caused by JDBC pool
 starvation.  This is unexpected and not likely to manifest unless you've got
 a non-trivial number of threads servicing requests.

 To avoid this unexpected situation, I returned DB.buildLoanWrapper to being
 eager, but you (and by you, I mean Jeppe), can also call
 DB.buildLoanWrapper(false) which will have the newer, lazy behavior.

Thanks for the direct attention :-) I can see the problem, but just so
I understand this completely: Can we agree that,

1) The above pattern (global synchronized render method) is a rather bad
pattern, scalability wise?

2) If there are no such methods (in user code), lazy connection acquiring is 
fine?

The question remains of course, if there are more such accidents waiting
to happen? I always try to avoid using synchronize in application code
(where possible :-) but I realize that Lift as a framework has to be
somewhat more low level.

 Additionally, the default thread pool manager in Lift (ProtoDBVendor) will
 allow temporary pool expansion.  If there are no connections available after
 waiting 50ms, the pool will be temporarily expanded.

Is there a limit to the expansion? (Before we know we've implemented
c3p0 :-)

[...]

/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] Re: Fwd: Watch Foursquare Lift talk live from NY

2009-12-08 Thread Mateo Barraza
Anyone still looking into uploading the video version of this prezo?

M

On Tue, Dec 8, 2009 at 12:38 PM, Peter Robinett pe...@bubblefoundry.com wrote:
 On Dec 7, 7:36 pm, David Pollak feeder.of.the.be...@gmail.com wrote:
 On Mon, Dec 7, 2009 at 6:59 PM, Peter Robinett 
 pe...@bubblefoundry.comwrote:

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

 It's on my to-do list.

 This is something we'll need at EQUAL Networks within a month or two.
 Do you think you'll get to it within that time period? I'm happy to
 take a stab at it first, though I know it's not trivial (I've only
 written oAuth clients, not servers).

 Peter

 --

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




--

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




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

2009-12-08 Thread Jeppe Nejsum Madsen
cody koeninger c...@koeninger.org writes:

 On Dec 8, 2:19 am, Jeppe Nejsum Madsen je...@ingolfs.dk wrote:

 record will not be unlocked until the session times out

 I thought it was stated above that the transaction is scoped to the
 request by default, not the session?

It is. But even if it wasn't I don't think select for update solves
the problem of two users trying to edit the same record.

 A much better solution imo is to use optimistic locking.

 I'm not going to disagree with you there.

 However, are the lift devs really interested in spending time
 implementing an optimistic locking system?  

Who knows :-)

 As it stands, if I actually need data consistency with Lift, it looks
 like the choice is JPA.  An optional pessimistic lock would make
 mapper a more realistic choice, and the implementation should be
 pretty blunt in terms of complexity (and drawbacks as you noted).

Maybe I don't really understand what you mean when you say data
consistency. A pessimistic lock is only useful within a single database
transaction. In my experience, in a web app, a user transaction (such as
loading a record, changing data, saving the record) is not covered by a
single database transaction, but will span several.

/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-08 Thread Derek Chen-Becker
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.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-08 Thread Timothy Perrett
Im sure n8han will put it on blip.tv when he gets a chance. Be patient, im sure 
it'll come soon :-)

Cheers, Tim

On 8 Dec 2009, at 20:50, Mateo Barraza wrote:

 Anyone still looking into uploading the video version of this prezo?
 
 M
 
 On Tue, Dec 8, 2009 at 12:38 PM, Peter Robinett pe...@bubblefoundry.com 
 wrote:
 On Dec 7, 7:36 pm, David Pollak feeder.of.the.be...@gmail.com wrote:
 On Mon, Dec 7, 2009 at 6:59 PM, Peter Robinett 
 pe...@bubblefoundry.comwrote:
 
 One thing mentioned briefly in the talk that I'd like to know more
 about is oAuth Server code. Is anyone working on that?
 
 It's on my to-do list.
 
 This is something we'll need at EQUAL Networks within a month or two.
 Do you think you'll get to it within that time period? I'm happy to
 take a stab at it first, though I know it's not trivial (I've only
 written oAuth clients, not servers).
 
 Peter
 
 --
 
 You received this message because you are subscribed to the Google Groups 
 Lift group.
 To post to this group, send email to lift...@googlegroups.com.
 To unsubscribe from this group, send email to 
 liftweb+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/liftweb?hl=en.
 
 
 
 
 --
 
 You received this message because you are subscribed to the Google Groups 
 Lift group.
 To post to this group, send email to lift...@googlegroups.com.
 To unsubscribe from this group, send email to 
 liftweb+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/liftweb?hl=en.
 
 
 

--

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




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

2009-12-08 Thread TylerWeir
N8han upped it a while ago: http://www.vimeo.com/8057986

On Dec 8, 4:08 pm, Timothy Perrett timo...@getintheloop.eu wrote:
 Im sure n8han will put it on blip.tv when he gets a chance. Be patient, im 
 sure it'll come soon :-)

 Cheers, Tim

 On 8 Dec 2009, at 20:50, Mateo Barraza wrote:



  Anyone still looking into uploading the video version of this prezo?

  M

  On Tue, Dec 8, 2009 at 12:38 PM, Peter Robinett pe...@bubblefoundry.com 
  wrote:
  On Dec 7, 7:36 pm, David Pollak feeder.of.the.be...@gmail.com wrote:
  On Mon, Dec 7, 2009 at 6:59 PM, Peter Robinett 
  pe...@bubblefoundry.comwrote:

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

  It's on my to-do list.

  This is something we'll need at EQUAL Networks within a month or two.
  Do you think you'll get to it within that time period? I'm happy to
  take a stab at it first, though I know it's not trivial (I've only
  written oAuth clients, not servers).

  Peter

  --

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

2009-12-08 Thread Randinn
Haha, upvoted :)

On Dec 9, 3:57 am, Marius marius.dan...@gmail.com wrote:
 You can vote up or down here :)

 http://www.dzone.com/links/video_interview_with_marius_danciu_author_...

 Br's,
 Marius

 On Dec 7, 9: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.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-08 Thread Mateo Barraza
that last link works. THanks  Tyler!

M

On Tue, Dec 8, 2009 at 2:18 PM, TylerWeir tyler.w...@gmail.com wrote:
 N8han upped it a while ago: http://www.vimeo.com/8057986

 On Dec 8, 4:08 pm, Timothy Perrett timo...@getintheloop.eu wrote:
 Im sure n8han will put it on blip.tv when he gets a chance. Be patient, im 
 sure it'll come soon :-)

 Cheers, Tim

 On 8 Dec 2009, at 20:50, Mateo Barraza wrote:



  Anyone still looking into uploading the video version of this prezo?

  M

  On Tue, Dec 8, 2009 at 12:38 PM, Peter Robinett pe...@bubblefoundry.com 
  wrote:
  On Dec 7, 7:36 pm, David Pollak feeder.of.the.be...@gmail.com wrote:
  On Mon, Dec 7, 2009 at 6:59 PM, Peter Robinett 
  pe...@bubblefoundry.comwrote:

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

  It's on my to-do list.

  This is something we'll need at EQUAL Networks within a month or two.
  Do you think you'll get to it within that time period? I'm happy to
  take a stab at it first, though I know it's not trivial (I've only
  written oAuth clients, not servers).

  Peter

  --

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

  --

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

 --

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




--

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




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

2009-12-08 Thread cody koeninger


On Dec 8, 2:53 pm, Jeppe Nejsum Madsen je...@ingolfs.dk wrote:
 Maybe I don't really understand what you mean when you say data
 consistency. A pessimistic lock is only useful within a single database
 transaction. In my experience, in a web app, a user transaction (such as
 loading a record, changing data, saving the record) is not covered by a
 single database transaction, but will span several.



Yes, as you say, optimistic would be better for conversations that
span multiple transactions.

With pessimistic locking I could at least check-then-act before saving
the record in places where it was critical.  Otherwise e.g. lost
updates can become an issue.

Again, as it stands, it looks like lift gives me neither (short of
sprinkling InsecureSql about), and one or the other seems to be
required based on pain points I've encountered in previous projects.

If there's someone running production lift sites with non-jpa
persistence that manages concurrency, I'm all ears.

--

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

2009-12-08 Thread Julian Backes
 OK, I've run into a snag. Schemifier does support foreign key creation, 
 as do most of the database vendors. The ManyToMany Mapper support, 
 however, seems to expect no foreign key constraints, since it's 
 explicitly testing broken refs in the ManyToManySpecs tests:
I do not really know something about the ManyToMany stuff in mapper but
in my opinion, it should support foreign keys. You always have
situations where you change something in the database by hand. In such
cases, it's always good to have foreign keys...


 I wonder if we should have FK generation be a configuration parameter 
 for schemify. I could change the code so that the default schemify 
 method continues to generate DDL without FK  constraints, but add a 
 second schemify method that takes a boolean parameter controlling 
 whether FKs are generated.
Sounds good to me

 That, coupled with the
 DriverType.supportsForeignKeys_?, would allow people to add FKs if they 
 want. Thoughts?
I had the problem that when I wanted to test the foreign key support, I
had to recompile most parts of lift with
DriverType.supportsForeignKeys_? set to true (which was no fun because I
had to download many many dependencies from the incredible slow maven
repo). Wouldn't it make sense to allow setting
DriverType.supportsForeignKeys_? at runtime? This would be useful when,
for example, some database system does not support foreign keys when the
corresponding Lift version is released but starts supporting it two
weeks later. In such a situation, I do not want do recompile Lift just
to have DriverType.supportsForeignKeys_? set to true...

Julian

--

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




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

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




[Lift] Re: Sharing a RequestVar Across CometActors

2009-12-08 Thread Peter Robinett
This was from a while ago but I just wanted to note that it works
well, though I do have some issues with when render is then called,
since localSetup is no longer used.

Also, why does setupComet take a boxed name parameter?

Thanks,
Peter

On Oct 12, 8:15 am, David Pollak feeder.of.the.be...@gmail.com
wrote:
 On Mon, Oct 12, 2009 at 7:04 AM, Peter Robinett 
 pe...@bubblefoundry.comwrote:







  Hi all,

  I have a question about whether it's possible to access RequestVars in
  CometActors (specifically, to access them in localSetup). I believe it
  is, based upon a recent thread about sharing them among snippets[1]
  and an older thread about Actors accessing S[2]. But first, some
  background, as I may be going around this in totally the wrong way and
  would appreciate your thoughts.

  I am making a dashboard to display a bunch of data that will be coming
  in (near) real-time and I want to use Comet to make sure the user
  always sees the most update-to-date information in their dashboard. I
  have a variety of different aggregate values to display that fall into
  several categories together, so I can group the calculations together.
  I think this sectioning will prove useful in the future, as I can
  imagine wanting to display some but not all of these sections on
  another page.

  Because the CometActors all will need to know the dashboard to which
  they belong, my thought was to share this Mapper instance via a
  RequestVar.

 You can create messages to be sent to a CometActor upon setup:

 for {
   session - S.session
  } session.setupComet(Dashboard, Empty, ABunchOfInfo(sessionInfo))

 When the Dashboard comet actor is created, it will be sent the
 ABunchOfInfo message.  In this way you can send current request state info
 to a CometActor.

 Does this help?







  I call my snippet like so:
  lift:Dashboard.display
  /lift:Dashboard.display

  The snippet defines a RequestVar called myDashboard and then returns a
  NodeSeq:
  div
   lift:comet type=DashboardHelper1
   /lift:comet
  // 
   lift:comet type=DashboardHelperN
   /lift:comet
  /div

  While I can get this all to compile, myDashboard is empty in the
  CometActors. I understand that CometActors basically exist outside of
  the normal request cycle, so would this be the reason why my
  RequestVar is always empty? I was hoping that it would still be in the
  request cycle when localSetup is called, but I can see why that would
  be unrealistic.

  I just tried using SessionVar instead of a RequestVar and this works.
  However, I'm worried about having to be more careful about emptying
  the SessionVar if requesting a different dashboard than if I would if
  I were using a RequestVar. Is this an unrealistic fear?

  What do you think is the best way to proceed?

  Thanks for your help,
  Peter Robinett

  [1]:
 http://groups.google.com/group/liftweb/browse_thread/thread/5cf4ae2ec...
  [2]:
 http://groups.google.com/group/liftweb/browse_thread/thread/274cfc9d2...

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




[Lift] Re: Sharing a RequestVar Across CometActors

2009-12-08 Thread Peter Robinett
Specifically, I have:
case Setup(newDatacenter) = {
  datacenter = Full(newDatacenter)
  DatacenterBroker.datacenters(newDatacenter.id) ! AddAListener
(this)
  DatacenterBroker.datacenters(newDatacenter.id) !? GetPackets
match {
case Packets(packets) = {
  savePackets(packets)
  reRender(true)
}
  }
}

My problem is that reRender, while sending the data, doesn't seem to
be causing the new script code to be merged into the document's
head, leaving me with: divheadscript.../script/head/div
in the body.

It's not clear to me whether the script contents are being evaluated
(I would think it shouldn't, since there should only be 1 head tag in
an HTML document) and, even if they are, whether anything happens
since they are all wrapped in a jQuery(document).ready() call.

Peter

On Dec 8, 7:05 pm, Peter Robinett pe...@bubblefoundry.com wrote:
 This was from a while ago but I just wanted to note that it works
 well, though I do have some issues with when render is then called,
 since localSetup is no longer used.

 Also, why does setupComet take a boxed name parameter?

 Thanks,
 Peter

 On Oct 12, 8:15 am, David Pollak feeder.of.the.be...@gmail.com
 wrote:



  On Mon, Oct 12, 2009 at 7:04 AM, Peter Robinett 
  pe...@bubblefoundry.comwrote:

   Hi all,

   I have a question about whether it's possible to access RequestVars in
   CometActors (specifically, to access them in localSetup). I believe it
   is, based upon a recent thread about sharing them among snippets[1]
   and an older thread about Actors accessing S[2]. But first, some
   background, as I may be going around this in totally the wrong way and
   would appreciate your thoughts.

   I am making a dashboard to display a bunch of data that will be coming
   in (near) real-time and I want to use Comet to make sure the user
   always sees the most update-to-date information in their dashboard. I
   have a variety of different aggregate values to display that fall into
   several categories together, so I can group the calculations together.
   I think this sectioning will prove useful in the future, as I can
   imagine wanting to display some but not all of these sections on
   another page.

   Because the CometActors all will need to know the dashboard to which
   they belong, my thought was to share this Mapper instance via a
   RequestVar.

  You can create messages to be sent to a CometActor upon setup:

  for {
    session - S.session
   } session.setupComet(Dashboard, Empty, ABunchOfInfo(sessionInfo))

  When the Dashboard comet actor is created, it will be sent the
  ABunchOfInfo message.  In this way you can send current request state info
  to a CometActor.

  Does this help?

   I call my snippet like so:
   lift:Dashboard.display
   /lift:Dashboard.display

   The snippet defines a RequestVar called myDashboard and then returns a
   NodeSeq:
   div
    lift:comet type=DashboardHelper1
    /lift:comet
   // 
    lift:comet type=DashboardHelperN
    /lift:comet
   /div

   While I can get this all to compile, myDashboard is empty in the
   CometActors. I understand that CometActors basically exist outside of
   the normal request cycle, so would this be the reason why my
   RequestVar is always empty? I was hoping that it would still be in the
   request cycle when localSetup is called, but I can see why that would
   be unrealistic.

   I just tried using SessionVar instead of a RequestVar and this works.
   However, I'm worried about having to be more careful about emptying
   the SessionVar if requesting a different dashboard than if I would if
   I were using a RequestVar. Is this an unrealistic fear?

   What do you think is the best way to proceed?

   Thanks for your help,
   Peter Robinett

   [1]:
  http://groups.google.com/group/liftweb/browse_thread/thread/5cf4ae2ec...
   [2]:
  http://groups.google.com/group/liftweb/browse_thread/thread/274cfc9d2...

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




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

2009-12-08 Thread DMB
I've been with Foursquare for four months, and during this time I've
decided to change their infrastructure to Scala and Lift. LOL.

Good luck hiring devs for this, guys. You will need it.

On Dec 8, 1:49 pm, Mateo Barraza mateo.barr...@gmail.com wrote:
 that last link works. THanks  Tyler!

 M

 On Tue, Dec 8, 2009 at 2:18 PM, TylerWeir tyler.w...@gmail.com wrote:
  N8han upped it a while ago:http://www.vimeo.com/8057986

  On Dec 8, 4:08 pm, Timothy Perrett timo...@getintheloop.eu wrote:
  Im sure n8han will put it on blip.tv when he gets a chance. Be patient, im 
  sure it'll come soon :-)

  Cheers, Tim

  On 8 Dec 2009, at 20:50, Mateo Barraza wrote:

   Anyone still looking into uploading the video version of this prezo?

   M

   On Tue, Dec 8, 2009 at 12:38 PM, Peter Robinett 
   pe...@bubblefoundry.com wrote:
   On Dec 7, 7:36 pm, David Pollak feeder.of.the.be...@gmail.com wrote:
   On Mon, Dec 7, 2009 at 6:59 PM, Peter Robinett 
   pe...@bubblefoundry.comwrote:

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

   It's on my to-do list.

   This is something we'll need at EQUAL Networks within a month or two.
   Do you think you'll get to it within that time period? I'm happy to
   take a stab at it first, though I know it's not trivial (I've only
   written oAuth clients, not servers).

   Peter

   --

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

   --

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

  --

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

--

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




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

2009-12-08 Thread David Pollak
On Tue, Dec 8, 2009 at 7:34 PM, DMB combust...@gmail.com wrote:

 I've been with Foursquare for four months, and during this time I've
 decided to change their infrastructure to Scala and Lift. LOL.

 Good luck hiring devs for this, guys. You will need it.


Why do you say this?  There is an increasing supply of talented Scala
developers.  I have nearly a dozen quality developers I know who would
rather be doing Scala work than whatever they're doing now... just come to a
Scala BASE meeting to meet some of them.

There is also an increasing demand for Scala developers between Twitter,
LinkedIn, and KaChing, etc.

Plus, it's a great match... by and large, Scala developers are the
intellectually curious sorts who are willing to do extra work in order to
get the benefits of Scala... this is an ideal profile for a start-up like
FourSquare.  And FourSquare is a wicked hot start-up that offers tremendous
upside to anyone who joins now (like Twitter did 2 years ago.)

In fact, Scala is a great filter for FourSquare... they get to cherry-pick
from a relatively small, tremendously talented pool of developers.  If I
were single and 20 years younger, I'd be updating and sending my resume to
FourSquare... and I haven't updated (or had to update) my resume in  5
years.


 On Dec 8, 1:49 pm, Mateo Barraza mateo.barr...@gmail.com wrote:
  that last link works. THanks  Tyler!
 
  M
 
  On Tue, Dec 8, 2009 at 2:18 PM, TylerWeir tyler.w...@gmail.com wrote:
   N8han upped it a while ago:http://www.vimeo.com/8057986
 
   On Dec 8, 4:08 pm, Timothy Perrett timo...@getintheloop.eu wrote:
   Im sure n8han will put it on blip.tv when he gets a chance. Be
 patient, im sure it'll come soon :-)
 
   Cheers, Tim
 
   On 8 Dec 2009, at 20:50, Mateo Barraza wrote:
 
Anyone still looking into uploading the video version of this prezo?
 
M
 
On Tue, Dec 8, 2009 at 12:38 PM, Peter Robinett 
 pe...@bubblefoundry.com wrote:
On Dec 7, 7:36 pm, David Pollak feeder.of.the.be...@gmail.com
 wrote:
On Mon, Dec 7, 2009 at 6:59 PM, Peter Robinett 
 pe...@bubblefoundry.comwrote:
 
One thing mentioned briefly in the talk that I'd like to know
 more
about is oAuth Server code. Is anyone working on that?
 
It's on my to-do list.
 
This is something we'll need at EQUAL Networks within a month or
 two.
Do you think you'll get to it within that time period? I'm happy to
take a stab at it first, though I know it's not trivial (I've only
written oAuth clients, not servers).
 
Peter
 
--
 
You received this message because you are subscribed to the Google
 Groups Lift group.
To post to this group, send email to lift...@googlegroups.com.
To unsubscribe from this group, send email to
 liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com
 .
For more options, visit this group athttp://
 groups.google.com/group/liftweb?hl=en.
 
--
 
You received this message because you are subscribed to the Google
 Groups Lift group.
To post to this group, send email to lift...@googlegroups.com.
To unsubscribe from this group, send email to
 liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com
 .
For more options, visit this group athttp://
 groups.google.com/group/liftweb?hl=en.
 
   --
 
   You received this message because you are subscribed to the Google
 Groups Lift group.
   To post to this group, send email to lift...@googlegroups.com.
   To unsubscribe from this group, send email to
 liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com
 .
   For more options, visit this group athttp://
 groups.google.com/group/liftweb?hl=en.

 --

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





-- 
Lift, the simply functional web framework http://liftweb.net
Beginning Scala 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: how to keep last submited form field value

2009-12-08 Thread Jarod Liu
Thank you for you guys answer. RequestVar is what I needed.

On Dec 9, 4:34 am, Derek Chen-Becker dchenbec...@gmail.com wrote:
 I think he might just mean the last submitted value for this particular form
 instance, in which case you want a RequestVar, not a SessionVar.

 On Tue, Dec 8, 2009 at 8:22 AM, Alex Boisvert alex.boisv...@gmail.comwrote:



  You should use a SessionVar or a stateful snippet.

  Here's how you would use a SessionVar,

  object lastSubmittedDate extends SessionVar[Date](new Date)

  ...
  bind(...,
          date - SHtml.text(lastSubmittedDate.is, lastSubmittedDate(_),
                               class - datepicker),

  alex

  On Tue, Dec 8, 2009 at 1:42 AM, Jarod Liu liuyuan...@gmail.com wrote:

  I want the date field keep the last submited value.  I tried with
  below code, but it's dosn't work. The date value(display in page)
  awalys the date of today.

  the form:
  lift:mySnippet.form1 form=POST
     f:date/
     f:submit/
  /lift:mySnippet.form1

  MySnippet:

  class MySnippet extends StatefulSnippet {
   val dfmt = new SimpleDateFormat(-MM-dd)
   var date =  dfmt.format(new Date)

   val dispatch: DispatchIt = {
     case form1 = form1 _
   }

   def form1(in: NodeSeq): NodeSeq = {
     bind(f, in,
          date - SHtml.text(date, date = _,
                               class - datepicker),
          submit - SHtml.submit(submit, println(submit:  +
  date))
     )
   }

  --

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

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

--

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




[Lift] Re: how to keep last submited form field value

2009-12-08 Thread Jarod Liu
Thank you for you guys answer. RequestVar is what I needed.

On Dec 9, 4:34 am, Derek Chen-Becker dchenbec...@gmail.com wrote:
 I think he might just mean the last submitted value for this particular form
 instance, in which case you want a RequestVar, not a SessionVar.

 On Tue, Dec 8, 2009 at 8:22 AM, Alex Boisvert alex.boisv...@gmail.comwrote:



  You should use a SessionVar or a stateful snippet.

  Here's how you would use a SessionVar,

  object lastSubmittedDate extends SessionVar[Date](new Date)

  ...
  bind(...,
          date - SHtml.text(lastSubmittedDate.is, lastSubmittedDate(_),
                               class - datepicker),

  alex

  On Tue, Dec 8, 2009 at 1:42 AM, Jarod Liu liuyuan...@gmail.com wrote:

  I want the date field keep the last submited value.  I tried with
  below code, but it's dosn't work. The date value(display in page)
  awalys the date of today.

  the form:
  lift:mySnippet.form1 form=POST
     f:date/
     f:submit/
  /lift:mySnippet.form1

  MySnippet:

  class MySnippet extends StatefulSnippet {
   val dfmt = new SimpleDateFormat(-MM-dd)
   var date =  dfmt.format(new Date)

   val dispatch: DispatchIt = {
     case form1 = form1 _
   }

   def form1(in: NodeSeq): NodeSeq = {
     bind(f, in,
          date - SHtml.text(date, date = _,
                               class - datepicker),
          submit - SHtml.submit(submit, println(submit:  +
  date))
     )
   }

  --

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

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

--

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




[Lift] Re: How can bind more than one element in the render method in CometActor ?

2009-12-08 Thread Neil.Lv

  Whether I have to create six comet to archieve this purpose ?

  I want to use only one comet to update the six parts.

  The layouf is like this:
###
part1 part2


part3 part6
part4
part5
###

###
...
lift:comet type=TestComet
  info:One/
/lift:comet
span/span
lift:comet type=TestComet
  info:Two/
/lift:comet
span/span
lift:comet type=TestComet
  info:Three
/lift:comet
span/span
lift:comet type=TestComet
  info:Four
/lift:comet
...
lift:comet type=TestComet
  info:Sixr
/lift:comet
###

   Thanks!

Cheers,
  Neil


On Dec 9, 12:49 am, Neil.Lv anim...@gmail.com wrote:
   BTW, when the partialUpdate method is called , the result is
 correct.

   But when refreshing the browser or open a new browser, the result
 also is 3,

 Cheers,
   Neil

 On Dec 9, 12:44 am, Neil.Lv anim...@gmail.com wrote:

  Hi all,

     How can bind more than one element in the render method in
  CometActor ?

     The msg1 is an
  ###
  class TestComet extends CometActor {
    override def defaultPrefix = Full(info)
    ...
    def render = { bind(One   - span1/span,
                               Two   - span2/span,
                               Three - span3/span,
                               Four  - span4/span,
                               Five  - span5/span,
                               Six   - span6/span ) }
    ...}

  ###

    And in the index.html page
  ###
  ...
  lift:comet type=TestComet
    info:One/
  /lift:comet
  span/span
  lift:comet type=TestComet
    info:Two/
  /lift:comet
  span/span
  lift:comet type=TestComet
    info:Three
  /lift:comet
  span/span
  lift:comet type=TestComet
    info:Four
  /lift:comet
  ...
  ###

    And these four comet all show the same result  span3/span,
  not 1, 2, 3, 4, 5, 6 

    I don't know what's wrong with it ?

    Dose anybody know what's the problem with this render metho?

    Thanks for any help.

  Cheers,
    Neil

--

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




Re: [Lift] Re: How can bind more than one element in the render method in CometActor ?

2009-12-08 Thread David Pollak
Neil,

bind() works the same everywhere... CometActors, Helpers.bind, etc.

If you are having a problem with bind, I would strongly recommend writing a
test with a template that allows your to figure out how bind works and then
take the template and binding and put it in your CometActor.

Thanks,

David

On Tue, Dec 8, 2009 at 7:51 PM, Neil.Lv anim...@gmail.com wrote:


  Whether I have to create six comet to archieve this purpose ?

  I want to use only one comet to update the six parts.

  The layouf is like this:
 ###
 part1 part2


 part3 part6
 part4
 part5
 ###

 ###
 ...
 lift:comet type=TestComet
  info:One/
 /lift:comet
 span/span
 lift:comet type=TestComet
  info:Two/
 /lift:comet
 span/span
 lift:comet type=TestComet
  info:Three
 /lift:comet
 span/span
 lift:comet type=TestComet
  info:Four
 /lift:comet
 ...
 lift:comet type=TestComet
   info:Sixr
 /lift:comet
 ###

   Thanks!

 Cheers,
   Neil


 On Dec 9, 12:49 am, Neil.Lv anim...@gmail.com wrote:
BTW, when the partialUpdate method is called , the result is
  correct.
 
But when refreshing the browser or open a new browser, the result
  also is 3,
 
  Cheers,
Neil
 
  On Dec 9, 12:44 am, Neil.Lv anim...@gmail.com wrote:
 
   Hi all,
 
  How can bind more than one element in the render method in
   CometActor ?
 
  The msg1 is an
   ###
   class TestComet extends CometActor {
 override def defaultPrefix = Full(info)
 ...
 def render = { bind(One   - span1/span,
Two   - span2/span,
Three - span3/span,
Four  - span4/span,
Five  - span5/span,
Six   - span6/span ) }
 ...}
 
   ###
 
 And in the index.html page
   ###
   ...
   lift:comet type=TestComet
 info:One/
   /lift:comet
   span/span
   lift:comet type=TestComet
 info:Two/
   /lift:comet
   span/span
   lift:comet type=TestComet
 info:Three
   /lift:comet
   span/span
   lift:comet type=TestComet
 info:Four
   /lift:comet
   ...
   ###
 
 And these four comet all show the same result  span3/span,
   not 1, 2, 3, 4, 5, 6 
 
 I don't know what's wrong with it ?
 
 Dose anybody know what's the problem with this render metho?
 
 Thanks for any help.
 
   Cheers,
 Neil

 --

 You received this message because you are subscribed to the Google Groups
 Lift group.
 To post to this group, send email to lift...@googlegroups.com.
 To unsubscribe from this group, send email to
 liftweb+unsubscr...@googlegroups.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: Fwd: Watch Foursquare Lift talk live from NY

2009-12-08 Thread DMB
 cherry-pick from a relatively small, tremendously talented pool of developers

Startups never get to cherry pick from anything since they don't
have the dough to pay for best work. If I'm a kick ass dev, why would
I trade my six figure salary for a five figure one with a tiny sliver
of equity which may or may not actually be worth anything in the end?

In any startup, I would emphasize readability/maintainability of code,
and broad availability of lower cost workforce. I mean, I would not
LOL if he switched things over to Grails, for instance. Both Java and
RoR devs feel comfortable with that, it's easy as a pie, and it's a
massive improvement over PHP. Sure, it's not as fast as Lift, but I've
found it to be more concise for most things, since the framework does
quite a bit more work for you. More importantly, it's better
documented, it takes far less time to build a site with it, and to
train new devs who are not familiar with the framework. If I were
doing a startup, Scala and Lift would surely not be the top choices.
They could work for an established business with a solid developer
core though (like LinkedIn, for instance).

Don't get me wrong, I like both Lift and Scala (enough to tinker with
both for extended periods of time), but I don't foresee any kind of
mainstream adoption for either of the two. 90% of developers out there
can't grasp even Java fully, and the remaining 10% make enough money
on Java to stick with it.

On Dec 8, 7:47 pm, David Pollak feeder.of.the.be...@gmail.com wrote:
 On Tue, Dec 8, 2009 at 7:34 PM, DMB combust...@gmail.com wrote:
  I've been with Foursquare for four months, and during this time I've
  decided to change their infrastructure to Scala and Lift. LOL.

  Good luck hiring devs for this, guys. You will need it.

 Why do you say this?  There is an increasing supply of talented Scala
 developers.  I have nearly a dozen quality developers I know who would
 rather be doing Scala work than whatever they're doing now... just come to a
 Scala BASE meeting to meet some of them.

 There is also an increasing demand for Scala developers between Twitter,
 LinkedIn, and KaChing, etc.

 Plus, it's a great match... by and large, Scala developers are the
 intellectually curious sorts who are willing to do extra work in order to
 get the benefits of Scala... this is an ideal profile for a start-up like
 FourSquare.  And FourSquare is a wicked hot start-up that offers tremendous
 upside to anyone who joins now (like Twitter did 2 years ago.)

 In fact, Scala is a great filter for FourSquare... they get to cherry-pick
 from a relatively small, tremendously talented pool of developers.  If I
 were single and 20 years younger, I'd be updating and sending my resume to
 FourSquare... and I haven't updated (or had to update) my resume in  5
 years.



  On Dec 8, 1:49 pm, Mateo Barraza mateo.barr...@gmail.com wrote:
   that last link works. THanks  Tyler!

   M

   On Tue, Dec 8, 2009 at 2:18 PM, TylerWeir tyler.w...@gmail.com wrote:
N8han upped it a while ago:http://www.vimeo.com/8057986

On Dec 8, 4:08 pm, Timothy Perrett timo...@getintheloop.eu wrote:
Im sure n8han will put it on blip.tv when he gets a chance. Be
  patient, im sure it'll come soon :-)

Cheers, Tim

On 8 Dec 2009, at 20:50, Mateo Barraza wrote:

 Anyone still looking into uploading the video version of this prezo?

 M

 On Tue, Dec 8, 2009 at 12:38 PM, Peter Robinett 
  pe...@bubblefoundry.com wrote:
 On Dec 7, 7:36 pm, David Pollak feeder.of.the.be...@gmail.com
  wrote:
 On Mon, Dec 7, 2009 at 6:59 PM, Peter Robinett 
  pe...@bubblefoundry.comwrote:

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

 It's on my to-do list.

 This is something we'll need at EQUAL Networks within a month or
  two.
 Do you think you'll get to it within that time period? I'm happy to
 take a stab at it first, though I know it's not trivial (I've only
 written oAuth clients, not servers).

 Peter

 --

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

 --

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

--

You received this message because you are subscribed to the Google
  Groups Lift group.
To post to this 

[Lift] Re: How can bind more than one element in the render method in CometActor ?

2009-12-08 Thread Neil.Lv

   Here is the code:
###
override def defaultPrefix = Full(info)

def show(in: NodeSeq): NodeSeq = {
  bind(show, in,
   list1 - Text(1),
   list2 - Text(2)
   )
}

def render = {
  bind(
   list1 - Text(1),
   list2 - Text(2)
   )
}
###

   In the index.html page:

###
lift:comet type=ForumComet
  info.show:list1/
  info.show:list2/
/lift:comet

lift:comet type=ForumComet
  info.list1/
  info.list2/
/lift:comet
###

  Both of them don't work, In the Snippet, the render method could be
write like this:
###
def render(in : NodeSeq) : NodeSeq = {
   bind( info, in,
   list1 - Text(1),
list2 - Text(2)
  )
}
###

  It's different with Comet's render method .

  Thanks!

Cheers,
  Neil


On Dec 9, 11:53 am, David Pollak feeder.of.the.be...@gmail.com
wrote:
 Neil,

 bind() works the same everywhere... CometActors, Helpers.bind, etc.

 If you are having a problem with bind, I would strongly recommend writing a
 test with a template that allows your to figure out how bind works and then
 take the template and binding and put it in your CometActor.

 Thanks,

 David



 On Tue, Dec 8, 2009 at 7:51 PM, Neil.Lv anim...@gmail.com wrote:

   Whether I have to create six comet to archieve this purpose ?

   I want to use only one comet to update the six parts.

   The layouf is like this:
  ###
  part1             part2

  part3             part6
  part4
  part5
  ###

  ###
  ...
  lift:comet type=TestComet
   info:One/
  /lift:comet
  span/span
  lift:comet type=TestComet
   info:Two/
  /lift:comet
  span/span
  lift:comet type=TestComet
   info:Three
  /lift:comet
  span/span
  lift:comet type=TestComet
   info:Four
  /lift:comet
  ...
  lift:comet type=TestComet
    info:Sixr
  /lift:comet
  ###

    Thanks!

  Cheers,
    Neil

  On Dec 9, 12:49 am, Neil.Lv anim...@gmail.com wrote:
     BTW, when the partialUpdate method is called , the result is
   correct.

     But when refreshing the browser or open a new browser, the result
   also is 3,

   Cheers,
     Neil

   On Dec 9, 12:44 am, Neil.Lv anim...@gmail.com wrote:

Hi all,

   How can bind more than one element in the render method in
CometActor ?

   The msg1 is an
###
class TestComet extends CometActor {
  override def defaultPrefix = Full(info)
  ...
  def render = { bind(One   - span1/span,
                             Two   - span2/span,
                             Three - span3/span,
                             Four  - span4/span,
                             Five  - span5/span,
                             Six   - span6/span ) }
  ...}

###

  And in the index.html page
###
...
lift:comet type=TestComet
  info:One/
/lift:comet
span/span
lift:comet type=TestComet
  info:Two/
/lift:comet
span/span
lift:comet type=TestComet
  info:Three
/lift:comet
span/span
lift:comet type=TestComet
  info:Four
/lift:comet
...
###

  And these four comet all show the same result  span3/span,
not 1, 2, 3, 4, 5, 6 

  I don't know what's wrong with it ?

  Dose anybody know what's the problem with this render metho?

  Thanks for any help.

Cheers,
  Neil

  --

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




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

2009-12-08 Thread Randinn
Very nice work, I don't deal with records but it looks very useful.

On Dec 9, 1: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 athttps://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.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-08 Thread Xuefeng Wu
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] Re: Fwd: Watch Foursquare Lift talk live from NY

2009-12-08 Thread Jeppe Nejsum Madsen
DMB combust...@gmail.com writes:

 cherry-pick from a relatively small, tremendously talented pool of 
 developers

 Startups never get to cherry pick from anything since they don't
 have the dough to pay for best work. If I'm a kick ass dev, why would
 I trade my six figure salary for a five figure one with a tiny sliver
 of equity which may or may not actually be worth anything in the end?

Because you're sick and tired of maintaining other peoples
EJB/Struts/whatever application?

 In any startup, I would emphasize readability/maintainability of code,
 and broad availability of lower cost workforce. 

That sounds more like an enterprise mindset to me.

[...]

 Don't get me wrong, I like both Lift and Scala (enough to tinker with
 both for extended periods of time), but I don't foresee any kind of
 mainstream adoption for either of the two. 

Me neither, at least in the near future, but while startups get a lot of
press it will never be the majority of people who will work there. But
startups have to pick the best tools for the job to get something going,
fast. For some (myself included) this meant Scala/Lift.

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

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