[Lift] Re: unit test framework

2009-07-02 Thread etorreborre

Hi Bill and ph,

Using specs matchers inside a JUnit test class is also possible using
the org.specs.SpecsMatchers trait.

However, I realize that both ScalaTest and specs suffer from the same
issue in that scenario.
When expectations are failing an exception is thrown but it is
interpreted by JUnit as an error instead of a failure.

We should instead throw an AssertionFailedError from the junit
library.

That shouldn't be a big deal to fix.

Eric.

On Jul 3, 10:34 am, Bill Venners  wrote:
> Hi ph,
>
> If you end up needing to use JUnit, you can import Assertions or
> ShouldMatchers or MustMatchers from ScalaTest to get a nicer
> scala-like assertion syntax inside JUnit tests. JUnit won't care it
> was written in Scala or used ScalaTest assertions and will run it and
> generate JUnit-compatible output, since it actually is JUnit. Here's
> what that might look like:
>
> import org.junit.Test
> import org.scalatest.matchers.MustMatchers._
>
> class MyJUnitTest {
>   @Test
>   def mapKeys() {
>     Map("one" -> 1, "two" -> 2) must contain key ("two")
>   }
>   @Test
>   def stringLength() {
>     "hello, world" must have length (12)
>   }
>   @Test
>   def stringCharAtMethodRejectsBadInput() {
>     intercept[StringIndexOutOfBoundsException] {
>       "hi".charAt(-1)
>     }
>   }
>
> }
>
> http://www.artima.com/scalatest
>
> Bill
>
>
>
>
>
> On Wed, Jul 1, 2009 at 3:07 PM, ph wrote:
>
> > This question might be obvious to most of the people here, but since I
> > new to Scala and Java I'm not clear
>
> > Maven generates 2 different unit test files:
> > MySpec >> specs
> > AppTest >> junit
>
> > running "mvn test" invokes AppTest (and other test cases with
> > annotation @Test)
> > running from Eclipse project as JUnit invokes MySpec
>
> > I'm trying to figure out what unit test framework to use in my
> > project. I'd prefer to have JUnit compatible output as continuous
> > build system will, probably, understand it.
>
> > Are both test frameworks generate JUnit-compatible output?
> > How to make maven invoke specs test when running "mvn test"?
> > Why is it 2 different test frameworks used? Are they complimentary? If
> > yes when use which?
> > I will probably use Hudson for continuous builds and also invoke unit
> > tests from script and or command line and will need parse result and
> > generate reports. What framework is better for these purposes? Or
> > maybe use both in defferent cases?
>
> --
> Bill Venners
> Artima, Inc.http://www.artima.com
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



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

2009-07-02 Thread David Pollak
On Thu, Jul 2, 2009 at 4:09 PM, Calen Pennington  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
> Pollak 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
> >  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
> >>
> >>
> >>  org.scala-tools.testing
> >>  specs
> >>  1.5.0
> >>
> >>
> >> 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: 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
Pollak 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
>  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
>>
>>    
>>      org.scala-tools.testing
>>      specs
>>      1.5.0
>>    
>>
>> 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] Re: unit test framework

2009-07-02 Thread Bill Venners

Hi ph,

If you end up needing to use JUnit, you can import Assertions or
ShouldMatchers or MustMatchers from ScalaTest to get a nicer
scala-like assertion syntax inside JUnit tests. JUnit won't care it
was written in Scala or used ScalaTest assertions and will run it and
generate JUnit-compatible output, since it actually is JUnit. Here's
what that might look like:

import org.junit.Test
import org.scalatest.matchers.MustMatchers._

class MyJUnitTest {
  @Test
  def mapKeys() {
Map("one" -> 1, "two" -> 2) must contain key ("two")
  }
  @Test
  def stringLength() {
"hello, world" must have length (12)
  }
  @Test
  def stringCharAtMethodRejectsBadInput() {
intercept[StringIndexOutOfBoundsException] {
  "hi".charAt(-1)
}
  }
}

http://www.artima.com/scalatest

Bill

On Wed, Jul 1, 2009 at 3:07 PM, ph wrote:
>
> This question might be obvious to most of the people here, but since I
> new to Scala and Java I'm not clear
>
> Maven generates 2 different unit test files:
> MySpec >> specs
> AppTest >> junit
>
> running "mvn test" invokes AppTest (and other test cases with
> annotation @Test)
> running from Eclipse project as JUnit invokes MySpec
>
> I'm trying to figure out what unit test framework to use in my
> project. I'd prefer to have JUnit compatible output as continuous
> build system will, probably, understand it.
>
> Are both test frameworks generate JUnit-compatible output?
> How to make maven invoke specs test when running "mvn test"?
> Why is it 2 different test frameworks used? Are they complimentary? If
> yes when use which?
> I will probably use Hudson for continuous builds and also invoke unit
> tests from script and or command line and will need parse result and
> generate reports. What framework is better for these purposes? Or
> maybe use both in defferent cases?
>
> >
>



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

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



[Lift] How to test/TDD lift apps?

2009-07-02 Thread Jeppe Nejsum Madsen

Hi,

Having taken the first baby steps and gotten a Lift app running, it's
time to bring back some of the old engineering practices to make sure
things keep running when new features are added at a rapid pace :-)

I'm interested in how people are testing their Lift apps, both at the
unit test level (ie. specs/scalatest with no container) and at the
integration test level (running in servlet container). Also, how are you
doing TDD with Lift (if at all).

Specifically, I've run into the following issues:

1) Testing model classes. Many require access to S (ie to read
resources) or other static Lift constructs. How can you mock these?

2) Testing snippets. Same issue with S, but more related to the actual
request, eg. S.param

For in-container testing it seems the practice of generating unique
names for form fields, makes it difficult to use tools like Selenium to
do browser based testing? How do you handle this?

Any input is appreciated

/Jeppe

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



[Lift] Re: Changes to ajax handling?

2009-07-02 Thread Kris Nuttycombe

Marius, that fix appears to work fine, thank you!

Bloody nulls. :)

Kris

On Thu, Jul 2, 2009 at 7:17 AM, marius d. wrote:
>
> Corrected and pushed. Please do an update and give it a try.
>
> Br's,
> Marius
>
> On Jul 2, 8:56 am, "marius d."  wrote:
>> On Jul 2, 12:40 am, Kris Nuttycombe  wrote:
>>
>>
>>
>> > To answer my own question, looking over the commit log 28595307 looks
>> > extremely suspicious. I can revert it locally but would prefer a
>> > mainline fix, and don't want to attempt it myself. Marius?
>>
>> > Kris
>>
>> > On Wed, Jul 1, 2009 at 3:33 PM, Kris
>>
>> > Nuttycombe wrote:
>> > > Hi, all,
>>
>> > > Have there been recent changes made to liftAjax.js? I am encountering
>> > > new errors from an ajaxSelect() today that were not present yesterday.
>> > > Firebug complains:
>>
>> > > Use of getBoxObjectFor() is deprecated. Try to use
>> > > element.getBoundingClientRect() if possible.
>> > > [Break on this error] undefined
>> > > liftAjax.js (line 111)
>> > > aboutToSend.responseType is null
>> > > lift_doAjaxCycle()()liftAjax.js (line 111)
>> > > lift_ajaxHandler()()liftAjax.js (line 21)
>> > > onchange(change )add_trig...Gyw%3D%3D (line 2)
>> > > [Break on this error] if (aboutToSend.responseType.toLowerCase() === 
>> > > "json")
>>
>> That is my commt but right now I don,t see how it affects other
>> things ... But I,ll definitely look on it today. Note that there is no
>> intent for ajax behavior changes .. Just an augmentation ...
>>
>> > > Thanks,
>>
>> > > Kris
> >
>

--~--~-~--~~~---~--~~
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 Wass 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  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: can a Snippet call a Snippet?

2009-07-02 Thread Timothy Perrett

But of course ­ I know this :-)

Thinking back to when I first started scala a couple of years ago I just
couldn¹t understand why you wanted to put something in a box... Your article
does a good job of explaining, but I think we could do with some specific
documentation.

Cheers, Tim

On 02/07/2009 15:04, "David Pollak"  wrote:

> http://blog.lostlake.org/index.php?/archives/50-The-Scala-Option-class-and-how
> -lift-uses-it.html
> 
> Options and Boxes are very similar, although Boxes have "Failure" as well as
> Empty (None)
> 
> Also, note that the code in the example is Scala 2.3 era code, so some syntax
> has changed.
>  


--~--~-~--~~~---~--~~
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] Binding based on attributes

2009-07-02 Thread Nolan Darilek

I'm working on an app that allows users to enter their own form 
templates, which are rendered to HTML forms and filled out. The results 
are then captured and encoded for later rendering. So the user might 
input something like:

Name: 
Is this your first visit? 
..

Is it possible to bind the various snippets, but perform special 
handling on their attribute values? So, for instance, I'd bind an 
S.text() to all , but it'd set a variable based on its name 
attribute, and perform rough validations based on whether required is 
set to true? It isn't immediately obvious how to do this, even when 
digging through the Lift sources.


--~--~-~--~~~---~--~~
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: can a Snippet call a Snippet?

2009-07-02 Thread David Pollak
On Thu, Jul 2, 2009 at 6:55 AM, Timothy Perrett wrote:

>
> We really ought to get around to writing a “guides for boxes” - its easily
> one of the most confusing concepts in lift (a magnitude less confusing
> than when it was called Can[T])
>

http://blog.lostlake.org/index.php?/archives/50-The-Scala-Option-class-and-how-lift-uses-it.html

Options and Boxes are very similar, although Boxes have "Failure" as well as
Empty (None)

Also, note that the code in the example is Scala 2.3 era code, so some
syntax has changed.


>
>
> Cheers, Tim
>
>
> On 02/07/2009 14:46, "David Pollak"  wrote:
>
>
>
> On Wed, Jul 1, 2009 at 10:43 PM, g-man  wrote:
>
>
> I'm getting a Null Pointer: 'Trying to open an empty box', from S.attr
> ("todos").open_!
>
>
> Don't use open_!  It's dangerous.
>
> That's why Boxes exist.  They contain (or don't) something that may or may
> not exist.  If you use open_! in your code, it is a major mistake (a logic
> error) unless the line before the open contains "if (thing.isDefined) {"
>
> Thanks,
>
> David
>
>
>
>
> Here's my layout:
>
> todo.html template 
>
> 
> --- Todo list table stuff ---
> 
> --- Tag list table stuff (where the selection to filter comes from)
> ---
>
> TD.scala snippet =
>
> // this arity is for the default 'show all Todos' condition
> def list(html: NodeSeq) = {
> val id = S.attr("todos").open_!
>
> // this arity is for the 'filter by Tag' case
> def list(filterTag: Long)(html: NodeSeq) = {
> val id = S.attr("todos").open_!
>
> The two snippet methods could probably be combined with a (param:
> Long*) signature, but Scala does not seem to care right now. The
> default works perfectly, but when a Tag is selected to filter by, the
> 'todos' id Box cannot be seen when attempting to open.
>
> Is this because it is probably out of scope? I am using an ajaxbutton
> to make the call and pass in the tag.id  , but it is hard
> to see how an
>
> S.attr could exist for one request, then be gone for the next, unless
> I am confusing this with a stateful attribute.
>
>
> On Jul 1, 2:42 pm, David Pollak  wrote:
> > On Wed, Jul 1, 2009 at 2:28 PM, g-man  wrote:
> >
> > > I will look into the nested snippets.
> >
> > > For expediency, I folded all the snippets that interact with my
> > > template into one file, so I can concentrate on the business logic.
> >
> > > For my Todo app enhancement, I need to pass the id of my selected Tag
> > > (which I have confirmed is correctly gathered from the page request)
> > > in to the TD.list method, so that the filtered Todos (those bearing
> > > the required Tag) will be found and rendered.
> >
> > > My problem is that if I try to pass an additional argument (tagId:
> > > Long), the TD.list method is not happy and will not even render the
> > > template.
> >
> > > I have tried both paired (html: NodeSeq, tagId: Long) as well as
> > > curried style (html: NodeSeq)(tagId: Long), but neither works.
> >
> > Try:
> >
> > list(tagId: Long)(html: NodeSeq): NodeSeq
> >
> > That way list(44L) _ becomes a NodeSeq => NodeSeq
> >
> >
> >
> >
> >
> > > There must be a simple way to accomplish such a common task!
> >
> > > Thanks to all the members for commenting...
> >
> > > On Jun 29, 11:25 pm, "marius d."  wrote:
> > > > Or you can use S.locateMappedSnippet ... but first try to see if
> > > > nested snippet won't do the trick for you ...
> >
> > > > On Jun 30, 10:17 am, "marius d."  wrote:
> >
> > > > > Can you paste some code?
> >
> > > > > Essentially we support nested snippets so your snippet can simply
> > > > > return a markup containing another snippet and it will be invoked.
> If
> > > > > you really want to manually invoke a snippet from another snippet
> and
> > > > > if you are not using StatefulSnippets you can just instantiate the
> > > > > class and call your function and pass it the right NodeSeq.
> >
> > > > > Br's,
> > > > > Marius
> >
> > > > > On Jun 30, 5:36 am, g-man  wrote:
> >
> > > > > > I am enhancing the Todo app by adding tags.
> >
> > > > > > I have retained the TD.scala snippet to manage the Todos on my
> page,
> > > > > > and added a TG.scala snippet to handle tags on the same page,
> which
> > > > > > works well for creating new and listing in both cases.
> >
> > > > > > Now I want to filter my Todos list by a Tag instance I select
> from my
> > > > > > list, and therefore need to pass the id of the selected tag over
> from
> > > > > > the TG snippet to the TD snippet, where it can be used as a
> filter
> > > > > > argument for a find method.
> >
> > > > > > The problem is that scala says it cannot find snippet TD, whose
> > > method
> > > > > > I am calling as TD.list from the TG.scala snippet. I have tried
> all
> > > > > > kinds of explicit importing, but no luck.
> >
> > > > > > So,  can a snippet call a snippet, or is that controlled only
> from
> > > the
> > > > > > web page?- Hide quoted text -
> >
> > > > - Show quoted text -
> >
> > --
> > Lift, the simply 

[Lift] Re: can a Snippet call a Snippet?

2009-07-02 Thread g-man

The open_! came right from the 'Getting Started' Todo tutorial I am
enhancing:

Listing 17:  list method in TD class
def list(html: NodeSeq) = {
 val id = S.attr("all_id").open_!

Nevertheless, the question remains: How can I filter the Todo items by
a Tag and render the list?

I guess I could always link to a new page and let the template drive
the snippet, but I kind of wanted to keep one page open and just do
AJAX stuff within  elements.

Thanks again..


On Jul 2, 5:46 am, David Pollak  wrote:
> On Wed, Jul 1, 2009 at 10:43 PM, g-man  wrote:
>
> > I'm getting a Null Pointer: 'Trying to open an empty box', from S.attr
> > ("todos").open_!
>
> Don't use open_!  It's dangerous.
>
> That's why Boxes exist.  They contain (or don't) something that may or may
> not exist.  If you use open_! in your code, it is a major mistake (a logic
> error) unless the line before the open contains "if (thing.isDefined) {"
>
> Thanks,
>
> David
>
>
>
>
>
>
>
> > Here's my layout:
>
> > todo.html template 
>
> > 
> > --- Todo list table stuff ---
> > 
> > --- Tag list table stuff (where the selection to filter comes from)
> > ---
>
> > TD.scala snippet =
>
> > // this arity is for the default 'show all Todos' condition
> > def list(html: NodeSeq) = {
> >    val id = S.attr("todos").open_!
>
> > // this arity is for the 'filter by Tag' case
> > def list(filterTag: Long)(html: NodeSeq) = {
> >    val id = S.attr("todos").open_!
>
> > The two snippet methods could probably be combined with a (param:
> > Long*) signature, but Scala does not seem to care right now. The
> > default works perfectly, but when a Tag is selected to filter by, the
> > 'todos' id Box cannot be seen when attempting to open.
>
> > Is this because it is probably out of scope? I am using an ajaxbutton
> > to make the call and pass in the tag.id, but it is hard to see how an
> > S.attr could exist for one request, then be gone for the next, unless
> > I am confusing this with a stateful attribute.
>
> > On Jul 1, 2:42 pm, David Pollak  wrote:
> > > On Wed, Jul 1, 2009 at 2:28 PM, g-man  wrote:
>
> > > > I will look into the nested snippets.
>
> > > > For expediency, I folded all the snippets that interact with my
> > > > template into one file, so I can concentrate on the business logic.
>
> > > > For my Todo app enhancement, I need to pass the id of my selected Tag
> > > > (which I have confirmed is correctly gathered from the page request)
> > > > in to the TD.list method, so that the filtered Todos (those bearing
> > > > the required Tag) will be found and rendered.
>
> > > > My problem is that if I try to pass an additional argument (tagId:
> > > > Long), the TD.list method is not happy and will not even render the
> > > > template.
>
> > > > I have tried both paired (html: NodeSeq, tagId: Long) as well as
> > > > curried style (html: NodeSeq)(tagId: Long), but neither works.
>
> > > Try:
>
> > > list(tagId: Long)(html: NodeSeq): NodeSeq
>
> > > That way list(44L) _ becomes a NodeSeq => NodeSeq
>
> > > > There must be a simple way to accomplish such a common task!
>
> > > > Thanks to all the members for commenting...
>
> > > > On Jun 29, 11:25 pm, "marius d."  wrote:
> > > > > Or you can use S.locateMappedSnippet ... but first try to see if
> > > > > nested snippet won't do the trick for you ...
>
> > > > > On Jun 30, 10:17 am, "marius d."  wrote:
>
> > > > > > Can you paste some code?
>
> > > > > > Essentially we support nested snippets so your snippet can simply
> > > > > > return a markup containing another snippet and it will be invoked.
> > If
> > > > > > you really want to manually invoke a snippet from another snippet
> > and
> > > > > > if you are not using StatefulSnippets you can just instantiate the
> > > > > > class and call your function and pass it the right NodeSeq.
>
> > > > > > Br's,
> > > > > > Marius
>
> > > > > > On Jun 30, 5:36 am, g-man  wrote:
>
> > > > > > > I am enhancing the Todo app by adding tags.
>
> > > > > > > I have retained the TD.scala snippet to manage the Todos on my
> > page,
> > > > > > > and added a TG.scala snippet to handle tags on the same page,
> > which
> > > > > > > works well for creating new and listing in both cases.
>
> > > > > > > Now I want to filter my Todos list by a Tag instance I select
> > from my
> > > > > > > list, and therefore need to pass the id of the selected tag over
> > from
> > > > > > > the TG snippet to the TD snippet, where it can be used as a
> > filter
> > > > > > > argument for a find method.
>
> > > > > > > The problem is that scala says it cannot find snippet TD, whose
> > > > method
> > > > > > > I am calling as TD.list from the TG.scala snippet. I have tried
> > all
> > > > > > > kinds of explicit importing, but no luck.
>
> > > > > > > So,  can a snippet call a snippet, or is that controlled only
> > from
> > > > the
> > > > > > > web page?- Hide quoted text -
>
> > > > > - Show quoted text -
>
> > > --
> > > Lift, the simply functional web frame

[Lift] Re: can a Snippet call a Snippet?

2009-07-02 Thread Timothy Perrett

We really ought to get around to writing a ³guides for boxes² - its easily
one of the most confusing concepts in lift (a magnitude less confusing
than when it was called Can[T])

Cheers, Tim

On 02/07/2009 14:46, "David Pollak"  wrote:

> 
> 
> On Wed, Jul 1, 2009 at 10:43 PM, g-man  wrote:
>> 
>> I'm getting a Null Pointer: 'Trying to open an empty box', from S.attr
>> ("todos").open_!
> 
> Don't use open_!  It's dangerous.
> 
> That's why Boxes exist.  They contain (or don't) something that may or may not
> exist.  If you use open_! in your code, it is a major mistake (a logic error)
> unless the line before the open contains "if (thing.isDefined) {"
> 
> Thanks,
> 
> David
>  
>> 
>> 
>> Here's my layout:
>> 
>> todo.html template 
>> 
>> 
>> --- Todo list table stuff ---
>> 
>> --- Tag list table stuff (where the selection to filter comes from)
>> ---
>> 
>> TD.scala snippet =
>> 
>> // this arity is for the default 'show all Todos' condition
>> def list(html: NodeSeq) = {
>>     val id = S.attr("todos").open_!
>> 
>> // this arity is for the 'filter by Tag' case
>> def list(filterTag: Long)(html: NodeSeq) = {
>>     val id = S.attr("todos").open_!
>> 
>> The two snippet methods could probably be combined with a (param:
>> Long*) signature, but Scala does not seem to care right now. The
>> default works perfectly, but when a Tag is selected to filter by, the
>> 'todos' id Box cannot be seen when attempting to open.
>> 
>> Is this because it is probably out of scope? I am using an ajaxbutton
>> to make the call and pass in the tag.id  , but it is hard to
>> see how an
>> S.attr could exist for one request, then be gone for the next, unless
>> I am confusing this with a stateful attribute.
>> 
>> 
>> On Jul 1, 2:42 pm, David Pollak  wrote:
>>> > On Wed, Jul 1, 2009 at 2:28 PM, g-man  wrote:
>>> >
 > > I will look into the nested snippets.
>>> >
 > > For expediency, I folded all the snippets that interact with my
 > > template into one file, so I can concentrate on the business logic.
>>> >
 > > For my Todo app enhancement, I need to pass the id of my selected Tag
 > > (which I have confirmed is correctly gathered from the page request)
 > > in to the TD.list method, so that the filtered Todos (those bearing
 > > the required Tag) will be found and rendered.
>>> >
 > > My problem is that if I try to pass an additional argument (tagId:
 > > Long), the TD.list method is not happy and will not even render the
 > > template.
>>> >
 > > I have tried both paired (html: NodeSeq, tagId: Long) as well as
 > > curried style (html: NodeSeq)(tagId: Long), but neither works.
>>> >
>>> > Try:
>>> >
>>> > list(tagId: Long)(html: NodeSeq): NodeSeq
>>> >
>>> > That way list(44L) _ becomes a NodeSeq => NodeSeq
>>> >
>>> >
>>> >
>>> >
>>> >
 > > There must be a simple way to accomplish such a common task!
>>> >
 > > Thanks to all the members for commenting...
>>> >
 > > On Jun 29, 11:25 pm, "marius d."  wrote:
> > > > Or you can use S.locateMappedSnippet ... but first try to see if
> > > > nested snippet won't do the trick for you ...
>>> >
> > > > On Jun 30, 10:17 am, "marius d."  wrote:
>>> >
>> > > > > Can you paste some code?
>>> >
>> > > > > Essentially we support nested snippets so your snippet can simply
>> > > > > return a markup containing another snippet and it will be
>> invoked. If
>> > > > > you really want to manually invoke a snippet from another snippet
and
>> > > > > if you are not using StatefulSnippets you can just instantiate
the
>> > > > > class and call your function and pass it the right NodeSeq.
>>> >
>> > > > > Br's,
>> > > > > Marius
>>> >
>> > > > > On Jun 30, 5:36 am, g-man  wrote:
>>> >
>>> > > > > > I am enhancing the Todo app by adding tags.
>>> >
>>> > > > > > I have retained the TD.scala snippet to manage the Todos on my
page,
>>> > > > > > and added a TG.scala snippet to handle tags on the same page,
which
>>> > > > > > works well for creating new and listing in both cases.
>>> >
>>> > > > > > Now I want to filter my Todos list by a Tag instance I select
from my
>>> > > > > > list, and therefore need to pass the id of the selected tag
over from
>>> > > > > > the TG snippet to the TD snippet, where it can be used as a
filter
>>> > > > > > argument for a find method.
>>> >
>>> > > > > > The problem is that scala says it cannot find snippet TD,
whose
 > > method
>>> > > > > > I am calling as TD.list from the TG.scala snippet. I have
tried all
>>> > > > > > kinds of explicit importing, but no luck.
>>> >
>>> > > > > > So,  can a snippet call a snippet, or is that controlled only
from
 > > the
>>> > > > > > web page?- Hide quoted text -
>>> >
> > > > - Show quoted text -
>>> >
>>> > --
>>> > Lift, the simply functional web frameworkhttp://liftweb.net
>>> 

[Lift] Re: can a Snippet call a Snippet?

2009-07-02 Thread David Pollak
On Wed, Jul 1, 2009 at 10:43 PM, g-man  wrote:

>
> I'm getting a Null Pointer: 'Trying to open an empty box', from S.attr
> ("todos").open_!


Don't use open_!  It's dangerous.

That's why Boxes exist.  They contain (or don't) something that may or may
not exist.  If you use open_! in your code, it is a major mistake (a logic
error) unless the line before the open contains "if (thing.isDefined) {"

Thanks,

David


>
>
> Here's my layout:
>
> todo.html template 
>
> 
> --- Todo list table stuff ---
> 
> --- Tag list table stuff (where the selection to filter comes from)
> ---
>
> TD.scala snippet =
>
> // this arity is for the default 'show all Todos' condition
> def list(html: NodeSeq) = {
>val id = S.attr("todos").open_!
>
> // this arity is for the 'filter by Tag' case
> def list(filterTag: Long)(html: NodeSeq) = {
>val id = S.attr("todos").open_!
>
> The two snippet methods could probably be combined with a (param:
> Long*) signature, but Scala does not seem to care right now. The
> default works perfectly, but when a Tag is selected to filter by, the
> 'todos' id Box cannot be seen when attempting to open.
>
> Is this because it is probably out of scope? I am using an ajaxbutton
> to make the call and pass in the tag.id, but it is hard to see how an
> S.attr could exist for one request, then be gone for the next, unless
> I am confusing this with a stateful attribute.
>
>
> On Jul 1, 2:42 pm, David Pollak  wrote:
> > On Wed, Jul 1, 2009 at 2:28 PM, g-man  wrote:
> >
> > > I will look into the nested snippets.
> >
> > > For expediency, I folded all the snippets that interact with my
> > > template into one file, so I can concentrate on the business logic.
> >
> > > For my Todo app enhancement, I need to pass the id of my selected Tag
> > > (which I have confirmed is correctly gathered from the page request)
> > > in to the TD.list method, so that the filtered Todos (those bearing
> > > the required Tag) will be found and rendered.
> >
> > > My problem is that if I try to pass an additional argument (tagId:
> > > Long), the TD.list method is not happy and will not even render the
> > > template.
> >
> > > I have tried both paired (html: NodeSeq, tagId: Long) as well as
> > > curried style (html: NodeSeq)(tagId: Long), but neither works.
> >
> > Try:
> >
> > list(tagId: Long)(html: NodeSeq): NodeSeq
> >
> > That way list(44L) _ becomes a NodeSeq => NodeSeq
> >
> >
> >
> >
> >
> > > There must be a simple way to accomplish such a common task!
> >
> > > Thanks to all the members for commenting...
> >
> > > On Jun 29, 11:25 pm, "marius d."  wrote:
> > > > Or you can use S.locateMappedSnippet ... but first try to see if
> > > > nested snippet won't do the trick for you ...
> >
> > > > On Jun 30, 10:17 am, "marius d."  wrote:
> >
> > > > > Can you paste some code?
> >
> > > > > Essentially we support nested snippets so your snippet can simply
> > > > > return a markup containing another snippet and it will be invoked.
> If
> > > > > you really want to manually invoke a snippet from another snippet
> and
> > > > > if you are not using StatefulSnippets you can just instantiate the
> > > > > class and call your function and pass it the right NodeSeq.
> >
> > > > > Br's,
> > > > > Marius
> >
> > > > > On Jun 30, 5:36 am, g-man  wrote:
> >
> > > > > > I am enhancing the Todo app by adding tags.
> >
> > > > > > I have retained the TD.scala snippet to manage the Todos on my
> page,
> > > > > > and added a TG.scala snippet to handle tags on the same page,
> which
> > > > > > works well for creating new and listing in both cases.
> >
> > > > > > Now I want to filter my Todos list by a Tag instance I select
> from my
> > > > > > list, and therefore need to pass the id of the selected tag over
> from
> > > > > > the TG snippet to the TD snippet, where it can be used as a
> filter
> > > > > > argument for a find method.
> >
> > > > > > The problem is that scala says it cannot find snippet TD, whose
> > > method
> > > > > > I am calling as TD.list from the TG.scala snippet. I have tried
> all
> > > > > > kinds of explicit importing, but no luck.
> >
> > > > > > So,  can a snippet call a snippet, or is that controlled only
> from
> > > the
> > > > > > web page?- Hide quoted text -
> >
> > > > - Show quoted text -
> >
> > --
> > Lift, the simply functional web frameworkhttp://liftweb.net
> > Beginning Scalahttp://www.apress.com/book/view/1430219890
> > Follow me:http://twitter.com/dpp
> > Git some:http://github.com/dpp
> >
>


-- 
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...@go

[Lift] Re: Changes to ajax handling?

2009-07-02 Thread marius d.

Corrected and pushed. Please do an update and give it a try.

Br's,
Marius

On Jul 2, 8:56 am, "marius d."  wrote:
> On Jul 2, 12:40 am, Kris Nuttycombe  wrote:
>
>
>
> > To answer my own question, looking over the commit log 28595307 looks
> > extremely suspicious. I can revert it locally but would prefer a
> > mainline fix, and don't want to attempt it myself. Marius?
>
> > Kris
>
> > On Wed, Jul 1, 2009 at 3:33 PM, Kris
>
> > Nuttycombe wrote:
> > > Hi, all,
>
> > > Have there been recent changes made to liftAjax.js? I am encountering
> > > new errors from an ajaxSelect() today that were not present yesterday.
> > > Firebug complains:
>
> > > Use of getBoxObjectFor() is deprecated. Try to use
> > > element.getBoundingClientRect() if possible.
> > > [Break on this error] undefined
> > > liftAjax.js (line 111)
> > > aboutToSend.responseType is null
> > > lift_doAjaxCycle()()liftAjax.js (line 111)
> > > lift_ajaxHandler()()liftAjax.js (line 21)
> > > onchange(change )add_trig...Gyw%3D%3D (line 2)
> > > [Break on this error] if (aboutToSend.responseType.toLowerCase() === 
> > > "json")
>
> That is my commt but right now I don,t see how it affects other
> things ... But I,ll definitely look on it today. Note that there is no
> intent for ajax behavior changes .. Just an augmentation ...
>
> > > Thanks,
>
> > > Kris
--~--~-~--~~~---~--~~
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: grabbing rss or other type of feeds within lift

2009-07-02 Thread Mark Essel

ps found a nice code framework to help with my initial setup here from
Ted Neward
http://www.ibm.com/developerworks/java/library/j-scala06029.html
Will use some of those classes/objects to get started (Ted's cool with
it as long as I show him how it ends up)

On Jul 1, 6:28 pm, Naftoli Gugenhem  wrote:
> Which maven plugin did you try for eclipse? M2eclipse works for me...
>
> -
>
> Mark Essel wrote:
>
> Thanks think I'm making progress
> following this:http://wiki.netbeans.org/Scala
> after the install of 6.7RC3, jdk, scala plugin, lift, maven (used it
> to get a test lift project)
> my lift project worked with scala code inside the project
>
> but what I didn't do was set SCALA_HOME, my class path appended with
> that SCALA_HOME\bin and finally
> add that option -J-Dscala.home=SCALA_HOME  to the netbeans.conf
>
> hoping that does it.
>
> Not for nothing but I wonder why all the hoops to get a compiler + IDE
> has so many little steps. Eclipse I tried something similar with but
> never even got the lift project or maven working.
>
> I come from an old makefile /command line library background, and
> recently .NET libraries, mains (various languages).
> Netbeans is still new to me (used once before for gcc in cygwin).
>
> On Jul 1, 5:24 pm, David Pollak  wrote:
>
>
>
> > On Wed, Jul 1, 2009 at 2:16 PM, Mark Essel  wrote:
>
> > > Thanks David. I'm going with some direct calls for simplicity (along
> > > the path you suggested).
> > > along the lines of:
>
> > > val rssFeed = XML.load( (new URL
> > > (feedUrl)).openConnection.getInputStream )
>
> > > One more oddity, I'm getting problems compiling normal scala code but
> > > I can build lift projects (with scala inside them).
>
> > No clue about this... sorry.
>
> > > Something that I need to add in the config file like a path to the
> > > scala binaries? (installed it in windows default spot)
> > > for netbeans.conf
> > > the netbeans_default_options var, adding
> > > -J-Dscala.home=SCALA_HOME
> > > where's SCALA_HOME supposed to point to?
> > > I tried:
> > > -D\"c:\Users\Dude Jones\.netbeans\6.7rc3\scala\scala-2.7.3.final\\"
> > > where the binaries are no luck
>
> > > Getting the error:
> > > init:
> > > deps-jar:
> > > Compiling 1 source file to C:\Mark\misc\EntrepreneurInfo
> > > \IntelligentAdvertisingSoftware\testo\build\classes
> > > Could not connect to compilation daemon.
> > > org.netbeans.core.execution.ExitSecurityException: Exit from within
> > > execution engine, normal
> > >        at org.netbeans.core.execution.SecMan.checkExitImpl
> > > (SecMan.java:85)
> > >        at org.netbeans.core.execution.SecMan$PrivilegedCheck.run
> > > (SecMan.java:160)
> > >        at java.security.AccessController.doPrivileged(Native Method)
> > >        at org.netbeans.core.execution.SecMan$PrivilegedCheck.check
> > > (SecMan.java:175)
> > >        at org.netbeans.core.execution.SecMan$PrivilegedCheck.checkExit
> > > (SecMan.java:170)
> > >        at org.netbeans.core.execution.SecMan.checkExit(SecMan.java:
> > > 69)
> > >        at org.netbeans.TopSecurityManager.checkExit
> > > (TopSecurityManager.java:149)
> > >        at java.lang.Runtime.exit(Runtime.java:88)
> > >        at java.lang.System.exit(System.java:904)
> > >        at scala.Predef$.exit(Predef.scala:81)
> > >        at scala.tools.nsc.CompileSocket.fatal(CompileSocket.scala:53)
> > >        at scala.tools.nsc.CompileSocket.getPort(CompileSocket.scala:
> > > 175)
> > >        at scala.tools.nsc.CompileSocket.getsock$1(CompileSocket.scala:
> > > 206)
> > >        at scala.tools.nsc.CompileSocket.getOrCreateSocket
> > > (CompileSocket.scala:227)
> > >        at scala.tools.nsc.StandardCompileClient.main0
> > > (CompileClient.scala:94)
> > >        at scala.tools.ant.FastScalac.execute(FastScalac.scala:96)
> > >        at org.apache.tools.ant.UnknownElement.execute
> > > (UnknownElement.java:288)
> > >        at sun.reflect.GeneratedMethodAccessor48.invoke(Unknown
> > > Source)
> > >        at sun.reflect.DelegatingMethodAccessorImpl.invoke
> > > (DelegatingMethodAccessorImpl.java:25)
> > >        at java.lang.reflect.Method.invoke(Method.java:597)
> > >        at org.apache.tools.ant.dispatch.DispatchUtils.execute
> > > (DispatchUtils.java:106)
> > >        at org.apache.tools.ant.Task.perform(Task.java:348)
> > >        at org.apache.tools.ant.taskdefs.Sequential.execute
> > > (Sequential.java:62)
> > >        at org.apache.tools.ant.UnknownElement.execute
> > > (UnknownElement.java:288)
> > >        at sun.reflect.GeneratedMethodAccessor48.invoke(Unknown
> > > Source)
> > >        at sun.reflect.DelegatingMethodAccessorImpl.invoke
> > > (DelegatingMethodAccessorImpl.java:25)
> > >        at java.lang.reflect.Method.invoke(Method.java:597)
> > >        at org.apache.tools.ant.dispatch.DispatchUtils.execute
> > > (DispatchUtils.java:106)
> > >        at org.apache.tools.ant.Task.perform(Task.java:348)
> > >        at org.apache.tools.ant.taskdefs.MacroInstance.

[Lift] Re: grabbing rss or other type of feeds within lift

2009-07-02 Thread Mark Essel

Yeah Naftoli it was m2eclipse. May have been my failure to set
SCALA_HOME and the path properly.
I'll review it next time I do an eclipse setup (hopefully not for a
while now that netbeans is cooking with scala/lift)

Seriously, thanks much for all the feedback and help gents.

On Jul 1, 6:28 pm, Naftoli Gugenhem  wrote:
> Which maven plugin did you try for eclipse? M2eclipse works for me...
>
> -
>
> Mark Essel wrote:
>
> Thanks think I'm making progress
> following this:http://wiki.netbeans.org/Scala
> after the install of 6.7RC3, jdk, scala plugin, lift, maven (used it
> to get a test lift project)
> my lift project worked with scala code inside the project
>
> but what I didn't do was set SCALA_HOME, my class path appended with
> that SCALA_HOME\bin and finally
> add that option -J-Dscala.home=SCALA_HOME  to the netbeans.conf
>
> hoping that does it.
>
> Not for nothing but I wonder why all the hoops to get a compiler + IDE
> has so many little steps. Eclipse I tried something similar with but
> never even got the lift project or maven working.
>
> I come from an old makefile /command line library background, and
> recently .NET libraries, mains (various languages).
> Netbeans is still new to me (used once before for gcc in cygwin).
>
> On Jul 1, 5:24 pm, David Pollak  wrote:
>
>
>
> > On Wed, Jul 1, 2009 at 2:16 PM, Mark Essel  wrote:
>
> > > Thanks David. I'm going with some direct calls for simplicity (along
> > > the path you suggested).
> > > along the lines of:
>
> > > val rssFeed = XML.load( (new URL
> > > (feedUrl)).openConnection.getInputStream )
>
> > > One more oddity, I'm getting problems compiling normal scala code but
> > > I can build lift projects (with scala inside them).
>
> > No clue about this... sorry.
>
> > > Something that I need to add in the config file like a path to the
> > > scala binaries? (installed it in windows default spot)
> > > for netbeans.conf
> > > the netbeans_default_options var, adding
> > > -J-Dscala.home=SCALA_HOME
> > > where's SCALA_HOME supposed to point to?
> > > I tried:
> > > -D\"c:\Users\Dude Jones\.netbeans\6.7rc3\scala\scala-2.7.3.final\\"
> > > where the binaries are no luck
>
> > > Getting the error:
> > > init:
> > > deps-jar:
> > > Compiling 1 source file to C:\Mark\misc\EntrepreneurInfo
> > > \IntelligentAdvertisingSoftware\testo\build\classes
> > > Could not connect to compilation daemon.
> > > org.netbeans.core.execution.ExitSecurityException: Exit from within
> > > execution engine, normal
> > >        at org.netbeans.core.execution.SecMan.checkExitImpl
> > > (SecMan.java:85)
> > >        at org.netbeans.core.execution.SecMan$PrivilegedCheck.run
> > > (SecMan.java:160)
> > >        at java.security.AccessController.doPrivileged(Native Method)
> > >        at org.netbeans.core.execution.SecMan$PrivilegedCheck.check
> > > (SecMan.java:175)
> > >        at org.netbeans.core.execution.SecMan$PrivilegedCheck.checkExit
> > > (SecMan.java:170)
> > >        at org.netbeans.core.execution.SecMan.checkExit(SecMan.java:
> > > 69)
> > >        at org.netbeans.TopSecurityManager.checkExit
> > > (TopSecurityManager.java:149)
> > >        at java.lang.Runtime.exit(Runtime.java:88)
> > >        at java.lang.System.exit(System.java:904)
> > >        at scala.Predef$.exit(Predef.scala:81)
> > >        at scala.tools.nsc.CompileSocket.fatal(CompileSocket.scala:53)
> > >        at scala.tools.nsc.CompileSocket.getPort(CompileSocket.scala:
> > > 175)
> > >        at scala.tools.nsc.CompileSocket.getsock$1(CompileSocket.scala:
> > > 206)
> > >        at scala.tools.nsc.CompileSocket.getOrCreateSocket
> > > (CompileSocket.scala:227)
> > >        at scala.tools.nsc.StandardCompileClient.main0
> > > (CompileClient.scala:94)
> > >        at scala.tools.ant.FastScalac.execute(FastScalac.scala:96)
> > >        at org.apache.tools.ant.UnknownElement.execute
> > > (UnknownElement.java:288)
> > >        at sun.reflect.GeneratedMethodAccessor48.invoke(Unknown
> > > Source)
> > >        at sun.reflect.DelegatingMethodAccessorImpl.invoke
> > > (DelegatingMethodAccessorImpl.java:25)
> > >        at java.lang.reflect.Method.invoke(Method.java:597)
> > >        at org.apache.tools.ant.dispatch.DispatchUtils.execute
> > > (DispatchUtils.java:106)
> > >        at org.apache.tools.ant.Task.perform(Task.java:348)
> > >        at org.apache.tools.ant.taskdefs.Sequential.execute
> > > (Sequential.java:62)
> > >        at org.apache.tools.ant.UnknownElement.execute
> > > (UnknownElement.java:288)
> > >        at sun.reflect.GeneratedMethodAccessor48.invoke(Unknown
> > > Source)
> > >        at sun.reflect.DelegatingMethodAccessorImpl.invoke
> > > (DelegatingMethodAccessorImpl.java:25)
> > >        at java.lang.reflect.Method.invoke(Method.java:597)
> > >        at org.apache.tools.ant.dispatch.DispatchUtils.execute
> > > (DispatchUtils.java:106)
> > >        at org.apache.tools.ant.Task.perform(Task.java:348)
> > >        at org.apache.tools.ant.task

[Lift] Re: Unique constraint

2009-07-02 Thread Joe Wass

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  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: Thoughts on file streaming

2009-07-02 Thread Timothy Perrett

Very nice DPP - will try and take a look at this today.

Cheers, Tim

On Jul 1, 7:20 pm, David Pollak  wrote:
> Okay... I've checked in new code.
>
> In LiftRules, there's:
>
>   /**
>    * The function that converts a fieldName, contentType, fileName and an
> InputStream into
>    * a FileParamHolder.  By default, create an in-memory instance.  Use
> OnDiskFileParamHolder
>    * to create an on-disk version
>    */
>   var handleMimeFile: (String, String, String, InputStream) =>
> FileParamHolder =
>   (fieldName, contentType, fileName, inputStream) =>
>   new InMemFileParamHolder(fieldName, contentType, fileName,
> Helpers.readWholeStream(inputStream))
>
> You can change handleMimeFile to use OnDiskFileParamHolder.  There's a
> companion object that has a helper that'll allow you to create an instance
> out of the parameters.  By default, the OnDiskFileParamHolder deletes the
> temporary file when it is finalized.
>
> If you want to monitor the progress of an upload, use LiftRules:
>   /**
>    * The global multipart progress listener:
>    *     pBytesRead - The total number of bytes, which have been read so
> far.
>    *    pContentLength - The total number of bytes, which are being read.
> May be -1, if this number is unknown.
>    *    pItems - The number of the field, which is currently being read. (0
> = no item so far, 1 = first item is being read, ...)
>    */
>   var progessListener: (Long, Long, Int) => Unit = (_, _, _) => ()
>
> By default, it does nothing, but you can put in a function that'll look for
> a session-specific CometActor and send it messages.
>
> If the above does not satisfy all your needs, you can subclass
> FileParamHolder and do whatever you want.
>
> Thanks,
>
> David
>
> On Wed, Jul 1, 2009 at 10:31 AM, David Pollak 
>
>
>
>
> > wrote:
> > K... I'll check some code in later today.
>
> > On Wed, Jul 1, 2009 at 9:05 AM, Andrew Scherpbier 
> > wrote:
>
> >> It would also be nice to be able to provide progress feedback.  The page
> >> returned after the form submission can then use comet to display a
> >> progress bar or something like that.  (The media upload at Vimeo comes
> >> to mind as a good example of this!)
>
> >> Also, I would suggest some smarts when creating temporary files.  It
> >> might be good to abstract the cache so that small files don't get put on
> >> disk.
>
> >> --Andrew
>
> >> Vlad Seryakov wrote:
> >> > I am also contemplating to use Lift but lack of big file upload is the
> >> > showstopper. We need to upload images, and big video files and
> >> > currently there i snot way to do it in Lift, i need something else to
> >> > handle that which makes the whole stuff more complex than needed.
>
> >> > Spooling into temp file and doing async upload of multiple files at
> >> > the same time is what needed. Nowadays media uploads is normal and
> >> > those files are getting bigger and bigger.
>
> >> > On Jun 30, 5:58 pm, Timothy Perrett  wrote:
>
> >> >> This has been hurting me for quite a while now (raised it on list
> >> >> about 2 months ago) and could really do with getting it fixed.
>
> >> >> As derek points out, it's not a small change which is why I've done
> >> >> nothing about it to date - a little too much core hacking to feel happy
>
> >> >> If you think your able to do something about it that would be
> >> >> absolutly brilliant!
>
> >> >> Cheers
>
> >> >> Tim
>
> >> >> Sent from my iPhone
>
> >> >> On 30 Jun 2009, at 22:33, David Pollak 
> >> >> wrote:
>
> >> >>> What kind of priority is this issue?  I think I can abstract things
> >> >>> in such a way that it works correctly, but it'll take a couple of
> >> >>> days.
>
> >> >>> On Tue, Jun 30, 2009 at 2:08 PM, Derek Chen-Becker <
> >> dchenbec...@gmail.com
>
> >>  wrote:
>
> >> >>> Well, as usual something that seemed simple at first glance is now
> >> >>> looking somewhat complex. I'm thinking of reworking the fileUpload
> >> >>> handling to allow a user to register either a (String, String, Array
> >> >>> [Byte]) => Any or (String, String, InputStream) => Any function,
> >> >>> which would then be executed during request processing. The issue is
> >> >>>  that form field processing (ParamHolders) takes place in Req, befor
> >> >>> e LiftSession has been set up, and the act of parsing the request fo
> >> >>> r form data, particularly for large upload streams (the target of th
> >> >>> ese changes) precludes holding on to any data for later processing (
> >> >>> the servlet container cannot be expected to hold the entire request
> >> >>> in memory). On the other hand, users should reasonably expect that t
> >> >>> heir form handling functions are stateful, so I'm trying to think of
> >> >>>  some way to meet in the middle on form processing. Ideas?
>
> >> >>> Derek
>
> >> >>> --
> >> >>> Lift, the simply functional web frameworkhttp://liftweb.net
> >> >>> Beginning Scalahttp://www.apress.com/book/view/1430219890
> >> >>> Follow me:http://twitter.com/dpp
> >> >>> Git some:http://github.com/dp

[Lift] Re: Maven License Expired

2009-07-02 Thread Timothy Perrett

Hey Jevgeni,

Thats strange, I mailed you from my gmail account to your gmail, so
perhaps it got spammed or something?

Probably the best thing to do then would be for us to remove the
current .lic from the lift installer - perhaps i'll include the latest
JAR and then display a screen saying "if you want a license get in
touch with XYZ"

Thoughts?

Cheers, Tim

On Jul 1, 6:03 pm, Jevgeni Kabanov  wrote:
> Interestingly enough I didn't get an email from Tim yet, but I got a
> google alert for this message :)
>
> The original free Scala license was given for a limited period to be
> prolonged (or not) later. We knew that the current license is ending
> on 30th June and have already decided to prolong it. However we also
> decided to do it differently from the current setup (one license
> issued to the community). Instead we'll give free personal annual
> JavaRebel for Scala licenses individually through a website. This will
> give us a better sense of the current JavaRebel/Scala community :)
>
> But (and here comes the embarrassing part) the ZeroTurnaround team was
> so overworked lately that we didn't get to implementing the actual
> infrastructure yet. We have most of the stuff ready, and hopefully
> next week we'll send the announcement to the list. Until then I can
> recommend to download 2.0.1 from ZeroTurnaround.com and delete the
> current javarebel.lic so you can use the 30 day evaluation. Or just
> buy the personal license, it's worth it :)
>
> Sorry for the hassle!
> Jevgeni Kabanov
> ZeroTurnaround
>
> On Jul 1, 6:49 pm, Timothy Perrett  wrote:
>
>
>
> > I've mailed Jevgeni (at javarebel), so will see what's what. If he doesn't
> > come back in a day or two I'll try to get in touch with him again.
>
> > Cheers, Tim
>
> > On 01/07/2009 16:18, "Peter Robinett"  wrote:
>
> > > Yep, in /Applications/liftweb-1.0/java-rebel/ I have both a
> > > javarebel.jar and a javarebel.lic. Removing both of those 1.2.2 files
> > > and copying in the 2.0.1 jar works, though it says it's only licensed
> > > for a 30 day trial. Timothy, if you can get a longer license that
> > > would be awesome. Thanks!
>
> > > Peter
>
> > > On Jul 1, 3:25 am, Timothy Perrett  wrote:
> > >> The way we are handling it in the installer is all JR users have a .lic 
> > >> file
> > >> for the license... The actual JAR for javarebel is separate so I think it
> > >> would still persist to be an issue.
>
> > >> Either way, I've gotten in touch with Jevgeni to see what he says.
>
> > >> Cheers, Tim  
>
> > >> On 01/07/2009 11:19, "TylerWeir"  wrote:
>
> > >>> You're using an old version, grab 2.0.1 and try that.
>
> > >>> 1.X may have expired.
>
> > >>> On Jul 1, 3:46 am, Timothy Perrett  wrote:
> >  Hey Peter,
>
> >  That is odd! I'll speak with the folk at javarebel and get them to  
> >  give us a new license file for the comunity.
>
> >  Cheers
>
> >  Tim
>
> >  Sent from my iPhone
>
> >  On 1 Jul 2009, at 08:28, Peter Robinett  
> >  wrote:
>
> > > Hi all,
>
> > > I just launched Maven and got the following error:
> > > $ mvn jetty:run
>
> > > ##
>
> > > ZeroTurnaround JavaRebel 1.2.2 (200812021546)
> > > (c) Copyright Webmedia, Ltd, 2007, 2008. All rights reserved.
>
> > > YOUR JAVAREBEL LIMITED LICENSE HAS EXPIRED!
> > > This product is licensed to Scala Community
> > > until June 30, 2009
> > > for unlimited number of developer seats on site.
> > > With the following restrictions:
> > > For use with Scala only
>
> > > ##
>
> > > I got Maven via the Lift Mac OS X .dmg installer. Any idea how I can
> > > address this licensing issue and continue developing?
>
> > > Thanks!
>
> > > Peter Robinett
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---