Re: [Lift] Goals for type and method renaming for Lift 2.0 - was: Open discussion on Lift Name Calling practices

2009-12-18 Thread Heiko Seeberger
Thank you for writing this up, Naftoli.
I edited the abbreviation section ...

Heiko

2009/12/18 Naftoli Gugenheim naftoli...@gmail.com

 (Not sure why on Chrome the wiki article page is all centered. Reported it
 to Chrome.)

 Can everyone look over the article? Especially everyone quoted in it --
 Kris, Jim, DPP, Heiko, and anyone who I may have missed -- can you make sure
 everything represents your opinion correctly?
 Then if there is any disagreement after everyone's opinion is clarified we
 need to make some decisions together.
 This should not take much time, but it's very valuable! Thanks.


 2009/12/15 Naftoli Gugenheim naftoli...@gmail.com

 I compiled much of this thread into
 http://wiki.github.com/dpp/liftweb/about-naming-conventions in raw form.
 As we continue to discuss the naming goals and guidelines and vote or decide
 on controversial goals, that wiki page should become more consolidated and
 less of a copy-paste of a discussion. :)


 On Mon, Dec 14, 2009 at 6:32 PM, Kris Nuttycombe 
 kris.nuttyco...@gmail.com wrote:

 On Mon, Dec 14, 2009 at 12:31 PM, David Pollak
 feeder.of.the.be...@gmail.com wrote:
  Folks,
 
  Lift allows developers to create web sites that are:
 
  Reliable (which includes secure)
  Maintainable/concise
  Highly interactive
  Easy to build
  High Performance
  Easy to on-board (initial understanding of the APIs)
 
  Lift's APIs should reflect these rank-ordered goals.  Some of these
 goals
  are in tension with each other.  For example, easy on-boarding (e.g.,
 longer
  method names, more traditional imperative style) is in tension with
 concise.
 
  There's also a very diverse Lift community.
 
  I use Emacs for a lot of my Lift coding.  I know folks who use TextMate
 for
  Lift coding.  Having long method names assumes the use of an IDE which
 has
  name completion.  Lift's APIs must serve both communities.
  People are coming to Lift from Java, Ruby, PHP, and other backgrounds.
  Assuming Scala conventions rather than a best choice for naming does
 a
  dis-service to the polygots.  Further, most of Scala's API conventions
  except for the collections stuff is not in my opinion that well thought
 out
  or consistent.
  Many of Lift's APIs have evolved correctly based on actual usage
 patterns.
  For example, the initially counter-intuitive use of apply to set fields
 and
  vars works far better than any other mechanism, especially when
 chaining
  calls.  I've tried many different mechanisms (e.g., update(), Pascal
 style
  :=, set(), etc.) for setting fields and the one that everybody
 gravitated to
  was apply().
 
  We also have to consider the existing code base.  I've personally got
 150K
  lines of Lift-code under management.  If we start breaking APIs without
 a
  compelling reason, it costs me money and it costs my clients less of my
  time.  What's the impact to various different current users of Lift of
  breaking APIs without a compelling reason (and I like this name better
 than
  that name or this name is more consistent are not compelling
 reasons.)
  So, my criteria for any name changes (and this is not open to any type
 of
  negotiation and I've been 100% consistent about this since the
 discussion
  began) is:
 
  If the name change can be accomplished with a deprecation of the old
 name
  without breaking any existing APIs, then the name change can be the
 better
  name.
  If the name change is internal to Lift or is in a little-used feature
 (e.g.,
  Kris's API changes in Loc) such that very few projects will likely be
  impacted by a name change and those that are impacted are sufficiently
 savvy
  that they will understand the change and be able to make it in a matter
 of
  minutes.
  Any class name or object name change that does not meet the above
 criteria
  must be compelling.  For example, we changed from Scala Actors to Lift
  Actors.  This was a substantial amount of breakage, but there were no
  alternatives and the Scala Actor memory retention issues were
 materially
  impacting many different sites and we had worked on various attempted
  solutions over a 10 month period.  If we're going to break without
  deprecation and the breakage is going to impact a substantial part of
 the
  Lift community, there must be a compelling reason to make the breakage.
 
  On Sun, Dec 13, 2009 at 10:49 AM, Kris Nuttycombe
  kris.nuttyco...@gmail.com wrote:
 
  To this point, the only goals that have been recommended for this
  effort are those that I've noted below:
 
   1) Remove ambiguity wherever possible! There are a number of places
   where very similar names are used to refer to utterly different
   things.
 
   2) As an aide removing ambiguity, consider outlawing or eliminating
   extremely generic names, or else establish a single way in which a
   given name will be used across Lift. Examples are Field, Info,
 Holder,
   etc.
 
  In general, this is okay, but if there's a FooHolder that holds a Foo,
  what's wrong with that kind of 

[Lift] Make it possible to add LocParams to MetaMegaProtoUser's menus

2009-12-18 Thread Heiko Seeberger
Hi,

I created an issue (#251) to Make it possible to add LocParams to
MetaMegaProtoUser's menus:
The various user related menus are created by methods xxxMenuLoc (e.g.
loginMenuLoc) which give us no flexibility to add LocParams. Why would there
be a need for that? E.g. for adding a LocGroup in order to customize menu
display.
The idea is that there are additional methods that are called from
xxxMenuLoc in order to populate the LocParams. The default implementation
will add a LocGroup(user).

Before implementing that I would like to ask for you opinion.

Thank you,

Heiko Seeberger

My job: weiglewilczek.com
My blog: heikoseeberger.name
Follow me: twitter.com/hseeberger
OSGi on Scala: scalamodules.org
Lift, the simply functional web framework: liftweb.net

--

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] Confused about validation

2009-12-18 Thread Jeppe Nejsum Madsen
Naftoli Gugenheim naftoli...@gmail.com writes:

 What would such an abstraction do?
 What code would you like to write (including templates) and what should it do?

I had some input here:

http://groups.google.com/group/liftweb/browse_thread/thread/814de5be30410925/4a327d21cf4cc123?lnk=gstq=jeppe+wizard+forms#4a327d21cf4cc123

/Jeppe

--

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




Re: [Lift] Make it possible to add LocParams to MetaMegaProtoUser's menus

2009-12-18 Thread Jeppe Nejsum Madsen
Heiko Seeberger heiko.seeber...@googlemail.com writes:

 Hi,

 I created an issue (#251) to Make it possible to add LocParams to
 MetaMegaProtoUser's menus:
 The various user related menus are created by methods xxxMenuLoc (e.g.
 loginMenuLoc) which give us no flexibility to add LocParams. Why would there
 be a need for that? E.g. for adding a LocGroup in order to customize menu
 display.

Agreed. I had to make my own:

var logoutMenu = Menu(Loc(logout, User.logoutPath, Log ud,
User.logoutTemplate, appMenuGroup))


 The idea is that there are additional methods that are called from
 xxxMenuLoc in order to populate the LocParams. The default
 implementation will add a LocGroup(user).

 Before implementing that I would like to ask for you opinion.

I think this should mimic the way things are done in CRUDify, ie:

 def showAllMenuLoc: Box[Menu] =
  Full(Menu(Loc(List +Prefix, listPath, showAllMenuName,
locSnippets :: Loc.Template(showAllTemplate) :: 
showAllMenuLocParams)))

  /**
   * Override to include new Params for the show all menu
   */
  def showAllMenuLocParams: List[Loc.AnyLocParam] = Nil

I think the default impl should just be empty.

/Jeppe

--

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




[Lift] (Maybe bug)comet long polling into javascript loop?

2009-12-18 Thread Andrea Peruffo
I have a project where a snippet generates the code for a comet actor, but 
when I open two(or more) windows of the same browser on the page I can see 
that javascript on both pages start to makes continuous comet calls.

I attach a simple project that reproduce the problem.

Please any fix or workaround??

Andrea

--

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.




CometPolling.tar.gz
Description: application/tgz


[Lift] Re: (Maybe bug)comet long polling into javascript loop?

2009-12-18 Thread Marius
This is not a bug. When Lift detects multiple requests for the same
session it breaks out the Comet request. This is a safety mechanism in
order to avoid HTTP connection starvation on the client side. This is
because browsers have a very limited connection pools and the number
of parallel HTTP connections are quite low varying from 2 to probably
8 depending on the browser. Note that this pool is shared among
different tab browsers AND different instances of the same browser.

So if you want to test with multiple browsers on you dev env use
different browsers such that open your app with Firefox, then open the
same app with Chrome etc.

Br's,
Marius

On Dec 18, 11:34 am, Andrea Peruffo a.peru...@mcmspa.it wrote:
 I have a project where a snippet generates the code for a comet actor, but
 when I open two(or more) windows of the same browser on the page I can see
 that javascript on both pages start to makes continuous comet calls.

 I attach a simple project that reproduce the problem.

 Please any fix or workaround??

 Andrea

  CometPolling.tar.gz
 7KViewDownload

--

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




Re: [Lift] Re: (Maybe bug)comet long polling into javascript loop?

2009-12-18 Thread Andrea Peruffo
And this does not affect performances? or server side computations?

Andrea


Il Friday 18 December 2009 10:50:17 Marius ha scritto:
 This is not a bug. When Lift detects multiple requests for the same
 session it breaks out the Comet request. This is a safety mechanism in
 order to avoid HTTP connection starvation on the client side. This is
 because browsers have a very limited connection pools and the number
 of parallel HTTP connections are quite low varying from 2 to probably
 8 depending on the browser. Note that this pool is shared among
 different tab browsers AND different instances of the same browser.

 So if you want to test with multiple browsers on you dev env use
 different browsers such that open your app with Firefox, then open the
 same app with Chrome etc.

 Br's,
 Marius

 On Dec 18, 11:34 am, Andrea Peruffo a.peru...@mcmspa.it wrote:
  I have a project where a snippet generates the code for a comet actor,
  but when I open two(or more) windows of the same browser on the page I
  can see that javascript on both pages start to makes continuous comet
  calls.
 
  I attach a simple project that reproduce the problem.
 
  Please any fix or workaround??
 
  Andrea
 
   CometPolling.tar.gz
  7KViewDownload

 --

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


--

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




[Lift] stable identifier required - problems with rewriting requests

2009-12-18 Thread ortis
i have problem with rewriting

if i do something like this
  LiftRules.rewrite.append {
 case RewriteRequest(ParsePath(List(Documents), _,
_, _), _, _) =
 RewriteResponse(List(Documents, VZN ))
  }

evrything works fine but if i do

val doc = Documents

   LiftRules.rewrite.append {
case RewriteRequest(ParsePath(List(doc),
_, _, _), _, _) =
  RewriteResponse(List(Documents,
VZN ))
   }
in browser i can see only : The Requested URL / was not found on this
server

if i do

  LiftRules.rewrite.append {
case RewriteRequest(ParsePath(List
( something.toString ), _, _, _), _, _) =
  RewriteResponse(List(Documents,
VZN ))
   }
i get error stable identifier required

Is there something i do not know about rewriting, or problem is in
something else. I'm new in scala and lift, and
i can't find any solution for this for now

Can anybody help?

very thanks

majo


--

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




[Lift] Re: (Maybe bug)comet long polling into javascript loop?

2009-12-18 Thread Marius
Not sure what you mean ... what concerns do you have about
performance? ... If you are referring to this mechanism built in Lift,
there is virtually no performance impact. This is very lightweight.

If you are referring to something else, please provide more details
about your concerns.

Br's,
Marius

On Dec 18, 11:58 am, Andrea Peruffo a.peru...@mcmspa.it wrote:
 And this does not affect performances? or server side computations?

 Andrea

 Il Friday 18 December 2009 10:50:17 Marius ha scritto:

  This is not a bug. When Lift detects multiple requests for the same
  session it breaks out the Comet request. This is a safety mechanism in
  order to avoid HTTP connection starvation on the client side. This is
  because browsers have a very limited connection pools and the number
  of parallel HTTP connections are quite low varying from 2 to probably
  8 depending on the browser. Note that this pool is shared among
  different tab browsers AND different instances of the same browser.

  So if you want to test with multiple browsers on you dev env use
  different browsers such that open your app with Firefox, then open the
  same app with Chrome etc.

  Br's,
  Marius

  On Dec 18, 11:34 am, Andrea Peruffo a.peru...@mcmspa.it wrote:
   I have a project where a snippet generates the code for a comet actor,
   but when I open two(or more) windows of the same browser on the page I
   can see that javascript on both pages start to makes continuous comet
   calls.

   I attach a simple project that reproduce the problem.

   Please any fix or workaround??

   Andrea

    CometPolling.tar.gz
   7KViewDownload

  --

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

--

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




Re: [Lift] Re: (Maybe bug)comet long polling into javascript loop?

2009-12-18 Thread David Pollak
On Fri, Dec 18, 2009 at 1:58 AM, Andrea Peruffo a.peru...@mcmspa.it wrote:

 And this does not affect performances? or server side computations?


The short answer is that it does increase the amount of HTTP traffic, but
with HTTP keep-alive, that's not a lot of new TCP/IP connections.

On the server side, Lift does its Comet support very early in the HTTP
request/response cycle and the computations for handling the setup/tear down
of the Comet long poll and minimal.

If you have an actual application that has actual performance issues related
to this, there are things that can be done:

   - You can use DNS wildcarding to sent the Comet long poll requests to a
   different, random host and this will allow more than 2 HTTP requests to the
   same server because the browser logic is based on the host name.
   - You can include your own logic for when a Comet long poll operation is
   terminated

But (and I say this based on many years of experience deploying Lift-based
Comet apps and interacting on this list and privately with folks who have
built Lift apps), it's never been an actual production issue and there are
plenty of folks using Lift and Lift's comet long polling in production for
non-trivial applications.



 Andrea


 Il Friday 18 December 2009 10:50:17 Marius ha scritto:
  This is not a bug. When Lift detects multiple requests for the same
  session it breaks out the Comet request. This is a safety mechanism in
  order to avoid HTTP connection starvation on the client side. This is
  because browsers have a very limited connection pools and the number
  of parallel HTTP connections are quite low varying from 2 to probably
  8 depending on the browser. Note that this pool is shared among
  different tab browsers AND different instances of the same browser.
 
  So if you want to test with multiple browsers on you dev env use
  different browsers such that open your app with Firefox, then open the
  same app with Chrome etc.
 
  Br's,
  Marius
 
  On Dec 18, 11:34 am, Andrea Peruffo a.peru...@mcmspa.it wrote:
   I have a project where a snippet generates the code for a comet actor,
   but when I open two(or more) windows of the same browser on the page I
   can see that javascript on both pages start to makes continuous comet
   calls.
  
   I attach a simple project that reproduce the problem.
  
   Please any fix or workaround??
  
   Andrea
  
CometPolling.tar.gz
   7KViewDownload
 
  --
 
  You received this message because you are subscribed to the Google Groups
  Lift group. To post to this group, send email to
  lift...@googlegroups.com.
  To unsubscribe from this group, send email to
  liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com.
 For more options, visit this group at
  http://groups.google.com/group/liftweb?hl=en.


 --

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





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

--

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




Re: [Lift] Re: Problem in Lift 1.1-SNAPSHOT ?

2009-12-18 Thread David Pollak
On Thu, Dec 17, 2009 at 10:16 PM, ngocdaothanh ngocdaoth...@gmail.comwrote:

 I am sorry. That compilation error comes from Lift's branch for Scala
 2.8.


The 2.8 branch is not a complete port of Lift.  It's lift-base, lift-mapper
and the lift-examples/example code.  We will complete the port (the other
Lift modules) once 2.8 Beta 1 is out and the Scala depencies are ported to
2.8 Beta1




 On 12月18日, 午前8:38, David Pollak feeder.of.the.be...@gmail.com wrote:
  On Thu, Dec 17, 2009 at 2:08 PM, ngocdaothanh ngocdaoth...@gmail.com
 wrote:
 
   I checkout the source code from GitHub, do mvn clean compile and the
   output is:
 
   lift-modules/lift-jta/src/main/scala/net/liftweb/transaction/
   TransactionContext.scala:206: error: class TransactionContext needs to
   be abstract, since method getUnitName in trait ScalaEMFactory of type
   = String is not defined
   class TransactionContext(private implicit val transactionService:
   TransactionService)
^
   one error found
 
   The source code from GitHub is not always compilable.
 
  This is simply not true.  The code on the master branch always compiles.
  I
  just did a checkout and compilation of the lift-jta module and it worked
  just fine.
 
 
 
 
 
   On Dec 18, 3:17 am, David Pollak feeder.of.the.be...@gmail.com
   wrote:
Did you do an mvn clean compile?
 
On Thu, Dec 17, 2009 at 9:27 AM, earthling_paul 
 paul.ber...@gmail.com
   wrote:
 
 While compiling my samples with Lift 1.1-SNAPSHOT I get this
 Compiler-
 Error:
 
 [ERROR] D:\Projekte\TestProjects\hello-lift-11\src\main\scala\net
 \liftweb\hello\snippet\TD.scala:76: error: object creation
 impossible,
 since method doSync in trait AnyVarTrait of type [F](= F)F is not
 defined
 [INFO] object QueryNotDone extends SessionVar(false)
 
 Any ideas ?
 Regards Paul
 
 --
 
 You received this message because you are subscribed to the Google
   Groups
 Lift group.
 To post to this group, send email to lift...@googlegroups.com.
 To unsubscribe from this group, send email to
 liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com
 liftweb%2bunsubscr...@googlegroups.comliftweb%252bunsubscr...@googlegroups.com
 
   liftweb%2bunsubscr...@googlegroups.comliftweb%252bunsubscr...@googlegroups.com
 liftweb%252bunsubscr...@googlegroups.comliftweb%25252bunsubscr...@googlegroups.com
 
 
 .
 For more options, visit this group at
http://groups.google.com/group/liftweb?hl=en.
 
--
Lift, the simply functional web frameworkhttp://liftweb.net
Beginning Scalahttp://www.apress.com/book/view/1430219890
Follow me:http://twitter.com/dpp
Surf the harmonics
 
   --
 
   You received this message because you are subscribed to the Google
 Groups
   Lift group.
   To post to this group, send email to lift...@googlegroups.com.
   To unsubscribe from this group, send email to
   liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com
 liftweb%2bunsubscr...@googlegroups.comliftweb%252bunsubscr...@googlegroups.com
 
   .
   For more options, visit this group at
  http://groups.google.com/group/liftweb?hl=en.
 
  --
  Lift, the simply functional web frameworkhttp://liftweb.net
  Beginning Scalahttp://www.apress.com/book/view/1430219890
  Follow me:http://twitter.com/dpp
  Surf the harmonics

 --

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





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

--

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




Re: [Lift] stable identifier required - problems with rewriting requests

2009-12-18 Thread David Pollak
For stable identifers, see the Scala Language Specification, section 8.1.4:
http://www.scala-lang.org/sites/default/files/linuxsoft_archives/docu/files/ScalaReference.pdf

You can also see this discussion:
http://old.nabble.com/About-Class-Type-match-td22309426.html

Short answer is that you cannot pattern match against the result of a method
invocation (foo.toString).  A stable identifier must be a val (something
that is calculated and will not change for the duration of the pattern match
and be upper case or in back-ticks.  So, in your case:

val doc = Foo // can't match against doc because it looks like something
you want to extract
val Doc = Foo // can match against Doc


On Fri, Dec 18, 2009 at 3:48 AM, ortis marian.po...@gmail.com wrote:

 i have problem with rewriting

 if i do something like this
  LiftRules.rewrite.append {
 case RewriteRequest(ParsePath(List(Documents), _,
 _, _), _, _) =
 RewriteResponse(List(Documents, VZN ))
  }

 evrything works fine but if i do

val doc = Documents

   LiftRules.rewrite.append {
case RewriteRequest(ParsePath(List(doc),
 _, _, _), _, _) =
  RewriteResponse(List(Documents,
 VZN ))
   }
 in browser i can see only : The Requested URL / was not found on this
 server

 if i do

  LiftRules.rewrite.append {
case RewriteRequest(ParsePath(List
 ( something.toString ), _, _, _), _, _) =
  RewriteResponse(List(Documents,
 VZN ))
   }
 i get error stable identifier required

 Is there something i do not know about rewriting, or problem is in
 something else. I'm new in scala and lift, and
 i can't find any solution for this for now

 Can anybody help?

 very thanks

 majo


 --

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





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

--

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




[Lift] Re: How can i update and insert record into database via Raw sql in Lift?

2009-12-18 Thread Marcin Jurczuk
Hi,

You have few options:
- DB.runQuery(UPDATE blogs set click_counts=click_counts+1 WHERE
id=1)
- DBprepareStatement(UPDATE blogs set click_counts=click_counts+1
WHERE id=?,yourDBConnection) {
stmt =
stmt.setLong(1,1)
stmt.executeUpdate()
}
Where first 1 in setLong is position in prepared statment where you
will put second value. Since You have only one ? it always will be
1.

WARNING:
runQuery is vulnerable to SQL injection in many situations (mostly
where string is passed to query)


Marcin,

On 18 Gru, 15:45, Neil.Lv anim...@gmail.com wrote:
 Hi all,

    How can i update and insert record into database via Raw sql in
 Lift?

    I write some code but it failed, here is :

 ### In the model

   def updateClickCountsById(id: Long) =
     DB.runQuery(UPDATE blogs set click_counts=click_counts+1 WHERE
 id=1)

   def insertRecord() =
     DB.runQuery(INSERT INTO blogs click_counts=100 WHERE id=1)

 ###

    This two method doesn't work, so how can i update and insert via
 raw SQL in the lift with Mapper?

    Thanks for any suggestion !

 Cheers,
   Neil

--

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




[Lift] MetaMapper broke LifecycleCallbacks ?

2009-12-18 Thread night_stalker
I need to add a beforeSave() callback, so I wrote:

class X extends LongKeyedMapper[X] with IdPK with
LifecycleCallbacks {
  def getSingleton = X
  def beforeSave {
println(hi!)
  }
  ...
}
object X extends X with LongKeyedMetaMapper[X] {
  ...
}

Then got a compile error:

[ERROR]  X.scala:35: error: error overriding method
beforeValidation in trait LifecycleCallbacks of type = Unit;
[INFO]  method beforeValidation in trait MetaMapper of type = List
[(com.lawsite.model.precedent.PrecedentContent) = Unit] needs
`override' modifier

Is it a bug or, am I doing something wrong ?

--

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] MetaMapper broke LifecycleCallbacks ?

2009-12-18 Thread Naftoli Gugenheim
I think LifecycleCallbacks is needed for fields, not the mapper itself.

-
night_stalkerusur...@gmail.com wrote:

I need to add a beforeSave() callback, so I wrote:

class X extends LongKeyedMapper[X] with IdPK with
LifecycleCallbacks {
  def getSingleton = X
  def beforeSave {
println(hi!)
  }
  ...
}
object X extends X with LongKeyedMetaMapper[X] {
  ...
}

Then got a compile error:

[ERROR]  X.scala:35: error: error overriding method
beforeValidation in trait LifecycleCallbacks of type = Unit;
[INFO]  method beforeValidation in trait MetaMapper of type = List
[(com.lawsite.model.precedent.PrecedentContent) = Unit] needs
`override' modifier

Is it a bug or, am I doing something wrong ?

--

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


--

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




[Lift] Re: Problem in Lift 1.1-SNAPSHOT ?

2009-12-18 Thread earthling_paul
David,

mvn clean compile

worked. Thanks!

--

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




[Lift] Re: MetaMapper broke LifecycleCallbacks ?

2009-12-18 Thread Gijs S.
I had the same problem with a User object that extends
MetaMegaProtoUser[User], which has the MetaMapper trait as well.

The afterSave you wish to override is defined in the trait
net.liftweb.mapper.MetaMapper as def afterSave: List[(A) = Any] =
Nil.

You can add an operation to afterSave like this:

class X extends LongKeyedMapper[X] with IdPK {
  def getSingleton = X

  def myAfterSaveOperation(obj: X): Unit = {
println(hi!)
  }

  def myOtherAfterSaveOperation(obj: X): Unit = {
println(hi again!)
  }

  override def afterSave = myAfterSaveOperation _ ::
myOtherAfterSaveOperation _ :: Nil
  /* Equal to: override def afterSave = List(myAfterSaveOperation
_, myOtherAfterSaveOperation _) */
  ...
}
object X extends X with LongKeyedMetaMapper[X] {
 ...
}

Here the underscore after myAfterSaveOperation makes it a partially
applied function.
This is similar to the way validations are added to MetaMapper
classes, as decribed in listing 6.38 in the Lift book (http://
groups.google.com/group/the-lift-book).

MetaMapper does not implement LifecycleCallbacks, that trait is indeed
used in MappedFields.

--

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




[Lift] Re: MetaMapper broke LifecycleCallbacks ?

2009-12-18 Thread night_stalker
Got it, I was a little bit confused :)

class X extends LongKeyedMapper[X] with IdPK {
  ...
}
object X extends X with LongKeyedMetaMapper[X] {
  override def beforeSave = List((x: X) = {
println(hi)
()
  })
}

On Dec 18, 11:50 pm, Naftoli Gugenheim naftoli...@gmail.com wrote:
 I think LifecycleCallbacks is needed for fields, not the mapper itself.

--

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




[Lift] Re: How can i update and insert record into database via Raw sql in Lift?

2009-12-18 Thread Neil.Lv
Hi Marcin,

   Thank you very much! The update statement works now!

   There is a question about the insert statement, how can i use the
prepareStatement ?

###
  INSERT INTO blogs click_counts=100 WHERE id=1
###

   I'm not familiar with it,

   Thanks very much!

   :)

Cheers,
  Neil

On Dec 18, 11:13 pm, Marcin Jurczuk mjurc...@gmail.com wrote:
 Hi,

 You have few options:
 - DB.runQuery(UPDATE blogs set click_counts=click_counts+1 WHERE
 id=1)
 - DBprepareStatement(UPDATE blogs set click_counts=click_counts+1
 WHERE id=?,yourDBConnection) {
 stmt =
 stmt.setLong(1,1)
 stmt.executeUpdate()}

 Where first 1 in setLong is position in prepared statment where you
 will put second value. Since You have only one ? it always will be
 1.

 WARNING:
 runQuery is vulnerable to SQL injection in many situations (mostly
 where string is passed to query)

 Marcin,

 On 18 Gru, 15:45, Neil.Lv anim...@gmail.com wrote:

  Hi all,

     How can i update and insert record into database via Raw sql in
  Lift?

     I write some code but it failed, here is :

  ### In the model

    def updateClickCountsById(id: Long) =
      DB.runQuery(UPDATE blogs set click_counts=click_counts+1 WHERE
  id=1)

    def insertRecord() =
      DB.runQuery(INSERT INTO blogs click_counts=100 WHERE id=1)

  ###

     This two method doesn't work, so how can i update and insert via
  raw SQL in the lift with Mapper?

     Thanks for any suggestion !

  Cheers,
    Neil

--

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




Re: [Lift] Re: MetaMapper broke LifecycleCallbacks ?

2009-12-18 Thread David Pollak
On Fri, Dec 18, 2009 at 9:28 AM, night_stalker usur...@gmail.com wrote:

 Got it, I was a little bit confused :)

 class X extends LongKeyedMapper[X] with IdPK {
   ...
 }
 object X extends X with LongKeyedMetaMapper[X] {
   override def beforeSave = List((x: X) = {
println(hi)
()
  })
 }


When you override this method, you *must* call super:

override def beforeSave = doHi _ :: super.beforeSave // You *must* include
the super list

private def doHi(inst: X) {println(hi)}





 On Dec 18, 11:50 pm, Naftoli Gugenheim naftoli...@gmail.com wrote:
  I think LifecycleCallbacks is needed for fields, not the mapper itself.

 --

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





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

--

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




[Lift] Nexus/Hudson maitenance on scala-tools.org

2009-12-18 Thread Josh Suereth
All,

Nexus/Hudson will be temporarily disabled Saturday/Sunday  from 8-11pm
EST.   These services are being upgraded.   I'll post an email 15 minutes
before the actual shutdown and immediately after things are back up and
working.  You should be able to make use of artifacts on the
scala-tools.orgserver, however nightly builds and posting releases
will be disabled.  If
anyone has a specific release/test they need performed during this period
please send me an email and I can accomodate you.


Thanks for your cooperation!

- Josh Suereth

--

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




[Lift] Re: [scala-tools] Nexus/Hudson maitenance on scala-tools.org

2009-12-18 Thread David Pollak
On Fri, Dec 18, 2009 at 12:38 PM, Josh Suereth joshua.suer...@gmail.comwrote:

 All,

 Nexus/Hudson will be temporarily disabled Saturday/Sunday  from 8-11pm
 EST.   These services are being upgraded.   I'll post an email 15 minutes
 before the actual shutdown and immediately after things are back up and
 working.  You should be able to make use of artifacts on the
 scala-tools.org server, however nightly builds and posting releases will
 be disabled.  If anyone has a specific release/test they need performed
 during this period please send me an email and I can accomodate you.


Josh,

Thanks for the heads up!

David




 Thanks for your cooperation!

 - Josh Suereth






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

--

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




Re: [Lift] Radio labels

2009-12-18 Thread David Pollak
On Sun, Dec 13, 2009 at 9:08 PM, Todd ojint...@gmail.com wrote:

 Looking to properly label my radios with label for=inputid/
 labelinput id=inputid /.  Here's my current snippet:

 def create(xhtml: NodeSeq) : NodeSeq = {

def submitHandler() = {
   S.redirectTo(/createSuccess?name= + name.is);
}

var chosenMethod: Box[ContestType.Value] = Empty

return bind(createForm, xhtml, name - SHtml.text(
 name.is, name
 (_)),
type   - SHtml.radio(
ContestType.elements.toList.map(_.toString),
Empty,
selected = chosenMethod = Box(ContestType.valueOf
 (selected)), {id - {var i = 1; i.toString()}}
).flatMap(choice = (span{choice.xhtml} label
 for='type'{choice.key.toString}/label/span)),
submit - SHtml.submit(Submit, submitHandler _)
)
}


val radios: ChoiceHolder[String] = SHtml.radio(elements, callBack)
val radioHtml: NodeSeq = radios.items.toList.zipWithIndex.map{case (choice,
idx) = span{choice.xhtml} label id={idx.toString}
for='type'{choice.key.toString}/label/span



 So to highlight the important bits : i.toString() was the beginnings
 to test out how the attributes got applied to each radio.  What I end
 up with is a bunch of input name=CRAZYINTERNALLIFT# id=1 / where
 the id doesn't change from 1, which is expected.  But I'm thinking
 that the additional attributes passed into the SHtml.radio button get
 applied to each input tag and are evaluated immediately, not when they
 are applied to each tag.  Am I wrong?

 --

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





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

--

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




Re: [Lift] jsonCall for clickable links

2009-12-18 Thread David Pollak
On Thu, Dec 10, 2009 at 12:13 PM, Nolan Darilek no...@thewordnerd.infowrote:

 Hello, all. I'm sure this is an incredibly silly mistake on my part, but
 I've never really done AJAX until playing with Lift and am at a loss as
 to what's going wrong.

 I'm dusting off my old geolocation web app. My current goals are
 two-fold: set an initial position based on the browser, then generate
 links to update that position based on nearby points. Thus far I have
 the first goal working quite nicely. A snippet registers a javascript
 callback to call a Lift function, and my page is being updated
 correctly. Here's what I have:

   def update(in:NodeSeq):NodeSeq = Script(JsRaw(
 loc.onUpdate = function(lat, lon) {
   +SHtml.jsonCall(JsObj(lat - JsVar(lat), lon -
 JsVar(lon)), updatePosition _)._2.toJsCmd+;
 }
   ))

 The problem arises when I try calling my updatePosition function from an
 SHtml.a link, like so:

   val nodeList = ul
 {nodes.map(nd = li{SHtml.a(
   nd.name(None, None).getOrElse(Unnamed way),
   SHtml.jsonCall(
 JsObj(lat - nd.latitude, lon - nd.longitude),
 updatePosition _
   )._2
 )}/li)}
 /ul


How about:

val nodes: List[xxx] = ...
val nodeList = nodes match {
  case Nil = pNo nodes/p
  case xs = ul{xs.map(nd = li{SHtml.a(() = updatePosition(nd), Text(
ns.name(None, None) getOrElse Unnamed)}/li)}/ul



 Ultimately, this function returns a JsCmd that performs two Replaces.

 First, that seems just a bit ugly to me, with the escape within an
 escape and all. Is there any way of eliminating that, short of placing
 the ul/ into the template? Ideally this should handle the case where
 there are no nearby nodes, in which case there'd be a pNo nearby
 points of interest./p instead of the enclosing ul, but I haven't
 coded that yet.

 Next, clicking on these links doesn't work, and I get a parent is null
 error from Firebug. I'm guessing that this new call is registered in the
 context of a new, blank document, and hence can't perform any of the
 Replace commands that work fine when this function is used in the
 context of a callback in an existing document? If so, do I need another
 Shtml function to make the jsonCall occur in the current DOM?

 Finally, any idea as to why the link names appear as quoted strings
 (I.e. Unnamed way instead of just Unnamed way)? I'm guessing it may
 have to do with the embedded escape, but I'm not entirely certain.

 Thanks in advance, this is such a helpful and patient community,
 especially with newbies like myself. :)

 --

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





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

--

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




[Lift] Ajax Forms and Binding

2009-12-18 Thread Peter Robinett
Hi all,

I think there is a simple answer to this, but I'm a little confused. I
want to update a bound element when my Ajax form is submitted. Here's
a simple version based upon what I gleaned from the wiki and the
mailing list:

lift:Test.form
  pDisplay: test:display //p
  pInput1: test:input1 //p
  pInput2: test:input2 //p
  ptest:submit //p
/lift:Test.form

class Test {
  var display = 
  var input1 = 
  var input2 = 
  def form(xhtml: NodeSeq): NodeSeq = {
SHtml.ajaxForm(
  bind(test, xhtml,
display - display,
input1 - SHtml.text(input1, input1 = _),
input2 - SHtml.text(input2, input2 = _),
submit - SHtml.submit(Submit, () = {}) // empty method
since our hidden item will be called instead?
  ) ++
  SHtml.hidden(() = {
   display = input1 + input2
   // push an update to display here?
   ()
  })
)
  }
}

Am I on the right track? How do I actually get test:display / to be
updated?

Thanks,
Peter

--

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




Re: [Lift] More AJAX issues

2009-12-18 Thread David Pollak
On Fri, Dec 11, 2009 at 8:21 AM, Nolan Darilek no...@thewordnerd.infowrote:

 Hello. Sorry for being the squeaky wheel on this one, but I'm really at
 a loss with no way to know if this is an issue with me, or with how I'm
 doing things in Lift. I've also been at this particular problem for a
 bit under a day now, and am running out of things to try and words to
 google.

 I think I figured out yesterday's issue--likely should have set onclick
 to an anonymous function returning false to prevent the browser from
 running it in a new DOM--but I've decided to chage my approach slightly.
 For various reasons, I'm now trying to use a select/ with an onBlur
 handler which submits the value, a JSON string, to a function via
 jsonCall. Here is my entire function, still with a few rough edges as I
 add in the various AJAX bits:

   def updatePosition(pos:Any):JsCmd = pos match {
 case p:Map[String, Double] =
   GeoNode.nearestTo(p(lat), p(lon)) match {
 case Some(node) =
   val nodes = node.within(0.001).remove(n = n.ways.size == 1)
   val nodeList = select onblur = {
 JsRaw(alert(\Blur!\))
   }


You're making things way too complex:

select onblur=alert('Blur!')


 {
 nodes.map(n =
 option value={JsObj(lat - n.latitude, lon -
 n.longitude)}


value={JsObj(lat - n.latitude, lon - n.longitude)}

does not do what you think it does.  You can't put a JSON object in the
attribute of an HTML element.

When the item is selected, what do you want to happen?


 {n.name(None, None).getOrElse(Unnamed node)}/option
 )
   }/select
   println(nodeList)
   Replace(location, node.nearestWay match {
 case Some(w) = pOn {w.name.getOrElse(Unnamed way)}./p
 case None = pNo nearby ways/p
   }) 
   Replace(nearby, nodeList)
 case _ = Replace(location, pThar be dragons! (You don't
 appear to be on any current maps./p)
 }
 case _ =
   println(pos)
   Alert(Unexpected geolocation API response from browser.)
   }

 No matter what I try, I can't get the alert() to trigger when I tab off
 the select/. The println outputs what appears to be a sane value. I've
 inspected the element in Firebug, and everything appears as I'd expect.
 I've saved the entire page body with everything inserted, and everything
 looks fine there too. I've even done up a simple HTML document to make
 sure this behaves as I'd expect, and it does exactly what I think it
 should.

 So, what am I missing? Is embedded JS in a Replace call not run or
 something odd like that?

 --

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





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

--

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




Re: [Lift] Ajax Forms and Binding

2009-12-18 Thread David Pollak
On Fri, Dec 18, 2009 at 3:22 PM, Peter Robinett pe...@bubblefoundry.comwrote:

 Hi all,

 I think there is a simple answer to this, but I'm a little confused. I
 want to update a bound element when my Ajax form is submitted. Here's
 a simple version based upon what I gleaned from the wiki and the
 mailing list:

 lift:Test.form
  pDisplay: test:display //p
  pInput1: test:input1 //p
  pInput2: test:input2 //p
  ptest:submit //p
 /lift:Test.form

 class Test {
  var display = 
  var input1 = 
  var input2 = 
  def form(xhtml: NodeSeq): NodeSeq = {
SHtml.ajaxForm(
  bind(test, xhtml,
display - span id=i_like_yaks{display}/span,
input1 - SHtml.text(input1, input1 = _),
input2 - SHtml.text(input2, input2 = _),
submit - SHtml.submit(Submit, () = {}) // empty method
 since our hidden item will be called instead?
  ) ++
  SHtml.hidden(() = {
   display = input1 + input2


SetHtml(i_like_yaks, Text(display))

  })
)
  }
 }

 Am I on the right track? How do I actually get test:display / to be
 updated?

 Thanks,
 Peter

 --

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





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

--

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




Re: [Lift] JS event source in a server side handler

2009-12-18 Thread David Pollak
This code does what I think you want:

package com.liftcode.snippet

import _root_.scala.xml.{NodeSeq, Text}
import _root_.net.liftweb.util._
import _root_.net.liftweb.common._

import com.liftcode.lib._
import Helpers._
import _root_.net.liftweb.http._
import js._
import JsCmds._
import JE._

class HelloWorld {

  private def processAjaxCall(in: String): JsCmd =
  SetHtml(fruit_bat, spanThe id is {in}/span)

  def howdy(in: NodeSeq): NodeSeq =
  for {
i - 1 to 20
  } yield diva id={id_+i} onclick={SHtml.ajaxCall(JsRaw(this.id),
processAjaxCall)._2.toJsCmd+; return false;}Click me #{i}/a/div

}



On Sun, Nov 15, 2009 at 3:07 PM, Chris Lewis burningodzi...@gmail.comwrote:


 Hello list,

 Often in an AJAX handler I need to update something on the client side;
 usually a UI control that initiated the handler. The only way I know to
 handle this is to generate a DOM id in the snippet during a rendering
 call (like a bind() call in a flatMap over a dataset), look for that id
 in my handler, and then query up or down the DOM to find the
 corresponding UI component to tweak. It'd be nice if I could access the
 event source node in my handler. In a standard JS event handler, 'this'
 references the source element, and in some JS libraries like prototype,
 a method is added to the event object to access the source element.

 Given the current implementation, what's the best way to access the
 client side source of a UI event in a server-side handler? It seems like
 there'd be a cleaner way than what I'm doing. 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.comliftweb%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/liftweb?hl=en
 -~--~~~~--~~--~--~---




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

--

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




[Lift] Re: Duplicate Keys Created by Schemefier

2009-12-18 Thread Peter Robinett
Sorry, dropped the ball on this one. Maybe change something in
MySqlDriver, perhaps primaryKeySetup? Unfortunately at that level you
don't know what columns have been defined. Anyway, I don't think this
is a pressing issue, so in the absence of having a solution to offer,
I'll leave it be.

Peter

On Dec 16, 12:55 pm, David Pollak feeder.of.the.be...@gmail.com
wrote:
 On Wed, Dec 16, 2009 at 11:07 AM, Peter Robinett 
 pe...@bubblefoundry.comwrote:

  Fair enough, but isn't this still a non-optimal situation with the
  MySQL database driver?

 What is your proposed change?







  Peter

  On Dec 15, 7:23 pm, David Pollak feeder.of.the.be...@gmail.com
  wrote:
   On Tue, Dec 15, 2009 at 5:46 PM, Peter Robinett pe...@bubblefoundry.com
  wrote:

My tables created by Schemefier have multiple keys for the primary key
when my Mapper model is declared like so: class myModel extends
LongKeyedMapper[myModel] with IdPK. There is naturally the primary key
but there is also a unique key on the column that simply duplicates
the functionality of the primary key.

Are other people seeing this? I've only looked on MySQL. This seems to
be because IdPK adds an id of type MappedLongIndex. Only the
longIndexColumnType of MySqlDriver has UNIQUE KEY in its definition.
Unique keys are great but, as I mentioned, if the column is also the
primary key the index is a duplication. Maybe this is something that
IdPK can disable when declaring the column? At least with MySQL
primary keys are guaranteed to be unique and InnoDB tables, which
Mapper uses, can have issues with long primary keys[1].

Should this be fixed? Or is the more helpful answer 'Don't use
MySQL'? ;-)

   I would use MySQL for a production site.

   If IdPK isn't doing what you want, then don't use it, just declare the
   primary key field manually.

Peter

[1]:http://dev.mysql.com/doc/refman/5.1/en/innodb-index-types.html

--

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

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

  --

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

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

--

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




Re: [Lift] Re: How to redirect to a specify url when logged in successfully?

2009-12-18 Thread David Pollak
I did a override def homePage = /all_users and that's where I go after I
log in.

On Thu, Dec 3, 2009 at 5:44 AM, Neil.Lv anim...@gmail.com wrote:

  I added this code in the User model, but it doesn't work yet.

  This println method is never executed.

  Maybe some configuration need to be set ?

 ###
 object User extends User with MetaMegaProtoUser[User] {
  ...
   override def loginFirst = If(
loggedIn_? _,
() = {
  import net.liftweb.http.{RedirectWithState, RedirectState}
   val uri = Full(/all_users)
 println( xxx )
   RedirectWithState(
loginPageURL,
RedirectState( ()={loginRedirect.set(uri)})
  )
}
  )
   ...
 }
 ###


 Cheers,
  Neil


 On Dec 1, 8:15 am, David Pollak feeder.of.the.be...@gmail.com wrote:
  On Sun, Nov 29, 2009 at 12:17 AM, Neil.Lv anim...@gmail.com wrote:
   Hi all,
 
 I want to redirecto to a specify URL like this /all_users when
   logged in successfully via the default link,
  http://localhost:8080/user_mgt/login
 
Is there a help method (i dont't find it) to configure it?
 
When i logged in successfully via /user_mgt/login link and redirect
   to the /all_users link not the /index page.
 
  In your User object (singleton):
override def loginFirst = If(
  loggedIn_? _,
  () = {
import net.liftweb.http.{RedirectWithState, RedirectState}
val uri = /all_users
RedirectWithState(
  loginPageURL,
  RedirectState( ()={loginRedirect.set(uri)})
)
  }
)
 
 
 
 
 
Thanks for any help.
 
   Cheers,
Neil
 
   --
 
   You received this message because you are subscribed to the Google
 Groups
   Lift group.
   To post to this group, send email to lift...@googlegroups.com.
   To unsubscribe from this group, send email to
   liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com
 liftweb%2bunsubscr...@googlegroups.comliftweb%252bunsubscr...@googlegroups.com
 
   .
   For more options, visit this group at
  http://groups.google.com/group/liftweb?hl=en.
 
  --
  Lift, the simply functional web frameworkhttp://liftweb.net
  Beginning Scalahttp://www.apress.com/book/view/1430219890
  Follow me:http://twitter.com/dpp
  Surf the harmonics

 --

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





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

--

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




Re: [Lift] Re: API-Doc generation help, pls

2009-12-18 Thread David Pollak
On Mon, Nov 16, 2009 at 12:33 PM, alux alu...@googlemail.com wrote:


 Back to the first computer:

 I get the impression, its problems were result of bad connection. now
 it looks different. But 1. still wrong, 2. different then computer 2 :-
 (

 See below.

 Thank you.

 a.

 D:\lang\lift1.0\liftwebmvn -v
 Maven version: 2.0.9
 Java version: 1.6.0_06
 OS name: windows xp version: 5.1 arch: x86 Family: windows


Please upgrade to Maven 2.2.0+




 Trying to build the docs.

 D:\lang\lift1.0\liftwebmvn scala:doc
 [INFO] Scanning for projects...
 [INFO] Reactor build order:
 [INFO]   Lift Web Framework
 [INFO]   Lift Base Components
 [INFO]   Lift Common
 [INFO]   Lift Actor
 [INFO]   Lift Json
 [INFO]   Lift Util
 [INFO]   Lift WebKit
 [INFO]   Lift Modules
 [INFO]   Lift Widgets
 [INFO]   Lift Persistence Components
 [INFO]   Lift Mapper
 [INFO]   Lift JPA
 [INFO]   Lift Record
 [INFO]   Lift TestKit
 [INFO]   Lift OSGi
 [INFO]   Lift Wizard
 [INFO]   Lift Machine
 [INFO]   Lift Textile
 [INFO]   Lift Facebook
 [INFO]   Lift AMQP
 [INFO]   Lift XMPP
 [INFO]   Lift OpenID
 [INFO]   Lift OAuth
 [INFO]   Lift PayPal
 [INFO]   Lift JTA
 [INFO]   Lift Archetypes
 [INFO]   lift-archetype-blank
 [INFO]   lift-archetype-basic
 [INFO]   lift-archetype-jpa-basic
 [INFO]   lift-archetype-jpa-blank
 [INFO]   lift-archetype-jpa-blank-single
 [INFO]   Lift Core (full lift)
 [INFO]   Lift Sites
 [INFO]   Lift Example
 [INFO]   OSGi Examples for Lift
 [INFO]   OSGi Examples for Lift - Hello
 [INFO]   Skittr Example
 [INFO]   HelloLift example application
 [INFO]   HelloDarwin tutorial application
 [INFO]   JPA Demo Master
 [INFO]   JPADemo-spa
 [INFO]   JPADemo-web
 [INFO]   Lift Flot widget example
 [INFO]   HTTP Authentication example
 [INFO] Searching repository for plugin with prefix: 'scala'.
 Downloading:
 http://scala-tools.org/repo-releases/de/zeigermann/xml/xml-im-expor
 ter/1.1/xml-im-exporter-1.1.pomhttp://scala-tools.org/repo-releases/de/zeigermann/xml/xml-im-expor%0Ater/1.1/xml-im-exporter-1.1.pom
 Downloading:
 http://scala-tools.org/repo-snapshots/de/zeigermann/xml/xml-im-expo
 rter/1.1/xml-im-exporter-1.1.pomhttp://scala-tools.org/repo-snapshots/de/zeigermann/xml/xml-im-expo%0Arter/1.1/xml-im-exporter-1.1.pom
 Downloading:
 http://repo1.maven.org/maven2/de/zeigermann/xml/xml-im-exporter/1.1
 /xml-im-exporter-1.1.pomhttp://repo1.maven.org/maven2/de/zeigermann/xml/xml-im-exporter/1.1%0A/xml-im-exporter-1.1.pom
 Downloading:
 http://scala-tools.org/repo-releases/de/zeigermann/xml/xml-im-expor
 ter/1.1/xml-im-exporter-1.1.jarhttp://scala-tools.org/repo-releases/de/zeigermann/xml/xml-im-expor%0Ater/1.1/xml-im-exporter-1.1.jar
 Downloading:
 http://scala-tools.org/repo-snapshots/de/zeigermann/xml/xml-im-expo
 rter/1.1/xml-im-exporter-1.1.jarhttp://scala-tools.org/repo-snapshots/de/zeigermann/xml/xml-im-expo%0Arter/1.1/xml-im-exporter-1.1.jar
 Downloading:
 http://repo1.maven.org/maven2/de/zeigermann/xml/xml-im-exporter/1.1
 /xml-im-exporter-1.1.jarhttp://repo1.maven.org/maven2/de/zeigermann/xml/xml-im-exporter/1.1%0A/xml-im-exporter-1.1.jar
 WAGON_VERSION: 1.0-beta-2
 [INFO]
 
 [INFO] Building Lift Web Framework
 [INFO]task-segment: [scala:doc]
 [INFO]
 
 [INFO] [scala:doc]
 [INFO] Checking for multiple versions of scala
 [INFO]
 
 [INFO] Building Lift Base Components
 [INFO]task-segment: [scala:doc]
 [INFO]
 
 Downloading:
 http://scala-tools.org/repo-releases/javax/script/script-js/1.0/scr
 ipt-js-1.0.pom
 Downloading:
 http://scala-tools.org/repo-snapshots/javax/script/script-js/1.0/sc
 ript-js-1.0.pom
 Downloading:
 http://repo1.maven.org/maven2/javax/script/script-js/1.0/script-js-
 1.0.pom
 Downloading:
 http://scala-tools.org/repo-releases/javax/script/js-engine/1.0/js-
 engine-1.0.pomhttp://scala-tools.org/repo-releases/javax/script/js-engine/1.0/js-%0Aengine-1.0.pom
 Downloading:
 http://scala-tools.org/repo-snapshots/javax/script/js-engine/1.0/js
 -engine-1.0.pomhttp://scala-tools.org/repo-snapshots/javax/script/js-engine/1.0/js%0A-engine-1.0.pom
 Downloading:
 http://repo1.maven.org/maven2/javax/script/js-engine/1.0/js-engine-
 1.0.pom
 [INFO] [scala:doc]
 [INFO] Checking for multiple versions of scala
 [WARNING] No source files found in D:\lang\lift1.0\liftweb\lift-base
 \src\main\sc
 ala
 [INFO]
 
 [INFO] Building Lift Common
 [INFO]task-segment: [scala:doc]
 [INFO]
 
 [INFO] [scala:doc]
 [INFO] Checking for multiple versions of scala
 [INFO] Checking for multiple versions of scala
 16.11.2009 21:10:48 org.scala_tools.vscaladoc.HtmlRenderer render
 INFO: write 

[Lift] Re: Ajax Forms and Binding

2009-12-18 Thread Peter Robinett
Unfortunately there is no change. Firebug shows that the POST reply
was empty.

Peter

On Dec 18, 3:26 pm, David Pollak feeder.of.the.be...@gmail.com
wrote:
 On Fri, Dec 18, 2009 at 3:22 PM, Peter Robinett 
 pe...@bubblefoundry.comwrote:





  Hi all,

  I think there is a simple answer to this, but I'm a little confused. I
  want to update a bound element when my Ajax form is submitted. Here's
  a simple version based upon what I gleaned from the wiki and the
  mailing list:

  lift:Test.form
   pDisplay: test:display //p
   pInput1: test:input1 //p
   pInput2: test:input2 //p
   ptest:submit //p
  /lift:Test.form

  class Test {
   var display = 
   var input1 = 
   var input2 = 
   def form(xhtml: NodeSeq): NodeSeq = {
     SHtml.ajaxForm(
       bind(test, xhtml,
         display - span id=i_like_yaks{display}/span,
         input1 - SHtml.text(input1, input1 = _),
         input2 - SHtml.text(input2, input2 = _),
         submit - SHtml.submit(Submit, () = {}) // empty method
  since our hidden item will be called instead?
       ) ++
       SHtml.hidden(() = {
        display = input1 + input2

 SetHtml(i_like_yaks, Text(display))





       })
     )
   }
  }

  Am I on the right track? How do I actually get test:display / to be
  updated?

  Thanks,
  Peter

  --

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

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

--

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




[Lift] Re: Ajax Forms and Binding

2009-12-18 Thread Peter Robinett
Sorry, spoke to soon. I got it, thanks.

On Dec 18, 4:27 pm, Peter Robinett pe...@bubblefoundry.com wrote:
 Unfortunately there is no change. Firebug shows that the POST reply
 was empty.

 Peter

 On Dec 18, 3:26 pm, David Pollak feeder.of.the.be...@gmail.com
 wrote:



  On Fri, Dec 18, 2009 at 3:22 PM, Peter Robinett 
  pe...@bubblefoundry.comwrote:

   Hi all,

   I think there is a simple answer to this, but I'm a little confused. I
   want to update a bound element when my Ajax form is submitted. Here's
   a simple version based upon what I gleaned from the wiki and the
   mailing list:

   lift:Test.form
    pDisplay: test:display //p
    pInput1: test:input1 //p
    pInput2: test:input2 //p
    ptest:submit //p
   /lift:Test.form

   class Test {
    var display = 
    var input1 = 
    var input2 = 
    def form(xhtml: NodeSeq): NodeSeq = {
      SHtml.ajaxForm(
        bind(test, xhtml,
          display - span id=i_like_yaks{display}/span,
          input1 - SHtml.text(input1, input1 = _),
          input2 - SHtml.text(input2, input2 = _),
          submit - SHtml.submit(Submit, () = {}) // empty method
   since our hidden item will be called instead?
        ) ++
        SHtml.hidden(() = {
         display = input1 + input2

  SetHtml(i_like_yaks, Text(display))

        })
      )
    }
   }

   Am I on the right track? How do I actually get test:display / to be
   updated?

   Thanks,
   Peter

   --

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

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

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

--

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




[Lift] Re: DB connection fail after upgrade from 1.1M7 to 1.1M8

2009-12-18 Thread Jarod Liu
I did mvn clean but dosn't help. And I try implement a custom
DBVender, found that the newConnection() even not being call.

  def boot {
LiftRules.formatDate = formatDate

  DB.defineConnectionManager(DefaultConnectionIdentifier,
DBVendor)

LiftRules.addToPackages(hello)

LiftRules.setSiteMap(SiteMap(MenuInfo.menu: _*))

LiftRules.early.append{ _.setCharacterEncoding(UTF-8) }
  }


  object DBVendor extends ConnectionManager {

def newConnection(name: ConnectionIdentifier): Box[Connection] = {
  try {
Class.forName(Props.get(db.driver).openOr
(com.mysql.jdbc.Driver))
println(Props.props)
val c = Full(DriverManager.getConnection(
Props.get(db.url).openOr(jdbc:mysql://localhost/mydb?
autoReconnectForPools=true),
Props.get(db.user).openOr(root), Props.get
(db.password).openOr()))
println()
println(c)
c
  } catch {
case e: Exception = e.printStackTrace; Empty
  }
}

def releaseConnection(conn: Connection) {
  conn.close
}
  }


On Dec 18, 8:05 am, David Pollak feeder.of.the.be...@gmail.com
wrote:
 Please try doing a mvn clean and then retry your application.

 I have seen no problems with the dozen+ Lift apps I work with related to
 connections not working between M7 and M8.





 On Thu, Dec 17, 2009 at 5:59 AM, Jarod Liu liuyuan...@gmail.com wrote:
  The same code works fine in 1.1M7. Anyone know what causes the
  problem. Or maybe a bug in 1.1M8?

  boot.scala:
       DB.defineConnectionManager(DefaultConnectionIdentifier,
                                  new StandardDBVendor
  (com.mysql.jdbc.Driver,
                                                       jdbc:mysql://
  localhost/mydb?autoReconnectForPools=true,
                                                       root, ))

  the error message:

     Looking for Connection Identifier ConnectionIdentifier(lift) but
  failed to find either a JNDI data source with the name lift or a lift
  connection manager with the correct name/pre/ph3Caused by:/
  h3prejava.lang.NullPointerException: Looking for Connection
  Identifier ConnectionIdentifier(lift) but failed to find either a JNDI
  data source with the name lift or a lift connection manager with the
  correct name
         at net.liftweb.mapper.DB$$anonfun$2$$anonfun$apply$8.apply(DB.scala:
  97)
         at net.liftweb.mapper.DB$$anonfun$2$$anonfun$apply$8.apply(DB.scala:
  97)
         at net.liftweb.common.EmptyBox.openOr(Box.scala:372)
         at net.liftweb.mapper.DB$$anonfun$2.apply(DB.scala:96)
         at net.liftweb.mapper.DB$$anonfun$2.apply(DB.scala:96)
         at net.liftweb.common.EmptyBox.openOr(Box.scala:372)
         at net.liftweb.mapper.DB$.newConnection(DB.scala:90)
         at net.liftweb.mapper.DB$.getConnection(DB.scala:186)
         at net.liftweb.mapper.DB$.use(DB.scala:446)
         at net.liftweb.mapper.DB$$anon$1$$anonfun$apply$9.recurseMe$1
  (DB.scala:160)
         at
  net.liftweb.mapper.DB$$anon$1$$anonfun$apply$9.apply(DB.scala:162)
         at net.liftweb.util.DynoVar$class.run(ThreadGlobal.scala:91)
         at net.liftweb.mapper.DB$$anon$1$DepthCnt$.run(DB.scala:143)
         at net.liftweb.mapper.DB$$anon$1.apply(DB.scala:146)
         at net.liftweb.http.S$.net$liftweb$http$S$$doAround(S.scala:912)
         at net.liftweb.http.S$$anonfun$net$liftweb$http$S$$_nest2InnerInit
  $1.apply(S.scala:1112)
         at net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:67)
         at net.liftweb.http.S$.net$liftweb$http$S$$_nest2InnerInit(S.scala:
  )
         at net.liftweb.http.S$$anonfun$net$liftweb$http$S$$_innerInit$1$
  $anonfun$apply$28$$anonfun$apply$29$$anonfun$apply$30$$anonfun$apply
  $31.apply(S.scala:1133)
         at net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:67)
         at net.liftweb.http.S$$anonfun$net$liftweb$http$S$$_innerInit$1$
  $anonfun$apply$28$$anonfun$apply$29$$anonfun$apply$30.apply(S.scala:
  1132)
         at net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:67)
         at net.liftweb.http.S$$anonfun$net$liftweb$http$S$$_innerInit$1$
  $anonfun$apply$28$$anonfun$apply$29.apply(S.scala:1131)
         at net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:67)
         at net.liftweb.http.S$$anonfun$net$liftweb$http$S$$_innerInit$1$
  $anonfun$apply$28.apply(S.scala:1130)
         at net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:67)
         at
  net.liftweb.http.S$$anonfun$net$liftweb$http$S$$_innerInit$1.apply
  (S.scala:1129)
         at net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:67)
         at net.liftweb.http.S$.net$liftweb$http$S$$_innerInit(S.scala:1128)
         at net.liftweb.http.S$$anonfun$_init$1$$anonfun$apply$38$$anonfun
  $apply$39$$anonfun$apply$40$$anonfun$apply$41$$anonfun$apply$42.apply
  (S.scala:1175)
         at net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:67)
         at 

Re: [Lift] Re: DB connection fail after upgrade from 1.1M7 to 1.1M8

2009-12-18 Thread David Pollak
If you want to tar up your project (please remove the target directory) and
send it to me privately, I'll look into it.

On Fri, Dec 18, 2009 at 4:48 PM, Jarod Liu liuyuan...@gmail.com wrote:

 I did mvn clean but dosn't help. And I try implement a custom
 DBVender, found that the newConnection() even not being call.

  def boot {
LiftRules.formatDate = formatDate

  DB.defineConnectionManager(DefaultConnectionIdentifier,
 DBVendor)

LiftRules.addToPackages(hello)

LiftRules.setSiteMap(SiteMap(MenuInfo.menu: _*))

LiftRules.early.append{ _.setCharacterEncoding(UTF-8) }
  }


  object DBVendor extends ConnectionManager {

def newConnection(name: ConnectionIdentifier): Box[Connection] = {
  try {
Class.forName(Props.get(db.driver).openOr
 (com.mysql.jdbc.Driver))
println(Props.props)
val c = Full(DriverManager.getConnection(
Props.get(db.url).openOr(jdbc:mysql://localhost/mydb?
 autoReconnectForPools=true),
Props.get(db.user).openOr(root), Props.get
 (db.password).openOr()))
println()
println(c)
c
  } catch {
case e: Exception = e.printStackTrace; Empty
  }
}

def releaseConnection(conn: Connection) {
  conn.close
}
  }


 On Dec 18, 8:05 am, David Pollak feeder.of.the.be...@gmail.com
 wrote:
  Please try doing a mvn clean and then retry your application.
 
  I have seen no problems with the dozen+ Lift apps I work with related to
  connections not working between M7 and M8.
 
 
 
 
 
  On Thu, Dec 17, 2009 at 5:59 AM, Jarod Liu liuyuan...@gmail.com wrote:
   The same code works fine in 1.1M7. Anyone know what causes the
   problem. Or maybe a bug in 1.1M8?
 
   boot.scala:
DB.defineConnectionManager(DefaultConnectionIdentifier,
   new StandardDBVendor
   (com.mysql.jdbc.Driver,
jdbc:mysql://
   localhost/mydb?autoReconnectForPools=true,
root, ))
 
   the error message:
 
  Looking for Connection Identifier ConnectionIdentifier(lift) but
   failed to find either a JNDI data source with the name lift or a lift
   connection manager with the correct name/pre/ph3Caused by:/
   h3prejava.lang.NullPointerException: Looking for Connection
   Identifier ConnectionIdentifier(lift) but failed to find either a JNDI
   data source with the name lift or a lift connection manager with the
   correct name
  at
 net.liftweb.mapper.DB$$anonfun$2$$anonfun$apply$8.apply(DB.scala:
   97)
  at
 net.liftweb.mapper.DB$$anonfun$2$$anonfun$apply$8.apply(DB.scala:
   97)
  at net.liftweb.common.EmptyBox.openOr(Box.scala:372)
  at net.liftweb.mapper.DB$$anonfun$2.apply(DB.scala:96)
  at net.liftweb.mapper.DB$$anonfun$2.apply(DB.scala:96)
  at net.liftweb.common.EmptyBox.openOr(Box.scala:372)
  at net.liftweb.mapper.DB$.newConnection(DB.scala:90)
  at net.liftweb.mapper.DB$.getConnection(DB.scala:186)
  at net.liftweb.mapper.DB$.use(DB.scala:446)
  at net.liftweb.mapper.DB$$anon$1$$anonfun$apply$9.recurseMe$1
   (DB.scala:160)
  at
   net.liftweb.mapper.DB$$anon$1$$anonfun$apply$9.apply(DB.scala:162)
  at net.liftweb.util.DynoVar$class.run(ThreadGlobal.scala:91)
  at net.liftweb.mapper.DB$$anon$1$DepthCnt$.run(DB.scala:143)
  at net.liftweb.mapper.DB$$anon$1.apply(DB.scala:146)
  at net.liftweb.http.S$.net$liftweb$http$S$$doAround(S.scala:912)
  at
 net.liftweb.http.S$$anonfun$net$liftweb$http$S$$_nest2InnerInit
   $1.apply(S.scala:1112)
  at net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:67)
  at
 net.liftweb.http.S$.net$liftweb$http$S$$_nest2InnerInit(S.scala:
   )
  at net.liftweb.http.S$$anonfun$net$liftweb$http$S$$_innerInit$1$
   $anonfun$apply$28$$anonfun$apply$29$$anonfun$apply$30$$anonfun$apply
   $31.apply(S.scala:1133)
  at net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:67)
  at net.liftweb.http.S$$anonfun$net$liftweb$http$S$$_innerInit$1$
   $anonfun$apply$28$$anonfun$apply$29$$anonfun$apply$30.apply(S.scala:
   1132)
  at net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:67)
  at net.liftweb.http.S$$anonfun$net$liftweb$http$S$$_innerInit$1$
   $anonfun$apply$28$$anonfun$apply$29.apply(S.scala:1131)
  at net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:67)
  at net.liftweb.http.S$$anonfun$net$liftweb$http$S$$_innerInit$1$
   $anonfun$apply$28.apply(S.scala:1130)
  at net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:67)
  at
   net.liftweb.http.S$$anonfun$net$liftweb$http$S$$_innerInit$1.apply
   (S.scala:1129)
  at net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:67)
  at
 

Re: [Lift] DB connection fail after upgrade from 1.1M7 to 1.1M8

2009-12-18 Thread David Pollak
I ran your app and when the DB connector was created, I got the following
exception:

2009-12-18 20:20:38.641:INFO::No Transaction manager found - if your webapp
requires one, please configure one.
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown database
'test'
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
at com.mysql.jdbc.Util.getInstance(Util.java:381)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1030)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3558)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3490)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:919)
at com.mysql.jdbc.MysqlIO.secureAuth411(MysqlIO.java:3996)
at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1284)
at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2142)
at com.mysql.jdbc.ConnectionImpl.init(ConnectionImpl.java:781)
at com.mysql.jdbc.JDBC4Connection.init(JDBC4Connection.java:46)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:352)
at
com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:284)
at java.sql.DriverManager.getConnection(DriverManager.java:582)
at java.sql.DriverManager.getConnection(DriverManager.java:185)
at net.liftweb.mapper.StandardDBVendor.createOne(DB.scala:870)
at net.liftweb.mapper.ProtoDBVendor$class.newConnection(DB.scala:915)
at net.liftweb.mapper.StandardDBVendor.newConnection(DB.scala:861)
at net.liftweb.mapper.DB$$anonfun$1$$anonfun$apply$1.apply(DB.scala:90)
at net.liftweb.mapper.DB$$anonfun$1$$anonfun$apply$1.apply(DB.scala:90)
at net.liftweb.common.EmptyBox.or(Box.scala:374)
at net.liftweb.mapper.DB$$anonfun$1.apply(DB.scala:90)
at net.liftweb.mapper.DB$$anonfun$1.apply(DB.scala:90)
at net.liftweb.common.Full.flatMap(Box.scala:332)
at net.liftweb.mapper.DB$.newConnection(DB.scala:90)
at net.liftweb.mapper.DB$.getConnection(DB.scala:186)
at net.liftweb.mapper.DB$.use(DB.scala:446)
at net.liftweb.mapper.Schemifier$.schemify(Schemifier.scala:54)
at net.liftweb.mapper.Schemifier$.schemify(Schemifier.scala:37)
at bootstrap.liftweb.Boot.boot(Boot.scala:29)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
net.liftweb.util.ClassHelpers$$anonfun$createInvoker$1.apply(ClassHelpers.scala:409)
at
net.liftweb.util.ClassHelpers$$anonfun$createInvoker$1.apply(ClassHelpers.scala:407)
at
net.liftweb.http.DefaultBootstrap$$anonfun$boot$1.apply(LiftRules.scala:1261)
at
net.liftweb.http.DefaultBootstrap$$anonfun$boot$1.apply(LiftRules.scala:1261)
at net.liftweb.common.Full.map(Box.scala:330)
at net.liftweb.http.DefaultBootstrap$.boot(LiftRules.scala:1261)
at
net.liftweb.http.provider.HTTPProvider$class.bootLift(HTTPProvider.scala:70)
at net.liftweb.http.LiftFilter.bootLift(LiftServlet.scala:523)
at net.liftweb.http.provider.servlet.ServletFilterProvider$class.init(Se

*The problem is very simply that your database is rejecting the connection.
 I changed the connection to run against H2 as I didn't have MySQL installed
on my machine and everything ran fine.*
*
*
*In the future, please check to make sure you can actually connect to the
RDBMS and include *all* the exceptions generated from your app in postings.*
*
*

On Fri, Dec 18, 2009 at 7:22 PM, Jarod Liu liuyuan...@gmail.com wrote:

 *
 the attached package is the sources.  It just the lift-archetype-basic
 project with changes to use mysql. without the changes work fine using h2
 DB.

 On Dec 19, 8:51 am, David Pollak feeder.of.the.be...@gmail.com wrote:
  If you want to tar up your project (please remove the target directory)
 and
  send it to me privately, I'll look into it.
 
 *

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

[Lift] Re: DB connection fail after upgrade from 1.1M7 to 1.1M8

2009-12-18 Thread Jarod Liu
I can 100% sure I can connect to the mysql db 'test' with 'root'
username and empty password. Do you have mysql installed? A default
mysql installation should have a DB call 'test'

the error message I got are different:

2009-12-19 12:41:05.486:INFO::No Transaction manager found - if your
webapp requires one, please configure one.
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException:
Communications link failure

The last packet sent successfully to the server was 0 milliseconds
ago. The driver has not received any packets from the server.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance
(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance
(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
at com.mysql.jdbc.SQLError.createCommunicationsException
(SQLError.java:1074)
at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:
2214)
at com.mysql.jdbc.ConnectionImpl.init(ConnectionImpl.java:781)
at com.mysql.jdbc.JDBC4Connection.init(JDBC4Connection.java:46)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance
(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance
(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:352)
at com.mysql.jdbc.NonRegisteringDriver.connect
(NonRegisteringDriver.java:284)
at java.sql.DriverManager.getConnection(DriverManager.java:582)
at java.sql.DriverManager.getConnection(DriverManager.java:185)
at net.liftweb.mapper.StandardDBVendor.createOne(DB.scala:870)
at net.liftweb.mapper.ProtoDBVendor$class.newConnection(DB.scala:915)
at net.liftweb.mapper.StandardDBVendor.newConnection(DB.scala:861)
at net.liftweb.mapper.DB$$anonfun$1$$anonfun$apply$1.apply(DB.scala:
90)
at net.liftweb.mapper.DB$$anonfun$1$$anonfun$apply$1.apply(DB.scala:
90)
at net.liftweb.common.EmptyBox.or(Box.scala:374)
at net.liftweb.mapper.DB$$anonfun$1.apply(DB.scala:90)
at net.liftweb.mapper.DB$$anonfun$1.apply(DB.scala:90)
at net.liftweb.common.Full.flatMap(Box.scala:332)
at net.liftweb.mapper.DB$.newConnection(DB.scala:90)
at net.liftweb.mapper.DB$.getConnection(DB.scala:186)
at net.liftweb.mapper.DB$.use(DB.scala:446)
at net.liftweb.mapper.Schemifier$.schemify(Schemifier.scala:54)
at net.liftweb.mapper.Schemifier$.schemify(Schemifier.scala:37)
at bootstrap.liftweb.Boot.boot(Boot.scala:29)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at net.liftweb.util.ClassHelpers$$anonfun$createInvoker$1.apply
(ClassHelpers.scala:409)
at net.liftweb.util.ClassHelpers$$anonfun$createInvoker$1.apply
(ClassHelpers.scala:407)
at net.liftweb.http.DefaultBootstrap$$anonfun$boot$1.apply
(LiftRules.scala:1261)
at net.liftweb.http.DefaultBootstrap$$anonfun$boot$1.apply
(LiftRules.scala:1261)
at net.liftweb.common.Full.map(Box.scala:330)
at net.liftweb.http.DefaultBootstrap$.boot(LiftRules.scala:1261)
at net.liftweb.http.provider.HTTPProvider$class.bootLift
(HTTPProvider.scala:70)
at net.liftweb.http.LiftFilter.bootLift(LiftServlet.scala:523)
at net.liftweb.http.provider.servlet.ServletFilterProvider$class.init
(ServletFilterProvider.scala:20)
at net.liftweb.http.LiftFilter.init(LiftServlet.scala:523)
at org.mortbay.jetty.servlet.FilterHolder.doStart(FilterHolder.java:
97)
at org.mortbay.component.AbstractLifeCycle.start
(AbstractLifeCycle.java:50)
at org.mortbay.jetty.servlet.ServletHandler.initialize
(ServletHandler.java:662)
at org.mortbay.jetty.servlet.Context.startContext(Context.java:140)
at org.mortbay.jetty.webapp.WebAppContext.startContext
(WebAppContext.java:1250)
at org.mortbay.jetty.handler.ContextHandler.doStart
(ContextHandler.java:517)
at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:
467)
at org.mortbay.jetty.plugin.Jetty6PluginWebAppContext.doStart
(Jetty6PluginWebAppContext.java:115)
at org.mortbay.component.AbstractLifeCycle.start
(AbstractLifeCycle.java:50)
at 

[Lift] re: user_id has value, but get constraint exception of it being null, using JPA and Lift 1.1

2009-12-18 Thread James Black
Hello,
I have struggled with this for a few hours and hopefully someone can
see what I am doing wrong.

Basically, I insert into users, I then select the user, I then set
that in my address and try to insert and get an error that the user_id
cannot be null, but it has a value.

I am including the two entities involved at the bottom, and the part
of the test that is executed. The last line in the test is where the
error is thrown.


Hibernate: insert into users (firstName, lastName, username, id)
values (?, ?, ?, ?)
Hibernate: select user0_.id as id105_, user0_.firstName as
firstName105_, user0_.lastName as lastName105_, user0_.username as
username105_ from users user0_ where user0_.username=?
Found User /* loaded from the database */
id: 11403264
firstName: Test lastName: User
username: testuser_resume

Address being persisted /*, user.id has a value */:
id: 0
addressLineOne: Some street address
user:
id: 11403264
firstName: Test lastName: User
username: testuser_resume
Hibernate: insert into address (addressLineOne, city, state, user_fk,
zipCode, id) values (?, ?, ?, ?, ?, ?)
13800 [main] WARN org.hibernate.util.JDBCExceptionReporter - SQL
Error: 2, SQLState: 23502
13800 [main] ERROR org.hibernate.util.JDBCExceptionReporter - Column
'USER_ID'  cannot accept a NULL value.
13800 [main] ERROR
org.hibernate.event.def.AbstractFlushingEventListener - Could not
synchronize database state with session
org.hibernate.exception.ConstraintViolationException: could not
insert: [jblack.resumeapp.lift.model.Address]
at org.hibernate.exception.SQLStateConverter.convert
(SQLStateConverter.java:94)
at org.hibernate.exception.JDBCExceptionHelper.convert
(JDBCExceptionHelper.java:66)
at org.hibernate.persister.entity.AbstractEntityPersister.insert
(AbstractEntityPersister.java:2295)
at org.hibernate.persister.entity.AbstractEntityPersister.insert
(AbstractEntityPersister.java:2688)
at org.hibernate.action.EntityInsertAction.execute
(EntityInsertAction.java:79)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:279)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:
263)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:
167)
at
org.hibernate.event.def.AbstractFlushingEventListener.performExecutions
(AbstractFlushingEventListener.java:321)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush
(DefaultFlushEventListener.java:50)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1027)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:365)
at org.hibernate.transaction.JDBCTransaction.commit
(JDBCTransaction.java:137)
at org.hibernate.ejb.TransactionImpl.commit(TransactionImpl.java:54)
at jblack.resumeapp.lift.model.TestJPAWeb.save_resume
(TestJPAWeb.scala:76)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall
(FrameworkMethod.java:44)
at org.junit.internal.runners.model.ReflectiveCallable.run
(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively
(FrameworkMethod.java:41)
at org.junit.internal.runners.statements.InvokeMethod.evaluate
(InvokeMethod.java:20)
at org.junit.internal.runners.statements.RunBefores.evaluate
(RunBefores.java:28)
at org.junit.internal.runners.statements.RunAfters.evaluate
(RunAfters.java:31)
at org.junit.runners.BlockJUnit4ClassRunner.runChild
(BlockJUnit4ClassRunner.java:73)
at org.junit.runners.BlockJUnit4ClassRunner.runChild
(BlockJUnit4ClassRunner.java:46)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:180)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:41)
at org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java:173)
at org.junit.internal.runners.statements.RunBefores.evaluate
(RunBefores.java:28)
at org.junit.internal.runners.statements.RunAfters.evaluate
(RunAfters.java:31)
at org.junit.runners.ParentRunner.run(ParentRunner.java:220)
at org.apache.maven.surefire.junit4.JUnit4TestSet.execute
(JUnit4TestSet.java:62)
at
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet
(AbstractDirectoryTestSuite.java:140)
at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute
(AbstractDirectoryTestSuite.java:127)
at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.java:39)
   

[Lift] Re: How can i update and insert record into database via Raw sql in Lift?

2009-12-18 Thread Neil.Lv
 It works now.

 I use the same executeUpdate method, and it can insert into the db.

 Thanks Marcin,

Cheers,
  Neil


On Dec 19, 1:29 am, Neil.Lv anim...@gmail.com wrote:
 Hi Marcin,

    Thank you very much! The update statement works now!

    There is a question about the insert statement, how can i use the
 prepareStatement ?

 ###
   INSERT INTO blogs click_counts=100 WHERE id=1
 ###

    I'm not familiar with it,

    Thanks very much!

    :)

 Cheers,
   Neil

 On Dec 18, 11:13 pm, Marcin Jurczuk mjurc...@gmail.com wrote:

  Hi,

  You have few options:
  - DB.runQuery(UPDATE blogs set click_counts=click_counts+1 WHERE
  id=1)
  - DBprepareStatement(UPDATE blogs set click_counts=click_counts+1
  WHERE id=?,yourDBConnection) {
  stmt =
  stmt.setLong(1,1)
  stmt.executeUpdate()}

  Where first 1 in setLong is position in prepared statment where you
  will put second value. Since You have only one ? it always will be
  1.

  WARNING:
  runQuery is vulnerable to SQL injection in many situations (mostly
  where string is passed to query)

  Marcin,

  On 18 Gru, 15:45, Neil.Lv anim...@gmail.com wrote:

   Hi all,

      How can i update and insert record into database via Raw sql in
   Lift?

      I write some code but it failed, here is :

   ### In the model

     def updateClickCountsById(id: Long) =
       DB.runQuery(UPDATE blogs set click_counts=click_counts+1 WHERE
   id=1)

     def insertRecord() =
       DB.runQuery(INSERT INTO blogs click_counts=100 WHERE id=1)

   ###

      This two method doesn't work, so how can i update and insert via
   raw SQL in the lift with Mapper?

      Thanks for any suggestion !

   Cheers,
     Neil

--

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




Re: [Lift] Re: DB connection fail after upgrade from 1.1M7 to 1.1M8

2009-12-18 Thread James Black
It would seem that this error is the main problem that has to be solved:
Caused by: java.net.ConnectException: Connection refused
   at java.net.PlainSocketImpl.
socketConnect(Native Method)



This should have nothing to do with the web framework, as it seems that the
driver just can't connect to the database.

--

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.