[Lift] Re: AJAX form with returned NodeSeq

2009-07-31 Thread Calen Pennington
Sorry my original question was unclear. I'm looking to submit data with the
form, and then get a response back from the server to act on.

The use case is that I have a list of things that I would like to add
elements to on the fly. The desired action is to have the list on the page,
with an add form below it. This form has two text fields, quantity and
item. When submit is clicked, I want to save the contents of those two
fields on the server, and update the displayed list with the new item added.

In other frameworks, the way that I've done this is to have the form
onsubmit contain code that made a jquery ajax call with the contents of the
form, and then would receive the full contents of the new list, which it
would drop into the DOM. Not sure how to rig that up in Lift, though.

-Cale

On Thu, Jul 30, 2009 at 10:52 PM, David Pollak 
feeder.of.the.be...@gmail.com wrote:



 On Thu, Jul 30, 2009 at 7:28 PM, Calen Pennington 
 calen.penning...@gmail.com wrote:

 Hey, all,

 I want to create a form that on submission executes some serverside code
 that returns a NodeSeq, and then updates the page with that xml. It seems
 like some combination of AjaxForm and SetHtml should do what I want, but I
 can't seem to get the server to send a response to the client that can be
 used to update the html.

 Is there a lifty way of doing this?


 ajaxButton(bPress me/b, () = SetHtml(myspan, spanThe time is {new
 java.util.Date}/span))




 Thanks

 -Cale





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

 


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



[Lift] AJAX form with returned NodeSeq

2009-07-30 Thread Calen Pennington
Hey, all,

I want to create a form that on submission executes some serverside code
that returns a NodeSeq, and then updates the page with that xml. It seems
like some combination of AjaxForm and SetHtml should do what I want, but I
can't seem to get the server to send a response to the client that can be
used to update the html.

Is there a lifty way of doing this?

Thanks

-Cale

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



[Lift] Re: Code Review for Unique Key Constraints

2009-07-13 Thread Calen Pennington

Hey, I'm glad the code could make it in. One comment on your changes:
It seems to me that using the pattern matching in ensureIndexes puts
Lift in the position of maintaining support for various DBs, rather
than letting the client code do it in a project by project basis (for
instance, the FULLTEXT and SPACIAL index types that I mentioned, that
are mysql specific.) Is there a reason that you preferred that over
allowing client code to specify the index type?

-Cale

On Fri, Jul 10, 2009 at 5:32 PM, Derek Chen-Beckerdchenbec...@gmail.com wrote:
 I've pushed a smaller commit into the wip-dcb-unique-indices branch on
 GitHub that adds a UniqueIndex case class. Conceivably we could add other
 types of indices if there's a need. If no one has any objections to what
 I've added I can merge with trunk on Monday.

 Derek

 http://github.com/dpp/liftweb/tree/wip-dcb-unique-indices

 On Thu, Jul 9, 2009 at 9:44 PM, DFectuoso santiago1...@gmail.com wrote:

 I for one would like to say: Cool! Thanks! If i need unique indexes in
 the next couple of weeks i'll get this baby to the war( .war thats
 it ) =)

 On Jul 9, 11:30 am, Calen Pennington calen.penning...@gmail.com
 wrote:
  As mentioned is this issue
  (http://github.com/dpp/liftweb/issues#issue/19), and as came up on the
  list recently, Lift currently has no way to specify that a field or an
  index be unique. I've coded up a patch that addresses this, and could
  also be used for other index types on a project specific basis (for
  instance, FULLTEXT or SPATIAL indexes in mysql).
 
  -Cale
 
   0001-Adding-the-ability-to-create-UNIQUE-indexes-over-sin.patch
  5KViewDownload




 


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



[Lift] Re: Building from source - error importing _root_.org.specs

2009-07-08 Thread Calen Pennington

I looked at, and redownloaded specs-1.5.0.jar earlier in the process,
with no avail. However, last night I ran the tests as root, and after
downloading the world, they succeeded. So, I blew away my maven
repository, and ran the tests again, and they compiled and run
correctly. I don't know what was wrong in that repo, but it's fixed
now.

Thanks for your help

-Cale

On Tue, Jul 7, 2009 at 11:42 PM, David
Pollakfeeder.of.the.be...@gmail.com wrote:


 On Tue, Jul 7, 2009 at 7:35 PM, Calen Pennington
 calen.penning...@gmail.com wrote:

 So, I switched to Sun's 1.6 JDK, and am getting the same errors. And
 yes, I changed the scala version from 2.7.4 to 2.7.5 in pom.xml.

 Interestingly, running mvn compile works correctly, and mvn test fails
 with the same errors that mvn install does. Unfortunately, I'm not
 familiar enough with maven to diagnose further than that. Any ideas?

 Please look at
 ~/.m2/repository/org/scala-tools/testing/specs/1.5.0/specs-1.5.0.jar

 Does it exist?  Can you open it?  Does it contain
 org.specs.BeforeAfter.class?



 -Cale

 On Thu, Jul 2, 2009 at 10:39 PM, David
 Pollakfeeder.of.the.be...@gmail.com wrote:
 
 
  On Thu, Jul 2, 2009 at 4:09 PM, Calen Pennington
  calen.penning...@gmail.com wrote:
 
  I'm running Ubuntu 9.04.
 
  The only difference between your setup and mine is that I'm using Sun's
  1.6
  JDK rather than OpenJDK.
 
 
  $ mvn -v
 
  Maven version: 2.0.9
  Java version: 1.6.0_0
  OS name: linux version: 2.6.28-13-generic arch: i386 Family:
  unix
 
  I get the same errors using scala 2.7.4 and 2.7.5
 
  When you say using, do you mean that you changed the version of Scala in
  the
  pom.xml files?
 
 
  -Cale
 
 
  On Thu, Jul 2, 2009 at 12:24 AM, David
  Pollakfeeder.of.the.be...@gmail.com wrote:
   I've built Lift from source on Windows, Linux and Mac OS X within the
   last 2
   days without incident.
  
   What OS are you running, what version of Maven and what version of
   Java?
  
   On Wed, Jul 1, 2009 at 8:00 PM, Calen Pennington
   calen.penning...@gmail.com wrote:
  
   Hi,
  
   I'm trying to build Lift from the source. I pulled the latest source
   from git, and ran
  
   cd liftweb
   mvn install
  
   as suggested in the wiki (http://wiki.liftweb.net/index.php/
   Source_code)
  
   When I did this, I got a large number of warnings like the
   following:
   [WARNING] /home/cpenning/work/scala/lift/liftweb-cpenning/lift-util/
   src/test/scala/net/liftweb/util/CombParserHelpersSpec.scala:18:
   error:
   value specs is not a member of package org
   [WARNING] import _root_.org.specs._
  
   The lift-util/pom.xml includes the dependency
  
      dependency
        groupIdorg.scala-tools.testing/groupId
        artifactIdspecs/artifactId
        version1.5.0/version
      /dependency
  
   as expected, and looking at my ~/.m2/repository/org/scala-tools/
   testing/specs/1.5.0/ contains a pom and a jar.
  
   Anyone know why lift-utils isn't able to import specs?
  
   Thanks
  
   -Cale
  
  
  
  
  
   --
   Lift, the simply functional web framework http://liftweb.net
   Beginning Scala http://www.apress.com/book/view/1430219890
   Follow me: http://twitter.com/dpp
   Git some: http://github.com/dpp
  
   
  
 
 
 
 
 
  --
  Lift, the simply functional web framework http://liftweb.net
  Beginning Scala http://www.apress.com/book/view/1430219890
  Follow me: http://twitter.com/dpp
  Git some: http://github.com/dpp
 
  
 





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

 


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



[Lift] Re: Unique constraint

2009-07-08 Thread Calen Pennington

I looked into this a little bit. The relevant chunks of code seem to
be Schemifier.scala, lines 163 and 207, where
connection.driverType.pkDefinedByIndexColumn_? is checked before using
an ALTER TABLE to set a primary key, and Driver.scala, line 131, where
the H2Driver has pkDefinedByIndexColumn_? set to True with the comment
Whether the primary key has been defined by the index column. H2
creates primary key for a table, when AUTO_INCREMENT type is used.

So, it looks like lift is expecting H2 to use the autoincrement key as
the primary key automatically, but H2 isn't doing that, or isn't
reporting that it's doing that. However, I don't know enough about H2
to know which.

Hope that was helpful.

-Cale

On Wed, Jul 8, 2009 at 7:09 PM, Naftoli Gugenhemnaftoli...@gmail.com wrote:

 Anyone? Why isn't IdPK telling Schemifier to create the id column as a unique 
 primary key, and how can I get it to?

 -
 Naftoli Gugenhemnaftoli...@gmail.com wrote:

 I just found the INFORMATION_SCHEMA.INDEXES table. It clearly says that all 
 my id's are non-unique, non primary key. I'm mixing in IdPK. What am I doing 
 wrong?

 -
 Tim Nelsontnell...@gmail.com wrote:

 H2 has a great console servlet that you can use to connect to any jdbc
 compliant database and I just figured out how to configure it to work with
 lift.

 Assuming you already have H2 as a dependency, just add a mapping to the
 servlet in your web.xml. Mine looks like this:

 web-app

  filter
    filter-nameLiftFilter/filter-name
    display-nameLift Filter/display-name
    descriptionThe Filter that intercepts lift calls/description
    filter-classnet.liftweb.http.LiftFilter/filter-class
  /filter

  filter-mapping
    filter-nameLiftFilter/filter-name
    url-pattern/*/url-pattern
  /filter-mapping

  servlet
    servlet-nameH2Console/servlet-name
    servlet-classorg.h2.server.web.WebServlet/servlet-class
    load-on-startup1/load-on-startup
  /servlet
  servlet-mapping
    servlet-nameH2Console/servlet-name
    url-pattern/console/*/url-pattern
  /servlet-mapping

 /web-app

 Then you need to add a rule to LiftRules.liftRequest using the following
 line in boot:

 LiftRules.liftRequest.append({case r if (r.path.partPath match {case
 console :: _ = true case _ = false}) = false})

 That basically allows all requests that start with console to be ignored
 by lift and passed thru to the servlet.

 I am actually using PostgreSQL, but I prefer using this to pgAdmin or other
 SQL tools.

 Tim


 On Fri, Jul 3, 2009 at 3:25 PM, Naftoli Gugenheim naftoli...@gmail.comwrote:

 Okay. What about two fields in a unique constraint, e.g. first+last?Also,
 my H2 databased generated by schemifying allowed me to insert rows that had
 duplicate primary keys (or at least they're supposed to be primary keys).
 I'm using LongKeyedMapper ... with IdPK. Am I missing something?
 Anyone know how to read constraints in H2, meaning get it to to tell me
 what constraints/indexes exists?
 Thanks!


 On Thu, Jul 2, 2009 at 9:50 AM, Calen Pennington 
 calen.penning...@gmail.com wrote:


 I actually had the same question last night. I didn't see the
 valUnique on mapped string. However, it seems like a better way to do
 this would be to change the Schemifier::ensureIndexes (line 260 in
 Schemifier.scala) to do CREATE UNIQUE INDEX on request. Is there a
 known reason why this is hard, or is it just that no one has taken the
 time to do it yet? If it's the latter (and if I can figure out what's
 going wrong with my attempts to build lift from source), I hope to
 take a stab at it in the next day or two.

 -Cale

 On Thu, Jul 2, 2009 at 7:21 AM, Joe Wassj...@folktunefinder.com wrote:
 
  Yes for MappedString, valUnique .
 
 
 http://scala-tools.org/scaladocs/liftweb/1.0/net/liftweb/mapper/MappedString.html
 
  Joe
 
 
 
  On Jul 2, 7:55 am, Naftoli Gugenhem naftoli...@gmail.com wrote:
  Does lift have any way to specify a unique constraint on a field, via
 schemify (or validation)?
  If not, how complex would it be to implement?
 
  
 




 




 


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



[Lift] Re: Building from source - error importing _root_.org.specs

2009-07-07 Thread Calen Pennington

So, I switched to Sun's 1.6 JDK, and am getting the same errors. And
yes, I changed the scala version from 2.7.4 to 2.7.5 in pom.xml.

Interestingly, running mvn compile works correctly, and mvn test fails
with the same errors that mvn install does. Unfortunately, I'm not
familiar enough with maven to diagnose further than that. Any ideas?

-Cale

On Thu, Jul 2, 2009 at 10:39 PM, David
Pollakfeeder.of.the.be...@gmail.com wrote:


 On Thu, Jul 2, 2009 at 4:09 PM, Calen Pennington
 calen.penning...@gmail.com wrote:

 I'm running Ubuntu 9.04.

 The only difference between your setup and mine is that I'm using Sun's 1.6
 JDK rather than OpenJDK.


 $ mvn -v

 Maven version: 2.0.9
 Java version: 1.6.0_0
 OS name: linux version: 2.6.28-13-generic arch: i386 Family: unix

 I get the same errors using scala 2.7.4 and 2.7.5

 When you say using, do you mean that you changed the version of Scala in the
 pom.xml files?


 -Cale


 On Thu, Jul 2, 2009 at 12:24 AM, David
 Pollakfeeder.of.the.be...@gmail.com wrote:
  I've built Lift from source on Windows, Linux and Mac OS X within the
  last 2
  days without incident.
 
  What OS are you running, what version of Maven and what version of Java?
 
  On Wed, Jul 1, 2009 at 8:00 PM, Calen Pennington
  calen.penning...@gmail.com wrote:
 
  Hi,
 
  I'm trying to build Lift from the source. I pulled the latest source
  from git, and ran
 
  cd liftweb
  mvn install
 
  as suggested in the wiki (http://wiki.liftweb.net/index.php/
  Source_code)
 
  When I did this, I got a large number of warnings like the following:
  [WARNING] /home/cpenning/work/scala/lift/liftweb-cpenning/lift-util/
  src/test/scala/net/liftweb/util/CombParserHelpersSpec.scala:18: error:
  value specs is not a member of package org
  [WARNING] import _root_.org.specs._
 
  The lift-util/pom.xml includes the dependency
 
     dependency
       groupIdorg.scala-tools.testing/groupId
       artifactIdspecs/artifactId
       version1.5.0/version
     /dependency
 
  as expected, and looking at my ~/.m2/repository/org/scala-tools/
  testing/specs/1.5.0/ contains a pom and a jar.
 
  Anyone know why lift-utils isn't able to import specs?
 
  Thanks
 
  -Cale
 
 
 
 
 
  --
  Lift, the simply functional web framework http://liftweb.net
  Beginning Scala http://www.apress.com/book/view/1430219890
  Follow me: http://twitter.com/dpp
  Git some: http://github.com/dpp
 
  
 





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

 


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



[Lift] Re: Unique constraint

2009-07-04 Thread Calen Pennington

Currently, to create a 2 key index, you do something like:
dbIndexes = Index(IndexedField(foo), IndexedField(bar)) :: Nil

My intention is set it up so doing something like:
dbIndexes = UniqueIndex(IndexedField(foo), IndexedField(bar)) :: Nil

will create a unique index over the combination of both fields.

-Cale


On Fri, Jul 3, 2009 at 4:25 PM, Naftoli Gugenheimnaftoli...@gmail.com wrote:
 Okay. What about two fields in a unique constraint, e.g. first+last?
 Also, my H2 databased generated by schemifying allowed me to insert rows
 that had duplicate primary keys (or at least they're supposed to be primary
 keys). I'm using LongKeyedMapper ... with IdPK. Am I missing something?
 Anyone know how to read constraints in H2, meaning get it to to tell me what
 constraints/indexes exists?
 Thanks!

 On Thu, Jul 2, 2009 at 9:50 AM, Calen Pennington
 calen.penning...@gmail.com wrote:

 I actually had the same question last night. I didn't see the
 valUnique on mapped string. However, it seems like a better way to do
 this would be to change the Schemifier::ensureIndexes (line 260 in
 Schemifier.scala) to do CREATE UNIQUE INDEX on request. Is there a
 known reason why this is hard, or is it just that no one has taken the
 time to do it yet? If it's the latter (and if I can figure out what's
 going wrong with my attempts to build lift from source), I hope to
 take a stab at it in the next day or two.

 -Cale

 On Thu, Jul 2, 2009 at 7:21 AM, Joe Wassj...@folktunefinder.com wrote:
 
  Yes for MappedString, valUnique .
 
 
  http://scala-tools.org/scaladocs/liftweb/1.0/net/liftweb/mapper/MappedString.html
 
  Joe
 
 
 
  On Jul 2, 7:55 am, Naftoli Gugenhem naftoli...@gmail.com wrote:
  Does lift have any way to specify a unique constraint on a field, via
  schemify (or validation)?
  If not, how complex would it be to implement?
 
  
 




 


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



[Lift] Re: Unique constraint

2009-07-02 Thread Calen Pennington

I actually had the same question last night. I didn't see the
valUnique on mapped string. However, it seems like a better way to do
this would be to change the Schemifier::ensureIndexes (line 260 in
Schemifier.scala) to do CREATE UNIQUE INDEX on request. Is there a
known reason why this is hard, or is it just that no one has taken the
time to do it yet? If it's the latter (and if I can figure out what's
going wrong with my attempts to build lift from source), I hope to
take a stab at it in the next day or two.

-Cale

On Thu, Jul 2, 2009 at 7:21 AM, Joe Wassj...@folktunefinder.com wrote:

 Yes for MappedString, valUnique .

 http://scala-tools.org/scaladocs/liftweb/1.0/net/liftweb/mapper/MappedString.html

 Joe



 On Jul 2, 7:55 am, Naftoli Gugenhem naftoli...@gmail.com wrote:
 Does lift have any way to specify a unique constraint on a field, via 
 schemify (or validation)?
 If not, how complex would it be to implement?

 


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



[Lift] Re: Building from source - error importing _root_.org.specs

2009-07-02 Thread Calen Pennington

I'm running Ubuntu 9.04.

$ mvn -v

Maven version: 2.0.9
Java version: 1.6.0_0
OS name: linux version: 2.6.28-13-generic arch: i386 Family: unix

I get the same errors using scala 2.7.4 and 2.7.5

-Cale


On Thu, Jul 2, 2009 at 12:24 AM, David
Pollakfeeder.of.the.be...@gmail.com wrote:
 I've built Lift from source on Windows, Linux and Mac OS X within the last 2
 days without incident.

 What OS are you running, what version of Maven and what version of Java?

 On Wed, Jul 1, 2009 at 8:00 PM, Calen Pennington
 calen.penning...@gmail.com wrote:

 Hi,

 I'm trying to build Lift from the source. I pulled the latest source
 from git, and ran

 cd liftweb
 mvn install

 as suggested in the wiki (http://wiki.liftweb.net/index.php/
 Source_code)

 When I did this, I got a large number of warnings like the following:
 [WARNING] /home/cpenning/work/scala/lift/liftweb-cpenning/lift-util/
 src/test/scala/net/liftweb/util/CombParserHelpersSpec.scala:18: error:
 value specs is not a member of package org
 [WARNING] import _root_.org.specs._

 The lift-util/pom.xml includes the dependency

    dependency
      groupIdorg.scala-tools.testing/groupId
      artifactIdspecs/artifactId
      version1.5.0/version
    /dependency

 as expected, and looking at my ~/.m2/repository/org/scala-tools/
 testing/specs/1.5.0/ contains a pom and a jar.

 Anyone know why lift-utils isn't able to import specs?

 Thanks

 -Cale





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

 


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



[Lift] Building from source - error importing _root_.org.specs

2009-07-01 Thread Calen Pennington

Hi,

I'm trying to build Lift from the source. I pulled the latest source
from git, and ran

cd liftweb
mvn install

as suggested in the wiki (http://wiki.liftweb.net/index.php/
Source_code)

When I did this, I got a large number of warnings like the following:
[WARNING] /home/cpenning/work/scala/lift/liftweb-cpenning/lift-util/
src/test/scala/net/liftweb/util/CombParserHelpersSpec.scala:18: error:
value specs is not a member of package org
[WARNING] import _root_.org.specs._

The lift-util/pom.xml includes the dependency

dependency
  groupIdorg.scala-tools.testing/groupId
  artifactIdspecs/artifactId
  version1.5.0/version
/dependency

as expected, and looking at my ~/.m2/repository/org/scala-tools/
testing/specs/1.5.0/ contains a pom and a jar.

Anyone know why lift-utils isn't able to import specs?

Thanks

-Cale

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