[Lift] Re: Cookie not being removed for custom user logout

2009-08-15 Thread marius d.

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

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] Re: Db.addLogFunc

2009-08-15 Thread Derek Chen-Becker
OK, a preliminary version of log wrappers is checked in on
wip-dcb-sql-log-wrappers. I'll merge it on Tuesday if no one sees any
problems with it.

Derek

On Tue, Aug 11, 2009 at 11:08 AM, Derek Chen-Becker
dchenbec...@gmail.comwrote:

 Will do.


 On Tue, Aug 11, 2009 at 2:33 AM, marius d. marius.dan...@gmail.comwrote:


 Please do so. If you need any help for some reason (time availability
 etc.) please let me know. As a note probably the wrappers should be
 only only when there is at least one log function registered.

 Br's,
 Marius

 On Aug 6, 11:48 pm, Derek Chen-Becker dchenbec...@gmail.com wrote:
  If there's a consensus that we want our own JDBC wrappers I'll go ahead
 and
  write them.
 
  Derek
 
  On Thu, Aug 6, 2009 at 1:19 PM, marius d. marius.dan...@gmail.com
 wrote:
 
   Probably building our own wrappers would be more lightweight then 3-rd
   party. Jus' guessing
 
   Br's,
   Marius
 
   On Aug 6, 9:58 pm, Derek Chen-Becker dchenbec...@gmail.com wrote:
Well, I started looking at it and determined that the only way for
 us to
truly log the queries would be to essentially make our own wrappers
 over
Statement and PreparedStatement. There are projects (log4jdbc,
 notably)
   that
already do this, and in a transparent manner. I'm not sure that
 adding a
whole bunch of SQL logging directly to Lift is better than
 leveraging
   some
existing libraries to do it.
 
Derek
 
On Thu, Aug 6, 2009 at 11:03 AM, marius d. marius.dan...@gmail.com
 
   wrote:
 
 Yeah we're aware of that. That is based on toString application
 which
 is JDBC driver dependent. I think Derek started some work on this
 to
 correct this behavior. Derek ?
 
 Br's,
 Marius
 
 On Aug 6, 8:01 pm, jon jonhoff...@gmail.com wrote:
  Hi,
 
  I have the following in boot:
DB.addLogFunc((query, len) = Log.info(The query: +query+
 took
  +len+ milliseconds))
 
  I was expecting the query parameter to be sql, but it's actually
 some
  sort of guid
 
  INFO - The query: 6839c016-0122-f09a-9c96-003844e8 took 5
  milliseconds
 
  Any ideas?
  I'm running with derby.
 
  Thanks,
 
  Jon
 



--~--~-~--~~~---~--~~
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: ws-generated code in lift

2009-08-15 Thread Timothy Perrett

Sounds like a classic situation what is technically possible is
one thing but what you should do to preserve your sanity is most
probably another ;-)

Good luck!

Cheers, Tim

On Aug 15, 4:29 am, Meredith Gregory lgreg.mered...@gmail.com wrote:
 Tim, Viktor,

 Thanks for the insights and sharing of experience. i'm in a situation where
 i'm working with legacy stuff. i was just wondering how deeply into lift i
 could push the WSDL-based Java handlers.

 Best wishes,

 --greg

 On Fri, Aug 14, 2009 at 2:54 PM, Timothy Perrett 
 timo...@getintheloop.euwrote:







  I agree with Viktor - in a similar vein, this is exactly what I
  implemented with Akka; the servlet runs in conjunction with lifts
  filter and lift just hands off stuff it doesnt know what to do with.
  So if you want to use AxisServlet or whatever its real easy.

  From my point of view, you'd need a good reason to bring the SOAP
  stuff into lift; right now i havent found one... I write a lot of lift
  apps that consume SOAP services, but as yet have no good reason to
  write a SOAP serving app with lift - If i were to do one, id do
  exactly as with the JAX-RS stuff in Akka and passNotFoundToChain.

  Cheers, Tim

  On Aug 14, 10:24 pm, Viktor Klang viktor.kl...@gmail.com wrote:
   Gregory,

   Depending on what WS-* stuff you're using, you _should_ be able to wire
  the
   AxisServlet in web.xml under /ws/* or something like that, and then have
   lift passNotFoundToChain=true

   But I guess it boils down to what liftiness you're planning to do. Can
  you
   elaborate a bit on what you're aiming for?

   On Fri, Aug 14, 2009 at 9:00 PM, Meredith Gregory
   lgreg.mered...@gmail.comwrote:

Tim, Viktor,

Do you wire your SOAP services into lift or do you keep that
  independent? i
was just talking to DPP and according to him it appears you can
  successfully
wire WS-generated code anywhere along in the http-request processing
pipeline. He pointed out a gotcha that i think can be circumvented with
HttpServletResponse trampoline. Both lift and the WS-generated code are
likely to want to be in the driver's seat regarding who's returning the
bytes. But, i think you can just fool the WS-generated code into
  thinking
it's got an HttpServletResponse that is really a widget that will just
  write
into the one lift returns. In this way you can write a 1-size-fits-all
return adapter. Is this what you guys are doing, or am i making this
  too
complicated?

Best wishes,

--greg

--
L.G. Meredith
Managing Partner
Biosimilarity LLC
1219 NW 83rd St
Seattle, WA 98117

+1 206.650.3740

   http://biosimilarity.blogspot.com

   --
   Viktor Klang

   Rogue Scala-head

   Blog: klangism.blogspot.com
   Twttr: viktorklang

 --
 L.G. Meredith
 Managing Partner
 Biosimilarity LLC
 1219 NW 83rd St
 Seattle, WA 98117

 +1 206.650.3740

 http://biosimilarity.blogspot.com
--~--~-~--~~~---~--~~
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: ws-generated code in lift

2009-08-15 Thread David Pollak
I think there will be an important Goat Rodeo/Lift/SOAP story that I'll be
able to tell in a week or so... integrating WS into Lift (rather than
running on the side) will, I think, have benefits.

On Sat, Aug 15, 2009 at 9:45 AM, Timothy Perrett timo...@getintheloop.euwrote:


 Sounds like a classic situation what is technically possible is
 one thing but what you should do to preserve your sanity is most
 probably another ;-)

 Good luck!

 Cheers, Tim

 On Aug 15, 4:29 am, Meredith Gregory lgreg.mered...@gmail.com wrote:
  Tim, Viktor,
 
  Thanks for the insights and sharing of experience. i'm in a situation
 where
  i'm working with legacy stuff. i was just wondering how deeply into lift
 i
  could push the WSDL-based Java handlers.
 
  Best wishes,
 
  --greg
 
  On Fri, Aug 14, 2009 at 2:54 PM, Timothy Perrett timo...@getintheloop.eu
 wrote:
 
 
 
 
 
 
 
   I agree with Viktor - in a similar vein, this is exactly what I
   implemented with Akka; the servlet runs in conjunction with lifts
   filter and lift just hands off stuff it doesnt know what to do with.
   So if you want to use AxisServlet or whatever its real easy.
 
   From my point of view, you'd need a good reason to bring the SOAP
   stuff into lift; right now i havent found one... I write a lot of lift
   apps that consume SOAP services, but as yet have no good reason to
   write a SOAP serving app with lift - If i were to do one, id do
   exactly as with the JAX-RS stuff in Akka and passNotFoundToChain.
 
   Cheers, Tim
 
   On Aug 14, 10:24 pm, Viktor Klang viktor.kl...@gmail.com wrote:
Gregory,
 
Depending on what WS-* stuff you're using, you _should_ be able to
 wire
   the
AxisServlet in web.xml under /ws/* or something like that, and then
 have
lift passNotFoundToChain=true
 
But I guess it boils down to what liftiness you're planning to do.
 Can
   you
elaborate a bit on what you're aiming for?
 
On Fri, Aug 14, 2009 at 9:00 PM, Meredith Gregory
lgreg.mered...@gmail.comwrote:
 
 Tim, Viktor,
 
 Do you wire your SOAP services into lift or do you keep that
   independent? i
 was just talking to DPP and according to him it appears you can
   successfully
 wire WS-generated code anywhere along in the http-request
 processing
 pipeline. He pointed out a gotcha that i think can be circumvented
 with
 HttpServletResponse trampoline. Both lift and the WS-generated code
 are
 likely to want to be in the driver's seat regarding who's returning
 the
 bytes. But, i think you can just fool the WS-generated code into
   thinking
 it's got an HttpServletResponse that is really a widget that will
 just
   write
 into the one lift returns. In this way you can write a
 1-size-fits-all
 return adapter. Is this what you guys are doing, or am i making
 this
   too
 complicated?
 
 Best wishes,
 
 --greg
 
 --
 L.G. Meredith
 Managing Partner
 Biosimilarity LLC
 1219 NW 83rd St
 Seattle, WA 98117
 
 +1 206.650.3740
 
http://biosimilarity.blogspot.com
 
--
Viktor Klang
 
Rogue Scala-head
 
Blog: klangism.blogspot.com
Twttr: viktorklang
 
  --
  L.G. Meredith
  Managing Partner
  Biosimilarity LLC
  1219 NW 83rd St
  Seattle, WA 98117
 
  +1 206.650.3740
 
  http://biosimilarity.blogspot.com
 



-- 
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: ws-generated code in lift

2009-08-15 Thread Timothy Perrett

Id be interested to hear those stories... all the ones i've heard so
far that involve anything to do with SOAP have usually been tales of
woe ;-)

Cheers, Tim

On Aug 15, 6:47 pm, David Pollak feeder.of.the.be...@gmail.com
wrote:
 I think there will be an important Goat Rodeo/Lift/SOAP story that I'll be
 able to tell in a week or so... integrating WS into Lift (rather than
 running on the side) will, I think, have benefits.

 On Sat, Aug 15, 2009 at 9:45 AM, Timothy Perrett 
 timo...@getintheloop.euwrote:

  Sounds like a classic situation what is technically possible is
  one thing but what you should do to preserve your sanity is most
  probably another ;-)

  Good luck!

  Cheers, Tim

  On Aug 15, 4:29 am, Meredith Gregory lgreg.mered...@gmail.com wrote:
   Tim, Viktor,

   Thanks for the insights and sharing of experience. i'm in a situation
  where
   i'm working with legacy stuff. i was just wondering how deeply into lift
  i
   could push the WSDL-based Java handlers.

   Best wishes,

   --greg

   On Fri, Aug 14, 2009 at 2:54 PM, Timothy Perrett timo...@getintheloop.eu
  wrote:

I agree with Viktor - in a similar vein, this is exactly what I
implemented with Akka; the servlet runs in conjunction with lifts
filter and lift just hands off stuff it doesnt know what to do with.
So if you want to use AxisServlet or whatever its real easy.

From my point of view, you'd need a good reason to bring the SOAP
stuff into lift; right now i havent found one... I write a lot of lift
apps that consume SOAP services, but as yet have no good reason to
write a SOAP serving app with lift - If i were to do one, id do
exactly as with the JAX-RS stuff in Akka and passNotFoundToChain.

Cheers, Tim

On Aug 14, 10:24 pm, Viktor Klang viktor.kl...@gmail.com wrote:
 Gregory,

 Depending on what WS-* stuff you're using, you _should_ be able to
  wire
the
 AxisServlet in web.xml under /ws/* or something like that, and then
  have
 lift passNotFoundToChain=true

 But I guess it boils down to what liftiness you're planning to do.
  Can
you
 elaborate a bit on what you're aiming for?

 On Fri, Aug 14, 2009 at 9:00 PM, Meredith Gregory
 lgreg.mered...@gmail.comwrote:

  Tim, Viktor,

  Do you wire your SOAP services into lift or do you keep that
independent? i
  was just talking to DPP and according to him it appears you can
successfully
  wire WS-generated code anywhere along in the http-request
  processing
  pipeline. He pointed out a gotcha that i think can be circumvented
  with
  HttpServletResponse trampoline. Both lift and the WS-generated code
  are
  likely to want to be in the driver's seat regarding who's returning
  the
  bytes. But, i think you can just fool the WS-generated code into
thinking
  it's got an HttpServletResponse that is really a widget that will
  just
write
  into the one lift returns. In this way you can write a
  1-size-fits-all
  return adapter. Is this what you guys are doing, or am i making
  this
too
  complicated?

  Best wishes,

  --greg

  --
  L.G. Meredith
  Managing Partner
  Biosimilarity LLC
  1219 NW 83rd St
  Seattle, WA 98117

  +1 206.650.3740

 http://biosimilarity.blogspot.com

 --
 Viktor Klang

 Rogue Scala-head

 Blog: klangism.blogspot.com
 Twttr: viktorklang

   --
   L.G. Meredith
   Managing Partner
   Biosimilarity LLC
   1219 NW 83rd St
   Seattle, WA 98117

   +1 206.650.3740

  http://biosimilarity.blogspot.com

 --
 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
--~--~-~--~~~---~--~~
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 do basic joins

2009-08-15 Thread harryh

 class Foo extends LongKeyedMapper[Foo] with IdPK {
  def getBazes = {
    Baz.findAll(In(Baz.barid, Bar.id, By(Bar.fooid, this)))
  }

OK, upgrading to 1.1-M4 got rid of the NPE so I'm just gonna assume
there was a bug that has been fixed.  However the SQL query that lift
is generating is no good.  It's doing something like this:

SELECT bazes.cityid, bazes.xdatetime, bazes.aliasid, bazes.userid,
bazes.id FROM bazes WHERE barid IN (SELECT id FROM bars WHERE fooid =
22120 );

which is WAY WAY more inefficient than this (by a factor of like
100x):

SELECT bazes.cityid, bazes.xdatetime, bazes.aliasid, bazes.userid,
bazes.id FROM bazes, bars WHERE bazes.barid = bars.id AND bars.fooid =
22120;

At least on MySQL (which is what I'm using).  Is there any way to get
Lift to use a query like the latter instead of the former?

-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] ScalaTest dependency

2009-08-15 Thread Bill Venners
Hi Derek,

I noticed you checked in a change to Lift that updated the Maven  
ScalaTest ref. However the ref is to version 0.9.4, whereas the  
current version is 0.9.5.

Thanks.

Bill

Bill Venners
Artima, Inc.
http://www.artima.com

On Aug 15, 2009, at 7:02 AM, Derek Chen-Becker dchenbec...@gmail.com  
wrote:

 OK, a preliminary version of log wrappers is checked in on wip-dcb- 
 sql-log-wrappers. I'll merge it on Tuesday if no one sees any  
 problems with it.

 Derek

 On Tue, Aug 11, 2009 at 11:08 AM, Derek Chen-Becker dchenbec...@gmail.com 
  wrote:
 Will do.


 On Tue, Aug 11, 2009 at 2:33 AM, marius d. marius.dan...@gmail.com  
 wrote:

 Please do so. If you need any help for some reason (time availability
 etc.) please let me know. As a note probably the wrappers should be
 only only when there is at least one log function registered.

 Br's,
 Marius

 On Aug 6, 11:48 pm, Derek Chen-Becker dchenbec...@gmail.com wrote:
  If there's a consensus that we want our own JDBC wrappers I'll go  
 ahead and
  write them.
 
  Derek
 
  On Thu, Aug 6, 2009 at 1:19 PM, marius d.  
 marius.dan...@gmail.com wrote:
 
   Probably building our own wrappers would be more lightweight  
 then 3-rd
   party. Jus' guessing
 
   Br's,
   Marius
 
   On Aug 6, 9:58 pm, Derek Chen-Becker dchenbec...@gmail.com  
 wrote:
Well, I started looking at it and determined that the only way  
 for us to
truly log the queries would be to essentially make our own  
 wrappers over
Statement and PreparedStatement. There are projects (log4jdbc,  
 notably)
   that
already do this, and in a transparent manner. I'm not sure  
 that adding a
whole bunch of SQL logging directly to Lift is better than  
 leveraging
   some
existing libraries to do it.
 
Derek
 
On Thu, Aug 6, 2009 at 11:03 AM, marius d.  
 marius.dan...@gmail.com
   wrote:
 
 Yeah we're aware of that. That is based on toString  
 application which
 is JDBC driver dependent. I think Derek started some work on  
 this to
 correct this behavior. Derek ?
 
 Br's,
 Marius
 
 On Aug 6, 8:01 pm, jon jonhoff...@gmail.com wrote:
  Hi,
 
  I have the following in boot:
DB.addLogFunc((query, len) = Log.info(The query:  
 +query+ took
  +len+ milliseconds))
 
  I was expecting the query parameter to be sql, but it's  
 actually some
  sort of guid
 
  INFO - The query: 6839c016-0122-f09a-9c96-003844e8  
 took 5
  milliseconds
 
  Any ideas?
  I'm running with derby.
 
  Thanks,
 
  Jon




 

--~--~-~--~~~---~--~~
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] H2 schema

2009-08-15 Thread Naftoli Gugenheim

There was a bug discussed recently about connecting to H2 with a username and 
not being able to schemify, caused by the schema defaulting to the username, a 
schema that does not exist. I just learned that H2's default schema is actually 
public--go to the H2 console, create table public.bar ..., you'll see it on 
the top level.
So could someone copy the line from PostgreSqlDriver in 
lift-mapper/src/main/scala/net/liftweb/mapper/Driver.scala that sets the schema 
to public into H2Driver?
If not I'll try to push it tomorrow.
Thanks.

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