[Lift] Re: Great pictures from the Scala Lift Off

2009-06-09 Thread Richard Dallaway

On 9 Jun 2009, at 15:57, Kevin Wright wrote:
 I wish I could actually discover LSUG meets!
 I signed up on (the extremely minimalist) http://lsug.org/ but the  
 only other hits I get are fleeting references to old meets on nabble  
 and flickr

Ah, good point.  For London Scala User group announcements you need to  
subscribe to the LSUG mailing list.  You can do that by sending a  
blank email to lsug+subscr...@lists.scalaforge.org

Hmm... might be an idea if we actually add that info to lsug.org :-/

Returning to the subject: My photos from liftoff are 
http://www.flickr.com/photos/d6y/sets/72157619282779995/

Cheers
Richard


--~--~-~--~~~---~--~~
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: Great pictures from the Scala Lift Off

2009-06-09 Thread Richard Dallaway


On 9 Jun 2009, at 17:21, Kevin Wright wrote:

 BTW, are you in need of someone to actually add a bit of content to  
 that site?

lsug.org is Aaron's site, and the code is: 
http://code.google.com/p/lsug-website/ 
  -- I suspect it's very close to a default Lift Hello World site. I'd  
say it's something to just hack on for an evening, or something to  
chat about over a beer sometime.

Richard


--~--~-~--~~~---~--~~
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] Submit like SHtml.text but with ajaxText

2009-07-31 Thread Richard Dallaway

I'm looking for some guidance on how best to have the value of text  
field that's been ajax-ified picked up on a regular submit.

What I mean is:

If I have a field of

   object word extends RequestVar()

which I bind like this

 bind(f, xhtml,
word - SHtml.text(word,word(_)),
submit - SHtml.submit(GO,  processForm)
 )

and everything is lovely and this does what you expect:

 def processForm() = {
Log.info(Submit from the form:)
Log.info(word)
}

Now I want to add some dynamic feedback for the user of the form so I  
switch to...

word - SHtml.ajaxText(word, checkWord(_))

with

  def checkWord(w:String) = {
   Log.info(Ajax check: +w)
   Noop
 }


That also works just great.  But when the submit button is hit, of  
course there's now no-longer the assignment into word RequestVar  
anymore.  And I'd like there to be (regardless of if the Ajax  
checkWords is ever called or not).

So where should I be looking to insert the word(_) call to get the  
AJAX goodness but also the good old submit behaviour?

My current thinking is that I use a SHtml.text but then mess with the  
input that's created to include the appropriate Ajax calls I want.

Lift 1.1-SNAPSHOT on 2.7.5.final

Many thanks
Richard



--~--~-~--~~~---~--~~
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: Submit like SHtml.text but with ajaxText

2009-08-01 Thread Richard Dallaway

David

I've updated, tried it, and it works just how I need it to work.   
Brilliant.

Thank you
RIchard

On 31 Jul 2009, at 22:12, David Pollak wrote:

 I just committed code that allows:

 bind(form, xhtml,
  first - text(firstName, firstName = _, s =  
 {S.notice(First name +s); Noop}),
  last - text(lastName, lastName = _, s = {S.notice(Last  
 name +s); Noop}),
  submit - submit(Send, validate _))

 You can have an onblur associated with a server-side function.

 On Fri, Jul 31, 2009 at 6:33 AM, Richard Dallaway  
 dalla...@gmail.com wrote:

 I'm looking for some guidance on how best to have the value of text
 field that's been ajax-ified picked up on a regular submit.

 What I mean is:

 If I have a field of

   object word extends RequestVar()

 which I bind like this

 bind(f, xhtml,
word - SHtml.text(word,word(_)),
submit - SHtml.submit(GO,  processForm)
 )

 and everything is lovely and this does what you expect:

 def processForm() = {
Log.info(Submit from the form:)
Log.info(word)
}

 Now I want to add some dynamic feedback for the user of the form so I
 switch to...

word - SHtml.ajaxText(word, checkWord(_))

 with

  def checkWord(w:String) = {
   Log.info(Ajax check: +w)
   Noop
 }


 That also works just great.  But when the submit button is hit, of
 course there's now no-longer the assignment into word RequestVar
 anymore.  And I'd like there to be (regardless of if the Ajax
 checkWords is ever called or not).

 So where should I be looking to insert the word(_) call to get the
 AJAX goodness but also the good old submit behaviour?

 My current thinking is that I use a SHtml.text but then mess with the
 input that's created to include the appropriate Ajax calls I want.

 Lift 1.1-SNAPSHOT on 2.7.5.final

 Many thanks
 Richard



--~--~-~--~~~---~--~~
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] Cookie not being removed for custom user logout

2009-08-14 Thread Richard Dallaway

I'm seeing some odd behaviour with a cookie I'm setting not being
removed.  I'm unsure which phase of my code is broken or how deep my
misunderstandings are here... so I'm looking for some clues.

I'm setting a keep me logged in cookie for users of my application.
That works fine using...

val c = HTTPCookie(COOKIE_NAME, encode(user)).setMaxAge(three_months_as_seconds)
S.addCookie(c)

The encode(user) is, when all is said and done, returning the user PK
as the cookie value.

I'm not using ProtoUser, I'm using the scheme outlined in
http://groups.google.com/group/liftweb/msg/85a8e790d5efec26

That is, I have...

object LoginContext {
  object userId extends SessionVar[Box[Long]](KeepMeLoggedIn.findUserId)
  // etc...
}

...and the findUserId function tries to decode the cookie and find a
matching user:

def findUserId:Box[Long] = for {
 cookie - S.findCookie(COOKIE_NAME);
 cookie_value - cookie.value;
 (id, salt) - decode(cookie_value);
 u - User.find(By(User.id, id),By(User.salt,salt))
 } yield {
 println(u)
 id
  }

And that's all working for me.

The problem comes when the user clicks the logout link, and I want to
remove this cookie.

The logout link is:

SHtml.link(/logout, LoginContext.logout, spanLogout/span )

... and LoginContext.logout is

KeepMeLoggedIn.removeCookie()
// the above is just: S.deleteCookie(COOKIE_NAME)
userId.remove()
currentUser.remove()
S.request.foreach(_.request.session.terminate)

And for completeness, my /logout page is a redirect to the home page:

Menu(Loc(logout, List(logout) - false, Logout, Hidden, If(
()=false, ()=RedirectResponse(/index)) ))


What I'm seeing is:
 - user clicks logout
 - logout function called, and Jetty tells me /logout took N
milliseconds to render
 - then I'm seeing activity in the findUserId function, a result is
found, and the user is logged back in again.
 - then Jetty tells me /index took N milliseconds to render.

When I dig into HTTP headers, I'm not seeing the cookie value being
set in the response header (which I believe is required to remove it).

I'm guessing my confusion is perhaps over how the SHtml.link magic works?

Any suggestions of where I might poke around next?

I'm using 1.1-SNAPSHOT (updated a few hours ago).

Thank you
Richard

--~--~-~--~~~---~--~~
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: Cookie not being removed for custom user logout

2009-08-15 Thread Richard Dallaway

Thank you for the debugging clue (very handy function; I can see
myself using that in other situations).

What I see when the logout link is followed is:

List()

When I set the cookie originally, I do see a List(HTTPCookie(...))

I'm running all of this on 127.0.0.1:8080.

Thanks
Richard


On Sat, Aug 15, 2009 at 8:37 AM, marius d.marius.dan...@gmail.com wrote:

 Your code looks fine to me. There is notmagic withXHtml.link just that
 when you click the link on server-side your function gets called
 before the /logout page gets rendered.

 Can you add a function to LiftRules.onEndServicing ?

 LiftRules.onEndServicing.append {

  case (req, Full(resp)) =
   val cookies = resp.toResponse.cookies
   // trace the cookies

  case _ =
 }


 Br's,
 Marius

 On Aug 14, 8:20 pm, Richard Dallaway dalla...@gmail.com wrote:
 I'm seeing some odd behaviour with a cookie I'm setting not being
 removed.  I'm unsure which phase of my code is broken or how deep my
 misunderstandings are here... so I'm looking for some clues.

 I'm setting a keep me logged in cookie for users of my application.
 That works fine using...

 val c = HTTPCookie(COOKIE_NAME, 
 encode(user)).setMaxAge(three_months_as_seconds)
 S.addCookie(c)

 The encode(user) is, when all is said and done, returning the user PK
 as the cookie value.

 I'm not using ProtoUser, I'm using the scheme outlined 
 inhttp://groups.google.com/group/liftweb/msg/85a8e790d5efec26

 That is, I have...

 object LoginContext {
   object userId extends SessionVar[Box[Long]](KeepMeLoggedIn.findUserId)
   // etc...

 }

 ...and the findUserId function tries to decode the cookie and find a
 matching user:

 def findUserId:Box[Long] = for {
          cookie - S.findCookie(COOKIE_NAME);
          cookie_value - cookie.value;
          (id, salt) - decode(cookie_value);
          u - User.find(By(User.id, id),By(User.salt,salt))
      } yield {
          println(u)
          id
   }

 And that's all working for me.

 The problem comes when the user clicks the logout link, and I want to
 remove this cookie.

 The logout link is:

 SHtml.link(/logout, LoginContext.logout, spanLogout/span )

 ... and LoginContext.logout is

     KeepMeLoggedIn.removeCookie()
     // the above is just: S.deleteCookie(COOKIE_NAME)
     userId.remove()
     currentUser.remove()
     S.request.foreach(_.request.session.terminate)

 And for completeness, my /logout page is a redirect to the home page:

 Menu(Loc(logout, List(logout) - false, Logout, Hidden, If(
 ()=false, ()=RedirectResponse(/index)) ))

 What I'm seeing is:
  - user clicks logout
  - logout function called, and Jetty tells me /logout took N
 milliseconds to render
  - then I'm seeing activity in the findUserId function, a result is
 found, and the user is logged back in again.
  - then Jetty tells me /index took N milliseconds to render.

 When I dig into HTTP headers, I'm not seeing the cookie value being
 set in the response header (which I believe is required to remove it).

 I'm guessing my confusion is perhaps over how the SHtml.link magic works?

 Any suggestions of where I might poke around next?

 I'm using 1.1-SNAPSHOT (updated a few hours ago).

 Thank you
 Richard
 


--~--~-~--~~~---~--~~
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: Cookie not being removed for custom user logout

2009-08-15 Thread Richard Dallaway

I've made some progress with this. By changing my link to go to a
different page, I do see the cookie being removed.

So by going from...

SHtml.link(/logout, LoginContext.logout, spanLogout/span )

to

SHtml.link(/blank, LoginContext.logout, spanLogout/span )

It works: the cookie is deleted when the user clicks the logout link.
The menu items are now:

Menu(Loc(logout, List(logout) - false, Logout, Hidden, If(
()=false, ()=RedirectResponse(/blank)) )) ::
Menu(Loc(blank, List(blank) - false, Blank, Hidden )) ::

...and blank is blank.html which contains pThis page intentionally blank./p

The reason for the RedirectResponse is to (eventually) send the user
to the /index (home page)... but I send them to blank.html at the
moment while I'm working through this issue.

I'll go read up on RedirectResponse ...

Cheers
Richard

On Sat, Aug 15, 2009 at 11:30 AM, Richard Dallawaydalla...@gmail.com wrote:
 Thank you for the debugging clue (very handy function; I can see
 myself using that in other situations).

 What I see when the logout link is followed is:

 List()

 When I set the cookie originally, I do see a List(HTTPCookie(...))

 I'm running all of this on 127.0.0.1:8080.

 Thanks
 Richard


 On Sat, Aug 15, 2009 at 8:37 AM, marius d.marius.dan...@gmail.com wrote:

 Your code looks fine to me. There is notmagic withXHtml.link just that
 when you click the link on server-side your function gets called
 before the /logout page gets rendered.

 Can you add a function to LiftRules.onEndServicing ?

 LiftRules.onEndServicing.append {

  case (req, Full(resp)) =
   val cookies = resp.toResponse.cookies
   // trace the cookies

  case _ =
 }


 Br's,
 Marius

 On Aug 14, 8:20 pm, Richard Dallaway dalla...@gmail.com wrote:
 I'm seeing some odd behaviour with a cookie I'm setting not being
 removed.  I'm unsure which phase of my code is broken or how deep my
 misunderstandings are here... so I'm looking for some clues.

 I'm setting a keep me logged in cookie for users of my application.
 That works fine using...

 val c = HTTPCookie(COOKIE_NAME, 
 encode(user)).setMaxAge(three_months_as_seconds)
 S.addCookie(c)

 The encode(user) is, when all is said and done, returning the user PK
 as the cookie value.

 I'm not using ProtoUser, I'm using the scheme outlined 
 inhttp://groups.google.com/group/liftweb/msg/85a8e790d5efec26

 That is, I have...

 object LoginContext {
   object userId extends SessionVar[Box[Long]](KeepMeLoggedIn.findUserId)
   // etc...

 }

 ...and the findUserId function tries to decode the cookie and find a
 matching user:

 def findUserId:Box[Long] = for {
          cookie - S.findCookie(COOKIE_NAME);
          cookie_value - cookie.value;
          (id, salt) - decode(cookie_value);
          u - User.find(By(User.id, id),By(User.salt,salt))
      } yield {
          println(u)
          id
   }

 And that's all working for me.

 The problem comes when the user clicks the logout link, and I want to
 remove this cookie.

 The logout link is:

 SHtml.link(/logout, LoginContext.logout, spanLogout/span )

 ... and LoginContext.logout is

     KeepMeLoggedIn.removeCookie()
     // the above is just: S.deleteCookie(COOKIE_NAME)
     userId.remove()
     currentUser.remove()
     S.request.foreach(_.request.session.terminate)

 And for completeness, my /logout page is a redirect to the home page:

 Menu(Loc(logout, List(logout) - false, Logout, Hidden, If(
 ()=false, ()=RedirectResponse(/index)) ))

 What I'm seeing is:
  - user clicks logout
  - logout function called, and Jetty tells me /logout took N
 milliseconds to render
  - then I'm seeing activity in the findUserId function, a result is
 found, and the user is logged back in again.
  - then Jetty tells me /index took N milliseconds to render.

 When I dig into HTTP headers, I'm not seeing the cookie value being
 set in the response header (which I believe is required to remove it).

 I'm guessing my confusion is perhaps over how the SHtml.link magic works?

 Any suggestions of where I might poke around next?

 I'm using 1.1-SNAPSHOT (updated a few hours ago).

 Thank you
 Richard
 



--~--~-~--~~~---~--~~
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] Menu.builder li_item being applied to all?

2009-08-25 Thread Richard Dallaway

I've been running mvn -o for a while, but didn't today and noticed a
change in behaviour for the menu builder (1.1 SNAPSHOT).   I'm seeing
all my menus being given the selected item class, not just the one
that's selected for the page you're on.  I'm using...

lift:Menu.builder li_item:class=current_tab /

I've cut my site map down to this...

val menus = Menu(Loc(one, new Link(index :: Nil, false), Page 1)) ::
Menu(Loc(two, new Link(index2 :: Nil, false), Page 
2)) :: Nil

 LiftRules.setSiteMap(SiteMap(menus:_*))

...and I see the following output:

ulli class=current_taba href=/indexPage 1/a/lili
class=current_tabspanPage 2/span/li/ul

I'd expect only one of the li elements to have the class attribute.

Am I doing something wrong here?

Thank you
Richard

--~--~-~--~~~---~--~~
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: Menu.builder li_item being applied to all?

2009-08-26 Thread Richard Dallaway

I can confirm that your fix of the fix has fixed my issue (which means
I've grabbed the latest 1.1 snapshot and it's all good again)

Thank you
Richard

On Tue, Aug 25, 2009 at 9:55 PM, David
Pollakfeeder.of.the.be...@gmail.com wrote:
 I think I've fixed my bone-headed attempt to fix another issue.

 On Tue, Aug 25, 2009 at 5:48 AM, Richard Dallaway dalla...@gmail.com
 wrote:

 I've been running mvn -o for a while, but didn't today and noticed a
 change in behaviour for the menu builder (1.1 SNAPSHOT).   I'm seeing
 all my menus being given the selected item class, not just the one
 that's selected for the page you're on.  I'm using...

 lift:Menu.builder li_item:class=current_tab /

 I've cut my site map down to this...

 val menus = Menu(Loc(one, new Link(index :: Nil, false), Page 1)) ::
                    Menu(Loc(two, new Link(index2 :: Nil, false), Page
 2)) :: Nil

  LiftRules.setSiteMap(SiteMap(menus:_*))

 ...and I see the following output:

 ulli class=current_taba href=/indexPage 1/a/lili
 class=current_tabspanPage 2/span/li/ul

 I'd expect only one of the li elements to have the class attribute.

 Am I doing something wrong here?

 Thank you
 Richard





 --
 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] Props.userName minor minor minor suggestion

2009-08-27 Thread Richard Dallaway

As Props.userName is public, it would be good if it didn't include a
trailing . in the return value.  I see why it does for use in toTry
but as a user of Lift it was a surprise to ask for Props.userName and
see the . on the end.

The same applies for Props.hostName (even though there's S.hostName)
and maybe Props.modeName.

This came about because I was customizing a logging environment to use
the SMTP Appender and I wanted to include a username and hostname as
the sender of the SMTP error message.  I was happy to spot
Props.userName (thank you IDE code completion) but confused to get a
value of richard. not richard as my username.  It is, of course
trivial to get the values without the . on the end, but just as a
principle of least surprise it might be an idea to drop the trailing
. on these methods. Or make them private? :-O

Cheers
Richard

--~--~-~--~~~---~--~~
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] Small wiki contribution for log4j configuration

2009-08-27 Thread Richard Dallaway

What's the protocol for making a Wiki contribution: just go in and do it?

Turns out I'm not that brave.  I've pulled together the start of a
logging wiki entry, just covering what is (for me) the common case.
I've put it here for the moment...

http://github.com/d6y/brightontide/wikis/configuring-logging

...because I wanted to experiment with the mark up language -- the
project has nothing to do with Lift.

The old wiki content isn't quite right for what I'm seeing in 1.1
these days w.r.t modeName
(http://wiki.liftweb.net/index.php/HowTo_configure_logging)

Richard

--~--~-~--~~~---~--~~
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: Small wiki contribution for log4j configuration

2009-08-27 Thread Richard Dallaway

Thanks David, Thanks Tim

I've added the page, and also copied over what appears to be relevant
from the old wiki page.

http://wiki.github.com/dpp/liftweb/how-to-configure-logging

Right: back to some coding now...
Cheers
Richard

On Thu, Aug 27, 2009 at 5:34 PM, Timothy Perretttimo...@getintheloop.eu wrote:


 Looks great to me! Add it to the lift wiki with the prefix How To: as that
 follows our convention.

 Cheers, Tim

 On 27/08/2009 15:56, Richard Dallaway dalla...@gmail.com wrote:


 What's the protocol for making a Wiki contribution: just go in and do it?

 Turns out I'm not that brave.  I've pulled together the start of a
 logging wiki entry, just covering what is (for me) the common case.
 I've put it here for the moment...

 http://github.com/d6y/brightontide/wikis/configuring-logging

 ...because I wanted to experiment with the mark up language -- the
 project has nothing to do with Lift.

 The old wiki content isn't quite right for what I'm seeing in 1.1
 these days w.r.t modeName
 (http://wiki.liftweb.net/index.php/HowTo_configure_logging)

 Richard

 




 


--~--~-~--~~~---~--~~
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: Props.userName minor minor minor suggestion

2009-09-01 Thread Richard Dallaway

Tried it - works great for me. Thanks.
Richard

On Thu, Aug 27, 2009 at 4:31 PM, David
Pollakfeeder.of.the.be...@gmail.com wrote:
 On Thu, Aug 27, 2009 at 7:07 AM, Richard Dallaway dalla...@gmail.com
 wrote:

 As Props.userName is public, it would be good if it didn't include a
 trailing . in the return value.  .[snip]..
 Thanks for the suggestion.  See
 http://github.com/dpp/liftweb/commit/10ff1518f66a15e4f4b06157c49acaacb3a4c9cb

--~--~-~--~~~---~--~~
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: Google Analytics

2009-09-18 Thread Richard Dallaway

I'm a bit late to this thread, but found it really useful.

In case this is of any use to future explorers of the thread, I
thought I'd contribute what we ended up doing: we put
lift:Analytics.google / (snippet below) before /body in our
template.  I guess this may have been all over-taken by the lift:tail
work.

--
import scala.xml.NodeSeq

import net.liftweb._
import http._
import S._
import util._
import Props.RunModes._

class Analytics {

  // To avoid non-XHTML compliant JavaScript we decide if we're https
or not here.
  // See e.g., 
http://happygiraffe.net/blog/2009/06/06/google-analytics-in-xhtml/
  def google_script_url = S.request match {
case Full(req) if req.request.scheme == https =
https://ssl.google-analytics.com/ga.js;
case _ = http://www.google-analytics.com/ga.js;
  }

  // Output the Google Analytics JavaScript
  def google(xhtml: NodeSeq) = Props.mode match {
case Production | Pilot | Staging =
  script type=text/javascript src={google_script_url}/script ++
  script type=text/javascript
  ![CDATA[try {
  var pageTracker = _gat._getTracker('UA--1');
  pageTracker._trackPageview();
  } catch(err) {}
  ]]
  /script
case _ = Nil
  }

}
---

...but replacing 'UA--1' with your tracking code.

Warning: I've not tested with a https site yet.

Richard


On Wed, Jul 15, 2009 at 3:25 AM, Xavi Ramirez xavi@gmail.com wrote:

 Sorry, I didn't replay earlier, but it turns out that the operation
 is not supported code: 9 error is related to the fact that the
 default Google Analytics snippet uses document.write().  It turns out
 that XHTML does not support document.write(), which causes Firefox to
 chock.

 Ultimately, I replaced the default Google Analytics snippet with this one:
 script src=http://www.google-analytics.com/ga.js; type=text/javascript /
 script type=text/javascript
 //![CDATA[
    try { var pageTracker = _gat._getTracker(UA-4384857-1);
 pageTracker._trackPageview(); } catch(err) {}
 //]]
 /script

 A full write up of my experiences with Google Analytics and Lift can
 be found here:
 http://www.the-xavi.com/articles/operation-is-not-supported-code-9

 ~Xavi

 On Tue, Jul 7, 2009 at 4:34 PM, Xavi Ramirezxavi@gmail.com wrote:
 Thanks!  I ran into this exact problem.  Is there any way to get rid
 of it?  Is there a lift:production tag?

 Thanks,
 Xavi

 On Tue, Mar 17, 2009 at 5:22 PM, Charles F. Munatc...@munat.com wrote:

 OK, I have to stop posting this crap when it's 5:30 AM, I've been
 working for 18 hours straight, and my brain is fried.

 The problem was that I was looking at it on my development machine, not
 the production server. The Google Analytics code is tied to the URL. If
 the URL is wrong, it doesn't serve the script, so Firebug reports the
 error. I are dumb.

 Hopefully, though, my posting this will save some other person a hassle
 and a little public embarrassment.

 Chas.

 Derek Chen-Becker wrote:
 Can you send the beginning of the XHTML output, up to and including the
 GA script?

 Derek

 On Tue, Mar 17, 2009 at 6:31 AM, Charles F. Munat c...@munat.com
 mailto:c...@munat.com wrote:


     Is anyone else using Google Analytics? I am getting this strange
     JavaScript error:

     operation is not supported code: 9
      var pageTracker = _gat._getTracker(UA-5774043-2);

     The Google scripts are supposed to be placed right before the closing
     body tag, but Lift inserts its own script in there. I can't imagine how
     that would make a difference, but it is the only thing different from
     what Google recommends.

     Also, the analytics are not working.

     Any ideas?

     Chas.




 

 



 


--~--~-~--~~~---~--~~
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: Bug in MappedEmail: emailPattern is wrong

2009-09-20 Thread Richard Dallaway

Apologies if I've duplicated the ticket, but I couldn't find it one,
and this issue is going to impact me too.

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

Cheers
Richard

On Fri, Sep 18, 2009 at 6:32 PM, David Pollak
feeder.of.the.be...@gmail.com wrote:
 Please open a ticket

 On Wed, Sep 16, 2009 at 11:27 AM, harryh har...@gmail.com wrote:

 Hrm, MappedEmail is now rejecting e-mails with a - in the part before
 the @.

 is %-+ being interpreted as % through + and not % OR - OR + ?

 -harryh, who is easily confused by regular expressions


--~--~-~--~~~---~--~~
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
feeder.of.the.be...@gmail.com 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 har...@gmail.com 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] lift-json and attributes

2009-10-05 Thread Richard Dallaway

Loving the new lift-json code.  We've been producing XML for a REST
API, and now need to produce JSON.  lift-json to the rescue,
except...the Xml converter doesn't handle attributes:

scala val xml = user id=7nameBert/name/user
xml: scala.xml.Elem = user id=7nameBert/name/user

scala val json = toJson(xml)
json: net.liftweb.json.JsonAST.JValue =
JObject(List(JField(user,JObject(List(JField(name,JString(Bert)))

scala JsonDSL.compact(JsonAST.render(json))
res5: String = {user:{name:Bert}}

I'd expect res5 to be something like:  {user:{id:7,name:Bert}}

I'm either missing a clue, or this is a feature request.

I can see there's ambiguity in how you might map the above JSON back
to XML with attributes, but it seems reasonable that if you have XML +
attributes they would be present in a JSON representation.

Thank you
Richard

--~--~-~--~~~---~--~~
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: lift-json and attributes

2009-10-07 Thread Richard Dallaway

On Mon, Oct 5, 2009 at 9:01 PM, Joni Freeman freeman.j...@gmail.com wrote:

 Thanks Richard!

 This is a feature request and I just committed an implementation to my
 branch.

I've just pulled 1-1 SNAPSHOT, tried it, and it works just how I need it to.

Thank you
Richard

--~--~-~--~~~---~--~~
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: java.sql.SQLException | ERROR 07000

2009-10-13 Thread Richard Dallaway

On Tue, Oct 13, 2009 at 8:27 AM, Hannes hannes.flo...@gmx.li wrote:
 I'm almost sure that this error didn't occured before..I also
 updated to 1.1-M6 but the error is still there. Do I've to do some other
 update? I think the problem is related to some actor stuff.???

This is a long shot,  but I think I saw something similar and it
turned out I had an incorrect DB.addLogFunc in my Boot.   If you have
one, maybe comment it out and see if you get the same behaviour.

It doesn't really look related from the stack trace, but I thought I'd
mention it just in case...

Richard

--~--~-~--~~~---~--~~
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: Props file example

2009-10-13 Thread Richard Dallaway

On Mon, Oct 12, 2009 at 2:55 PM,  my_li...@me.com wrote:

 And how do I switch runtimes? within the boot.scala?

If I need to, I change the run mode at start up time:

$ MAVEN_OPTS=-Drun.mode=pilot mvn jetty:run

...if that helps

Richard

--~--~-~--~~~---~--~~
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: java.sql.SQLException | ERROR 07000

2009-10-13 Thread Richard Dallaway

On Tue, Oct 13, 2009 at 10:37 AM, Hannes hannes.flo...@gmx.li wrote:

 OK, thanks. I'll have a look!

Ah, it won't be that.  I've just seen the error I had documented here:

http://wiki.github.com/dpp/liftweb/10-11-possible-code-changes

...and it looks nothing like the error you're getting.

Sorry for the false lead.
Richard

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



Re: [Lift] Re: London Lift talk

2010-02-22 Thread Richard Dallaway
On Sun, Feb 21, 2010 at 1:09 AM, Timothy Perrett
timo...@getintheloop.eu wrote:
 Man, I really must try and drag my ass along to this...

There'll be a trip to the pub after, if that's any use as an incentive
to come along :-)

Cheers
Richard
--
@d6y

-- 
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, 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] London Lift talk

2010-03-09 Thread Richard Dallaway
On Sat, Feb 20, 2010 at 8:22 PM, andy andy1...@gmail.com wrote:
 The London Scala User Group (LSUG) will be presenting a talk by
 Richard Dallaway on 'Getting started with Lift' at SkillsMatter

It is done: http://icanhaz.com/gswl ... where you will find a link to
the Skillsmatter video.

Richard

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