[Lift] Re: Concurrent Web Service Requests?

2009-09-22 Thread Jeppe Nejsum Madsen

David Pollak  writes:

> I've added code (it's in review board right now) that will automatically
> farm any snippet with the "do:lazy='true'" attribute set.
>
> So,  will execute the foo snippet inline.
>
>  will execute the foo snippet in parallel and join
> the result back to page before its rendered.

Very nice! In what context is the snippet executed? I assume that
all timeout handling, errors etc should be handled by the snippet just
as in the non-lazy fashion?

/Jeppe


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



[Lift] Re: suggestion: strip comments when serving templates

2009-09-22 Thread Jeppe Nejsum Madsen

harryh  writes:

> I would love to add comments to my templates:
>
> 
>
> that got stripped out before being served to end users.

A few thoughts:

- Would also be nice if all excessive white space were stripped from
  the output (not sure how much this matters if it's gzip'ed)

- In dev mode, I think it's important to maintain a 1-1 mapping between
  what's output in the browser and the source template(s)

/Jeppe


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



[Lift] Re: SessionVar.remove() not clearing out the variable

2009-09-22 Thread Dano

Marius,

Thanks for your reply.  If I look in my pom.xml, I see that I am using
1.1-SNAPSHOT.  However, I see your point about the remove() function
not being in Vars.scala.  Not sure why I am able to compile a call to
remove() on a SessionVar - but it does!

My goal is to clear out the SessionVar for all sessions tied to the
variable so that I can return the Session to the state it was at the
beginning of time (at least with respect to the SessionVars).

I have an object contained within a LiftView class called
PartyLobbyUser:

class GameView extends LiftView {
   object PartyLobbyUser extends SessionVar[Box[UserInfo]](Empty)
...
}

This object is set in code called by the GameView.dispatch() function
and then referenced later by some comet actors.  I think the problem I
am having is that since a SessionVar is essentially a thread local
variable, I need to clear it (i.e. do something like PartyLobbyUser
(Empty) ) in the right place.

Perhaps the right context is to do this in the shutdown function of
the comet actors since they are able to reference the variable and get
the correct data (ie. via PartyLobbyUser.is).   I will try that and
report back.

Thanks again for your help.


Dan



On Sep 22, 7:03 pm, "marius d."  wrote:
> On Sep 22, 8:13 pm, Dano  wrote:
>
>
>
>
>
> > Hello Lifters,
>
> > I am struggling with trying to clear out a SessionVar which holds user
> > information which I need to clear out after the user has left a
> > 'lobby' page.
>
> > When I call the remove() function, I verify that the SessionVar is
> > Empty.  However, when I click on the URL for the lobby page with new
> > parameters, the SessionVar retains the old values for each session.
> > It is as if they were repopulated.
>
> > Perhaps I am not understanding out the function works.  When I look at
> > the source code (Vars.scala), it seems like it is clearing out the
> > state for each session.  The remove() function calls clearFunc().
>
> >   override protected def clearFunc(name: String): Unit =
> > S.session.foreach(_.unset(name))
>
> No not for each session. S.session returns a Box which has a foreach
> function, it does not iterate through all sessions.
>
> Which Lift version are you using? .. there is no remove function in
> Vars in 1.1-SNAPSHOT version.
>
> Can you post some code to show where you are setting values on your
> SessionVar and where are you deleting them?
>
>
>
>
>
> > Is there something I am missing?
>
> > Thanks in advance.
>
> > Dan
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: SHtml.a not active when used via innerHtml

2009-09-22 Thread David Pollak
On Tue, Sep 22, 2009 at 7:49 PM, KP  wrote:

>
> Hi all.
>
> I have essentially the following setup in a website:
>
> class AjaxTest {
>   def render =
>  
> foo
> {getAjaxForm}
>  
>
>   def getAjaxForm = SHtml.ajaxForm(
> SHtml.submit("submit", () => ()),
> Run(customJSStr))
>
>   def customJSStr = "document.getElementById('foo').innerHTML = '" +
> aStr + "';"
>

If aStr contains a single or double quote or a non-printable or non-ascii
character, your expression will fail (it will be invalid JavaScript).

I would suggest:

def customJSStr = "document.getElementById('foo').innerHTML = " +aStr.encJs
+ ";"

That will properly escape the string as a JavaScript string.


>
>   val aStr = SHtml.a(() => SetHtml("foo", Text("baz")), Text
> ("bar")).toString
> }
>
>
>
> when aStr is displayed (with text 'bar'), the link is inactive.
>
>
> I'm using Run(customJSStr) instead of SetHtml as, in the actual app,
> the situation is slightly more complicated (and the RHS of the
> assignment operator in the javascript expression has some more stuff
> fetched from the document).
>
> Note also that if the ajaxForm uses SetHtml() instead of Run() it
> works as expected.
>
> So the question is -- is there a straightforward explanation for
> what's going on here (I'm still kinda cargo-culting lift).
>
> And, unconditional upon the answer to the last question, is there a
> way to make aStr a valid, active link (or, I guess, string
> representing one) while retaining the ability to have an arbitrarily
> complex javascript expression in customJSStr (this would actually be
> defined in a separate js file, of course).
>
>
> Thanks much,
> KP
>
> >
>


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

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



[Lift] SHtml.a not active when used via innerHtml

2009-09-22 Thread KP

Hi all.

I have essentially the following setup in a website:

class AjaxTest {
   def render =
  
 foo
 {getAjaxForm}
  

   def getAjaxForm = SHtml.ajaxForm(
 SHtml.submit("submit", () => ()),
 Run(customJSStr))

   def customJSStr = "document.getElementById('foo').innerHTML = '" +
aStr + "';"

   val aStr = SHtml.a(() => SetHtml("foo", Text("baz")), Text
("bar")).toString
}



when aStr is displayed (with text 'bar'), the link is inactive.


I'm using Run(customJSStr) instead of SetHtml as, in the actual app,
the situation is slightly more complicated (and the RHS of the
assignment operator in the javascript expression has some more stuff
fetched from the document).

Note also that if the ajaxForm uses SetHtml() instead of Run() it
works as expected.

So the question is -- is there a straightforward explanation for
what's going on here (I'm still kinda cargo-culting lift).

And, unconditional upon the answer to the last question, is there a
way to make aStr a valid, active link (or, I guess, string
representing one) while retaining the ability to have an arbitrarily
complex javascript expression in customJSStr (this would actually be
defined in a separate js file, of course).


Thanks much,
KP

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



[Lift] Re: SessionVar.remove() not clearing out the variable

2009-09-22 Thread marius d.



On Sep 22, 8:13 pm, Dano  wrote:
> Hello Lifters,
>
> I am struggling with trying to clear out a SessionVar which holds user
> information which I need to clear out after the user has left a
> 'lobby' page.
>
> When I call the remove() function, I verify that the SessionVar is
> Empty.  However, when I click on the URL for the lobby page with new
> parameters, the SessionVar retains the old values for each session.
> It is as if they were repopulated.
>
> Perhaps I am not understanding out the function works.  When I look at
> the source code (Vars.scala), it seems like it is clearing out the
> state for each session.  The remove() function calls clearFunc().
>
>   override protected def clearFunc(name: String): Unit =
> S.session.foreach(_.unset(name))

No not for each session. S.session returns a Box which has a foreach
function, it does not iterate through all sessions.

Which Lift version are you using? .. there is no remove function in
Vars in 1.1-SNAPSHOT version.

Can you post some code to show where you are setting values on your
SessionVar and where are you deleting them?

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



[Lift] SessionVar.remove() not clearing out the variable

2009-09-22 Thread Dano

Hello Lifters,

I am struggling with trying to clear out a SessionVar which holds user
information which I need to clear out after the user has left a
'lobby' page.

When I call the remove() function, I verify that the SessionVar is
Empty.  However, when I click on the URL for the lobby page with new
parameters, the SessionVar retains the old values for each session.
It is as if they were repopulated.

Perhaps I am not understanding out the function works.  When I look at
the source code (Vars.scala), it seems like it is clearing out the
state for each session.  The remove() function calls clearFunc().

  override protected def clearFunc(name: String): Unit =
S.session.foreach(_.unset(name))

Is there something I am missing?

Thanks in advance.


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



[Lift] Re: suggestion: make Mailer use n.l.util.Props

2009-09-22 Thread David Pollak
On Tue, Sep 22, 2009 at 2:48 PM, Richard Dallaway wrote:

>
> Couldn't find a ticket for this, and it'd save us a few lines of code too.
>
> http://github.com/dpp/liftweb/issues/#issue/73
>
> Again, apologies if this is a duplicate.
>

I added this functionality when I did the character set support.  All the
Lift properties are pulled into the mailer properties.


>
> Richard
>
> On Thu, Sep 17, 2009 at 1:15 AM, David Pollak
>  wrote:
> > Open a ticket... I'll see what I can do to merge system properties and
> > Lift's props.
> >
> > On Wed, Sep 16, 2009 at 1:39 PM, harryh  wrote:
> >>
> >> Rather than using System.getProperties should Mailer use
> >> net.liftweb.util.Props?  It seems a little inconsistent as is.
> >>
> >> -harryh
> >>
> >>
> >
> >
> >
> > --
> > Lift, the simply functional web framework http://liftweb.net
> > Beginning Scala http://www.apress.com/book/view/1430219890
> > Follow me: http://twitter.com/dpp
> > Git some: http://github.com/dpp
> >
> > >
> >
>
> >
>


-- 
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
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 liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Concurrent Web Service Requests?

2009-09-22 Thread David Pollak
I've added code (it's in review board right now) that will automatically
farm any snippet with the "do:lazy='true'" attribute set.

So,  will execute the foo snippet inline.

 will execute the foo snippet in parallel and join
the result back to page before its rendered.

This should allow for the use case of going out to ad servers, etc. in
parallel.

On Mon, Sep 21, 2009 at 7:28 PM, espeed  wrote:

>
> On Sep 21, 5:30 pm, David Pollak 
> wrote:
> > Threads are used in Scala actors, but only while processing a message
> (actor
> > jobs are allocated to threads in a thread pool).  In the case of asking
> your
> > external ad server for information, Scala Actors are not going to help
> you
> > because they have not been integrated with the JVM's NIO library (NIO ~=
> > Unix I/O Select)  Erlang's actor scheduler is IO aware, Scala's is not.
>
> Googling for "Scala actors NIO" turned up a recent paper by Matthias
> Schmidt at Sun. There is a section on combing the Scala actor model
> with NIO...
>
> http://blogs.sun.com/schmidtm/entry/high_performance_tcp_ip_programming
>
> http://blogs.sun.com/schmidtm/resource/nio-whitepaper/High-Performance-TCPIP-JVM.edit.Final.Formatted.pdf
>
> I also found this from the upcoming O'Reilly book "Programming Scala,"
> by Dean Wampler and Alex Payne...
>
> Chapter 9. Robust, Scalable Concurrency with Actors
> http://programming-scala.labs.oreilly.com/ch09.html
>
> "The open-source Naggati library adds a Scala-friendly layer atop MINA
> that, according to its author, “makes it easy to build protocol
> filters [using a] sequential style”. Essentially, Naggati is a DSL for
> parsing network protocols, with MINA’s powerful NIO abilities under
> the hood."
>
> - James
>
> >
>


-- 
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 liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: suggestion: strip comments when serving templates

2009-09-22 Thread David Pollak
Turns out that's where I am in the code... I'll add it right now.

On Tue, Sep 22, 2009 at 3:46 PM, harryh  wrote:

>
> I would love to add comments to my templates:
>
> 
>
> that got stripped out before being served to end users.
>
> -harryh
>
> >
>


-- 
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 liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: access to raw HttpServletRequest/Response

2009-09-22 Thread David Pollak
On Tue, Sep 22, 2009 at 3:58 PM, marius d.  wrote:

>
> I really don't think Lift should expose directly expose servlet
> references. Applications still have access to servlet stuff by
> explicit casting.
>
> You can do it today like this:
>
> S.containerRequest.map(r => (r.asInstanceOf[HTTPRequestServlet]).req)
>


That's what I was planning to expose... no need to open a ticket.


>
>
>
> Br's,
> Marius
>
> On Sep 22, 3:53 pm, David Pollak 
> wrote:
> > Please open a ticket for this one as well.  I'll expose it for you.
> >
> >
> >
> > On Tue, Sep 22, 2009 at 1:07 PM, harryh  wrote:
> >
> > > Is it still possible to get access to the raw HttpServletRequest/
> > > Response objects?  I know you could at least do this for Request from
> > > S, but now I'm not seeing it anymore.
> >
> > > Looking to get this so I can use
> >
> > >http://mrepo.happyfern.com/sites/facebook-java-api/facebook-java-api/.
> ..
> >
> > > (I've found getting off the ground with lift-facebooksomewhat
> > > confusing).
> >
> > > -harryh
> >
> > --
> > 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
> >
>


-- 
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 liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: access to raw HttpServletRequest/Response

2009-09-22 Thread marius d.

I really don't think Lift should expose directly expose servlet
references. Applications still have access to servlet stuff by
explicit casting.

You can do it today like this:

S.containerRequest.map(r => (r.asInstanceOf[HTTPRequestServlet]).req)



Br's,
Marius

On Sep 22, 3:53 pm, David Pollak 
wrote:
> Please open a ticket for this one as well.  I'll expose it for you.
>
>
>
> On Tue, Sep 22, 2009 at 1:07 PM, harryh  wrote:
>
> > Is it still possible to get access to the raw HttpServletRequest/
> > Response objects?  I know you could at least do this for Request from
> > S, but now I'm not seeing it anymore.
>
> > Looking to get this so I can use
>
> >http://mrepo.happyfern.com/sites/facebook-java-api/facebook-java-api/...
>
> > (I've found getting off the ground with lift-facebooksomewhat
> > confusing).
>
> > -harryh
>
> --
> 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 liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] suggestion: strip comments when serving templates

2009-09-22 Thread harryh

I would love to add comments to my templates:



that got stripped out before being served to end users.

-harryh

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



[Lift] Re: suggestion: make Mailer use n.l.util.Props

2009-09-22 Thread Richard Dallaway

Couldn't find a ticket for this, and it'd save us a few lines of code too.

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

Again, apologies if this is a duplicate.

Richard

On Thu, Sep 17, 2009 at 1:15 AM, David Pollak
 wrote:
> Open a ticket... I'll see what I can do to merge system properties and
> Lift's props.
>
> On Wed, Sep 16, 2009 at 1:39 PM, harryh  wrote:
>>
>> Rather than using System.getProperties should Mailer use
>> net.liftweb.util.Props?  It seems a little inconsistent as is.
>>
>> -harryh
>>
>>
>
>
>
> --
> Lift, the simply functional web framework http://liftweb.net
> Beginning Scala http://www.apress.com/book/view/1430219890
> Follow me: http://twitter.com/dpp
> Git some: http://github.com/dpp
>
> >
>

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



[Lift] Re: access to raw HttpServletRequest/Response

2009-09-22 Thread David Pollak
Please open a ticket for this one as well.  I'll expose it for you.

On Tue, Sep 22, 2009 at 1:07 PM, harryh  wrote:

>
> Is it still possible to get access to the raw HttpServletRequest/
> Response objects?  I know you could at least do this for Request from
> S, but now I'm not seeing it anymore.
>
> Looking to get this so I can use
>
>
> http://mrepo.happyfern.com/sites/facebook-java-api/facebook-java-api/apidocs/com/google/code/facebookapi/FacebookWebappHelper.html
>
> (I've found getting off the ground with lift-facebooksomewhat
> confusing).
>
> -harryh
> >
>


-- 
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 liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Detecting when user has left a page

2009-09-22 Thread David Pollak
On Tue, Sep 22, 2009 at 1:37 PM, Xavi Ramirez  wrote:

>
> Hello,
>
> I'm trying to implement a member list for a chat application.  The
> member list is implemented as a comet actor which receives message
> when users visit and leave the chat page.
>
> Currently I detect when a user visits the page by executing a js
> function called "joinChat" near the bottom of the page.  When
> executed, "joinChat" calls (via  ajaxInvoke) a scala method that
> notifies a list of comet actors that a new visitor has arrived.  This
> works great.
>
> Unfortunately, I'm having trouble detecting when users leave the chat
> page.  I've tried using the window.onbeforeunload method, but there is
> an outstanding bug in chrome
> (http://code.google.com/p/chromium/issues/detail?id=11666) and Opera
> which prevent ajax calls from being sent in onbeforeunload.
>
> I've also tried setting the comet actor's lifespan to 5 seconds, but
> that seems to destroy comet actors once they've been idle for 5
> seconds.
>
> Are there any other mechanisms in lift that could help me solve this
> problem.  Perhaps, there is some way to hook into the "keepAlive"
> signal that lift uses for comet actors?


Lemme see what I can do.  Please open a ticket for this (we're doing changes
via tickets).  I'll see if I can get to it today.


>  Or maybe there's a setting
> that makes lift destroy comet actors as soon as they don't appear on a
> page?
>
> Thanks,
> Xavi
>
> >
>


-- 
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 liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Detecting when user has left a page

2009-09-22 Thread Xavi Ramirez

Hello,

I'm trying to implement a member list for a chat application.  The
member list is implemented as a comet actor which receives message
when users visit and leave the chat page.

Currently I detect when a user visits the page by executing a js
function called "joinChat" near the bottom of the page.  When
executed, "joinChat" calls (via  ajaxInvoke) a scala method that
notifies a list of comet actors that a new visitor has arrived.  This
works great.

Unfortunately, I'm having trouble detecting when users leave the chat
page.  I've tried using the window.onbeforeunload method, but there is
an outstanding bug in chrome
(http://code.google.com/p/chromium/issues/detail?id=11666) and Opera
which prevent ajax calls from being sent in onbeforeunload.

I've also tried setting the comet actor's lifespan to 5 seconds, but
that seems to destroy comet actors once they've been idle for 5
seconds.

Are there any other mechanisms in lift that could help me solve this
problem.  Perhaps, there is some way to hook into the "keepAlive"
signal that lift uses for comet actors?  Or maybe there's a setting
that makes lift destroy comet actors as soon as they don't appear on a
page?

Thanks,
Xavi

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



[Lift] access to raw HttpServletRequest/Response

2009-09-22 Thread harryh

Is it still possible to get access to the raw HttpServletRequest/
Response objects?  I know you could at least do this for Request from
S, but now I'm not seeing it anymore.

Looking to get this so I can use

http://mrepo.happyfern.com/sites/facebook-java-api/facebook-java-api/apidocs/com/google/code/facebookapi/FacebookWebappHelper.html

(I've found getting off the ground with lift-facebooksomewhat
confusing).

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



[Lift] Re: low level lift exception when building with sbt

2009-09-22 Thread harryh

Answering my own question: I missed a dependency when converting my
maven config -> sbt. So boot was failing on a NoClassDefFoundError.
Oops.

-harryh

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



[Lift] Re: low level lift exception when building with sbt

2009-09-22 Thread David Pollak
It looks like the Lift filter didn't get initialized correctly.  Please look
at web.xml and make sure the Lift filter is listed correctly.

On Tue, Sep 22, 2009 at 8:33 AM, harryh  wrote:

>
> Experimenting with SBT, and everything works fine when running jetty
> from within sbt, but when I package up a war file and try to run in
> production, I'm getting the following exception.  Any ideas?
>
> -harryh
>
> java.lang.NullPointerException
>at net.liftweb.http.provider.HTTPProvider$$anonfun$service$3.apply
> (HTTPProvider.scala:54)
>at net.liftweb.http.provider.HTTPProvider$$anonfun$service$3.apply
> (HTTPProvider.scala:54)
>at net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:65)
>at net.liftweb.http.URLRewriter$.doWith(Req.scala:470)
>at net.liftweb.http.provider.HTTPProvider$class.service
> (HTTPProvider.scala:53)
>at net.liftweb.http.LiftFilter.service(LiftServlet.scala:507)
>at net.liftweb.http.provider.servlet.ServletFilterProvider
> $class.protected$service(ServletFilterProvider.scala:41)
>at net.liftweb.http.LiftFilter.protected$service(LiftServlet.scala:
> 507)
>
> >
>


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

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



[Lift] Re: Autogenerated PKs and MetaMapper

2009-09-22 Thread David Pollak
Thomas,

We, as a rule, do not accept patches.  For a complete discussion, please
see:
http://groups.google.com/group/liftweb/browse_frm/thread/0c7a97cbf60780f0?hl=en#

The current state of mapper's primary key support is sub-optimal.  There
have been a couple of discussions of the issues on-list.  I am hoping to
spend some time on this issue on Thursday.  If you've got specific
requirements or specific tests, please post them.

Thanks,

David

On Mon, Sep 21, 2009 at 9:33 PM, Thomas Rampelberg wrote:

>
> I've been working at getting MetaMapper to work with primary keys that
> aren't auto-generated (or longs). Towards this end, I've got a patch
> for MetaMapper.scala that I'd like to get in. Who could I talk about
> the process for that?
>
> In addition, as part of implementing the functionality, I ran into
> some interesting problems. The most interesting one has to do with
> dbIndexFieldIndicatesSaved_?. The default (i_is_! != defaultValue)
> works great for cases where you're using the default value for the
> actual primary key. Unfortunately, if you use something like this when
> you're actively setting the primary key yourself there are some
> unfortunate side effects (nothing gets saved to the database).
>
> To get around this, I'm doing something along these lines:
>
> class InfoHashPrimaryKey[T<:Mapper[T]] (
>  override val fieldOwner: T) extends MappedStringPrimaryKey[T] (
>fieldOwner, 20) with LifecycleCallbacks {
>private var _saved = false
>override def dbIndexFieldIndicatesSaved_? = _saved
>override def afterSave = _saved = true
>  }
>
> Would there happen to be a better way to do this? Leveraging an
> afterSave hook seems like potential overkill.
>
> >
>


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

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



[Lift] low level lift exception when building with sbt

2009-09-22 Thread harryh

Experimenting with SBT, and everything works fine when running jetty
from within sbt, but when I package up a war file and try to run in
production, I'm getting the following exception.  Any ideas?

-harryh

java.lang.NullPointerException
at net.liftweb.http.provider.HTTPProvider$$anonfun$service$3.apply
(HTTPProvider.scala:54)
at net.liftweb.http.provider.HTTPProvider$$anonfun$service$3.apply
(HTTPProvider.scala:54)
at net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:65)
at net.liftweb.http.URLRewriter$.doWith(Req.scala:470)
at net.liftweb.http.provider.HTTPProvider$class.service
(HTTPProvider.scala:53)
at net.liftweb.http.LiftFilter.service(LiftServlet.scala:507)
at net.liftweb.http.provider.servlet.ServletFilterProvider
$class.protected$service(ServletFilterProvider.scala:41)
at net.liftweb.http.LiftFilter.protected$service(LiftServlet.scala:
507)

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



[Lift] Re: Function mapping in "S" doesn't support "image" type input form elements.

2009-09-22 Thread marius d.

name.x and name.y are a pain :) ... since these are propagated with
the same function ID we need to make sure that the function is not
going to be called twice.IO don't think this should be addressed from
fmapFunc. We should be able to handle this when lift is determining
the functions based on param names and apply the knowledge that
F529756071772HPQ.x=11&F529756071772HPQ.y=10 is about all about one
function.

One simple workaround is to place an image for the button but that is
not a submit button. Let's say it's a span. You add onclick to to to
submit the form. F529756071772HPQ input element can simply be a hidden
field (last field in the form) that you attach a function to it.



Br's,
Marius

On Sep 21, 11:51 pm, Mark Tye  wrote:
> Hello? Hello? Is this thing on?
>
> Ahem! Well, now that I have been un-banned, I shall re-post my
> original message:
>
> I've encountered a limitation in Lift's handling of form elements. I
> was able to come up with a workaround, but I was wondering if anyone
> knew of a better solution, or if perhaps functionality should be added
> to Lift to make the workaround unnecessary.
>
> I wanted to replace a standard form submit button with an image
> button. There was no helper function in SHtml for an image button, so
> I rolled my own:
>
>  private def image(src: String, func: () => Any, attrs: (String,
> String)*): Elem =
>    fmapFunc(func)(funcName => attrs.foldLeft( {src} name={funcName} />)(_ % _))
>
> This generated the correct HTML:
>
>   class="bar" />
>
> But when I clicked on the image in my browser, the function was not
> invoked!
>
> I discovered the reason when I captured the POST with Firebug:
>
>  http://localhost:8080/sample?F529756071772HPQ.x=11&F529756071772HPQ.y...
>
> As you can see, the browser appended an ".x" and a ".y" to the "name"
> parameter. (The HTML spec mandates this behavior so the server can
> implement "image map" functionality.) When Lift processed this
> request, it tries to invoke two functions named "...HPQ.x" and
> "...HQP.y", neither of which exist, instead of "...HPQ", which never
> gets invoked.
>
> I was able to get around this by hacking up an alternate version of
> S.fmapFunc, but it's ugly:
>
>  private def fmapFuncX[T](in: AFuncHolder)(f: String => T): T = {
>     val name = formFuncName
>     addFunctionMap(name + ".x", in)
>     f(name)
>  }
>
> This works for me because I don't care about the click coordinates,
> but it seems that in order to support image map functionality, Lift
> would have to intercept the "FOO.x" and "FOO.y" request parameters and
> combine them somehow before invoking "FOO". Is there a location in the
> pipeline where this could be done conveniently?
>
> Anyway, it'd be be great in anyone can think of a better solution than
> hacking up S.fmapFunc, or wants to properly support the x&y coordinate
> parameters.
>
> Here's the HTML spec for "image" type form INPUT elements:
>
> http://www.w3.org/TR/html401/interact/forms.html#h-17.4.1
>
> - Mark
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: How to mixin both MegaProtoUser & CRUDify?

2009-09-22 Thread Kevin Wright
You really need some way to delegate to the trait here, instead of
inheriting from it.

I'll add this as a use case for my dynamic-mixin compiler plugin, see if I
can't find a way out :)



On Tue, Sep 22, 2009 at 8:08 AM, Jeppe Nejsum Madsen wrote:

>
> David Pollak  writes:
>
> > Gakkk... I'm not sure it can be done.  You're welcome to try different
> > combinations of abstract override, etc. in the traits and see if you can
> > come up with an elegant or at least workable solution.
>
> I'm creating my own crudify anyway, so I'll just take the easy way out
> and rename editPath :-)
>
> Just curious how this could be solved in general. Since the two vals (in
> this case) are unrelated, it seem to prohibit some cases of adding
> functionality by mixing in a trait
>
> /Jeppe
>
> >
>

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



[Lift] Re: File uploads sans SHtml

2009-09-22 Thread David Pollak
On Mon, Sep 21, 2009 at 10:49 PM, Charles F. Munat  wrote:

>
> Perfect. I was hoping it was that simple. Thanks.
>
> Mind if I put that on the wiki?
>

Go right ahead.  I love stuff on the wiki.


>
> Chas.
>
> David Pollak wrote:
> > 
> > Select a file to upload: 
> > 
> > 
> >
> >
> > for {r <- S.request; f <- r.uploadedFiles if f.name  ==
> "i_like_mice"} yield (f.mimeType, f.fileStream)
> >
> >
> > On Mon, Sep 21, 2009 at 5:47 PM, Charles F. Munat  > > wrote:
> >
> >
> > I'm using ExtJS to upload a file using a homemade file upload field
> (for
> > styling purposes). I've only used the SHtml feature in the past. I
> can
> > see that the file is in the POST. How does one get it back out?
> >
> > Let's say it's a Word Doc or a PDF (it's actually a résumé). I want
> to
> > save it to the drive (or dump it in a BLOB) and pull it back out
> again
> > to attach to an email.
> >
> > Best practice on this?
> >
> > BTW, the demo here:
> >
> > http://demo.liftweb.net/file_upload
> >
> > is giving me a 500 error.
> >
> > Chas.
> >
> >
> >
> >
> >
> > --
> > Lift, the simply functional web framework http://liftweb.net
> > Beginning Scala http://www.apress.com/book/view/1430219890
> > Follow me: http://twitter.com/dpp
> > Git some: http://github.com/dpp
> >
> > >
>
> >
>


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

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



[Lift] Re: Turning off garbage collection

2009-09-22 Thread Viktor Klang
To be honest and fair, my personal opinion is that Tim didn't cross over to
the "RTFM noob" territory.

And yes, RTFM isn't something we want here on list.

On Tue, Sep 22, 2009 at 2:08 AM, Charles F. Munat  wrote:

>
> Now that's a clever idea.
>
> David Pollak wrote:
> >
> >
> > On Sep 21, 12:21 pm, "Charles F. Munat"  wrote:
> >> Why a once every 75 second ajax request to the server if it's not
> >> necessary? But I can live with it.
> >
> > http://github.com/dpp/liftweb/issues#issue/69
> >
> >> Chas.
> >>
> >>
> >>
> >> David Pollak wrote:
> >>
> >>> On Mon, Sep 21, 2009 at 6:34 AM, Xavi Ramirez  >>> > wrote:
> >>> Doesn't that disable garbage collection for the whole site?
> >>> Is it possible to turn off on specific pages?
> >>> It's currently not possible to turn of Lift's GUID <-> Function GC on a
> >>> page by page basis.
> >>> What's the use case for this?  Why is a once every 75 second ajax
> >>> request to the server causing issues?
> >>> Thanks,
> >>> Xavi
> >>> On Mon, Sep 21, 2009 at 4:41 AM, Timothy Perrett
> >>>  wrote:
> >>>  > Chas,
> >>>  > This has been asked a million times on list - did you not try
> >>>  > searching one of the many archives?
> >>>  > LiftRules.enableLiftGC = false;
> >>>  > Tim
> >>>  > On 21 Sep 2009, at 08:37, Charles F. Munat wrote:
> >>>  >> Is it possible to turn off garbage collection on an individual
> >>> page if
> >>>  >> there's nothing to be garbage collected on that page? If so,
> how
> >>> does
> >>>  >> one do it?
> >>>  >> Is it possible to turn off garbage collection completely? If
> so,
> >>> how?
> >>>  >> I can't seem to find this anywhere.
> >>>  >> Chas.
> >>> --
> >>> Lift, the simply functional web frameworkhttp://liftweb.net
> >>> Beginning Scalahttp://www.apress.com/book/view/1430219890
> >>> Follow me:http://twitter.com/dpp
> >>> Git some:http://github.com/dpp
> > >
> >
>
> >
>


-- 
Viktor Klang

Blog: klangism.blogspot.com
Twttr: viktorklang

Lift Committer - liftweb.com
AKKA Committer - akkasource.org
Cassidy - github.com/viktorklang/Cassidy.git
SoftPub founder: http://groups.google.com/group/softpub

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



[Lift] Function mapping in "S" doesn't support "image" type input form elements.

2009-09-22 Thread Mark Tye

Hello? Hello? Is this thing on?

Ahem! Well, now that I have been un-banned, I shall re-post my
original message:

I've encountered a limitation in Lift's handling of form elements. I
was able to come up with a workaround, but I was wondering if anyone
knew of a better solution, or if perhaps functionality should be added
to Lift to make the workaround unnecessary.

I wanted to replace a standard form submit button with an image
button. There was no helper function in SHtml for an image button, so
I rolled my own:

 private def image(src: String, func: () => Any, attrs: (String,
String)*): Elem =
   fmapFunc(func)(funcName => attrs.foldLeft()(_ % _))

This generated the correct HTML:

 

But when I clicked on the image in my browser, the function was not
invoked!

I discovered the reason when I captured the POST with Firebug:

 
http://localhost:8080/sample?F529756071772HPQ.x=11&F529756071772HPQ.y=6&F529756071774VLD=true

As you can see, the browser appended an ".x" and a ".y" to the "name"
parameter. (The HTML spec mandates this behavior so the server can
implement "image map" functionality.) When Lift processed this
request, it tries to invoke two functions named "...HPQ.x" and
"...HQP.y", neither of which exist, instead of "...HPQ", which never
gets invoked.

I was able to get around this by hacking up an alternate version of
S.fmapFunc, but it's ugly:

 private def fmapFuncX[T](in: AFuncHolder)(f: String => T): T = {
val name = formFuncName
addFunctionMap(name + ".x", in)
f(name)
 }

This works for me because I don't care about the click coordinates,
but it seems that in order to support image map functionality, Lift
would have to intercept the "FOO.x" and "FOO.y" request parameters and
combine them somehow before invoking "FOO". Is there a location in the
pipeline where this could be done conveniently?

Anyway, it'd be be great in anyone can think of a better solution than
hacking up S.fmapFunc, or wants to properly support the x&y coordinate
parameters.

Here's the HTML spec for "image" type form INPUT elements:

http://www.w3.org/TR/html401/interact/forms.html#h-17.4.1

- Mark

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



[Lift] Re: How to mixin both MegaProtoUser & CRUDify?

2009-09-22 Thread Jeppe Nejsum Madsen

David Pollak  writes:

> Gakkk... I'm not sure it can be done.  You're welcome to try different
> combinations of abstract override, etc. in the traits and see if you can
> come up with an elegant or at least workable solution.

I'm creating my own crudify anyway, so I'll just take the easy way out
and rename editPath :-)

Just curious how this could be solved in general. Since the two vals (in
this case) are unrelated, it seem to prohibit some cases of adding
functionality by mixing in a trait

/Jeppe

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