[Lift] Re: Errors not shown after AJAX form submit

2010-01-05 Thread Marius
I think the difference is in showAll scope. It was implemented for non
Ajax context (just for msgs snippet) but it wasn't implemented for
Ajax (as far as I can tell).

Ajax notices (if there are any) are appended to user's JsCmd response.
But this code has no idea about the showAll snippet attribute.
Therefore ajax notices that are associates with an ID will not be
shown in lift:Msgs showAll=true/ 's real estate.

Please open a defect for this.

Br's,
Marius

On Jan 5, 9:37 am, Adam Warski a...@warski.org wrote:
 Hello,

 Ah, I didn't spot this. I only have:

 lift:Msgs showAll=true/

 which would suggest that it should show all errors.
 And anyway, why does it work then with normal form submit, and doesn't with 
 ajax form submit?

 Adam

 On Jan 4, 2010, at 9:14 PM, Ross Mellgren wrote:

  S.error(NodeSeq) and S.error(List[FieldError]) differ in that the  
  latter registers errors against particular fields, and the former is a  
  page-wide error. The latter is more like S.error(String, NodeSeq). Do  
  you have Msg snippets for each field, like this?

  ... field ... lift:msg id=my_field_id /

  (see net.liftweb.builtin.snippet.Msg for a better example)

  Hope that helps,
  -Ross

  On Jan 4, 2010, at 3:10 PM, Adam Warski wrote:

  Hello,

  investigating further making the tutorial form submittable with  
  ajax, I found some weird behavior; I'm using 1.1-M8.

  It seems that when the form is submitted with ajax, and there are  
  form validation errors, the error is not shown. However, the notices  
  work fine. So:
  - S.notice(Added +todo.desc); shows the notice after the ajax form  
  submit
  - S.error(xs); doesn't, only if the form is submitted in the regular  
  way

  I didn't manage to find the problem yet, but if instead of calling  
  S.error(xs); I do:
  xs.map {i = S.error(i.msg) };
  the error is shown.

  The error(n: NodeSeq)  and error(vi: List[FieldError]) don't seem to  
  differ a lot, but there must be something special about the second.

  I tried to reproduce the problem using a simple application, but  
  there I found  another strange thing.
  The app is:

  object Test {
  def main(args: Array[String]) {
    val z = new ListBuffer[String]
    object x extends RequestVar(z)
    x += a

    object y extends RequestVar(new ListBuffer[String])
    y += b

    println(x.is)
    println(y.is)
  }
  }

  and prints out:
  ListBuffer(a)
  ListBuffer()

  so for some reason, if the initial value of the RequestVar is passed  
  without an intermediate val, the list content isn't modified.
  But it could be that I'm using the RequestVar outside of it's  
  intended environment which may be the cause ;).

  --
  Adam

  --

  You received this message because you are subscribed to the Google  
  Groups Lift group.
  To post to this group, 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: [lift] Lift based backend server subscribing via amqp

2010-01-05 Thread Timothy Perrett
We don't accept patches for legal reasons. However, I will upgrade the  
module today for you - giving a similar result.

Cheers, Tim

Sent from my iPhone

On 5 Jan 2010, at 04:29, Franz Bettag fr...@bett.ag wrote:

 Hey guys,

 i've just updated the amqp code. I started a pull request on github
 but that seems *not* to be the proper way *smirking @dpp's auto-
 reply*.

 Anyway here is the patch. The problem was that in version 1.5.0 of
 rabbitmq's library, the ticket-stuff was removed.

 diff --git a/lift-modules/lift-amqp/pom.xml b/lift-modules/lift-amqp/
 pom.xml
 index 9f4c1d5..424be0e 100644
 --- a/lift-modules/lift-amqp/pom.xml
 +++ b/lift-modules/lift-amqp/pom.xml
 @@ -32,6 +32,15 @@
   /parent
   artifactIdlift-amqp/artifactId

 +  repositories
 +repository
 +  idnexus.griddynamics.net/id
 +  nameNexus Maven2 Repository/name
 +  urlhttps://nexus.griddynamics.net/nexus/content/groups/
 public/url
 +/repository
 +  /repositories
 +
 +
   !-- properties/ --

   !--
 @@ -55,8 +64,8 @@
 /dependency
 dependency
   groupIdcom.rabbitmq/groupId
 -  artifactIdrabbitmq-client/artifactId
 -  version1.3.0/version
 +  artifactIdamqp-client/artifactId
 +  version1.7.0/version
 /dependency
   /dependencies

 diff --git a/lift-modules/lift-amqp/src/main/scala/net/liftweb/amqp/
 AMQPDispatcher.scala b/lift-modules/lift-amqp/src/main/scala/net/
 liftweb/amqp/AMQPDispatcher.scala
 index 26bca73..96c66c9 100644
 --- a/lift-modules/lift-amqp/src/main/scala/net/liftweb/amqp/
 AMQPDispatcher.scala
 +++ b/lift-modules/lift-amqp/src/main/scala/net/liftweb/amqp/
 AMQPDispatcher.scala
 @@ -91,7 +91,7 @@ abstract class AMQPDispatcher[T](cf:
 ConnectionFactory, host: String, port: Int)
 class SerializedConsumer[T](channel: Channel, a: LiftActor) extends
 DefaultConsumer(channel) {
   override def handleDelivery(tag: String, env: Envelope, props:
 AMQP.BasicProperties, body: Array[Byte]) {
 val routingKey = env.getRoutingKey
 -val contentType = props.contentType
 +val contentType = props.getContentType
 val deliveryTag = env.getDeliveryTag
 val in = new ObjectInputStream(new ByteArrayInputStream(body))
 val t = in.readObject.asInstanceOf[T];
 @@ -109,14 +109,12 @@ class SerializedConsumer[T](channel: Channel, a:
 LiftActor) extends DefaultConsu
 class ExampleSerializedAMQPDispatcher[T](factory: ConnectionFactory,
 host: String, port: Int)
 extends AMQPDispatcher[T](factory, host, port) {
   override def configure(channel: Channel) {
 -// Get the ticket.
 -val ticket = channel.accessRequest(/data)
 // Set up the exchange and queue
 -channel.exchangeDeclare(ticket, mult, direct)
 -channel.queueDeclare(ticket, mult_queue)
 -channel.queueBind(ticket, mult_queue, mult, routeroute)
 +channel.exchangeDeclare(mult, direct)
 +channel.queueDeclare(mult_queue)
 +channel.queueBind(mult_queue, mult, routeroute)
 // Use the short version of the basicConsume method for
 convenience.
 -channel.basicConsume(ticket, mult_queue, false, new
 SerializedConsumer(channel, this))
 +channel.basicConsume(mult_queue, false, new SerializedConsumer
 (channel, this))
   }
 }

 diff --git a/lift-modules/lift-amqp/src/main/scala/net/liftweb/amqp/
 AMQPSender.scala b/lift-modules/lift-amqp/src/main/scala/net/liftweb/
 amqp/AMQPSender.scala
 index 2c60ed6..dc29a2a 100644
 --- a/lift-modules/lift-amqp/src/main/scala/net/liftweb/amqp/
 AMQPSender.scala
 +++ b/lift-modules/lift-amqp/src/main/scala/net/liftweb/amqp/
 AMQPSender.scala
 @@ -14,11 +14,6 @@ import _root_.java.io.ObjectOutputStream
 abstract class AMQPSender[T](cf: ConnectionFactory, host: String,
 port: Int, exchange: String, routingKey: String) extends LiftActor {
   val conn = cf.newConnection(host, port)
   val channel = conn.createChannel()
 -  val ticket = configure(channel)
 -  /**
 -   * Override this to use your own AMQP queue/exchange with the given
 channel.
 -   */
 -  def configure(channel: Channel): Int

   def send(msg: T) {
 // Now write an object to a byte array and shove it across the
 wire.
 @@ -26,7 +21,7 @@ abstract class AMQPSender[T](cf: ConnectionFactory,
 host: String, port: Int, exc
 val store = new ObjectOutputStream(bytes)
 store.writeObject(msg)
 store.close
 -channel.basicPublish(ticket, exchange, routingKey, null,
 bytes.toByteArray)
 +channel.basicPublish(exchange, routingKey, null,
 bytes.toByteArray)
   }

   protected def messageHandler = {
 @@ -46,12 +41,6 @@ abstract class AMQPSender[T](cf: ConnectionFactory,
 host: String, port: Int, exc
  * consider creating Actor-based Senders, that will help your
 application to scale.
  */
 class StringAMQPSender(cf: ConnectionFactory, host: String, port:
 Int, exchange: String, routingKey: String) extends AMQPSender[String]
 (cf, host, port, exchange, routingKey) {
 -  override def configure(channel: Channel) = {
 -val conn = cf.newConnection(host, port)
 -val channel = 

[Lift] Re: multiple forms on a page.

2010-01-05 Thread daiwhea
Thanks David. But this seems not work as wished. It will meet some
error:

[INFO] Compiling 1 source files to /home/daiwhea/myworks/java/
liftonscala/MapperBBS/target/classes
/home/daiwhea/myworks/java/liftonscala/MapperBBS/src/main/scala/com/
vapee/main/snippet/GuestBook.scala:60: error: forward reference
extends over definition of variable localNote
  localNote.save
  ^
one error found
[INFO]

[ERROR] BUILD ERROR



Is there any error I made? Below is part of the GuestBook.scala for
list snippet:

  def list(html: NodeSeq): NodeSeq = {
toShow.flatMap(item = {
curListNote = item
bind(item, html,
  title - item.title,
  email - item.email,
  content - item.content,
  reply - getReplyContent(item)
)
  }
)
  }

  def replyNote(html: NodeSeq): NodeSeq = {
def doReply() = {
  localNote.save
}

var localNote = curListNote

bind(note, html,
  replyContent - SHtml.textarea(localNote.replyContent,
   localNote.replyContent(_)),
  submit - SHtml.submit(Reply, doReply)
)
  }

  private def toShow = GuestNote.findAll()

  var curListNote: GuestNote = _

  private def getReplyContent(item: GuestNote) = {
if (item.repliedByAdmin == 0) {
  divpNot replied by admin/plift:embed what=/templates-
hidden/gbook/replyForm //div
}
else
  divp{Replied by admin at: +item.replyTime}/plift:embed
what=/templates-hidden/gbook/replyForm //div
  }

--

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

2010-01-05 Thread martinsema...@googlemail.com
Thanks again,
what i want to do is some stuff with a canvas element, where changes
are reflected to the other clients. This why i think the SHtml things
do not fit for me. I now think the best way would be to use the
partialUpdate() of the CometActor to send changes to clients and may
be a JsonHandler to to get the updates to Server.

Sorry if i expressed my concerns unclear. In the end it seems not that
complicated as i tried to make it :).

Martin

On 4 Jan., 15:19, Marius marius.dan...@gmail.com wrote:
 From your render method you can return something like:

 ajaxText(Hello, (text) = {
 println(text is:  + text)
 // do something here and return a JsCmd. Thus you can return a JsRaw,
 a Call or whatever java script you want

 })

 F1162097909104VYK has nothing to do with Comet. It is an opaque ID
 generated by lift that is bound to the function you specified in the
 ajaxText call. Based on this information Lift will know to invoke the
 proper Scala function when the ajax request is sent to server when you
 hit enter in your text field or something.

 What function you want to build. With Lift you rarely want to call
 ajaxInvoke etc, as SHtml provides a bunch of Ajax helpers (such as
 ajaxText)

 Br's,
 Marius

 On Jan 4, 3:36 pm, martinsema...@googlemail.com

 martinsema...@googlemail.com wrote:
  Thanks for that Marius,
  it works, but it is only for the server to client direction.

  In the generated Html of the ajaxText there is something like:

  lift_ajaxHandler('F1162097909104VYK=' + encodeURIComponent
  (this.value), null, null)

  I guess the F116... is some kind of Id for the receiving Actor. Can i
  get it from the scala side to build my own function? I tried
  SHtml.ajaxCallto build a function that can send to to the Actor, but
  it seems not to work. Any suggestions?

  best regards
  Martin

  On 4 Jan., 13:36, Marius marius.dan...@gmail.com wrote:

   Do not disable Lift's ajax.

   Let's say you have your own myown.js file having say a function foo().
   Now you from a CometActor you want to call this function (assume to
   included myown.js in your page head).

   When you receive a message in your comet you can call partialUpdate
   like:

   case MyMessage =
      partialUpdate(Call(foo))

   Call is a JsCmd object from lift witch translates into a JS function
   call. You can also use JsRaw(put here any js code)

   You can also do it from render as well like:

   def render = {
      // do something
      new RenderOut(some_xhtml, Call(foo))

   }

   Br's,
   Marius

   On Jan 4, 1:30 pm, martinsema...@googlemail.com

   martinsema...@googlemail.com wrote:
Hi all
if just started exploring Lift and I am playing around with CometActor
and Listeneers. I followed Davids Screencast with the Chat Example
which works nicely.
Now i would like to communicate with the CometActors using my own
jQuery code. I don't want to use lifts helpers for that, but want to
use my own static JS code.

How would the send and receive functions look like? Should i disable
lifts ajax support or can i plug in somehow?

I have no clue how to begin. Can someone point to some examples or
article that is concerned with this type of stuff?

thanks in advance!
Martin

--

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

2010-01-05 Thread Adam Warski
Hello,

 I think the difference is in showAll scope. It was implemented for non
 Ajax context (just for msgs snippet) but it wasn't implemented for
 Ajax (as far as I can tell).
 
 Ajax notices (if there are any) are appended to user's JsCmd response.
 But this code has no idea about the showAll snippet attribute.
 Therefore ajax notices that are associates with an ID will not be
 shown in lift:Msgs showAll=true/ 's real estate.
 
 Please open a defect for this.
I think I more or less understand :)
Here's the defect: http://github.com/dpp/liftweb/issues/#issue/271

By the way, do you have any idea why my example application produces such weird 
results?
I looked in the RequestVar code and didn't find anything there that would make 
it behave differently in the two scenarios.

Adam


 Br's,
 Marius
 
 On Jan 5, 9:37 am, Adam Warski a...@warski.org wrote:
 Hello,
 
 Ah, I didn't spot this. I only have:
 
 lift:Msgs showAll=true/
 
 which would suggest that it should show all errors.
 And anyway, why does it work then with normal form submit, and doesn't with 
 ajax form submit?
 
 Adam
 
 On Jan 4, 2010, at 9:14 PM, Ross Mellgren wrote:
 
 S.error(NodeSeq) and S.error(List[FieldError]) differ in that the  
 latter registers errors against particular fields, and the former is a  
 page-wide error. The latter is more like S.error(String, NodeSeq). Do  
 you have Msg snippets for each field, like this?
 
 ... field ... lift:msg id=my_field_id /
 
 (see net.liftweb.builtin.snippet.Msg for a better example)
 
 Hope that helps,
 -Ross
 
 On Jan 4, 2010, at 3:10 PM, Adam Warski wrote:
 
 Hello,
 
 investigating further making the tutorial form submittable with  
 ajax, I found some weird behavior; I'm using 1.1-M8.
 
 It seems that when the form is submitted with ajax, and there are  
 form validation errors, the error is not shown. However, the notices  
 work fine. So:
 - S.notice(Added +todo.desc); shows the notice after the ajax form  
 submit
 - S.error(xs); doesn't, only if the form is submitted in the regular  
 way
 
 I didn't manage to find the problem yet, but if instead of calling  
 S.error(xs); I do:
 xs.map {i = S.error(i.msg) };
 the error is shown.
 
 The error(n: NodeSeq)  and error(vi: List[FieldError]) don't seem to  
 differ a lot, but there must be something special about the second.
 
 I tried to reproduce the problem using a simple application, but  
 there I found  another strange thing.
 The app is:
 
 object Test {
 def main(args: Array[String]) {
   val z = new ListBuffer[String]
   object x extends RequestVar(z)
   x += a
 
   object y extends RequestVar(new ListBuffer[String])
   y += b
 
   println(x.is)
   println(y.is)
 }
 }
 
 and prints out:
 ListBuffer(a)
 ListBuffer()
 
 so for some reason, if the initial value of the RequestVar is passed  
 without an intermediate val, the list content isn't modified.
 But it could be that I'm using the RequestVar outside of it's  
 intended environment which may be the cause ;).
 
 --
 Adam
 
 --
 
 You received this message because you are subscribed to the Google  
 Groups Lift group.
 To post to this group, 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: [lift] Lift based backend server subscribing via amqp

2010-01-05 Thread Timothy Perrett
In what way do you mean is mapper worth it?

What kind of system is it? do you need ACID or BASE? What kind of load
will the system be under? Do you need it to be distributed? You are
not restricted to Mapper, you could use JPA or whatever persistence
you want with lift.

If you just want to make a pretty simple service tier, then sure, Lift
will be fine. Akka works well when you need fault tolerance or
distributed nodes etc etc

Cheers, Tim

On Jan 5, 3:34 am, vishnu path...@gmail.com wrote:
 well I'm not sure how to describe it differently. As you said it's only
 service tier. The truth is I dont know anything about Lift yet and Im just
 now running through some basic Scala books.

 I need a library with which to talk to rabbitmq as a subscriber that might
 work at a higher level than the default java api that comes with rabbitmq
 and ideally something that provides the same service for me talk to a
 database via scala. I haven't seen Akka before, so I'll take a look at that
 :). Would you say mapper is worth it?

 On Tue, Jan 5, 2010 at 2:23 AM, Timothy Perrett 
 timo...@getintheloop.euwrote:



  It depends on your use case... you don't really describe exactly what you
  want to do. Perhaps start by providing more detail? If you want service teir
  *only* though, its quite probable that akka would be a better fix.

  Cheers, Tim

  On 4 Jan 2010, at 20:30, Channing Walton wrote:

   Maybe Akka would be better for you?http://akkasource.org/
   Akka has an AMQP module which abstracts AMQP Producer and Consumer as
   Actors.

   Channing

   vishnu-11 wrote:

   Hi
     I'm trying to use lift to right a back end for a system that
   communicates via AMQP. The idea is to have a bunch of (threads?,
   processes? actors?) that subscribe to some queues on a queueing system
   and react to various messages by contacting various third party
   systems and persisting messages to a database.

   I was wondering firstly if it makes sense to use lift, or if it makes
   more sense to pull various parts out of lift and use them?

   Additionally, looking at the lift amqp code, it seems to be a little
   out of date, especially with regard to amqp. Does anyone know if there
   has been any active work on this segment?

   --

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

   --
   View this message in context:
 http://old.nabble.com/Lift-based-backend-server-subscribing-via-amqp-...
   Sent from the liftweb mailing list archive at Nabble.com.

   --

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

  --

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

--

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




[Lift] Re: Lift based backend server subscribing via amqp

2010-01-05 Thread Timothy Perrett
Pushed to master - will be in hudson jars in a few hours.

Cheers, Tim

On Jan 5, 10:06 am, Timothy Perrett timo...@getintheloop.eu wrote:
 http://github.com/dpp/liftweb/issues/#issue/270

 Fixed and on review board.

 Cheers, Tim

 On Jan 5, 8:57 am, Timothy Perrett timo...@getintheloop.eu wrote:



  We don't accept patches for legal reasons. However, I will upgrade the  
  module today for you - giving a similar result.

  Cheers, Tim

  Sent from my iPhone

  On 5 Jan 2010, at 04:29, Franz Bettag fr...@bett.ag wrote:

   Hey guys,

   i've just updated the amqp code. I started a pull request on github
   but that seems *not* to be the proper way *smirking @dpp's auto-
   reply*.

   Anyway here is the patch. The problem was that in version 1.5.0 of
   rabbitmq's library, the ticket-stuff was removed.

   diff --git a/lift-modules/lift-amqp/pom.xml b/lift-modules/lift-amqp/
   pom.xml
   index 9f4c1d5..424be0e 100644
   --- a/lift-modules/lift-amqp/pom.xml
   +++ b/lift-modules/lift-amqp/pom.xml
   @@ -32,6 +32,15 @@
     /parent
     artifactIdlift-amqp/artifactId

   +  repositories
   +    repository
   +      idnexus.griddynamics.net/id
   +      nameNexus Maven2 Repository/name
   +      urlhttps://nexus.griddynamics.net/nexus/content/groups/
   public/url
   +    /repository
   +  /repositories
   +
   +
     !-- properties/ --

     !--
   @@ -55,8 +64,8 @@
       /dependency
       dependency
         groupIdcom.rabbitmq/groupId
   -      artifactIdrabbitmq-client/artifactId
   -      version1.3.0/version
   +      artifactIdamqp-client/artifactId
   +      version1.7.0/version
       /dependency
     /dependencies

   diff --git a/lift-modules/lift-amqp/src/main/scala/net/liftweb/amqp/
   AMQPDispatcher.scala b/lift-modules/lift-amqp/src/main/scala/net/
   liftweb/amqp/AMQPDispatcher.scala
   index 26bca73..96c66c9 100644
   --- a/lift-modules/lift-amqp/src/main/scala/net/liftweb/amqp/
   AMQPDispatcher.scala
   +++ b/lift-modules/lift-amqp/src/main/scala/net/liftweb/amqp/
   AMQPDispatcher.scala
   @@ -91,7 +91,7 @@ abstract class AMQPDispatcher[T](cf:
   ConnectionFactory, host: String, port: Int)
   class SerializedConsumer[T](channel: Channel, a: LiftActor) extends
   DefaultConsumer(channel) {
     override def handleDelivery(tag: String, env: Envelope, props:
   AMQP.BasicProperties, body: Array[Byte]) {
       val routingKey = env.getRoutingKey
   -    val contentType = props.contentType
   +    val contentType = props.getContentType
       val deliveryTag = env.getDeliveryTag
       val in = new ObjectInputStream(new ByteArrayInputStream(body))
       val t = in.readObject.asInstanceOf[T];
   @@ -109,14 +109,12 @@ class SerializedConsumer[T](channel: Channel, a:
   LiftActor) extends DefaultConsu
   class ExampleSerializedAMQPDispatcher[T](factory: ConnectionFactory,
   host: String, port: Int)
       extends AMQPDispatcher[T](factory, host, port) {
     override def configure(channel: Channel) {
   -    // Get the ticket.
   -    val ticket = channel.accessRequest(/data)
       // Set up the exchange and queue
   -    channel.exchangeDeclare(ticket, mult, direct)
   -    channel.queueDeclare(ticket, mult_queue)
   -    channel.queueBind(ticket, mult_queue, mult, routeroute)
   +    channel.exchangeDeclare(mult, direct)
   +    channel.queueDeclare(mult_queue)
   +    channel.queueBind(mult_queue, mult, routeroute)
       // Use the short version of the basicConsume method for
   convenience.
   -    channel.basicConsume(ticket, mult_queue, false, new
   SerializedConsumer(channel, this))
   +    channel.basicConsume(mult_queue, false, new SerializedConsumer
   (channel, this))
     }
   }

   diff --git a/lift-modules/lift-amqp/src/main/scala/net/liftweb/amqp/
   AMQPSender.scala b/lift-modules/lift-amqp/src/main/scala/net/liftweb/
   amqp/AMQPSender.scala
   index 2c60ed6..dc29a2a 100644
   --- a/lift-modules/lift-amqp/src/main/scala/net/liftweb/amqp/
   AMQPSender.scala
   +++ b/lift-modules/lift-amqp/src/main/scala/net/liftweb/amqp/
   AMQPSender.scala
   @@ -14,11 +14,6 @@ import _root_.java.io.ObjectOutputStream
   abstract class AMQPSender[T](cf: ConnectionFactory, host: String,
   port: Int, exchange: String, routingKey: String) extends LiftActor {
     val conn = cf.newConnection(host, port)
     val channel = conn.createChannel()
   -  val ticket = configure(channel)
   -  /**
   -   * Override this to use your own AMQP queue/exchange with the given
   channel.
   -   */
   -  def configure(channel: Channel): Int

     def send(msg: T) {
       // Now write an object to a byte array and shove it across the
   wire.
   @@ -26,7 +21,7 @@ abstract class AMQPSender[T](cf: ConnectionFactory,
   host: String, port: Int, exc
       val store = new ObjectOutputStream(bytes)
       store.writeObject(msg)
       store.close
   -    channel.basicPublish(ticket, exchange, routingKey, null,
   bytes.toByteArray)
   +    channel.basicPublish(exchange, routingKey, null,
   

[Lift] ANN: Akka 0.6 is released

2010-01-05 Thread Jonas Bonér
Hi.

I am proud to announce the release of Akka 0.6. It is a major release in
many ways.
Many people have made this happen. Especially the great
teamhttp://doc.akkasource.org/team but
also many of the users on the mailing list.
Thank you all.

Download Akka 0.6
herehttp://cloud.github.com/downloads/jboner/akka/akka-0.6.zip
.

The full release notes is available at
herehttp://doc.akkasource.org/release-notes,
but here is a summary of the highlights.

   - New STM impl with a declarative, a high-order fun and a monadic API
   - New persistence module backends; Redis, Cassandra, MongoDB, works with
   STM
   - Much improved performance; Akka is now 2-3 times faster than Scala
   Actors (both event and thread-based) in
   http://shootout.alioth.debian.org/ benchmark.
   - Much improved memory footprint; an Actor consumes ~600 bytes, can now
   create 6.5 million on 4 G RAM
   - Much improved Remote Actors; reconnect, compression, implicit sender,
   supervision across nodes etc.
   - Comet bindings for Actors
   - REST bindings for Actors
   - Cluster Membership protocol; nodes find each other automatically,
   simple API
   - Security module; HTTP digest and Kerberos
   - Many new Serializers; SBinary, JSON, Protobuf etc.
   - AMQP integration
   - Lift integration
   - Spring integration (in progress)
   - Guice integration
   - Microkernel

New home at http://akkasource.org
http://akkasource.orgNew docs at http://doc.akkasource.org
New tutorial at http://jonasboner.com/2010/01/04/introducing-akka.html

Feedback is most welcome. Join the mailing list and help us make it better.

Thanks.
--
Jonas Bonér

twitter: @jboner
blog:http://jonasboner.com
work:   http://scalablesolutions.se
code:   http://github.com/jboner
code:   http://akkasource.org
also:http://letitcrash.com

--

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




Re: [Lift] ANN: Akka 0.6 is released

2010-01-05 Thread Timothy Perrett
Congratulations all... you guys have put so much effort into Akka and its a 
really great framework; cant wait to see what is in store down the track!

Cheers, Tim 

On 5 Jan 2010, at 13:34, Jonas Bonér wrote:

 Hi.
 
 I am proud to announce the release of Akka 0.6. It is a major release in many 
 ways. 
 Many people have made this happen. Especially the great team but also many of 
 the users on the mailing list. 
 Thank you all. 
 
 Download Akka 0.6 here.
 
 The full release notes is available at here, but here is a summary of the 
 highlights.
   • New STM impl with a declarative, a high-order fun and a monadic API
   • New persistence module backends; Redis, Cassandra, MongoDB, works 
 with STM
   • Much improved performance; Akka is now 2-3 times faster than Scala 
 Actors (both event and thread-based) in http://shootout.alioth.debian.org/ 
 benchmark.
   • Much improved memory footprint; an Actor consumes ~600 bytes, can now 
 create 6.5 million on 4 G RAM
   • Much improved Remote Actors; reconnect, compression, implicit sender, 
 supervision across nodes etc.
   • Comet bindings for Actors
   • REST bindings for Actors
   • Cluster Membership protocol; nodes find each other automatically, 
 simple API 
   • Security module; HTTP digest and Kerberos
   • Many new Serializers; SBinary, JSON, Protobuf etc.
   • AMQP integration
   • Lift integration
   • Spring integration (in progress)
   • Guice integration
   • Microkernel
 New home at http://akkasource.org
 New docs at http://doc.akkasource.org
 New tutorial at http://jonasboner.com/2010/01/04/introducing-akka.html
 
 Feedback is most welcome. Join the mailing list and help us make it better.
 
 Thanks.  
 --
 Jonas Bonér
 
 twitter: @jboner
 blog:http://jonasboner.com
 work:   http://scalablesolutions.se
 code:   http://github.com/jboner
 code:   http://akkasource.org
 also:http://letitcrash.com
 
 
 
 
 --
 
 You received this message because you are subscribed to the Google Groups 
 Lift group.
 To post to this group, send email to lift...@googlegroups.com.
 To unsubscribe from this group, send email to 
 liftweb+unsubscr...@googlegroups.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] ANN: Akka 0.6 is released

2010-01-05 Thread Jonas Bonér
Thanks Tim. You are part of the story. Thanks.

2010/1/5 Timothy Perrett timo...@getintheloop.eu

 Congratulations all... you guys have put so much effort into Akka and its a
 really great framework; cant wait to see what is in store down the track!

 Cheers, Tim

 On 5 Jan 2010, at 13:34, Jonas Bonér wrote:

  Hi.
 
  I am proud to announce the release of Akka 0.6. It is a major release in
 many ways.
  Many people have made this happen. Especially the great team but also
 many of the users on the mailing list.
  Thank you all.
 
  Download Akka 0.6 here.
 
  The full release notes is available at here, but here is a summary of the
 highlights.
• New STM impl with a declarative, a high-order fun and a monadic
 API
• New persistence module backends; Redis, Cassandra, MongoDB, works
 with STM
• Much improved performance; Akka is now 2-3 times faster than
 Scala Actors (both event and thread-based) in
 http://shootout.alioth.debian.org/ benchmark.
• Much improved memory footprint; an Actor consumes ~600 bytes, can
 now create 6.5 million on 4 G RAM
• Much improved Remote Actors; reconnect, compression, implicit
 sender, supervision across nodes etc.
• Comet bindings for Actors
• REST bindings for Actors
• Cluster Membership protocol; nodes find each other automatically,
 simple API
• Security module; HTTP digest and Kerberos
• Many new Serializers; SBinary, JSON, Protobuf etc.
• AMQP integration
• Lift integration
• Spring integration (in progress)
• Guice integration
• Microkernel
  New home at http://akkasource.org
  New docs at http://doc.akkasource.org
  New tutorial at http://jonasboner.com/2010/01/04/introducing-akka.html
 
  Feedback is most welcome. Join the mailing list and help us make it
 better.
 
  Thanks.
  --
  Jonas Bonér
 
  twitter: @jboner
  blog:http://jonasboner.com
  work:   http://scalablesolutions.se
  code:   http://github.com/jboner
  code:   http://akkasource.org
  also:http://letitcrash.com
 
 
 
 
  --
 
  You received this message because you are subscribed to the Google Groups
 Lift group.
  To post to this group, send email to lift...@googlegroups.com.
  To unsubscribe from this group, send email to
 liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com
 .
  For more options, visit this group at
 http://groups.google.com/group/liftweb?hl=en.

 --

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





-- 
Jonas Bonér

twitter: @jboner
blog:http://jonasboner.com
work:   http://scalablesolutions.se
code:   http://github.com/jboner
code:   http://akkasource.org
also:http://letitcrash.com

--

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




Re: [Lift] Re: multiple forms on a page.

2010-01-05 Thread Naftoli Gugenheim
Just move var localNote ... to before def doReply() ...

-
daiwheadaiw...@gmail.com wrote:

Thanks David. But this seems not work as wished. It will meet some
error:

[INFO] Compiling 1 source files to /home/daiwhea/myworks/java/
liftonscala/MapperBBS/target/classes
/home/daiwhea/myworks/java/liftonscala/MapperBBS/src/main/scala/com/
vapee/main/snippet/GuestBook.scala:60: error: forward reference
extends over definition of variable localNote
  localNote.save
  ^
one error found
[INFO]

[ERROR] BUILD ERROR



Is there any error I made? Below is part of the GuestBook.scala for
list snippet:

  def list(html: NodeSeq): NodeSeq = {
toShow.flatMap(item = {
curListNote = item
bind(item, html,
  title - item.title,
  email - item.email,
  content - item.content,
  reply - getReplyContent(item)
)
  }
)
  }

  def replyNote(html: NodeSeq): NodeSeq = {
def doReply() = {
  localNote.save
}

var localNote = curListNote

bind(note, html,
  replyContent - SHtml.textarea(localNote.replyContent,
   localNote.replyContent(_)),
  submit - SHtml.submit(Reply, doReply)
)
  }

  private def toShow = GuestNote.findAll()

  var curListNote: GuestNote = _

  private def getReplyContent(item: GuestNote) = {
if (item.repliedByAdmin == 0) {
  divpNot replied by admin/plift:embed what=/templates-
hidden/gbook/replyForm //div
}
else
  divp{Replied by admin at: +item.replyTime}/plift:embed
what=/templates-hidden/gbook/replyForm //div
  }

--

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

2010-01-05 Thread daiwhea
my issue is:

There are some text input by users. There are new line character(\r\n)
in these text. I want to convert those new line characters into br /

In the snippet, I put p{note.replyContent.replaceAll(\n, br /)}
/p. But the converted br / was changed to lt;br /gt; by lift.

So, my question is: In lift, how can I convert those new lines into
br / tags?

Thanks in advance. ^_^

--

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

2010-01-05 Thread Naftoli Gugenheim
I don't know the exact reason, but the parameter to the RequestVar constructor 
is a call by name, which means it's a function that can be re-evaluated. 
Normally this value is recalculated at the start of each request. In any case 
its seems that in your case they're being recalculated and restored to before 
you modified them. However in the first case that means referencing a variable 
that holds the change.

-
Adam Warskia...@warski.org wrote:

Hello,

 I think the difference is in showAll scope. It was implemented for non
 Ajax context (just for msgs snippet) but it wasn't implemented for
 Ajax (as far as I can tell).
 
 Ajax notices (if there are any) are appended to user's JsCmd response.
 But this code has no idea about the showAll snippet attribute.
 Therefore ajax notices that are associates with an ID will not be
 shown in lift:Msgs showAll=true/ 's real estate.
 
 Please open a defect for this.
I think I more or less understand :)
Here's the defect: http://github.com/dpp/liftweb/issues/#issue/271

By the way, do you have any idea why my example application produces such weird 
results?
I looked in the RequestVar code and didn't find anything there that would make 
it behave differently in the two scenarios.

Adam


 Br's,
 Marius
 
 On Jan 5, 9:37 am, Adam Warski a...@warski.org wrote:
 Hello,
 
 Ah, I didn't spot this. I only have:
 
 lift:Msgs showAll=true/
 
 which would suggest that it should show all errors.
 And anyway, why does it work then with normal form submit, and doesn't with 
 ajax form submit?
 
 Adam
 
 On Jan 4, 2010, at 9:14 PM, Ross Mellgren wrote:
 
 S.error(NodeSeq) and S.error(List[FieldError]) differ in that the  
 latter registers errors against particular fields, and the former is a  
 page-wide error. The latter is more like S.error(String, NodeSeq). Do  
 you have Msg snippets for each field, like this?
 
 ... field ... lift:msg id=my_field_id /
 
 (see net.liftweb.builtin.snippet.Msg for a better example)
 
 Hope that helps,
 -Ross
 
 On Jan 4, 2010, at 3:10 PM, Adam Warski wrote:
 
 Hello,
 
 investigating further making the tutorial form submittable with  
 ajax, I found some weird behavior; I'm using 1.1-M8.
 
 It seems that when the form is submitted with ajax, and there are  
 form validation errors, the error is not shown. However, the notices  
 work fine. So:
 - S.notice(Added +todo.desc); shows the notice after the ajax form  
 submit
 - S.error(xs); doesn't, only if the form is submitted in the regular  
 way
 
 I didn't manage to find the problem yet, but if instead of calling  
 S.error(xs); I do:
 xs.map {i = S.error(i.msg) };
 the error is shown.
 
 The error(n: NodeSeq)  and error(vi: List[FieldError]) don't seem to  
 differ a lot, but there must be something special about the second.
 
 I tried to reproduce the problem using a simple application, but  
 there I found  another strange thing.
 The app is:
 
 object Test {
 def main(args: Array[String]) {
   val z = new ListBuffer[String]
   object x extends RequestVar(z)
   x += a
 
   object y extends RequestVar(new ListBuffer[String])
   y += b
 
   println(x.is)
   println(y.is)
 }
 }
 
 and prints out:
 ListBuffer(a)
 ListBuffer()
 
 so for some reason, if the initial value of the RequestVar is passed  
 without an intermediate val, the list content isn't modified.
 But it could be that I'm using the RequestVar outside of it's  
 intended environment which may be the cause ;).
 
 --
 Adam
 
 --
 
 You received this message because you are subscribed to the Google  
 Groups Lift group.
 To post to this group, 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.


--

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

Re: [Lift] Re: Errors not shown after AJAX form submit

2010-01-05 Thread Adam Warski
Ah so it's treated as a new request each time.
Clear now, thanks :)

Adam

On Jan 5, 2010, at 3:31 PM, Naftoli Gugenheim wrote:

 I don't know the exact reason, but the parameter to the RequestVar 
 constructor is a call by name, which means it's a function that can be 
 re-evaluated. Normally this value is recalculated at the start of each 
 request. In any case its seems that in your case they're being recalculated 
 and restored to before you modified them. However in the first case that 
 means referencing a variable that holds the change.
 
 -
 Adam Warskia...@warski.org wrote:
 
 Hello,
 
 I think the difference is in showAll scope. It was implemented for non
 Ajax context (just for msgs snippet) but it wasn't implemented for
 Ajax (as far as I can tell).
 
 Ajax notices (if there are any) are appended to user's JsCmd response.
 But this code has no idea about the showAll snippet attribute.
 Therefore ajax notices that are associates with an ID will not be
 shown in lift:Msgs showAll=true/ 's real estate.
 
 Please open a defect for this.
 I think I more or less understand :)
 Here's the defect: http://github.com/dpp/liftweb/issues/#issue/271
 
 By the way, do you have any idea why my example application produces such 
 weird results?
 I looked in the RequestVar code and didn't find anything there that would 
 make it behave differently in the two scenarios.
 
 Adam
 
 
 Br's,
 Marius
 
 On Jan 5, 9:37 am, Adam Warski a...@warski.org wrote:
 Hello,
 
 Ah, I didn't spot this. I only have:
 
 lift:Msgs showAll=true/
 
 which would suggest that it should show all errors.
 And anyway, why does it work then with normal form submit, and doesn't with 
 ajax form submit?
 
 Adam
 
 On Jan 4, 2010, at 9:14 PM, Ross Mellgren wrote:
 
 S.error(NodeSeq) and S.error(List[FieldError]) differ in that the  
 latter registers errors against particular fields, and the former is a  
 page-wide error. The latter is more like S.error(String, NodeSeq). Do  
 you have Msg snippets for each field, like this?
 
 ... field ... lift:msg id=my_field_id /
 
 (see net.liftweb.builtin.snippet.Msg for a better example)
 
 Hope that helps,
 -Ross
 
 On Jan 4, 2010, at 3:10 PM, Adam Warski wrote:
 
 Hello,
 
 investigating further making the tutorial form submittable with  
 ajax, I found some weird behavior; I'm using 1.1-M8.
 
 It seems that when the form is submitted with ajax, and there are  
 form validation errors, the error is not shown. However, the notices  
 work fine. So:
 - S.notice(Added +todo.desc); shows the notice after the ajax form  
 submit
 - S.error(xs); doesn't, only if the form is submitted in the regular  
 way
 
 I didn't manage to find the problem yet, but if instead of calling  
 S.error(xs); I do:
 xs.map {i = S.error(i.msg) };
 the error is shown.
 
 The error(n: NodeSeq)  and error(vi: List[FieldError]) don't seem to  
 differ a lot, but there must be something special about the second.
 
 I tried to reproduce the problem using a simple application, but  
 there I found  another strange thing.
 The app is:
 
 object Test {
 def main(args: Array[String]) {
  val z = new ListBuffer[String]
  object x extends RequestVar(z)
  x += a
 
  object y extends RequestVar(new ListBuffer[String])
  y += b
 
  println(x.is)
  println(y.is)
 }
 }
 
 and prints out:
 ListBuffer(a)
 ListBuffer()
 
 so for some reason, if the initial value of the RequestVar is passed  
 without an intermediate val, the list content isn't modified.
 But it could be that I'm using the RequestVar outside of it's  
 intended environment which may be the cause ;).
 
 --
 Adam
 
 --
 
 You received this message because you are subscribed to the Google  
 Groups Lift group.
 To post to this group, 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.
 
 
 --
 
 

Re: [Lift] new line to br /

2010-01-05 Thread Alex Boisvert
The problem is that you're creating a String (not a NodeSeq) and the String
content is being escaped inside the wrapping elements.

Try this,

p { note.replyContent split '\n' map { Text(_) ++ br/ } reduceLeft (_ ++
_) } /p

alex

On Tue, Jan 5, 2010 at 9:24 AM, daiwhea daiw...@gmail.com wrote:

 my issue is:

 There are some text input by users. There are new line character(\r\n)
 in these text. I want to convert those new line characters into br /

 In the snippet, I put p{note.replyContent.replaceAll(\n, br /)}
 /p. But the converted br / was changed to lt;br /gt; by lift.

 So, my question is: In lift, how can I convert those new lines into
 br / tags?

 Thanks in advance. ^_^

 --

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




--

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




Re: [Lift] new line to br /

2010-01-05 Thread Naftoli Gugenheim
I don't know the exact syntax offhand, but you could probably to a split on the 
string to divide it into lines, followed by a foldLeft to convert each line 
into a Text and a br.

-
daiwheadaiw...@gmail.com wrote:

my issue is:

There are some text input by users. There are new line character(\r\n)
in these text. I want to convert those new line characters into br /

In the snippet, I put p{note.replyContent.replaceAll(\n, br /)}
/p. But the converted br / was changed to lt;br /gt; by lift.

So, my question is: In lift, how can I convert those new lines into
br / tags?

Thanks in advance. ^_^

--

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

2010-01-05 Thread Jim Wise

 I can answer b) -- S.param(image).flatMap(asLong)

 asLong comes from BasicTypesHelpers.

 -Ross

One more quick question about this, more of a Scala question really:
I've noticed both here and in the examples that there is a tendency to
use flatMap() instead of map().  I understand the differences between
the two, but am not sure why flatMap is preferred when there aren't
Lists involved.  Any reason?  Aren't the two interchangeable in this
case?

Thanks,
-- 
Jim Wise
jw...@draga.com


pgpAa00XxSc5y.pgp
Description: PGP signature


Re: [Lift] Safe handling of long params

2010-01-05 Thread Naftoli Gugenheim
map would result in a Box[Box[Long]]

-
Jim Wisejw...@draga.com wrote:


 I can answer b) -- S.param(image).flatMap(asLong)

 asLong comes from BasicTypesHelpers.

 -Ross

One more quick question about this, more of a Scala question really:
I've noticed both here and in the examples that there is a tendency to
use flatMap() instead of map().  I understand the differences between
the two, but am not sure why flatMap is preferred when there aren't
Lists involved.  Any reason?  Aren't the two interchangeable in this
case?

Thanks,
-- 
Jim Wise
jw...@draga.com

--

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




Re: [Lift] Safe handling of long params

2010-01-05 Thread Ross Mellgren
They aren't. Here are the type signatures for map and flatMap, from  
Box (the type on Seq is the same, but not specialized to the Box  
return type):

def map[B](f: A = B): Box[B]
def flatMap[B](f: A = Box[B]): Box[B]

The key is the return type of f -- in map, it always returns what  
goes in the Full box, whereas in flatMap it returns any type of box  
(which could be empty, failure, etc).

To illustrate better, here are some examples:

def f1(i: Int): String = i.toString

Full(1).map(f1) // result is Full(1)
Full(2).map(f1) // result is Full(2)
Empty.map(f1) // result is Empty (f1 never applied)
Failure(...).map(f1) // result is Failure (f1 never applied)

def f2(i: Int): Box[String] = if (i % 2 == 0) Full(i.toString) else  
Failure(number is not even)

Full(1).flatMap(f2) // result is Failure(number is not even, ...)
Full(2).flatMap(f2) // result is Full(2)
Empty.flatMap(f2) // result is Empty (f2 never applied)
Failure(...).flatMap(f2) // result is Failure (f2 never applied)

As you can see, functions passed to map can never fail, that is,  
they can never cause a Box to become empty. The result of a map is as  
empty as the input to it.

Conversely, with flatMap the function passed in can fail, making a  
non-Full box.

So, flatMap is used for chaining together computations (functions)  
that can fail, whereas map is used for computations that can't fail  
(barring exceptions)

This ties in with the collection-like view of a Box, which can be  
views as a single-element collection (Full) or empty collection  
(Empty, Failure) where the empty collection might have some extra  
information about why the collection is empty.

In your case, asLong is:

def asLong(s: String): Box[Long]

So if you used map:

Full(1234).map(asLong) // result is Full(Full(1234)), because the  
result of asLong went into the Full that map creates

Conversely, flatMap removes a level of structure:

Full(1234).flatMap(asLong) // result is Full(1234)

Hope that helps,
-Ross


On Jan 5, 2010, at 10:45 AM, Jim Wise wrote:


 I can answer b) -- S.param(image).flatMap(asLong)

 asLong comes from BasicTypesHelpers.

 -Ross

 One more quick question about this, more of a Scala question really:
 I've noticed both here and in the examples that there is a tendency to
 use flatMap() instead of map().  I understand the differences between
 the two, but am not sure why flatMap is preferred when there aren't
 Lists involved.  Any reason?  Aren't the two interchangeable in this
 case?

 Thanks,
 -- 
   Jim Wise
   jw...@draga.com

--

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




Re: [Lift] Safe handling of long params

2010-01-05 Thread Jim Wise
Ross Mellgren dri...@gmail.com writes:

 In your case, asLong is:

 def asLong(s: String): Box[Long]

 So if you used map:

 Full(1234).map(asLong) // result is Full(Full(1234)), because the  
 result of asLong went into the Full that map creates

 Conversely, flatMap removes a level of structure:

 Full(1234).flatMap(asLong) // result is Full(1234)

 Hope that helps,

It does, thanks!
-- 
Jim Wise
jw...@draga.com


pgpob1HvlWv3g.pgp
Description: PGP signature


[Lift] SessionVars in different snippets

2010-01-05 Thread michall
I have two snippets Login and Profile, and I want to read same object
stored in session, when I use SessionVar it create two different
object:

object user extends SessionVar[Box[User]](Empty) // same in two
snippets

When I set this object in Login.scala :

 val usr = User.find(By(User.login,login))
user.set(usr)

in Profile it's still Empty

why?

--

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

2010-01-05 Thread David Pollak
Congratulations!

On Tue, Jan 5, 2010 at 5:34 AM, Jonas Bonér jbo...@gmail.com wrote:

 Hi.

 I am proud to announce the release of Akka 0.6. It is a major release in
 many ways.
 Many people have made this happen. Especially the great 
 teamhttp://doc.akkasource.org/team but
 also many of the users on the mailing list.
 Thank you all.

 Download Akka 0.6 
 herehttp://cloud.github.com/downloads/jboner/akka/akka-0.6.zip
 .

 The full release notes is available at 
 herehttp://doc.akkasource.org/release-notes,
 but here is a summary of the highlights.

- New STM impl with a declarative, a high-order fun and a monadic API
- New persistence module backends; Redis, Cassandra, MongoDB, works
with STM
- Much improved performance; Akka is now 2-3 times faster than Scala
Actors (both event and thread-based) in
http://shootout.alioth.debian.org/ benchmark.
- Much improved memory footprint; an Actor consumes ~600 bytes, can now
create 6.5 million on 4 G RAM
- Much improved Remote Actors; reconnect, compression, implicit sender,
supervision across nodes etc.
- Comet bindings for Actors
- REST bindings for Actors
- Cluster Membership protocol; nodes find each other automatically,
simple API
- Security module; HTTP digest and Kerberos
- Many new Serializers; SBinary, JSON, Protobuf etc.
- AMQP integration
- Lift integration
- Spring integration (in progress)
- Guice integration
- Microkernel

 New home at http://akkasource.org
  http://akkasource.orgNew docs at http://doc.akkasource.org
 New tutorial at http://jonasboner.com/2010/01/04/introducing-akka.html

 Feedback is most welcome. Join the mailing list and help us make it better.

 Thanks.
 --
 Jonas Bonér

 twitter: @jboner
 blog:http://jonasboner.com
 work:   http://scalablesolutions.se
 code:   http://github.com/jboner
 code:   http://akkasource.org
 also:http://letitcrash.com



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




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

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

To post to this group, send email to lift...@googlegroups.com.

To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.



Re: [Lift] ANN: Akka 0.6 is released

2010-01-05 Thread Jonas Bonér
Thanks

2010/1/5 David Pollak feeder.of.the.be...@gmail.com:
 Congratulations!

 On Tue, Jan 5, 2010 at 5:34 AM, Jonas Bonér jbo...@gmail.com wrote:

 Hi.

 I am proud to announce the release of Akka 0.6. It is a major release in
 many ways.
 Many people have made this happen. Especially the great team but also many
 of the users on the mailing list.
 Thank you all.

 Download Akka 0.6 here.
 The full release notes is available at here, but here is a summary of the
 highlights.

 New STM impl with a declarative, a high-order fun and a monadic API
 New persistence module backends; Redis, Cassandra, MongoDB, works with STM
 Much improved performance; Akka is now 2-3 times faster than Scala Actors
 (both event and thread-based) in http://shootout.alioth.debian.org/
 benchmark.
 Much improved memory footprint; an Actor consumes ~600 bytes, can now
 create 6.5 million on 4 G RAM
 Much improved Remote Actors; reconnect, compression, implicit sender,
 supervision across nodes etc.
 Comet bindings for Actors
 REST bindings for Actors
 Cluster Membership protocol; nodes find each other automatically, simple
 API
 Security module; HTTP digest and Kerberos
 Many new Serializers; SBinary, JSON, Protobuf etc.
 AMQP integration
 Lift integration
 Spring integration (in progress)
 Guice integration
 Microkernel

 New home at http://akkasource.org
 New docs at http://doc.akkasource.org
 New tutorial at http://jonasboner.com/2010/01/04/introducing-akka.html
 Feedback is most welcome. Join the mailing list and help us make it
 better.
 Thanks.
 --
 Jonas Bonér

 twitter: @jboner
 blog:    http://jonasboner.com
 work:   http://scalablesolutions.se
 code:   http://github.com/jboner
 code:   http://akkasource.org
 also:    http://letitcrash.com



 --

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





-- 
Jonas Bonér

twitter: @jboner
blog:http://jonasboner.com
work:   http://scalablesolutions.se
code:   http://github.com/jboner
code:   http://akkasource.org
also:http://letitcrash.com
-- 
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@googlegroups.com.
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en.




[Lift] Question: How to emulate exit behavior with LiftActors

2010-01-05 Thread Jcon
I'm new to scala and lift, and I've been hacking with a LiftActor used
to a local mail server for development based on the post by Ryan
Donahue:
http://groups.google.com/group/liftweb/browse_thread/thread/56002b39aa67aee6/4d3946d145560d3e?lnk=gstq=test+mail#4d3946d145560d3e

However the code in that post uses ActorPing.scheduledAtFixedRate
which has been removed in the lift 1.1-M8 which I'm using, and it also
looks like LiftActors are now the preferred actor library to use.

Question 1:  Given that my LiftActor has to do some cleanup at
shutdown, is a LiftActor even appropriate or should I look at regular
scala actors?  If LiftActor is still usable in that scenario, how can
my LiftActor get a notification that it needs to do cleanup?  The
particular problem I'm having is that Jetty restarts when I change
code, but the smtp server is still bound to the mail port so the
restart fails.  I need to stop the mail server when Jetty restarts.

Question 2: Is there an easier way to configure mail locally for
development?  I know I could create a gmail account and put the
credentials in Boot.scala, but I was hoping for something self-
contained on my local machine.

Here's my code if that helps (probably not since I'm new to scala it
is probably pretty bad):

package com.chariotsolutions.liftexpo

import scala.collection.jcl.MutableIterator.Wrapper
import net.liftweb.util._
import net.liftweb.util.Helpers._
import net.liftweb.actor._
import net.liftweb.common._
import com.dumbster.smtp._

object DumbMail extends LiftActor  {

private var server : Box[SimpleSmtpServer] = Empty
private var port : Int = 25

implicit def javaIteratorToScalaIterator[A](it : java.util.Iterator
[A]) = new Wrapper(it)

def boot(port:Int) = {
println(DumbMail booting)
this.port = port
restartServer
ActorPing.schedule(this, DumbMailEvent, 5 seconds)
}

private def restartServer {
stopServer
server = Full(SimpleSmtpServer.start(port))
}

private def stopServer {
server.map(_.stop)
server = Empty
}

protected def messageHandler = {
case DumbMailEvent = {
  println(DumbMailEvent received)
  server match {
  case Full(s) = {
  if (s.getReceivedEmailSize  0) {
  //val msgs = new Wrapper(s.getReceivedEmail)
  //val msgs = new IteratorWrapper
(s.getReceivedEmail.asInstanceOf [java.util.Iterator[SmtpMessage]])
  for (anyMsg - s.getReceivedEmail) {
  val msg = anyMsg.asInstanceOf[SmtpMessage]
  println(RECEIVED EMAIL
---)
  println(From:  + msg.getHeaderValue(From))
  println(To:  + msg.getHeaderValue(To))
  println(Subject:  + msg.getHeaderValue
(Subject))
  println(Body:  + msg.getBody)
  println
(--)
  }
  restartServer // reset state
  }
  }
  case _ = // do nothing
  }
}
ActorPing.schedule(this, DumbMailEvent, 5 seconds)
case _ = println(Unexpected event received)
}
}

case object DumbMailEvent
-- 
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@googlegroups.com.
To unsubscribe from 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: ANN: Akka 0.6 is released

2010-01-05 Thread Marius
Kudos ! Great stuff.

On Jan 5, 6:52 pm, Jonas Bonér jbo...@gmail.com wrote:
 Thanks

 2010/1/5 David Pollak feeder.of.the.be...@gmail.com:



  Congratulations!

  On Tue, Jan 5, 2010 at 5:34 AM, Jonas Bonér jbo...@gmail.com wrote:

  Hi.

  I am proud to announce the release of Akka 0.6. It is a major release in
  many ways.
  Many people have made this happen. Especially the great team but also many
  of the users on the mailing list.
  Thank you all.

  Download Akka 0.6 here.
  The full release notes is available at here, but here is a summary of the
  highlights.

  New STM impl with a declarative, a high-order fun and a monadic API
  New persistence module backends; Redis, Cassandra, MongoDB, works with STM
  Much improved performance; Akka is now 2-3 times faster than Scala Actors
  (both event and thread-based) in http://shootout.alioth.debian.org/
  benchmark.
  Much improved memory footprint; an Actor consumes ~600 bytes, can now
  create 6.5 million on 4 G RAM
  Much improved Remote Actors; reconnect, compression, implicit sender,
  supervision across nodes etc.
  Comet bindings for Actors
  REST bindings for Actors
  Cluster Membership protocol; nodes find each other automatically, simple
  API
  Security module; HTTP digest and Kerberos
  Many new Serializers; SBinary, JSON, Protobuf etc.
  AMQP integration
  Lift integration
  Spring integration (in progress)
  Guice integration
  Microkernel

  New home at http://akkasource.org
  New docs at http://doc.akkasource.org
  New tutorial at http://jonasboner.com/2010/01/04/introducing-akka.html
  Feedback is most welcome. Join the mailing list and help us make it
  better.
  Thanks.
  --
  Jonas Bonér

  twitter: @jboner
  blog:    http://jonasboner.com
  work:   http://scalablesolutions.se
  code:   http://github.com/jboner
  code:   http://akkasource.org
  also:    http://letitcrash.com

  --

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

 --
 Jonas Bonér

 twitter: @jboner
 blog:    http://jonasboner.com
 work:  http://scalablesolutions.se
 code:  http://github.com/jboner
 code:  http://akkasource.org
 also:    http://letitcrash.com
-- 
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@googlegroups.com.
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en.




Re: [Lift] Re: QueryParams and joins

2010-01-05 Thread David Pollak
Lift uses the SQL IN statement rather than joins.  This has a negative
impact for users of MySQL and Derby.

Try:

TagUser.findAll(By(TagUser.tag, this), In(TagUser.user, User.id,
OrderBy(User.followers_count, Descending), MaxRows[User](10)))



On Mon, Jan 4, 2010 at 11:10 PM, Mads Hartmann mads...@gmail.com wrote:

 My ultimate goal would be to only pull out the top x users. I'm
 currently using the following code to achieve this:

 TagUser.findAll(By(TagUser.tag, this.id)).map(_.user.obj.open_!)
.sort(_.followers_count.is  _.followers_count.is)
   .take(x)

 But im concerned that this creates an instance for each of the users
 in tag tag even though i only need the top x.

 Thanks for helping me out :)

 On Jan 5, 1:47 am, David Pollak feeder.of.the.be...@gmail.com wrote:
  On Mon, Jan 4, 2010 at 3:24 PM, Mads Hartmann mads...@gmail.com wrote:
   Hello, I'm having a problem and I'm sure it's an easy fix for someone
   with a bit more experience
 
   I have 3 model classes: tag, user, tweet and a join class TagUser. A
   tag has a list of users.
 
   If i want all of the users in a tag i use the following code (which
   works):
 
   def users = TagUser.findAll(By(TagUser.tag, this.id)).map
   (_.user.obj.open_!)
 
   my problem is that i can't figure out how to apply queryparams so i
   don't pull out all of the users from the DB if i don't need em. I was
   thinking something like this (doesn't compile):
 
   def getTopUsers(in: Int) :List[User] = {
  TagUser.findAll(By(TagUser.tag, this.id),
 OrderBy(User.followers_count, Descending),
 MaxRows(in))
 
  There is an issue:
 
  OrderBy(User., Descending) // illegal... you can only order by a
  TagUser.xxx field
 
  And a potential issue:
 
  MaxRows[TagUser](in) // sometimes the Type Inferencer doesn't get it
 right.
 
  What's your ultimate goal?
 
 
 
 
 
   }
 
   I get the following error:
   [ERROR] ... error: overloaded method value findAll with alternatives
   (net.liftweb.mapper.QueryParam[scalableKvidr.model.TagUser]*)List
   [scalableKvidr.model.TagUser] and ()List
   [scalableKvidr.model.TagUser] cannot be applied to
   (net.liftweb.mapper.Cmp
   [scalableKvidr.model.TagUser,Long],net.liftweb.mapper.OrderBy
   [scalableKvidr.model.User,Int],net.liftweb.mapper.MaxRows[Nothing])
 
   --
 
   You received this message because you are subscribed to the Google
 Groups
   Lift group.
   To post to this group, send email to lift...@googlegroups.com.
   To unsubscribe from this group, send email to
   liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com
 liftweb%2bunsubscr...@googlegroups.comliftweb%252bunsubscr...@googlegroups.com
   .
   For more options, visit this group at
  http://groups.google.com/group/liftweb?hl=en.
 
  --
  Lift, the simply functional web frameworkhttp://liftweb.net
  Beginning Scalahttp://www.apress.com/book/view/1430219890
  Follow me:http://twitter.com/dpp
  Surf the harmonics

 --

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





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

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

To post to this group, send email to lift...@googlegroups.com.

To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.



Re: [Lift] SessionVars in different snippets

2010-01-05 Thread Naftoli Gugenheim
Each SessionVar is distinct. Create one -- it can be global -- and use it in 
both snippets.

-
michallchen...@gmail.com wrote:

I have two snippets Login and Profile, and I want to read same object
stored in session, when I use SessionVar it create two different
object:

object user extends SessionVar[Box[User]](Empty) // same in two
snippets

When I set this object in Login.scala :

 val usr = User.find(By(User.login,login))
user.set(usr)

in Profile it's still Empty

why?

--

You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@googlegroups.com.
To unsubscribe from 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] Question: How to emulate exit behavior with LiftActors

2010-01-05 Thread David Pollak
On Tue, Jan 5, 2010 at 8:56 AM, Jcon javarad...@gmail.com wrote:

 I'm new to scala and lift, and I've been hacking with a LiftActor used
 to a local mail server for development based on the post by Ryan
 Donahue:

 http://groups.google.com/group/liftweb/browse_thread/thread/56002b39aa67aee6/4d3946d145560d3e?lnk=gstq=test+mail#4d3946d145560d3e

 However the code in that post uses ActorPing.scheduledAtFixedRate
 which has been removed in the lift 1.1-M8 which I'm using, and it also
 looks like LiftActors are now the preferred actor library to use.

 Question 1:  Given that my LiftActor has to do some cleanup at
 shutdown, is a LiftActor even appropriate or should I look at regular
 scala actors?


With a Scala Actor, you can only exit from the current Actor, so you must
send some sort of ShutDown message to the Actor and the Actor would do its
cleanup and then call this.exit().

It's the same scenario with Lift, except you don't do the this.exit() call


  If LiftActor is still usable in that scenario, how can
 my LiftActor get a notification that it needs to do cleanup?


You send a ShutDown message.


  The
 particular problem I'm having is that Jetty restarts when I change
 code, but the smtp server is still bound to the mail port so the
 restart fails.  I need to stop the mail server when Jetty restarts.

 Question 2: Is there an easier way to configure mail locally for
 development?  I know I could create a gmail account and put the
 credentials in Boot.scala, but I was hoping for something self-
 contained on my local machine.


Personally, I run Ubuntu and sendmail on my dev box.



 Here's my code if that helps (probably not since I'm new to scala it
 is probably pretty bad):

 package com.chariotsolutions.liftexpo

 import scala.collection.jcl.MutableIterator.Wrapper
 import net.liftweb.util._
 import net.liftweb.util.Helpers._
 import net.liftweb.actor._
 import net.liftweb.common._
 import com.dumbster.smtp._

 object DumbMail extends LiftActor  {

private var server : Box[SimpleSmtpServer] = Empty
private var port : Int = 25

implicit def javaIteratorToScalaIterator[A](it : java.util.Iterator
 [A]) = new Wrapper(it)

def boot(port:Int) = {
println(DumbMail booting)
this.port = port
restartServer
ActorPing.schedule(this, DumbMailEvent, 5 seconds)
}

private def restartServer {
stopServer
server = Full(SimpleSmtpServer.start(port))
}

private def stopServer {
server.map(_.stop)
server = Empty
}

protected def messageHandler = {
case DumbMailEvent = {
  println(DumbMailEvent received)
  server match {
  case Full(s) = {
  if (s.getReceivedEmailSize  0) {
  //val msgs = new Wrapper(s.getReceivedEmail)
  //val msgs = new IteratorWrapper
 (s.getReceivedEmail.asInstanceOf [java.util.Iterator[SmtpMessage]])
  for (anyMsg - s.getReceivedEmail) {
  val msg = anyMsg.asInstanceOf[SmtpMessage]
  println(RECEIVED EMAIL
 ---)
  println(From:  + msg.getHeaderValue(From))
  println(To:  + msg.getHeaderValue(To))
  println(Subject:  + msg.getHeaderValue
 (Subject))
  println(Body:  + msg.getBody)
  println
 (--)
  }
  restartServer // reset state
  }
  }
  case _ = // do nothing
  }
}
ActorPing.schedule(this, DumbMailEvent, 5 seconds)
case _ = println(Unexpected event received)
}
 }

 case object DumbMailEvent

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






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

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

To post to this group, send email to lift...@googlegroups.com.

To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.



Re: [Lift] Minor breaking changes -- LiftRules.getResourceAsStream and LiftRules.finder

2010-01-05 Thread David Pollak
On Mon, Jan 4, 2010 at 1:03 PM, Alex Boisvert alex.boisv...@gmail.comwrote:

 Instead of:

 LiftRules.getResourceAsStream(name: String): Box[InputStream]

 I'd suggest:

 LiftRules.doWithResource[T](name: String)(f: InputStream = T): Box[T].


Sounds good.  Please open a ticket and make it happen. ;-)


 And if you need laziness, you could use one of the usual suspects: lazy
 val, unapplied function, FatLazy, etc.

 alex


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

 Folks,

 I've changed LiftRules.getResourceAsStream and LiftRules.finder to return
 Box[Applier[InputStream]] rather than Box[InputStream].

 Applier has a single method, apply[T] which takes an InputStream = T and
 insures the InputStream is closed.

 This change is unlikely to impact much code out there, but does make sure
 that InputStreams are closed.

 If any of the folks out there that name things better than I do (at least
 I didn't call it Apply_A_Tron), please feel free to suggest name changes,
 variance changes, etc.

 Thanks,

 David

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

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


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




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

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

To post to this group, send email to lift...@googlegroups.com.

To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.



Re: [Lift] findAll and inner/outer joins

2010-01-05 Thread David Pollak
On Wed, Dec 23, 2009 at 10:18 PM, Dmitry Olyenyov dmitry.olyen...@gmail.com
 wrote:

 Hi!

 Help me, please, with example of inner and outer relations in findAll
 query. Is it possible to do without manual BySQL()? I want to do
 following select:

 select * from payment_order o
 join client c on o.client_id = c.id
 where c.type = 'xxx'
 =
 PaymentOrder.findAll(...)

 I had a lot of googling and didn't found anything...



PaymentOrder.findAll(In(PaymentOrder.client, Client.id, By(Client.type,
foo)))



 --

 You received this message because you are subscribed to the Google Groups
 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] How to remove manyTomany children?

2010-01-05 Thread GA
Hello guys,

I have a table that has a many-to-many relationship with itself.

I manage to add new entries to the relationship table using the 
MapperManyToMany, but I cannot remove entries.

This is the code I am using to remove:

for (entryToRemove - entry.childEntries) {
 val indexOf = entry.childEntries.indexOf(entryToRemove)
 entry.childEntries.remove(indexOf)
}
entry.save

This code is supposed to remove all the entries in the relationship table, but 
it does nothing.

The class I am using to define the ManyToMany table is an extension of Mapper, 
not LongKeyedMapper. This is because I do not really need an extra field just 
for the primary key. Could this be the problem?

Any suggestions?

Thanks in advance,

GA

-- 

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

To post to this group, send email to lift...@googlegroups.com.

To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.



Re: [Lift] How to remove manyTomany children?

2010-01-05 Thread Naftoli Gugenheim
Can you try
entry.childEntries.clear
entry.save
?

-
GAmy_li...@me.com wrote:

Hello guys,

I have a table that has a many-to-many relationship with itself.

I manage to add new entries to the relationship table using the 
MapperManyToMany, but I cannot remove entries.

This is the code I am using to remove:

for (entryToRemove - entry.childEntries) {
 val indexOf = entry.childEntries.indexOf(entryToRemove)
 entry.childEntries.remove(indexOf)
}
entry.save

This code is supposed to remove all the entries in the relationship table, but 
it does nothing.

The class I am using to define the ManyToMany table is an extension of Mapper, 
not LongKeyedMapper. This is because I do not really need an extra field just 
for the primary key. Could this be the problem?

Any suggestions?

Thanks in advance,

GA

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

2010-01-05 Thread GA
It does not work either with the LongKeyedMapper.

Am I doing something wrong?


On Jan 5, 2010, at 7:25 PM, Guillermo Acilu wrote:

 It was the first thing I tried. But it does not work.
 
 I have run out of options now. I am going to try to add a LongKeyMapper to 
 see if the problem gets solved.
 
 
 
 On Jan 5, 2010, at 7:12 PM, Naftoli Gugenheim wrote:
 
 Can you try
 entry.childEntries.clear
 entry.save
 ?
 
 -
 GAmy_li...@me.com wrote:
 
 Hello guys,
 
 I have a table that has a many-to-many relationship with itself.
 
 I manage to add new entries to the relationship table using the 
 MapperManyToMany, but I cannot remove entries.
 
 This is the code I am using to remove:
 
 for (entryToRemove - entry.childEntries) {
 val indexOf = entry.childEntries.indexOf(entryToRemove)
 entry.childEntries.remove(indexOf)
 }
 entry.save
 
 This code is supposed to remove all the entries in the relationship table, 
 but it does nothing.
 
 The class I am using to define the ManyToMany table is an extension of 
 Mapper, not LongKeyedMapper. This is because I do not really need an extra 
 field just for the primary key. Could this be the problem?
 
 Any suggestions?
 
 Thanks in advance,
 
 GA
 
 --
 You received this message because you are subscribed to the Google Groups 
 Lift group.
 To post to this group, send email to lift...@googlegroups.com.
 To unsubscribe from this group, send email to 
 liftweb+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/liftweb?hl=en.
 -- 
 You received this message because you are subscribed to the Google Groups 
 Lift group.
 To post to this group, send email to lift...@googlegroups.com.
 To unsubscribe from 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: QueryParams and joins

2010-01-05 Thread Mads Hartmann
Sure thing, it's quite long though :)

Just one thing, i added the following for it to compile (I want to
return List[User] not List[TagUser] : .map(_.user.obj.open_!)

So in all it looks like this

def getTopUsers(in: Int) :List[User] = {

   TagUser.findAll(By(TagUser.tag, this.id), In(TagUser.user, User.id,
OrderBy(User.followers_count, Descending), MaxRows[User](in)))
  .map(_.user.obj.open_!)

}

Exception occured while processing /
Message: java.lang.NullPointerException
net.liftweb.mapper.In$$anon$3.init(MetaMapper.scala:1206)
net.liftweb.mapper.In$.apply(MetaMapper.scala:1200)
scalableKvidr.model.Tag.getTopUsers(Tag.scala:38)
scalableKvidr.snippet.TagsSnippets$$anonfun$frontpageTags$1.apply
(TagsSnippets.scala:71)
scalableKvidr.snippet.TagsSnippets$$anonfun$frontpageTags$1.apply
(TagsSnippets.scala:68)
scala.List.flatMap(List.scala:1125)
scalableKvidr.snippet.TagsSnippets.frontpageTags(TagsSnippets.scala:
67)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
net.liftweb.util.ClassHelpers$$anonfun$net$liftweb$util$ClassHelpers$
$_invokeMethod$2$$anonfun$apply$7.apply(ClassHelpers.scala:352)
net.liftweb.util.ControlHelpers$class.tryo(ControlHelpers.scala:40)
net.liftweb.util.Helpers$.tryo(Helpers.scala:29)
net.liftweb.util.ControlHelpers$class.tryo(ControlHelpers.scala:55)
net.liftweb.util.Helpers$.tryo(Helpers.scala:29)
net.liftweb.util.ClassHelpers$$anonfun$net$liftweb$util$ClassHelpers$
$_invokeMethod$2.apply(ClassHelpers.scala:352)
net.liftweb.util.ClassHelpers$$anonfun$net$liftweb$util$ClassHelpers$
$_invokeMethod$2.apply(ClassHelpers.scala:352)
scala.Iterator$$anon$14.next(Iterator.scala:267)
scala.Iterator$class.find(Iterator.scala:462)
scala.Iterator$$anon$14.find(Iterator.scala:265)
net.liftweb.util.ClassHelpers$class.net$liftweb$util$ClassHelpers$
$_invokeMethod(ClassHelpers.scala:353)
net.liftweb.util.ClassHelpers$class.invokeMethod(ClassHelpers.scala:
285)
net.liftweb.util.Helpers$.invokeMethod(Helpers.scala:29)
net.liftweb.http.LiftSession$$anonfun$17$$anonfun$apply$33$$anonfun
$apply$36$$anonfun$apply$38.apply(LiftSession.scala:723)
net.liftweb.http.LiftSession$$anonfun$17$$anonfun$apply$33$$anonfun
$apply$36$$anonfun$apply$38.apply(LiftSession.scala:705)
net.liftweb.util.EmptyBox.openOr(Box.scala:372)
net.liftweb.http.LiftSession$$anonfun$17$$anonfun$apply$33$$anonfun
$apply$36.apply(LiftSession.scala:705)
net.liftweb.http.LiftSession$$anonfun$17$$anonfun$apply$33$$anonfun
$apply$36.apply(LiftSession.scala:705)
net.liftweb.util.EmptyBox.openOr(Box.scala:372)
net.liftweb.http.LiftSession$$anonfun$17$$anonfun$apply$33.apply
(LiftSession.scala:704)
net.liftweb.http.LiftSession$$anonfun$17$$anonfun$apply$33.apply
(LiftSession.scala:704)
net.liftweb.http.S$.doSnippet(S.scala:725)
net.liftweb.http.LiftSession$$anonfun$17.apply(LiftSession.scala:702)
net.liftweb.http.LiftSession$$anonfun$17.apply(LiftSession.scala:701)
net.liftweb.util.Full.map(Box.scala:330)
net.liftweb.http.LiftSession.net$liftweb$http$LiftSession$
$processSnippet(LiftSession.scala:701)
net.liftweb.http.LiftSession$$anonfun$_defaultLiftTagProcessing
$1.apply(LiftSession.scala:793)
net.liftweb.http.LiftSession$$anonfun$_defaultLiftTagProcessing
$1.apply(LiftSession.scala:777)
net.liftweb.util.NamedPF.apply(NamedPartialFunction.scala:30)
net.liftweb.util.NamedPF$.apply(NamedPartialFunction.scala:76)
net.liftweb.http.LiftSession$$anonfun$processSurroundAndInclude$1$
$anonfun$apply$49.apply(LiftSession.scala:808)
net.liftweb.http.LiftSession$$anonfun$processSurroundAndInclude$1$
$anonfun$apply$49.apply(LiftSession.scala:808)
net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:65)
net.liftweb.http.S$.setVars(S.scala:623)
net.liftweb.http.LiftSession$$anonfun$processSurroundAndInclude
$1.apply(LiftSession.scala:808)
net.liftweb.http.LiftSession$$anonfun$processSurroundAndInclude
$1.apply(LiftSession.scala:805)
scala.Seq$class.flatMap(Seq.scala:294)
scala.xml.NodeSeq.flatMap(NodeSeq.scala:34)
net.liftweb.http.LiftSession.processSurroundAndInclude
(LiftSession.scala:804)
net.liftweb.http.LiftSession.net$liftweb$http$LiftSession$
$processSurroundElement(LiftSession.scala:948)
net.liftweb.http.LiftSession$$anonfun$_defaultLiftTagProcessing
$1.apply(LiftSession.scala:784)
net.liftweb.http.LiftSession$$anonfun$_defaultLiftTagProcessing
$1.apply(LiftSession.scala:777)

[Lift] Re: QueryParams and joins

2010-01-05 Thread Mads Hartmann
I've got this in my pom.xml

   dependency
  groupIdnet.liftweb/groupId
  artifactIdlift-core/artifactId
  version1.0/version
/dependency

On Jan 5, 8:54 pm, David Pollak feeder.of.the.be...@gmail.com wrote:
 On Tue, Jan 5, 2010 at 11:51 AM, Mads Hartmann mads...@gmail.com wrote:
  Sure thing, it's quite long though :)

  Just one thing, i added the following for it to compile (I want to
  return List[User] not List[TagUser] : .map(_.user.obj.open_!)

  So in all it looks like this

  def getTopUsers(in: Int) :List[User] = {

     TagUser.findAll(By(TagUser.tag, this.id), In(TagUser.user, User.id,
  OrderBy(User.followers_count, Descending), MaxRows[User](in)))
           .map(_.user.obj.open_!)

  }

 What version of Lift?





  Exception occured while processing /
  Message: java.lang.NullPointerException
         net.liftweb.mapper.In$$anon$3.init(MetaMapper.scala:1206)
         net.liftweb.mapper.In$.apply(MetaMapper.scala:1200)
         scalableKvidr.model.Tag.getTopUsers(Tag.scala:38)
         scalableKvidr.snippet.TagsSnippets$$anonfun$frontpageTags$1.apply
  (TagsSnippets.scala:71)
         scalableKvidr.snippet.TagsSnippets$$anonfun$frontpageTags$1.apply
  (TagsSnippets.scala:68)
         scala.List.flatMap(List.scala:1125)
         scalableKvidr.snippet.TagsSnippets.frontpageTags(TagsSnippets.scala:
  67)
         sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         sun.reflect.NativeMethodAccessorImpl.invoke
  (NativeMethodAccessorImpl.java:39)
         sun.reflect.DelegatingMethodAccessorImpl.invoke
  (DelegatingMethodAccessorImpl.java:25)
         java.lang.reflect.Method.invoke(Method.java:597)

   net.liftweb.util.ClassHelpers$$anonfun$net$liftweb$util$ClassHelpers$
  $_invokeMethod$2$$anonfun$apply$7.apply(ClassHelpers.scala:352)
         net.liftweb.util.ControlHelpers$class.tryo(ControlHelpers.scala:40)
         net.liftweb.util.Helpers$.tryo(Helpers.scala:29)
         net.liftweb.util.ControlHelpers$class.tryo(ControlHelpers.scala:55)
         net.liftweb.util.Helpers$.tryo(Helpers.scala:29)

   net.liftweb.util.ClassHelpers$$anonfun$net$liftweb$util$ClassHelpers$
  $_invokeMethod$2.apply(ClassHelpers.scala:352)

   net.liftweb.util.ClassHelpers$$anonfun$net$liftweb$util$ClassHelpers$
  $_invokeMethod$2.apply(ClassHelpers.scala:352)
         scala.Iterator$$anon$14.next(Iterator.scala:267)
         scala.Iterator$class.find(Iterator.scala:462)
         scala.Iterator$$anon$14.find(Iterator.scala:265)
         net.liftweb.util.ClassHelpers$class.net$liftweb$util$ClassHelpers$
  $_invokeMethod(ClassHelpers.scala:353)
         net.liftweb.util.ClassHelpers$class.invokeMethod(ClassHelpers.scala:
  285)
         net.liftweb.util.Helpers$.invokeMethod(Helpers.scala:29)
         net.liftweb.http.LiftSession$$anonfun$17$$anonfun$apply$33$$anonfun
  $apply$36$$anonfun$apply$38.apply(LiftSession.scala:723)
         net.liftweb.http.LiftSession$$anonfun$17$$anonfun$apply$33$$anonfun
  $apply$36$$anonfun$apply$38.apply(LiftSession.scala:705)
         net.liftweb.util.EmptyBox.openOr(Box.scala:372)
         net.liftweb.http.LiftSession$$anonfun$17$$anonfun$apply$33$$anonfun
  $apply$36.apply(LiftSession.scala:705)
         net.liftweb.http.LiftSession$$anonfun$17$$anonfun$apply$33$$anonfun
  $apply$36.apply(LiftSession.scala:705)
         net.liftweb.util.EmptyBox.openOr(Box.scala:372)
         net.liftweb.http.LiftSession$$anonfun$17$$anonfun$apply$33.apply
  (LiftSession.scala:704)
         net.liftweb.http.LiftSession$$anonfun$17$$anonfun$apply$33.apply
  (LiftSession.scala:704)
         net.liftweb.http.S$.doSnippet(S.scala:725)

   net.liftweb.http.LiftSession$$anonfun$17.apply(LiftSession.scala:702)

   net.liftweb.http.LiftSession$$anonfun$17.apply(LiftSession.scala:701)
         net.liftweb.util.Full.map(Box.scala:330)
         net.liftweb.http.LiftSession.net$liftweb$http$LiftSession$
  $processSnippet(LiftSession.scala:701)
         net.liftweb.http.LiftSession$$anonfun$_defaultLiftTagProcessing
  $1.apply(LiftSession.scala:793)
         net.liftweb.http.LiftSession$$anonfun$_defaultLiftTagProcessing
  $1.apply(LiftSession.scala:777)
         net.liftweb.util.NamedPF.apply(NamedPartialFunction.scala:30)
         net.liftweb.util.NamedPF$.apply(NamedPartialFunction.scala:76)
         net.liftweb.http.LiftSession$$anonfun$processSurroundAndInclude$1$
  $anonfun$apply$49.apply(LiftSession.scala:808)
         net.liftweb.http.LiftSession$$anonfun$processSurroundAndInclude$1$
  $anonfun$apply$49.apply(LiftSession.scala:808)
         net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:65)
         net.liftweb.http.S$.setVars(S.scala:623)
         net.liftweb.http.LiftSession$$anonfun$processSurroundAndInclude
  $1.apply(LiftSession.scala:808)
         net.liftweb.http.LiftSession$$anonfun$processSurroundAndInclude
  $1.apply(LiftSession.scala:805)
         scala.Seq$class.flatMap(Seq.scala:294)
         scala.xml.NodeSeq.flatMap(NodeSeq.scala:34)
         

Re: [Lift] Re: QueryParams and joins

2010-01-05 Thread David Pollak
On Tue, Jan 5, 2010 at 12:10 PM, Mads Hartmann mads...@gmail.com wrote:

 I've got this in my pom.xml

   dependency
  groupIdnet.liftweb/groupId
  artifactIdlift-core/artifactId
  version1.0/version
/dependency


Ah hah!

I'd strongly recommend you upgrade to Lift 1.1-M8.  It's faster, more stable
and better supported than 1.0.




 On Jan 5, 8:54 pm, David Pollak feeder.of.the.be...@gmail.com wrote:
  On Tue, Jan 5, 2010 at 11:51 AM, Mads Hartmann mads...@gmail.com
 wrote:
   Sure thing, it's quite long though :)
 
   Just one thing, i added the following for it to compile (I want to
   return List[User] not List[TagUser] : .map(_.user.obj.open_!)
 
   So in all it looks like this
 
   def getTopUsers(in: Int) :List[User] = {
 
  TagUser.findAll(By(TagUser.tag, this.id), In(TagUser.user, User.id,
   OrderBy(User.followers_count, Descending), MaxRows[User](in)))
.map(_.user.obj.open_!)
 
   }
 
  What version of Lift?
 
 
 
 
 
   Exception occured while processing /
   Message: java.lang.NullPointerException
  net.liftweb.mapper.In$$anon$3.init(MetaMapper.scala:1206)
  net.liftweb.mapper.In$.apply(MetaMapper.scala:1200)
  scalableKvidr.model.Tag.getTopUsers(Tag.scala:38)
  
  scalableKvidr.snippet.TagsSnippets$$anonfun$frontpageTags$1.apply
   (TagsSnippets.scala:71)
  
  scalableKvidr.snippet.TagsSnippets$$anonfun$frontpageTags$1.apply
   (TagsSnippets.scala:68)
  scala.List.flatMap(List.scala:1125)
  
  scalableKvidr.snippet.TagsSnippets.frontpageTags(TagsSnippets.scala:
   67)
  sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  sun.reflect.NativeMethodAccessorImpl.invoke
   (NativeMethodAccessorImpl.java:39)
  sun.reflect.DelegatingMethodAccessorImpl.invoke
   (DelegatingMethodAccessorImpl.java:25)
  java.lang.reflect.Method.invoke(Method.java:597)
 
net.liftweb.util.ClassHelpers$$anonfun$net$liftweb$util$ClassHelpers$
   $_invokeMethod$2$$anonfun$apply$7.apply(ClassHelpers.scala:352)
  
  net.liftweb.util.ControlHelpers$class.tryo(ControlHelpers.scala:40)
  net.liftweb.util.Helpers$.tryo(Helpers.scala:29)
  
  net.liftweb.util.ControlHelpers$class.tryo(ControlHelpers.scala:55)
  net.liftweb.util.Helpers$.tryo(Helpers.scala:29)
 
net.liftweb.util.ClassHelpers$$anonfun$net$liftweb$util$ClassHelpers$
   $_invokeMethod$2.apply(ClassHelpers.scala:352)
 
net.liftweb.util.ClassHelpers$$anonfun$net$liftweb$util$ClassHelpers$
   $_invokeMethod$2.apply(ClassHelpers.scala:352)
  scala.Iterator$$anon$14.next(Iterator.scala:267)
  scala.Iterator$class.find(Iterator.scala:462)
  scala.Iterator$$anon$14.find(Iterator.scala:265)
  net.liftweb.util.ClassHelpers$class.net
 $liftweb$util$ClassHelpers$
   $_invokeMethod(ClassHelpers.scala:353)
  
  net.liftweb.util.ClassHelpers$class.invokeMethod(ClassHelpers.scala:
   285)
  net.liftweb.util.Helpers$.invokeMethod(Helpers.scala:29)
  
  net.liftweb.http.LiftSession$$anonfun$17$$anonfun$apply$33$$anonfun
   $apply$36$$anonfun$apply$38.apply(LiftSession.scala:723)
  
  net.liftweb.http.LiftSession$$anonfun$17$$anonfun$apply$33$$anonfun
   $apply$36$$anonfun$apply$38.apply(LiftSession.scala:705)
  net.liftweb.util.EmptyBox.openOr(Box.scala:372)
  
  net.liftweb.http.LiftSession$$anonfun$17$$anonfun$apply$33$$anonfun
   $apply$36.apply(LiftSession.scala:705)
  
  net.liftweb.http.LiftSession$$anonfun$17$$anonfun$apply$33$$anonfun
   $apply$36.apply(LiftSession.scala:705)
  net.liftweb.util.EmptyBox.openOr(Box.scala:372)
  net.liftweb.http.LiftSession$$anonfun$17$$anonfun$apply$33.apply
   (LiftSession.scala:704)
  net.liftweb.http.LiftSession$$anonfun$17$$anonfun$apply$33.apply
   (LiftSession.scala:704)
  net.liftweb.http.S$.doSnippet(S.scala:725)
 
net.liftweb.http.LiftSession$$anonfun$17.apply(LiftSession.scala:702)
 
net.liftweb.http.LiftSession$$anonfun$17.apply(LiftSession.scala:701)
  net.liftweb.util.Full.map(Box.scala:330)
  net.liftweb.http.LiftSession.net$liftweb$http$LiftSession$
   $processSnippet(LiftSession.scala:701)
  net.liftweb.http.LiftSession$$anonfun$_defaultLiftTagProcessing
   $1.apply(LiftSession.scala:793)
  net.liftweb.http.LiftSession$$anonfun$_defaultLiftTagProcessing
   $1.apply(LiftSession.scala:777)
  net.liftweb.util.NamedPF.apply(NamedPartialFunction.scala:30)
  net.liftweb.util.NamedPF$.apply(NamedPartialFunction.scala:76)
  
  net.liftweb.http.LiftSession$$anonfun$processSurroundAndInclude$1$
   $anonfun$apply$49.apply(LiftSession.scala:808)
  
  net.liftweb.http.LiftSession$$anonfun$processSurroundAndInclude$1$
   $anonfun$apply$49.apply(LiftSession.scala:808)
  net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:65)
  net.liftweb.http.S$.setVars(S.scala:623)
  net.liftweb.http.LiftSession$$anonfun$processSurroundAndInclude
   

[Lift] Re: Question: How to emulate exit behavior with LiftActors

2010-01-05 Thread Jcon
Great, thanks.  Added a shutdown message that my actor responds to and
added the following to Boot.scala:

   LiftRules.unloadHooks append(() = DumbMail ! DumbMailShutdown)

And now my mail actor cleans up appropriately when Jetty restarts.
Good learning exercise.  I may also try to configure a local smtp
server (postfix on my Mac) as suggested.
-- 
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@googlegroups.com.
To unsubscribe from 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 remove manyTomany children?

2010-01-05 Thread Naftoli Gugenheim
Are they not getting removed from the collection when you call clear, or are 
they not getting deleted in the database when you call save?
Also, are you trying to delete the actual entity? Clear and remove just delete 
the relationship.

-
GAmy_li...@me.com wrote:

It does not work either with the LongKeyedMapper.

Am I doing something wrong?


On Jan 5, 2010, at 7:25 PM, Guillermo Acilu wrote:

 It was the first thing I tried. But it does not work.
 
 I have run out of options now. I am going to try to add a LongKeyMapper to 
 see if the problem gets solved.
 
 
 
 On Jan 5, 2010, at 7:12 PM, Naftoli Gugenheim wrote:
 
 Can you try
 entry.childEntries.clear
 entry.save
 ?
 
 -
 GAmy_li...@me.com wrote:
 
 Hello guys,
 
 I have a table that has a many-to-many relationship with itself.
 
 I manage to add new entries to the relationship table using the 
 MapperManyToMany, but I cannot remove entries.
 
 This is the code I am using to remove:
 
 for (entryToRemove - entry.childEntries) {
 val indexOf = entry.childEntries.indexOf(entryToRemove)
 entry.childEntries.remove(indexOf)
 }
 entry.save
 
 This code is supposed to remove all the entries in the relationship table, 
 but it does nothing.
 
 The class I am using to define the ManyToMany table is an extension of 
 Mapper, not LongKeyedMapper. This is because I do not really need an extra 
 field just for the primary key. Could this be the problem?
 
 Any suggestions?
 
 Thanks in advance,
 
 GA
 
 --
 You received this message because you are subscribed to the Google Groups 
 Lift group.
 To post to this group, send email to lift...@googlegroups.com.
 To unsubscribe from this group, send email to 
 liftweb+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/liftweb?hl=en.
 -- 
 You received this message because you are subscribed to the Google Groups 
 Lift group.
 To post to this group, send email to lift...@googlegroups.com.
 To unsubscribe from 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.


-- 
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@googlegroups.com.
To unsubscribe from 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: IE6 Strict mode - skip ?xml version 1.0... header

2010-01-05 Thread Alex Black
Yep, that works great, thanks!

 Lift automatically detects IE and IE6 and does the right thing in terms of
 headers as well as the ?xml ? header.  Please take a look at the HTML and
 headers actually emitted when IE6 is detected... it should be correct.





  - Alex

  --

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

 --
 Lift, the simply functional web 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: QueryParams and joins

2010-01-05 Thread Mads Hartmann
I really appreciate you taking the time to help me out.

depedency now is:
dependency
  groupIdnet.liftweb/groupId
  artifactIdlift-core/artifactId
  version1.1-M8/version
/dependency

It compiles just fine, but when i try to start the server i get the
following error:

ERROR - Failed to Boot
java.lang.NoClassDefFoundError: net/liftweb/util/Box
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
at net.liftweb.http.DefaultBootstrap$.boot(LiftRules.scala:1260)
at net.liftweb.http.provider.HTTPProvider$class.bootLift
(HTTPProvider.scala:70)
at net.liftweb.http.LiftFilter.bootLift(LiftServlet.scala:523)
at net.liftweb.http.provider.servlet.ServletFilterProvider$class.init
(ServletFilterProvider.scala:20)
at net.liftweb.http.LiftFilter.init(LiftServlet.scala:523)
at org.mortbay.jetty.servlet.FilterHolder.doStart(FilterHolder.java:
97)
at org.mortbay.component.AbstractLifeCycle.start
(AbstractLifeCycle.java:50)
at org.mortbay.jetty.servlet.ServletHandler.initialize
(ServletHandler.java:662)
at org.mortbay.jetty.servlet.Context.startContext(Context.java:140)
at org.mortbay.jetty.webapp.WebAppContext.startContext
(WebAppContext.java:1250)
at org.mortbay.jetty.handler.ContextHandler.doStart
(ContextHandler.java:517)
at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:
467)
at org.mortbay.jetty.plugin.Jetty6PluginWebAppContext.doStart
(Jetty6PluginWebAppContext.java:115)
at org.mortbay.component.AbstractLifeCycle.start
(AbstractLifeCycle.java:50)
at org.mortbay.jetty.handler.HandlerCollection.doStart
(HandlerCollection.java:152)
at org.mortbay.jetty.handler.ContextHandlerCollection.doStart
(ContextHandlerCollection.java:156)
at org.mortbay.component.AbstractLifeCycle.start
(AbstractLifeCycle.java:50)
at org.mortbay.jetty.handler.HandlerCollection.doStart
(HandlerCollection.java:152)
at org.mortbay.component.AbstractLifeCycle.start
(AbstractLifeCycle.java:50)
at org.mortbay.jetty.handler.HandlerWrapper.doStart
(HandlerWrapper.java:130)
at org.mortbay.jetty.Server.doStart(Server.java:224)
at org.mortbay.component.AbstractLifeCycle.start
(AbstractLifeCycle.java:50)
at org.mortbay.jetty.plugin.Jetty6PluginServer.start
(Jetty6PluginServer.java:132)
at org.mortbay.jetty.plugin.AbstractJettyMojo.startJetty
(AbstractJettyMojo.java:441)
at org.mortbay.jetty.plugin.AbstractJettyMojo.execute
(AbstractJettyMojo.java:383)
at org.mortbay.jetty.plugin.AbstractJettyRunMojo.execute
(AbstractJettyRunMojo.java:210)
at org.mortbay.jetty.plugin.Jetty6RunMojo.execute(Jetty6RunMojo.java:
184)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo
(DefaultPluginManager.java:490)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals
(DefaultLifecycleExecutor.java:694)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal
(DefaultLifecycleExecutor.java:569)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal
(DefaultLifecycleExecutor.java:539)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures
(DefaultLifecycleExecutor.java:387)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments
(DefaultLifecycleExecutor.java:348)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute
(DefaultLifecycleExecutor.java:180)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
at org.apache.maven.cli.compat.CompatibleMain.main
(CompatibleMain.java:60)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:
315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:
430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: java.lang.ClassNotFoundException: net.liftweb.util.Box
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 org.codehaus.classworlds.RealmClassLoader.loadClassDirect
(RealmClassLoader.java:195)
at 

[Lift] Re: Simple deployment of Lift apps on Jetty/Nginx

2010-01-05 Thread Alex Black
 You can have more than one domain per IP address served by different
 applications with Nginx up front.  You can swap from one instance of an
 application to another (semi-seamless upgrades) with Nginx up front.  You
 can front many different Lift instances (some running on other machines)
 with Nginx up front (there are some high volume Lift sites that do this).

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




Re: [Lift] Re: QueryParams and joins

2010-01-05 Thread Ross Mellgren
It looks like you probably have some other dependencies somewhere or  
old jars pointing to the old lift version.


Please first try mvn clean jetty:run, and if that doesn't work, run  
mvn dependency:tree to try and find where the other version of lift- 
webkit is coming from. If you're still stuck, paste the output of  
dependency:tree please!


-Ross

On Jan 5, 2010, at 4:06 PM, Mads Hartmann wrote:


I really appreciate you taking the time to help me out.

depedency now is:
   dependency
 groupIdnet.liftweb/groupId
 artifactIdlift-core/artifactId
 version1.1-M8/version
   /dependency

It compiles just fine, but when i try to start the server i get the
following error:

ERROR - Failed to Boot
java.lang.NoClassDefFoundError: net/liftweb/util/Box
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
at net.liftweb.http.DefaultBootstrap$.boot(LiftRules.scala:1260)
at net.liftweb.http.provider.HTTPProvider$class.bootLift
(HTTPProvider.scala:70)
at net.liftweb.http.LiftFilter.bootLift(LiftServlet.scala:523)
at net.liftweb.http.provider.servlet.ServletFilterProvider$class.init
(ServletFilterProvider.scala:20)
at net.liftweb.http.LiftFilter.init(LiftServlet.scala:523)
at org.mortbay.jetty.servlet.FilterHolder.doStart(FilterHolder.java:
97)
at org.mortbay.component.AbstractLifeCycle.start
(AbstractLifeCycle.java:50)
at org.mortbay.jetty.servlet.ServletHandler.initialize
(ServletHandler.java:662)
at org.mortbay.jetty.servlet.Context.startContext(Context.java:140)
at org.mortbay.jetty.webapp.WebAppContext.startContext
(WebAppContext.java:1250)
at org.mortbay.jetty.handler.ContextHandler.doStart
(ContextHandler.java:517)
at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:
467)
at org.mortbay.jetty.plugin.Jetty6PluginWebAppContext.doStart
(Jetty6PluginWebAppContext.java:115)
at org.mortbay.component.AbstractLifeCycle.start
(AbstractLifeCycle.java:50)
at org.mortbay.jetty.handler.HandlerCollection.doStart
(HandlerCollection.java:152)
at org.mortbay.jetty.handler.ContextHandlerCollection.doStart
(ContextHandlerCollection.java:156)
at org.mortbay.component.AbstractLifeCycle.start
(AbstractLifeCycle.java:50)
at org.mortbay.jetty.handler.HandlerCollection.doStart
(HandlerCollection.java:152)
at org.mortbay.component.AbstractLifeCycle.start
(AbstractLifeCycle.java:50)
at org.mortbay.jetty.handler.HandlerWrapper.doStart
(HandlerWrapper.java:130)
at org.mortbay.jetty.Server.doStart(Server.java:224)
at org.mortbay.component.AbstractLifeCycle.start
(AbstractLifeCycle.java:50)
at org.mortbay.jetty.plugin.Jetty6PluginServer.start
(Jetty6PluginServer.java:132)
at org.mortbay.jetty.plugin.AbstractJettyMojo.startJetty
(AbstractJettyMojo.java:441)
at org.mortbay.jetty.plugin.AbstractJettyMojo.execute
(AbstractJettyMojo.java:383)
at org.mortbay.jetty.plugin.AbstractJettyRunMojo.execute
(AbstractJettyRunMojo.java:210)
at org.mortbay.jetty.plugin.Jetty6RunMojo.execute(Jetty6RunMojo.java:
184)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo
(DefaultPluginManager.java:490)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals
(DefaultLifecycleExecutor.java:694)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal
(DefaultLifecycleExecutor.java:569)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal
(DefaultLifecycleExecutor.java:539)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures
(DefaultLifecycleExecutor.java:387)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments
(DefaultLifecycleExecutor.java:348)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute
(DefaultLifecycleExecutor.java:180)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
at org.apache.maven.cli.compat.CompatibleMain.main
(CompatibleMain.java:60)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:
315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:
430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: java.lang.ClassNotFoundException: net.liftweb.util.Box
   

Re: [Lift] How to remove manyTomany children?

2010-01-05 Thread GA
I would like to remove them from the database, not only the relationship.

How should I do that?

Thanks,


On Jan 5, 2010, at 9:42 PM, Naftoli Gugenheim wrote:

 Are they not getting removed from the collection when you call clear, or are 
 they not getting deleted in the database when you call save?
 Also, are you trying to delete the actual entity? Clear and remove just 
 delete the relationship.
 
 -
 GAmy_li...@me.com wrote:
 
 It does not work either with the LongKeyedMapper.
 
 Am I doing something wrong?
 
 
 On Jan 5, 2010, at 7:25 PM, Guillermo Acilu wrote:
 
 It was the first thing I tried. But it does not work.
 
 I have run out of options now. I am going to try to add a LongKeyMapper to 
 see if the problem gets solved.
 
 
 
 On Jan 5, 2010, at 7:12 PM, Naftoli Gugenheim wrote:
 
 Can you try
 entry.childEntries.clear
 entry.save
 ?
 
 -
 GAmy_li...@me.com wrote:
 
 Hello guys,
 
 I have a table that has a many-to-many relationship with itself.
 
 I manage to add new entries to the relationship table using the 
 MapperManyToMany, but I cannot remove entries.
 
 This is the code I am using to remove:
 
 for (entryToRemove - entry.childEntries) {
 val indexOf = entry.childEntries.indexOf(entryToRemove)
 entry.childEntries.remove(indexOf)
 }
 entry.save
 
 This code is supposed to remove all the entries in the relationship table, 
 but it does nothing.
 
 The class I am using to define the ManyToMany table is an extension of 
 Mapper, not LongKeyedMapper. This is because I do not really need an extra 
 field just for the primary key. Could this be the problem?
 
 Any suggestions?
 
 Thanks in advance,
 
 GA
 
 --
 You received this message because you are subscribed to the Google Groups 
 Lift group.
 To post to this group, send email to lift...@googlegroups.com.
 To unsubscribe from this group, send email to 
 liftweb+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/liftweb?hl=en.
 -- 
 You received this message because you are subscribed to the Google Groups 
 Lift group.
 To post to this group, send email to lift...@googlegroups.com.
 To unsubscribe from 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.
 
 

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

2010-01-05 Thread Naftoli Gugenheim
Just call .delete_! on the entity itself. It should automatically remove the 
relationships.

-
GAmy_li...@me.com wrote:

I would like to remove them from the database, not only the relationship.

How should I do that?

Thanks,


On Jan 5, 2010, at 9:42 PM, Naftoli Gugenheim wrote:

 Are they not getting removed from the collection when you call clear, or are 
 they not getting deleted in the database when you call save?
 Also, are you trying to delete the actual entity? Clear and remove just 
 delete the relationship.
 
 -
 GAmy_li...@me.com wrote:
 
 It does not work either with the LongKeyedMapper.
 
 Am I doing something wrong?
 
 
 On Jan 5, 2010, at 7:25 PM, Guillermo Acilu wrote:
 
 It was the first thing I tried. But it does not work.
 
 I have run out of options now. I am going to try to add a LongKeyMapper to 
 see if the problem gets solved.
 
 
 
 On Jan 5, 2010, at 7:12 PM, Naftoli Gugenheim wrote:
 
 Can you try
 entry.childEntries.clear
 entry.save
 ?
 
 -
 GAmy_li...@me.com wrote:
 
 Hello guys,
 
 I have a table that has a many-to-many relationship with itself.
 
 I manage to add new entries to the relationship table using the 
 MapperManyToMany, but I cannot remove entries.
 
 This is the code I am using to remove:
 
 for (entryToRemove - entry.childEntries) {
 val indexOf = entry.childEntries.indexOf(entryToRemove)
 entry.childEntries.remove(indexOf)
 }
 entry.save
 
 This code is supposed to remove all the entries in the relationship table, 
 but it does nothing.
 
 The class I am using to define the ManyToMany table is an extension of 
 Mapper, not LongKeyedMapper. This is because I do not really need an extra 
 field just for the primary key. Could this be the problem?
 
 Any suggestions?
 
 Thanks in advance,
 
 GA
 
 --
 You received this message because you are subscribed to the Google Groups 
 Lift group.
 To post to this group, send email to lift...@googlegroups.com.
 To unsubscribe from this group, send email to 
 liftweb+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/liftweb?hl=en.
 -- 
 You received this message because you are subscribed to the Google Groups 
 Lift group.
 To post to this group, send email to lift...@googlegroups.com.
 To unsubscribe from 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.
 
 

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

2010-01-05 Thread daiwhea

On Jan 5, 10:18 pm, Naftoli Gugenheim naftoli...@gmail.com wrote:
Just move var localNote ... to before def doReply() ...

-


Thanks Naftoli. It does save a reply to the db after I move var
localNote to before def doReply(). But It will only save reply to the
last note even when I try to reply to the note in the top section.

So, in order to see what happend, I add lift:embed what=/templates-
hidden/gbook/replyForm / no matter the note was replied or not.
When the page loaded, I saw all the textareas in each reply form has
the same reply content of the last note. But both those textareas and
submit buttons have different names. Seems lift doesn't deal the
embeded template content in the snippet properly as wished.

I also test to add eager_eval=true to the list template as:
lift:GuestBook.list eager_eval=true. But this won't help.

Thanks for your time. You're so warmhearted. ^_^


  def replyNote(html: NodeSeq): NodeSeq = {

val localNote = curListNote

def doReply() = {
  localNote.save
}

bind(note, html,
  replyContent - SHtml.textarea(localNote.replyContent,
localNote.replyContent(_)),
  submit - SHtml.submit(Reply, doReply)
)
  }

  private def getReplyContent(item: GuestNote) = {
if (item.repliedByAdmin == 0) {
  divpNot replied by admin/pp{item.replyContent}/
plift:embed what=/templates-hidden/gbook/replyForm //div
}
else
  divp{Replied by admin at: +item.replyTime}/pp
{item.replyContent}/plift:embed what=/templates-hidden/gbook/
replyForm //div
  }
-- 
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@googlegroups.com.
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en.




[Lift] Re: new line to br /

2010-01-05 Thread daiwhea
Thanks Alex.

Yes, this can work. But I wonder how to achieve the require below?

In our old php practice, we often use some jseditor to provide some
kind of WYWG function. So peoples can input text with some style built
in, such as font-size, font-weight, color, background-color or even
insert a online image etc. Then, after submit, the content in db is
some html indeed.

For these html in db, how can I render it properly? Seems Text(_) is
not suitable for this kind of data now.

On Jan 5, 10:47 pm, Alex Boisvert alex.boisv...@gmail.com wrote:
 The problem is that you're creating a String (not a NodeSeq) and the String
 content is being escaped inside the wrapping elements.

 Try this,

 p { note.replyContent split '\n' map { Text(_) ++ br/ } reduceLeft (_ ++
 _) } /p

 alex

 On Tue, Jan 5, 2010 at 9:24 AM, daiwhea daiw...@gmail.com wrote:
  my issue is:

  There are some text input by users. There are new line character(\r\n)
  in these text. I want to convert those new line characters into br /

  In the snippet, I put p{note.replyContent.replaceAll(\n, br /)}
  /p. But the converted br / was changed to lt;br /gt; by lift.

  So, my question is: In lift, how can I convert those new lines into
  br / tags?

  Thanks in advance. ^_^

  --

  You received this message because you are subscribed to the Google Groups
  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: multiple forms on a page.

2010-01-05 Thread David Pollak
The easiest thing to do is for you to post your project as a complete
runnable whole to GitHub (just make a public repository).

I'll clone the repository, fix the issue and you'll see the diff and have a
running project.  Sound good?

On Tue, Jan 5, 2010 at 6:32 PM, daiwhea daiw...@gmail.com wrote:


 On Jan 5, 10:18 pm, Naftoli Gugenheim naftoli...@gmail.com wrote:
 Just move var localNote ... to before def doReply() ...

 -


 Thanks Naftoli. It does save a reply to the db after I move var
 localNote to before def doReply(). But It will only save reply to the
 last note even when I try to reply to the note in the top section.

 So, in order to see what happend, I add lift:embed what=/templates-
 hidden/gbook/replyForm / no matter the note was replied or not.
 When the page loaded, I saw all the textareas in each reply form has
 the same reply content of the last note. But both those textareas and
 submit buttons have different names. Seems lift doesn't deal the
 embeded template content in the snippet properly as wished.

 I also test to add eager_eval=true to the list template as:
 lift:GuestBook.list eager_eval=true. But this won't help.

 Thanks for your time. You're so warmhearted. ^_^


  def replyNote(html: NodeSeq): NodeSeq = {

 val localNote = curListNote

def doReply() = {
  localNote.save
 }

bind(note, html,
  replyContent - SHtml.textarea(localNote.replyContent,
localNote.replyContent(_)),
  submit - SHtml.submit(Reply, doReply)
)
  }

   private def getReplyContent(item: GuestNote) = {
if (item.repliedByAdmin == 0) {
   divpNot replied by admin/pp{item.replyContent}/
 plift:embed what=/templates-hidden/gbook/replyForm //div
}
else
   divp{Replied by admin at: +item.replyTime}/pp
 {item.replyContent}/plift:embed what=/templates-hidden/gbook/
 replyForm //div
  }

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

2010-01-05 Thread daiwhea
Yeah, I'll try Textile later. It's far beyond my ability now. I'm not
so familiar with lift now.

Thanks David. You always help a lot.

On Jan 6, 11:41 am, David Pollak feeder.of.the.be...@gmail.com
wrote:
 On Tue, Jan 5, 2010 at 7:34 PM, daiwhea daiw...@gmail.com wrote:
  Thanks Alex.

  Yes, this can work. But I wonder how to achieve the require below?

  In our old php practice, we often use some jseditor to provide some
  kind of WYWG function. So peoples can input text with some style built
  in, such as font-size, font-weight, color, background-color or even
  insert a online image etc. Then, after submit, the content in db is
  some html indeed.

  For these html in db, how can I render it properly? Seems Text(_) is
  not suitable for this kind of data now.

 You can use scala.xml.Unparsed.  This will pass a String to the XML output
 without transformation.  However, if the String is malformed XML, the
 browser will choke.  If the String contains JavaScript, it could result in
 Cross Site Scripting issues.

 Please take a look at Lift's Textile parser which transforms Strings in
 Textile format to valid, secure XHTML.





  On Jan 5, 10:47 pm, Alex Boisvert alex.boisv...@gmail.com wrote:
   The problem is that you're creating a String (not a NodeSeq) and the
  String
   content is being escaped inside the wrapping elements.

   Try this,

   p { note.replyContent split '\n' map { Text(_) ++ br/ } reduceLeft (_
  ++
   _) } /p

   alex

   On Tue, Jan 5, 2010 at 9:24 AM, daiwhea daiw...@gmail.com wrote:
my issue is:

There are some text input by users. There are new line character(\r\n)
in these text. I want to convert those new line characters into br /

In the snippet, I put p{note.replyContent.replaceAll(\n, br /)}
/p. But the converted br / was changed to lt;br /gt; by lift.

So, my question is: In lift, how can I convert those new lines into
br / tags?

Thanks in advance. ^_^

--

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

.
For more options, visit this group at
   http://groups.google.com/group/liftweb?hl=en.

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

 --
 Lift, the simply functional web 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] Debug message

2010-01-05 Thread Naftoli Gugenheim
What does this message mean?
Msgs: Default Error is not rendered as the default title is the empty string
-- 
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@googlegroups.com.
To unsubscribe from 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: Skittr example in bad shape

2010-01-05 Thread David Pollak
A fix will be up in the next few days.

On Mon, Dec 21, 2009 at 2:03 PM, Vesa brut...@gmail.com wrote:

 Hi,

 I noticed logged in user still can't see messages by other users they
 follow. There were couple of messages still missing parameters. Patch
 shows the parts that need to be modified to get it working again.

 - Vesa

 diff --git a/lift-examples/skittr/src/main/scala/com/skittr/actor/
 UserActor.scala b/lift-examples/skittr/src/main/scala/com/skittr/actor/
 UserActor.scala
 index cb51f45..a057192 100644
 --- a/lift-examples/skittr/src/main/scala/com/skittr/actor/
 UserActor.scala
 +++ b/lift-examples/skittr/src/main/scala/com/skittr/actor/
 UserActor.scala
 @@ -101,7 +101,7 @@ class UserActor extends LiftActor {

   // tell all our friends that we follow them
 case ConfigFollowers =
 -  friends.flatMap(f = UserList.find(f).toList).foreach(_ !
 AddFollower)
 +  friends.flatMap(f = UserList.find(f).toList).foreach(_ !
 AddFollower(this))
   // if the autogen property is set, then have each of the
 actors
   // randomly generate a message
   if (User.shouldAutogen_? || System.getProperty(autogen) !=
 null) autoGen
 @@ -110,11 +110,12 @@ class UserActor extends LiftActor {

   // if we add a friend,
 case AddFriend(name) =
 +
   friends = (name :: friends).sort(_  _)
   // find the user
   UserList.find(name).foreach{
 ua =
 -ua ! AddFollower // tell him we're a follower
 +ua ! AddFollower(this) // tell him we're a follower
 (ua !? GetUserIdAndName) match { // get the user info
   case UserIdInfo(id, _,_, _) = Friend.create.owner
 (userId).friend(id).save // and persist a friend connection in the DB
   case _ =
 @@ -127,7 +128,7 @@ class UserActor extends LiftActor {
   // find the user
   UserList.find(name).foreach{
 ua =
 -ua ! RemoveFollower // tell them we're no longer following
 +ua ! RemoveFollower(this) // tell them we're no longer
 following
 (ua !? GetUserIdAndName) match { // delete from database
   case UserIdInfo(id, _,_,_) = Friend.findAll(By
 (Friend.owner, userId), By(Friend.friend, id)).foreach(_.delete_!)
   case _ =




 On 17 joulu, 16:35, David Pollak feeder.of.the.be...@gmail.com
 wrote:
  On Thu, Dec 17, 2009 at 4:35 AM, Vesa brut...@gmail.com wrote:
   Hi,
 
   I was trying to run the skittr example from the lift-examples and it
   doesn't seem to work. It's demonstrating usage of comet but it doesn't
   get that far as the comet actor never receives any messages due to a
   bug. Also the indentation is a mix of spaces and tabs of different
   width and looks quite messed up. How should I deliver a fix when I'm
   done?
 
  There's a single simple bug.  When we moved from Scala Actors to Lift
  Actors, we moved from a case object AddTimelineViewer to case class
  AddTimelineViewer(who: SimpleActor[Any])  Unfortunately, the compiler
 didn't
  flag the actor ! AddTimelineViewer line as a bug... it converted the line
 to
  actor ! (who = AddTimelineViewer.apply) and passed a function as a
  message.  I've fixed the code locally (WatchUser.scala lines 49-52
 become):
 
override def localSetup {
  userActor = name.flatMap(name = UserList.find(name))
  userActor.foreach{ua = ua ! AddTimelineViewer(this) ;  messages =
 (ua
  !? GetTimeline) match {case Timeline(m) = m; case _ = Nil}}
}
 
  I'll get a patch onto review board by end of day today.
 
 
 
 
 
 
 
   - Vesa
 
   --
 
   You received this message because you are subscribed to the Google
 Groups
   Lift group.
   To post to this group, send email to lift...@googlegroups.com.
   To unsubscribe from this group, send email to
   liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com
 liftweb%2bunsubscr...@googlegroups.comliftweb%252bunsubscr...@googlegroups.com
   .
   For more options, visit this group at
  http://groups.google.com/group/liftweb?hl=en.
 
  --
  Lift, the simply functional web frameworkhttp://liftweb.net
  Beginning Scalahttp://www.apress.com/book/view/1430219890
  Follow me:http://twitter.com/dpp
  Surf the harmonics

 --

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





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

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

To post to this group, send email to lift...@googlegroups.com.

To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com.

For more options, visit this 

[Lift] Lift on Atmosphere

2010-01-05 Thread paksegu
Hello World.
I am a Lift beginner and I would like to know if anyone has
successfully succeeded in running Lift on Atmosphere: 
https://atmosphere.dev.java.net
thanks.
-- 
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@googlegroups.com.
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en.