[Lift] Iterate over mapper fields

2009-07-15 Thread Naftoli Gugenhem

Is there a way to get a list of a mapper's fields, without relying on 
fieldOrder being defined?

--~--~-~--~~~---~--~~
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: Lifespan of mapSnippet

2009-07-15 Thread Naftoli Gugenhem

So you use it in one snippet function to remap a subsequent snippet in the same 
page load?

-
David Pollak wrote:

On Wed, Jul 15, 2009 at 9:49 PM, Naftoli Gugenhem wrote:

>
> What is the lifespan/scope of the effects of calling mapSnippet?


The current HTTP request


>
>
> >
>


-- 
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] Lifespan of mapSnippet

2009-07-15 Thread Naftoli Gugenhem

What is the lifespan/scope of the effects of calling mapSnippet?

--~--~-~--~~~---~--~~
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: Disabling the lift auto-reload on webapp restart?

2009-07-15 Thread Naftoli Gugenhem

You could always launch jetty without maven...
Are there options for maven-jetty-plugin?

-
fbettag wrote:


liftweb auto-reinjects it.

On Jul 15, 2:27 pm, Ellis  wrote:
> This would interest me too.
>
> (but if you don't need jQuery, you can comment out the  tag
> in the template, e.g. templates-hidden/default.html)
>
> On Jul 15, 1:18 pm, fbettag  wrote:
>
>
>
> > The Auto-Reload feature done with jQuery really starts to get on my
> > nerves, i often find my self going back to the tab in my firefox and
> > trying to debug the last error i got via ajax in my firebug.. but it's
> > all gone thanks to the auto-reload.
>
> > Is there any way to turn it off?


--~--~-~--~~~---~--~~
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: Please back out the Box[] changes

2009-07-15 Thread Naftoli Gugenhem

You could always add a box version and deprecate the original...

-
Derek Chen-Becker wrote:

Backed out. I'm curious as to what kind of runtime error would happen with
this change. Also, sorry for breaking things. When I posted before I meant
that I would convert the API, and since no one said anything I went ahead
and did it. I would however, argue in favor of these changes. Not having
these functions "Boxed" makes it more difficult for people to provide their
own default values (openOr is really nice) and makes the code more
consistent.

Derek

On Tue, Jul 14, 2009 at 11:56 PM, David Pollak <
feeder.of.the.be...@gmail.com> wrote:

>
>
> On Tue, Jul 14, 2009 at 10:10 PM, Naftoli Gugenhem 
> wrote:
>
>> Isn't it easy to fix the apps with a find/replace?
>
>
> We don't break APIs unless there's a compelling reason to do so.  These
> APIs have survived for almost 3 years.  Yes, Box is better, but not that
> much better.
>
> In terms of the search/replace, the Lift example app was broken by the
> change (not a compilation error, but a runtime error).  That's the worst
> kind and I don't want to subject the hundreds of Lift apps out there to
> runtime problems.
>
>
>>
>>
>> -
>> David Pollak wrote:
>>
>> Derek,
>>
>> There's a lot of code that relies on the existing (admittedly broken)
>> implementation of host, hostAndPath, etc.
>>
>> Can you back out the changes and leave things the way there were?
>>
>> Thanks,
>>
>> David
>>
>> PS -- Every app I have broke.
>>
>> --
>> 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] Ambiguous bind

2009-07-14 Thread Naftoli Gugenhem

If a call to BindHelpers.bind has multiple bindings for the same element label, 
which gets used? The last one?

--~--~-~--~~~---~--~~
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: Please back out the Box[] changes

2009-07-14 Thread Naftoli Gugenhem

Isn't it easy to fix the apps with a find/replace?

-
David Pollak wrote:

Derek,

There's a lot of code that relies on the existing (admittedly broken)
implementation of host, hostAndPath, etc.

Can you back out the changes and leave things the way there were?

Thanks,

David

PS -- Every app I have broke.

-- 
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] Jetty & PermGen

2009-07-14 Thread Naftoli Gugenhem

After mvn jetty:run reloads my changes a number of times, it runs out of 
PermGen memory.
What is PermGen exactly and how can I prevent this from happening?

--~--~-~--~~~---~--~~
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: Wiki Articles

2009-07-13 Thread Naftoli Gugenhem

Not speaking for anyone else, but currently what I would like most is 
information on lift's internals.

-
Xavi Ramirez wrote:


Hello,

I've volunteered as a wiki gardener, and I'm looking for suggestions
on how to improve the liftwiki.

I personally feel that developing a comprehensive set of HowTo
articles (aka Cookbook receipts) is a worthwhile goal.  This type of
format has been suggested several times on the mailing list and it has
been very successful in other communities.  To that end, I feel that
we should start by improving these two pages:
http://wiki.liftweb.net/index.php/Lift_Tutorials
http://wiki.liftweb.net/index.php/CookBook

That said, I'm very open to suggestions.  Do you think our time is
better spend creating detailed write ups on working examples?  Or
writing articles on the internals of lift?  Please let me know!

Thanks,
Xavi

P.S. To help keep our efforts focus, I'll suggest 5 pages that could
use some attention each Monday.
P.P.S.S Here's a list of some quick wins I can think of:
- Replace the wiki logo with the lift logo
- Add syntax highlighting
- Open up registration (I'll monitor the recently modified page daily
to keep the spam down)

Unfortunately, I can't implement any of these myself.  I'll need
someone with admin access to help me out.



--~--~-~--~~~---~--~~
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: Sense check please!

2009-07-12 Thread Naftoli Gugenhem

Why are you mapping it, and why are you opening it, and why are you using a 
default of Empty? Assignment returns Unit so you will get a Full(()) or Empty. 
Then openOr Empty will give you a unit or Empty box. Why not just use for or 
foreach?

-
Timothy Perrett wrote:


Awesome - thanks Marius! A hacky solution well avoided!!

Cheers, Tim

Sent from my iPhone

On 12 Jul 2009, at 21:17, "marius d."  wrote:

>
>
>
> On Jul 12, 10:46 pm, Timothy Perrett  wrote:
>> Thats interesting... I wasn't aware of that...
>>
>> However, even now knowing that its possible to implement them for the
>> session, how would one then set my function into the current session?
>> Perhaps something like:
>>
>> S.session.map(_.progessListener = { ... }).openOr(Empty)
>
> yup  I assume you would set this when your upload progress actor
> starts ... say in localSetup() ...
>
>>
>> Cheers, Tim
>>
>> On Jul 12, 8:23 pm, "marius d."  wrote:
>>
>>> Why not use the progessListener from the LiftSession ?
>>
>>> Br's,
>>> Marius
>>
>>> On Jul 12, 9:57 pm, Timothy Perrett  wrote:
>>
 Hey guys,
>>
 Implementing this upload progress widget with comet, I just  
 wanted a
 quick sense check about how to organize things.
>>
 As the CometActor for a particular session will be instantiated  
 adhoc,
 and the LiftRules.progessListener is global, my current thinking  
 is to
 register a given comet actor with a singleton manager actor upon  
 its
 instantiation. Giving a progressListener something like:
>>
 LiftRules.progessListener = (pBytesRead, pContentLength, pItems)  
 => {
   UploadProgressManager ! StatusUpdate(
 S.session.map(_.uniqueId).openOr("default"),
 pBytesRead, pContentLength, pItems)
>>
 }
>>
 The idea being that when comet actors register with the manager  
 actor
 they give there sessionId and then I can ensure that only upload
 progress for the current session goes to a given user (and user B
 doesnt get user A's upload progress).
>>
 However, I cant help but feel this is a little messy? Thoughts?
>>
 Cheers, Tim
> >
>



--~--~-~--~~~---~--~~
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: Background jobs

2009-07-10 Thread Naftoli Gugenhem

I think paulp has a scala.xml that doesn't require loading everything into 
memory at once. He once demonstrated it on the scala list. I think it's for 
2.8. I'm not sure how you load but I think you process it with the regular 
scala pattern matching and "XPath." Either look in the 2.8 sources or get in 
touch with him.

-
David Pollak wrote:

On Thu, Jul 9, 2009 at 5:27 PM, Vlad Seryakov  wrote:

>
> I am building Web application using Lift (my first one) which is the
> port of existing Tcl/Aolserver based application. In the existing one
> i have two parts: Web and backend. Backedn part consists of jobs
> running in the background from time to time using schedule or on
> demand. I am trying to figure out the architecture and practical way
> of doing this in servlet/Lift environment. I used to have telnet
> interface but this is not a requirement, i can test using special
> temporary Web interface. Is there any recommendation or experience
> regarding such applications?


My rule of thumb is that if the app needs to "push" something to the web
interface, having them co-resident is easier.  If they are communicating by
writing RDBMS records, separation has advantages (bring down one of the
apps, doesn't impact the other app.)

You could also treat the apps as separate entities, but run them in the same
Java Virtual Machine.  OSGi is particularly good at handling stuff like
this.


>
> for example, i have special job for importing huge Xml files into the
> database. The problem of loading big Xml files in Scala is already a
> challenge but for now i assume i have unlimited memory. The problem i
> have how to test it. Using scala interpreter mode i could test the Xml
> loading and parsing, now i need to load it into database and i have
> Mapper setup for my schema. Calling this job from simple Web snippet
> is my only choice?


You can run a Mapper-based app separately from the web interface.  The XML
parsing issue with your data set is non-trivial.  Have you looked at the
Java SAX parser and hooking into events in the SAX parser so you're only
keeping 1 record in memory at once?

Thanks,

David


>
>
> Thanks
>
> >
>


-- 
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: Typesafe JSON builder?

2009-07-10 Thread Naftoli Gugenhem

Why don't you use the arrow syntax for pairs?

-
Jeppe Nejsum Madsen wrote:


"marius d."  writes:

> Please take a look on JsObj.

That's what I'm using now and it's a pain:

def generateOptions = JsObj(
  ("title", "My title"),
  ("series", JsArray(JsObj(("Label","MyLabel",
  ("seriesColors", JsArray("#00","#cc")),
  ("axes", JsObj(
("xaxis", JsObj(
  ("renderer", JsVar("$.jqplot.CategoryAxisRenderer")),
  ("ticks", JsArray(data.flatMap(series => {series.labels.map(v 
=> v.toString)}) : _*))
)),
("yaxis", JsObj(
  ("min", 0),
  ("tickOptions", JsObj(
("formatString", "%d")
  ))
))
)),
  ("seriesDefaults", JsObj(
("renderer", JsVar("$.jqplot.BarRenderer")),
("rendererOptions", JsObj(
("barDirection", "horizontal"),
("barPadding", 8),
("barMargin",20),
("barWidth", 20)
))

  )))

> But what is your exact use case? ...  generate JSON constructs from
> Scala and send then to browser?

Yes, I want the above JSON object (which is just a subset of the full
capabilities) to be generated in Scala, so I:

- will get typechecking
- Don't have to remember field names
- Can't get autocompletion on valid values for things like
- e.g. barDirection

/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: Mapper or Record

2009-07-10 Thread Naftoli Gugenhem

Any estimate/guess when record will be usable/complete?

-
marius d. wrote:


Mapper as Record is not yet complete.

Br's,
Marius

On Jul 10, 4:21 pm, czerwonka  wrote:
> If I'm starting today, should I use Mapper or Record?


--~--~-~--~~~---~--~~
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: Help with the eclipse plugin

2009-07-09 Thread Naftoli Gugenhem

Completion works for me, when there are no basic syntax errors in the file 
(mismatched bracketd etc.).
Also, I use lift without running maven from the command line. I create the 
project with m2eclipse, and I don't recall having to set M2_REPO.

-
Jeppe Nejsum Madsen wrote:


Ellis  writes:

> Hi Dan,
>
> I don't have an answer to your question, but maybe a suggestion.
> Eclipse does not work well with maven/scala/lift, and I really doubt
> it will anytime soon.

I don't know about the Maven part, but Eclipse works with Scala &
Lift. It's not nearly as functional as with Java, but I can edit,
compile and debug without too much trouble. Advanced stuff such as
completion, navigation etc. doesn't seem to work that well and I
sometimes need to do a "clean all" to get back into a working state

I'm using it daily without major pain, but await the 2.8 plugin (when
Lift moves to 2.8 :-)

I don't like Maven, so only use it to bootstrap the project. These steps works
for me (Eclipse EE 3.5, Scala 2.7.5):

mvn archetype:create -U -DarchetypeGroupId=net.liftweb \
-DarchetypeArtifactId=lift-archetype-basic \ 
-DarchetypeVersion=1.1-SNAPSHOT \
-DremoteRepositories=http://scala-tools.org/repo-snapshots \
-DgroupId=demo.helloworld -DartifactId=helloworld -Dversion=1.1-SNAPSHOT 

verify it works: mvn jetty:run
Press Ctrl-C to stop
mvn eclipse:eclipse

In Eclipse:
- If you haven't already: Define M2_REPO classpath var to point to your
local maven repo (~/.m2/repository)
- Import the project you just created above
- Eclipse plugin don't like multiple output folders so modify your
projects build path
  * Remove all existing source folders
  * Add the source folders src/main/scala, src/main/resources,
  src/test/scala & src/test/resources, all with the same output folder
- Clean the project
- You can now launch src/test/RunWebApp as a Scala Application to have
jetty run inside eclipse and you can run debug etc
- Running specs with the Eclipse JUnit runner is possible but requires a
workaround, see the specs site. 

/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: Help with the eclipse plugin

2009-07-09 Thread Naftoli Gugenhem

I'm using eclipse for lift. I'm not saying it's perfect but it's very usable. 
My understanding is that the important thing is not to use mv eclipse:eclipse.

-
Miles Sabin wrote:


On Thu, Jul 9, 2009 at 5:45 PM, David
Pollak wrote:
> But, until Martin's magic brain has yielded code for us, I would recommend
> avoiding Eclipse for Scala and Lift related development.

Unsurprisingly I disagree.

Bug reports and more contributions to documentation on using Eclipse
with Lift and Maven would be much appreciated from the Lift community.
There's a start here,

  http://lampsvn.epfl.ch/trac/scala/wiki/ScalaEclipseLift
  http://lampsvn.epfl.ch/trac/scala/wiki/ScalaEclipseMaven

but clearly a great deal more is needed. A little more encouragement
and a little less FUD wouldn't go amiss.

Cheers,


Miles

-- 
Miles Sabin
tel: +44 (0)7813 944 528
skype:  milessabin
http://www.chuusai.com/
http://twitter.com/milessabin



--~--~-~--~~~---~--~~
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: Anyone tried to use Velocity with scala/lift?

2009-07-09 Thread Naftoli Gugenhem

I don't know, but I would be surprised if it didn't!
Can you give it a Java Iterable view?

-
Ewan wrote:


All

I am trying to create an email using a velocity template all wired up
with Apache Camel.  The camel stuff aside I can't seem to get velocity
to render Scala lists along the lines of:

#foreach($email in $headers.emailAddresses)
hello $email
#end

where headers is a map and emailAddresses is a list.  Strings in the
headers map works fine i.e. ${headers.sender}.

If I dump out the contents of headers using ${headers} the toString
for the map renders as expected.

 I have not delved into the velocity code but I wonder if tries to
create a java interator over the list which does not work in this case
- maybe?

--Ewan



--~--~-~--~~~---~--~~
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: Help with the eclipse plugin

2009-07-09 Thread Naftoli Gugenhem

mvn eclipse:eclipse doesn't seem to like scala. Why don't you initialize 
everything from the IAM GUI?

-
Dan Gravell wrote:


I'm trying to learn about lift using the eclipse plugin but not really
getting far... Currently trying to build a project hangs eclipse which
is obviously something of a shortcoming.

Eclipse 3.4.2
Scala plugin 2.7.5
Maven plugin Q4E (IAM) 0.10

So I create a new lift project externally using maven and the
instructions at http://wiki.liftweb.net/index.php/Chore_wheel (I
believe this is the way to do it, I've tried other approaches but I
didn't really find anything that could be classed as canonical) did a
'mvn eclipse:eclipse' and imported it into eclipse. That's when it
hangs, because Eclipse tries to build straight away.

It hangs when it says:

Starting mojoExecution scala:compile

... in the progress bar. Meanwhile, in a different VM I notice the
following process has begun:

/usr/java/jdk1.6.0_12/jre/bin/java -classpath /home/gravelld/.m2/
repository/org/scala-lang/scala-compiler/2.7.3/scala-
compiler-2.7.3.jar:/home/gravelld/.m2/repository/org/scala-lang/scala-
library/2.7.3/scala-library-2.7.3.jar:/home/gravelld/.m2/repository/
org/scala-tools/maven-scala-plugin/2.11/maven-scala-plugin-2.11.jar -
Xbootclasspath/a:/home/gravelld/.m2/repository/org/scala-lang/scala-
library/2.7.3/scala-library-2.7.3.jar
org.scala_tools.maven.executions.MainWithArgsInFile
scala.tools.nsc.Main /tmp/scala-maven-1418794117226686986.args

But this doesn't appear to complete. Is this what the eclipse builder
is waiting for? I can actually run the above from the command line and
it returns in a couple of seconds.

Interestingly, when working through the 'todo' example there was a
period when it appeared to work, but going back to it today appears to
show the same issue above.

Really hoping someone can help me out because this stuff looked
interesting.



--~--~-~--~~~---~--~~
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: Set MappedLongForeignKey defaultValue...

2009-07-09 Thread Naftoli Gugenhem

Doesn't find return a boxed mapper? You need a Long. It's finding an Any 
because that's the common supertype of Mapper and 0L. What number do you want 
to be the default? The found objects id? Then before openOr write .map(_.id).

-
Hannes wrote:


Hey Lifters,

I wanna set the defaultValue for this object:

object status extends MappedLongForeignKey(this, OrderStateMetaObj){
override def defaultValue = 
OrderStateMetaObj.find(By(OrderStateMetaObj.name, "NEW")) openOr 0L
  }

The problem is, that the referenced OrderState object doesn't exist at 
the time when the application is started first. I thought the openOr 
would do the job, but I'm getting this error and don't know how to get 
further...

type mismatch;
 found   : Any
 required: Long
override def defaultValue = 
OrderStateMetaObj.find(By(OrderStateMetaObj.name, "NEW")) openOr 0L

  
^
one error found


Am I right, that Any is returned because there is no OrderState object 
found?


thanks.



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



[Lift] Re: Badly documented validation of MetaMapper records

2009-07-08 Thread Naftoli Gugenhem

Helpers has an implicit from String to Node.
Also, the list of validators should contain functions that take a mapper IIRC. 
So if the function needs more specifics, put the other arguments in a parameter 
list before. For examples see the built in validators name valXXX in various 
mapped field classes.

-
fbettag wrote:


Heyho folks,

i've been running into troubles when trying to validate records.
In the liftbook it says the following:

import _root_.java.util.Date
def noFutureDates (time : Date) = {
if (time.getTime > System.currentTimeMillis) {
List(FieldError(this, "You cannot make future expense entries"))
} else {
List[FieldError]()
}
}

object dateOf extends MappedDateTime(this) {
}override def validations = noFutureDates _ :: Nil
}

Besides the fact that FieldError awaits an XmlNode as second
parameter, the first parameter "this" will be seen from the classes
point of view which will fail to compile (since the class for the
record isn't a FieldIdentifier).

I tried this:

object startHour extends MappedInt(this) {
override def validations = validateHours(this, _) :: Nil
}
object stopHour extends MappedInt(this) {
override def validations = validateHours(this, _) :: Nil
}

/* Validations */
def validateHours(field: FieldIdentifier, hour: Int) =
if (hour < 0 || hour > 23) {
List(FieldError(field, Only values between 0 and 
23 are
allowed))
} else {
List[FieldError]()
}

This fails at the override lines at the point of _) , it says:
error: missing parameter type for expanded function ((x$3) => {
   val x$4 = validateHours(this, x$3);
  Nil.$colon$colon(x$4)

Since i didn't find anything describing how to properly validate
metamapper models, i guess i have to ask here ;)
Some working samples in that direction would be reeeally
helpful.

best regards!


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

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 Gugenhem 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 Nelson 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:



  
LiftFilter
Lift Filter
The Filter that intercepts lift calls
net.liftweb.http.LiftFilter
  

  
LiftFilter
/*
  

  
H2Console
org.h2.server.web.WebServlet
1
  
  
H2Console
/console/*
  



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 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 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: Overriding a lazy val and super?

2009-07-08 Thread Naftoli Gugenhem

Override with a def?

-
DFectuoso wrote:


I'm getting a little bit confused by the override lazy val behavior so
I wanted to ask you guys...

I want to create a trait that extends the MetaMegaProtoUser and
overrides the sitemap(defined as a lazy val), adding something to the
original sitemap, how would that declaration work?

If I do something like:
override lazy val sitemap = super.sitemap :: other elements

The compiler tells me that super cannot be used in this context. If I
dont user super, then it says that its a recursive declaration(and it
seems to be). How can you achieve this overriding?



--~--~-~--~~~---~--~~
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-06 Thread Naftoli Gugenhem

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 Nelson 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:



  
LiftFilter
Lift Filter
The Filter that intercepts lift calls
net.liftweb.http.LiftFilter
  

  
LiftFilter
/*
  

  
H2Console
org.h2.server.web.WebServlet
1
  
  
H2Console
/console/*
  



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 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 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: How to test/TDD lift apps?

2009-07-06 Thread Naftoli Gugenhem

I would like if in general you would be able to specify input names and have 
lift use those. Maybe FuncHolders could take an optional param?

-
Jeppe Nejsum Madsen wrote:


On Fri, Jul 3, 2009 at 6:43 PM, David
Pollak wrote:
> Jeppe,
>
> Once I check in some code (in about 20 minutes), if you run Lift in Test
> mode (-Drun.mode=test), forms, etc. will have stable names which makes
> testing easier.

Thanks. I just tried this, and it seem something is not correct.
Here's a form field genrated by CRUDify:



Firefox 3.5 complains about lift:field attribute.

Looking at the changes (and the example above) it seems that the field
name is still some psuedo random number. While this is better than
names changing between each request, I'm wondering if it's stable to
reordering & removing fields (my guess is no). It would be nice not to
change test cases just because we rearrange the form layout.

Moving forward, I'm not sure what the best solution is. I seem able to
specify the id attribute for forms that I create manually, but need
this also on CRUDify and other generated forms (and looking at the
above example, it seems it should be easy to eg. use the field_name).
In general, It would be nice for Lift to handle all this automatically
(as you've already started out to do), but if I have to add some
additional markup to make sure ids/names stay stable, I will prefer
that over test cases breaking if field ordering is changed.

/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: Becoming a Scala/Lift Guru

2009-07-05 Thread Naftoli Gugenhem

I would say that the main advantage knowledge of Java over a similar language 
gives you is knowledge of the Java environment and system, but you can pick 
that up via scala too.
As far as turning theory into actual programming, my personal advice is to take 
one small sample, get it running, and then ask yourself questions like "Why 
does it do this?" and "What if I change this." Once you have a thorough 
understanding of how the sample accomplishes what it was supposed to 
accomplish, and how all the parts contribute to that, repeat with another one. 
Along the way ask yourself, "What if I want the computer to do xyz (similar to 
sample x)?" Also, play around in the interpreter trying different permutations.
Of course, it goes without saying to read the books and articles, not to 
mention to ask all your questions on the scala-user list.
Enjoy!

-
eric cs wrote:


Hi guys,

I saw some posts on Scala website about helping newcomers and I was
wondering if some of you would be kind enough to help me out to start
with Scala/Lift.
My main problem is I am not a programmer yet but I really really want
to be, I've been studying Ruby/Rails, Php/Zend/Symfony,Mvc,Design
Patterns,Uml,Sql and some Java. I read some books but I don't get my
head to think like a programer.
I really like OO,Design Patterns, Uml but I don't know how to apply
that to a full application, how to link everything together,
classes,objects(books about that?Not about those items but how to put
everything together)...I know a lot of the theory and concepts but no
practice.
I have all july available to learn that 12 hours a day or more if
necessary I just need a push, someone to teach/help me out.
What's more, I saw a post saying that I could learn Scala from scratch
without learning Java, it's possible, not so much with Groovy. If it's
not what parts of Java do I need to know, in case some of you tell me
learn Java first(the easy answer).Do I need a lot of experience in
Java to jump in in Scala? I know it helps but I would like to finish
my first e-commerce in august, 100% opensource in Scala if possible.

P.s:I did 2 years of Computer Science C++ and 2 years of Civil
Engineering over 12 years ago both unfinished.



--~--~-~--~~~---~--~~
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: Creating a project

2009-07-05 Thread Naftoli Gugenhem

In general I would appreciate if people would refrain from inappropriate 
vocabulary.

-
TylerWeir wrote:


> Your email did not meet this standard.

dpp, I'm glad you addressed this.  My initial response, which I
deleted, would not have helped the situation.  Yours was measured and
mature.

Ty



On Jul 5, 4:32 pm, David Pollak  wrote:
> On Fri, Jul 3, 2009 at 4:00 PM, Douglas Quaid  wrote:
>
> > I heard some good vibes about Lift and then I saw this gem in the
> > "Getting Started" documentation for creating a project:
>
> >  From a command prompt, type:
>
> > mvn archetype:generate -U \
> > -DarchetypeGroupId=net.liftweb \
> > -DarchetypeArtifactId=lift-archetype-basic \
> > -DarchetypeVersion=1.0 \
> > -DremoteRepositories=http://scala-tools.org/repo-releases\
> > -DgroupId=com.liftworkshop \
> > -DartifactId=todo \
> > -Dversion=0.1-SNAPSHOT
>
> > Perhaps you guys could "innovate" and wrap this crap (rhyme!) in a
> > shell script.
>
> Howdy,
>
> I'll address your post in two parts.  First the form, and then the
> substance.
>
> This community is a welcoming (especially to newbies), kind, and generally
> cool place to hang out.  People in this community are here to help each
> other and to grow the knowledge, skills, and code around Lift.  We welcome
> feedback and comments and ways to improve Lift.  But we ask that people are
> polite and helpful.  Your email did not meet this standard.  So, in the
> future, please treat this community the way that you would like to be
> treated.  Approach this community the way you would like to be approached by
> a stranger.
>
> In terms of the substance of the issue, we've have a fair number of
> discussions about this over the years.  The first problem is a bootstrap
> problem.  Even if we have a shell script to wrap the maven command, how do
> we get it into users' hands?  The second problem is an OS support issue.
> Such a script is easy to write for Linux/Unix/OS X.  It's not so simple to
> make sure it works on Windows as a separate .bat file as well as a shell
> script that works under Cygwin.  We did do some testing of such a script as
> part of the installer and it always led to problems and we never found a
> person or collection of people who were willing to write, test and maintain
> such a script.  So, we decided that the cost of copy/paste of a copy of
> lines of Maven invocation was less of a priority than other Lift-related
> development.
>
> And as a practical matter, I probably create more Lift projects than anyone
> else.  It was only a few weeks ago that I made a script out of the above
> command rather than copy/pasting it.  I'm hardcore lazy and into making my
> life easier (I would be using other frameworks if it wasn't faster and
> easier for me to build a framework to do dynamic stuff rather than work
> around the suboptimal decisions made in other frameworks) and in the case of
> the Maven command to create a new Lift project, it just wasn't that hard.
>
> So, if you would like to write up some scripts and post them in a public
> place, that'd be great.  If you're the guy who is going to step up to the
> task of maintaining a complex cross-section of scripts, we'll link to your
> work and reference it in any way we can.
>
> Thanks,
>
> David
>
>
>
> > Good day!
>
> --
> Lift, the simply functional web frameworkhttp://liftweb.net
> Beginning Scalahttp://www.apress.com/book/view/1430219890
> Follow me:http://twitter.com/dpp
> Git some:http://github.com/dpp


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



[Lift] Re: using file-based data storage in Lift app

2009-07-05 Thread Naftoli Gugenhem

My point was to help him diagnose his file not found, not to know where the 
server is storing his app. I assume he is using relative paths and they may not 
be relative to where they should be.

-
Timothy Perrett wrote:


If you need to get the absolute path where the exploded war is living,
you can get that via ServletContext I do believe. Generally speaking,
Lift provides no mechanism for writing stuff to the filesystem and
does not interfere with file i/o.

Cheers, Tim

On Jul 5, 9:15 pm, Naftoli Gugenhem  wrote:
> Why would lift interfere with file io? Resource server is probably for static 
> http. If you're getting file not found I can't imagine it's lift's fault. Try 
> dumping new java.io.File(".").listFiles() or .getAbsolutePath etc. to see 
> what directory is the default. What kind of server are you using?
>
> -
>
> glenn wrote:
>
> Thanks, Marius.
>
> Now, is there something similar for writing XML to a file. I saw
> nothing on LiftRules that
> seems to apply.
>
> Glenn...
>
> On Jul 4, 12:36 am, "marius d."  wrote:
>
>
>
> > Try LiftRules.loadResourceAsXml
>
> > Br's,
> > Marius
>
> > On Jul 4, 1:11 am, glenn  wrote:
>
> > > I've searched this group and combed through the lift book for an
> > > answer, but found none - how to use file-based storage for data within
> > > Lift.
>
> > > For example, how would I call something like:
>
> > > def xml = XML.loadFile()
>
> > > without getting a java.io.FileNotFoundException?
>
> > > I tried storing the files in a directory under webapp, and even
> > > included the directory in the resource path in Boot.scala, like so:
>
> > > ResourceServer.allow({
> > >       case "contents" :: _ => true
>
> > >     })
>
> > > But that doesn't work.
>
> > > Any help would be appreciated.


--~--~-~--~~~---~--~~
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: using file-based data storage in Lift app

2009-07-05 Thread Naftoli Gugenhem

Why would lift interfere with file io? Resource server is probably for static 
http. If you're getting file not found I can't imagine it's lift's fault. Try 
dumping new java.io.File(".").listFiles() or .getAbsolutePath etc. to see what 
directory is the default. What kind of server are you using?

-
glenn wrote:


Thanks, Marius.

Now, is there something similar for writing XML to a file. I saw
nothing on LiftRules that
seems to apply.

Glenn...

On Jul 4, 12:36 am, "marius d."  wrote:
> Try LiftRules.loadResourceAsXml
>
> Br's,
> Marius
>
> On Jul 4, 1:11 am, glenn  wrote:
>
> > I've searched this group and combed through the lift book for an
> > answer, but found none - how to use file-based storage for data within
> > Lift.
>
> > For example, how would I call something like:
>
> > def xml = XML.loadFile()
>
> > without getting a java.io.FileNotFoundException?
>
> > I tried storing the files in a directory under webapp, and even
> > included the directory in the resource path in Boot.scala, like so:
>
> > ResourceServer.allow({
> >       case "contents" :: _ => true
>
> >     })
>
> > But that doesn't work.
>
> > Any help would be appreciated.



--~--~-~--~~~---~--~~
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-03 Thread Naftoli Gugenhem

The console is basically a text box for executing SQL. But how can I tell if my 
IDs are PKs? I inserted some rows exported from MySQL containing ids and ended 
up with a duplicate id of something I already had. So what went wrong? Lift 
generated the tables from my Mapper.

-
Tim Nelson 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:



  
LiftFilter
Lift Filter
The Filter that intercepts lift calls
net.liftweb.http.LiftFilter
  

  
LiftFilter
/*
  

  
H2Console
org.h2.server.web.WebServlet
1
  
  
H2Console
/console/*
  



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 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 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] Unique constraint

2009-07-01 Thread Naftoli Gugenhem

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-01 Thread Naftoli Gugenhem

Where is the second list getting called from? Code?

-
g-man wrote:


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

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


--~--~-~--~~~---~--~~
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: Modify CRUDify XHTML

2009-07-01 Thread Naftoli Gugenhem

If you know the Box is full you can write open_! (you'll get a runtime error if 
it wasn't). Otherwise openOr a default, e.g., an invalid id.
You have first answer the question, what _should_ happen if it's Empty after 
all? :)
-
Peter Robinett wrote:


Everyone, I apologize for monopolizing the list but this has been very
helpful for me. I've learned a bunch from similar, old entries in the
list and hope this thread will help future Lift beginners.

On to my reply to David:

On Jul 1, 4:19 pm, David Pollak  wrote:
> Yes, the reference contained a Loc, but the compiler could not verify that
> it contained a Loc.  At compile time, the compiler knows the common
> superclass between Loc[_] and String is Object.  Thus the type of l in your
> code was Object and Object doesn't have the foundParam method.

O! Ok, that makes a lot of sense.

> I'd put your snippet in your Loc.  That way you have access to the
> foundParam.
>
> Loc.Snippet("time", time)
>
> And then in your Loc, you put the time method below.  In that case, you'll
> have direct access to foundParam without any goofiness.

To be honest, this doesn't make a lot of sense to me. I assume you
mean a Loc in the Menus of my SiteMap that I assemble in Boot.scala.
I'm using the Locs created by the CRUDify trait added to my Node model
so I guess I would have to override the Node.menus method. I think
I'll delve into this more later when it's necessary...

> You could also write this as:
>
> override val data = Packet.findAll(By(Packet.node, for (req <- S.request;
> loc <- req.location) yield loc.asInstanceOf[Loc[Node]].foundParam.is),
> MaxRows(1000)

Ok, this makes sense but unfortunately the value yielded by the for
comprehension is all boxed up and so I get an error:
error: no implicit argument matching parameter type
(net.liftweb.util.Box[net.liftweb.util.Box
[com.equalnetworks.model.Node]]) => Long was found.
override val data = Packet.findAll(By(Packet.node, for (req <-
S.request;

What would be the best way to unbox things to get the actual Node
object so I can have a Long to put in my By() call?

Thanks,
Peter


--~--~-~--~~~---~--~~
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: Modify CRUDify XHTML

2009-07-01 Thread Naftoli Gugenhem

A Box is a container that holds 0 or 1 elements(s). openOr means if the Box is 
Full return the element; otherwise return the parameter--my default value.
One alternative approach would be to specify a default Loc.

-
Peter Robinett wrote:


Thanks Naftoli and David, I'm starting to understand what I need to
do. However, the solution has revealed a gap in my beginner's
knowledge of Scala: why was my code printing out the Loc instead of
"Couldn't open"?

Second, even with foundParam.is within the for comprehension, I still
need to get the the value out of the comprehension – the rest of my
snippet is based upon it. So, I still need to openOr the Box, no? If
so, how? Is there a more functional and Scalarific way to do this?

Thanks for your help,
Peter

On Jul 1, 2:45 pm, David Pollak  wrote:
> On Wed, Jul 1, 2009 at 2:02 PM, Peter Robinett wrote:
>
>
>
> > Thanks, David. Unfortunately I'm having a hard time figuring out how
> > to get the foundParam.
>
> > Using your code, I have:
> > val loc = for {req <- S.request; loc <- req.location} yield loc
> > val l = loc openOr "Couldn't open"
>
> When in doubt, specify a type explicitly:
>
> val l: Loc[_] = loc openOr "Couldn't open"
>
> This will fail because you've got a Box[Loc[_]] and you're doing an openOr
> with a String... the only common class between the two is Object.
>
> As another post suggested, do the foundParam.is inside the yield
>
>
>
>
>
> > println(loc)
> > println(l)
>
> > The first println give me:
> > Full(Loc(View List(nodes), , LinkText(), List()))
>
> > While the second shows that I am opening the Box:
> > Loc(View List(nodes), , LinkText(), List())
>
> > If I try to access my Loc object, I get compilation errors. For
> > example, "val p = l.foundParam" leads to the error "value foundParam
> > is not a member of java.lang.Object." The toString method works, while
> > the title parameter gives me the same error. I believe I am using the
> > latest Lift code (I ran "mvn -U jetty:run") and feel I must be missing
> > something very simple here.
>
> > Any advice is much appreciated!
>
> > Peter
>
> > On Jun 29, 10:05 am, David Pollak 
> > wrote:
> > > On Fri, Jun 26, 2009 at 6:39 PM, Peter Robinett  > >wrote:
>
> > > > Thanks, Derek and Jeppe, your responses were very helpful. I
> > > > implemented Jeppe's solution and added my own snippet tag within
> > > > _viewTemplate.  Unfortunately, I spent the whole day trying to figure
> > > > out how pass the current CRUDified object to my snippet. Do I retrieve
> > > > it in _viewTemplate from S.params and add an attribute to the snippet
> > > > tag? Or just retrieve it from S in the snippet?
>
> > > I've just made Loc.foundParam public.  If you get the Loc from the Req
> > from
> > > S (for {req <- S.request; loc <- req.location}) you can access foundParam
> > > which contains the current crudified object.
>
> > > Thanks,
>
> > > David
>
> > > > I think I'm missing
> > > > something fundamental with the S object and snippets. As you can tell,
> > > > I'm very new to Lift! Any advice is much appreciated.
>
> > > > Peter
>
> > > > On Jun 24, 11:01 am, Jeppe Nejsum Madsen  wrote:
> > > > > On 24 Jun 2009, Peter Robinett wrote:
>
> > > > > > Hi all,
>
> > > > > > I'm using CRUDify on one of my models and I'd like to display some
> > > > > > additional data on the view template. I believe that I need to
> > > > > > override one of the model definitions with some sort of reference
> > to
> > > > > > my own XHTML file. Which one? _viewTemplate? Or perhaps the
> > > > > > viewTemplate method?
>
> > > > > If you look at the source to CRUDify, you'll see
>
> > > > > def viewTemplate(): NodeSeq = pageWrapper(_viewTemplate)
>
> > > > > where
>
> > > > > def pageWrapper(body: NodeSeq): NodeSeq =
> > > > >   
> > > > >     {
> > > > >       body
> > > > >     }
> > > > >   
>
> > > > > def _viewTemplate =
> > > > >   
> > > > >     
> > > > >       
> > > > >         
> > > > >           
> > > > >           
> > > > >         
> > > > >       
> > > > >     
> > > > >   
>
> > > > > So the simplest thing is to override _viewTemplate with something
> > similar
> > > > > to the above. This should be done on the companion objects where
> > CRUDify
> > > > > is mixed in
>
> > > > > /Jeppe
>
> > > --
> > > 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 frameworkhttp://liftweb.net
> Beginning Scalahttp://www.apress.com/book/view/1430219890
> Follow me:http://twitter.com/dpp
> Git some:http://github.com/dpp


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.

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

2009-07-01 Thread Naftoli Gugenhem

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.execute
> > (MacroInstance.java:394)
> >        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

[Lift] Re: Modify CRUDify XHTML

2009-07-01 Thread Naftoli Gugenhem

Instead of yielding loc which is taking it out of the box and putting it back 
in, access foundParam inside the for loop.

-
Peter Robinett wrote:


Thanks, David. Unfortunately I'm having a hard time figuring out how
to get the foundParam.

Using your code, I have:
val loc = for {req <- S.request; loc <- req.location} yield loc
val l = loc openOr "Couldn't open"
println(loc)
println(l)

The first println give me:
Full(Loc(View List(nodes), , LinkText(), List()))

While the second shows that I am opening the Box:
Loc(View List(nodes), , LinkText(), List())

If I try to access my Loc object, I get compilation errors. For
example, "val p = l.foundParam" leads to the error "value foundParam
is not a member of java.lang.Object." The toString method works, while
the title parameter gives me the same error. I believe I am using the
latest Lift code (I ran "mvn -U jetty:run") and feel I must be missing
something very simple here.

Any advice is much appreciated!

Peter

On Jun 29, 10:05 am, David Pollak 
wrote:
> On Fri, Jun 26, 2009 at 6:39 PM, Peter Robinett 
> wrote:
>
>
>
> > Thanks, Derek and Jeppe, your responses were very helpful. I
> > implemented Jeppe's solution and added my own snippet tag within
> > _viewTemplate.  Unfortunately, I spent the whole day trying to figure
> > out how pass the current CRUDified object to my snippet. Do I retrieve
> > it in _viewTemplate from S.params and add an attribute to the snippet
> > tag? Or just retrieve it from S in the snippet?
>
> I've just made Loc.foundParam public.  If you get the Loc from the Req from
> S (for {req <- S.request; loc <- req.location}) you can access foundParam
> which contains the current crudified object.
>
> Thanks,
>
> David
>
>
>
> > I think I'm missing
> > something fundamental with the S object and snippets. As you can tell,
> > I'm very new to Lift! Any advice is much appreciated.
>
> > Peter
>
> > On Jun 24, 11:01 am, Jeppe Nejsum Madsen  wrote:
> > > On 24 Jun 2009, Peter Robinett wrote:
>
> > > > Hi all,
>
> > > > I'm using CRUDify on one of my models and I'd like to display some
> > > > additional data on the view template. I believe that I need to
> > > > override one of the model definitions with some sort of reference to
> > > > my own XHTML file. Which one? _viewTemplate? Or perhaps the
> > > > viewTemplate method?
>
> > > If you look at the source to CRUDify, you'll see
>
> > > def viewTemplate(): NodeSeq = pageWrapper(_viewTemplate)
>
> > > where
>
> > > def pageWrapper(body: NodeSeq): NodeSeq =
> > >   
> > >     {
> > >       body
> > >     }
> > >   
>
> > > def _viewTemplate =
> > >   
> > >     
> > >       
> > >         
> > >           
> > >           
> > >         
> > >       
> > >     
> > >   
>
> > > So the simplest thing is to override _viewTemplate with something similar
> > > to the above. This should be done on the companion objects where CRUDify
> > > is mixed in
>
> > > /Jeppe
>
> --
> Lift, the simply functional web frameworkhttp://liftweb.net
> Beginning Scalahttp://www.apress.com/book/view/1430219890
> Follow me:http://twitter.com/dpp
> Git some:http://github.com/dpp


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



[Lift] Re: Modify CRUDify XHTML

2009-07-01 Thread Naftoli Gugenhem

Well if the box is empty l will be a String so of course you can't access 
foundParam.

-
Peter Robinett wrote:


Thanks, David. Unfortunately I'm having a hard time figuring out how
to get the foundParam.

Using your code, I have:
val loc = for {req <- S.request; loc <- req.location} yield loc
val l = loc openOr "Couldn't open"
println(loc)
println(l)

The first println give me:
Full(Loc(View List(nodes), , LinkText(), List()))

While the second shows that I am opening the Box:
Loc(View List(nodes), , LinkText(), List())

If I try to access my Loc object, I get compilation errors. For
example, "val p = l.foundParam" leads to the error "value foundParam
is not a member of java.lang.Object." The toString method works, while
the title parameter gives me the same error. I believe I am using the
latest Lift code (I ran "mvn -U jetty:run") and feel I must be missing
something very simple here.

Any advice is much appreciated!

Peter

On Jun 29, 10:05 am, David Pollak 
wrote:
> On Fri, Jun 26, 2009 at 6:39 PM, Peter Robinett 
> wrote:
>
>
>
> > Thanks, Derek and Jeppe, your responses were very helpful. I
> > implemented Jeppe's solution and added my own snippet tag within
> > _viewTemplate.  Unfortunately, I spent the whole day trying to figure
> > out how pass the current CRUDified object to my snippet. Do I retrieve
> > it in _viewTemplate from S.params and add an attribute to the snippet
> > tag? Or just retrieve it from S in the snippet?
>
> I've just made Loc.foundParam public.  If you get the Loc from the Req from
> S (for {req <- S.request; loc <- req.location}) you can access foundParam
> which contains the current crudified object.
>
> Thanks,
>
> David
>
>
>
> > I think I'm missing
> > something fundamental with the S object and snippets. As you can tell,
> > I'm very new to Lift! Any advice is much appreciated.
>
> > Peter
>
> > On Jun 24, 11:01 am, Jeppe Nejsum Madsen  wrote:
> > > On 24 Jun 2009, Peter Robinett wrote:
>
> > > > Hi all,
>
> > > > I'm using CRUDify on one of my models and I'd like to display some
> > > > additional data on the view template. I believe that I need to
> > > > override one of the model definitions with some sort of reference to
> > > > my own XHTML file. Which one? _viewTemplate? Or perhaps the
> > > > viewTemplate method?
>
> > > If you look at the source to CRUDify, you'll see
>
> > > def viewTemplate(): NodeSeq = pageWrapper(_viewTemplate)
>
> > > where
>
> > > def pageWrapper(body: NodeSeq): NodeSeq =
> > >   
> > >     {
> > >       body
> > >     }
> > >   
>
> > > def _viewTemplate =
> > >   
> > >     
> > >       
> > >         
> > >           
> > >           
> > >         
> > >       
> > >     
> > >   
>
> > > So the simplest thing is to override _viewTemplate with something similar
> > > to the above. This should be done on the companion objects where CRUDify
> > > is mixed in
>
> > > /Jeppe
>
> --
> Lift, the simply functional web frameworkhttp://liftweb.net
> Beginning Scalahttp://www.apress.com/book/view/1430219890
> Follow me:http://twitter.com/dpp
> Git some:http://github.com/dpp


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



[Lift] Re: Thoughts on file streaming

2009-06-30 Thread Naftoli Gugenhem

I'm not too familiar with the topic but instead of dropping lift, as a 
temporary workaround can't you have the upload be handled by another servlet 
which will save it and then redirect?

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

2009-06-29 Thread Naftoli Gugenhem

I don't have such a clear picture of what you're trying to do. If you need to 
refer to the instance of a snippet that exists on the same page, it looks to me 
like that data is private in S.snippetForClass.
Maybe you can nest the Tag tags in the ToDo snippet tag, have it instantiate a 
Tag instance, and call its xml processing functions directly, so that its SHtml 
setters etc. will refer to variables in the outer snippet's scope, i.e. the Tag 
instance it owns.

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






--~--~-~--~~~---~--~~
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: Managed child entities

2009-06-29 Thread Naftoli Gugenhem

I wrote a similar implementation for many-to-many. Again, very untested, but it 
works as much as I've used it.
David suggested I create a project on GitHub where the community can contribute 
useful code that could then be integrated into lift proper. So far the actual 
project is empty but it's at github.com/nafg/lift-incubator .


-
David Pollak wrote:

Wow!

On Mon, Jun 22, 2009 at 9:30 PM, Naftoli Gugenheim wrote:

> I was working on something to help make it easier to deal with one to many
> relationships. I'm attaching it (OneToMany.scala) along with a class that
> uses it (partially work in progress), although it's a bit verbose (partially
> because my class names are very long). Advantages include access to the
> children like a collection, and ability to add and remove children but defer
> actually saving it, as well as adding the children before the parent was
> saved and got an id.
> It's not test very thoroughly, and of course any suggestions for
> improvement are more than welcome. I'm planning to try to make something
> similar for many to many soon.
>
>
> >
>


-- 
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: Java alternatives?

2009-06-29 Thread Naftoli Gugenhem

But if your team already has a bit of scala knowledge and is planning to 
transition gradually, I wonder if you could write the lift-specific parts in 
scala and delegate the logic to java code.

-
David Pollak wrote:

Sam,

On Mon, Jun 29, 2009 at 1:49 PM, samreid  wrote:

>
> My group may not be able to commit to Scala within the next year or
> so, so I have 2 related questions:


Bummer...


>
>
> (1) What's the best non-Lift framework?  We are leaning toward
> something on the JVM and I've heard David speak fondly of Wicket.
>

Depends on what you want to do.  For stateful web sites, I think Wicket's
the best choice.  I'm not sure about REST frameworks.


>
> (2) Is there any possibility of writing Java source to run under
> lift?  I'm finding it difficult to even create a NodeSeq from Java,
> and we may have to write Scala adapters to reach some of the Lift
> functionality.  I know this seems like an awkward approach (and
> probably some level of competence with Scala would probably be
> necessary in order to read docs, etc.), but this might be a way we
> could get the benefits of Lift platform without the costs associated
> with Scala.  Or would this be significantly worse than just picking
> another framework?


I would recommend picking another framework.  I'm not sure what you think
the benefits of Lift are (I have my list, but yours may differ), but I think
a lot of the value of Lift is based on Scala's Function and PartialFunction
classes.  It'd be hellish to replicate this functionality by hand in Java.

Thanks,

David


>
>
> Thanks,
> Sam Reid
>
> >
>


-- 
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] Package in snippet tag

2009-06-29 Thread Naftoli Gugenhem

Normally you write the snippet tag lift:MySnippet, and you add "my.package" to 
the searched packages.
Can you just add "my" and write the tag lift:package.MySnippet etc.?

--~--~-~--~~~---~--~~
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] Which is newer

2009-06-28 Thread Naftoli Gugenhem

Is 1.1-SNAPHOT newer than 1.1-M1?

--~--~-~--~~~---~--~~
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: Pagination in lift?

2009-06-28 Thread Naftoli Gugenhem

Thanks.
(I was asking about the view end more than the model side, but I'm using 
Mapper.)
So can you specify limits and offset without resorting to native queries? If 
so, how? And if not, what would it take to write cross-database lift support?

-
Timothy Perrett wrote:


You don't mention if your using JPA or Mapper - if your using mapper
then the answer is "no" we don't have any built in support but its not
to difficult to display limited lists. You could grab all the results
then do some manipulation on the list in memory if you only have a
small dataset, alternatively you could craft your own queries using
limiting / offsetting.

Alternatively, if your using JPA, you can use the stuff built into
jpa; more info here: http://is.gd/1hfCg

Cheers, Tim

On Jun 28, 8:44 pm, Naftoli Gugenhem  wrote:
> Does lift have built in support for pagination -- breaking up a query and 
> continuing it across multiple pages, and clicking the headers to sort?
> If not how hard is it?


--~--~-~--~~~---~--~~
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] Pagination in lift?

2009-06-28 Thread Naftoli Gugenhem

Does lift have built in support for pagination -- breaking up a query and 
continuing it across multiple pages, and clicking the headers to sort?
If not how hard is it?

--~--~-~--~~~---~--~~
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: Error attempting to persist Mapper

2009-06-26 Thread Naftoli Gugenhem

I think he said that code is in MetaMapper

-
Timothy Perrett wrote:


Jono,

The problem here is actually not with mapper. Look at your stack
trace:

java.lang.NullPointerException: Trying to open an empty Box
at net.liftweb.util.EmptyBox.open_$bang(Box.scala:370)
at net.liftweb.util.EmptyBox.open_$bang(Box.scala:366)

"UPDATE "+dbTableName+" SET "+whatToSet(toSave)+" WHERE
"+indexMap.open_! +" = ?"

Whatever indexMap is, its of type Empty rather than Full[YourType] -
try this:

"UPDATE "+dbTableName+" SET "+whatToSet(toSave)+" WHERE
"+indexMap.openOr("yourDefault") +" = ?"

Essentially, your getting an NPE because your trying to read something
that doesn't exist. Using openOr will make sure that if the box is
empty your default value is used in its place rather than exploding
like that.

Does that help?

Cheers, Tim

On Jun 26, 3:33 am, Jonathan Ferguson  wrote:
> Hi all,
>  I'm attempting to persist a Mapper used to join two tables.
>
> java.lang.NullPointerException: Trying to open an empty Box
>         at net.liftweb.util.EmptyBox.open_$bang(Box.scala:370)
>         at net.liftweb.util.EmptyBox.open_$bang(Box.scala:366)
>         at net.liftweb.mapper.MetaMapper$$anonfun$12.apply(MetaMapper.scala:
> 583)
>         at net.liftweb.mapper.MetaMapper$$anonfun$12.apply(MetaMapper.scala:
> 578)
>         at net.liftweb.mapper.DB$.use(DB.scala:305)
>         at net.liftweb.mapper.MetaMapper$class.save(MetaMapper.scala:577)
>
> The empty box is in the update statement, which confuses me as I
> should be performing an insert.( from MetaMapper )
>
>             val ret: Boolean = DB.prepareStatement("UPDATE
> "+dbTableName+" SET "+whatToSet(toSave)+" WHERE "+indexMap.open_! +"
> = ?", conn)
>
> I am assuming it is something to do with my understand of how to use a
> non-keyed Mapper.
> The exception is thrown when save is called in the join function.
>
> class AB extends Mapper[AB] {
>
>         def getSingleton = AB
>
>         object A      extends MappedLongForeignKey(this, A) { override def
> dbColumnName = "a_Bs_id" }
>         object B      extends MappedLongForeignKey(this, B) { override def
> dbColumnName = "B_id" }
>         object index  extends MappedInt(this) { override def dbColumnName =
> "Bs_idx" }
>
> }
>
> object AB extends AB with MetaMapper[AB]
> {
>    override def dbTableName = "A_B"
>
>   def join (a : A, b : B):Boolean = {
>     val list = AB.findAll(By(AB.a,a))
>     val i = list.isEmpty match {
>       case true => 0
>       case false => list.size
>     }
>     this.create.A(a).B(b).index(i).save
>     }
>
> }
>
> Any pointers would be appreciated, I can't change the data structure
> as the table is used by other applications.
>
> Jono


--~--~-~--~~~---~--~~
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: Warnings for missing binds?

2009-06-26 Thread Naftoli Gugenhem

+1

-
Derek Chen-Becker wrote:

I just spent the better part of half a day trying to track down an issue
with binding that ended up being a subtle typo. I'm thinking of adding in
some logging (in dev mode) for the bind function to warn about unused bind
elements and unused bind params, just to better help locate issues like
this. Any objections?

Derek



--~--~-~--~~~---~--~~
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: Another backtrace on reload

2009-06-24 Thread Naftoli Gugenhem

I had the same problem a while ago. I'm not sure if I fixed it then, but I 
think it had to do with the db still being open possibly. When the code changes 
does the servlet get undeployed?
You might need to run derby in server mode.
Lately I've been launching jetty without maven, and to get it to reload eclipse 
calls an ant script that touches the context.xml. I'm using h2 in tcp mode.
Another option is JavaRebel which often obviates the need to redeploy.
Sorry I can't help you better--I'm interested in any more information there is 
about this too.

-
David Pollak wrote:

I won't have a chance to look at it until next week, but maybe somebody else
could step in here and help.

On Wed, Jun 24, 2009 at 7:16 AM, Nolan Darilek wrote:

>
> On 06/24/2009 08:54 AM, David Pollak wrote:
> > Are you using JNDI or your own connection manager to connect to the
> RDBMS?
> >
> I'm new to this, but I'm guessing the latter. In any case, I haven't
> touched whatever values the snapshot sets up in Boot.scala, nor have I
> set any properties, so it's stock Derby.
>
> >
>


-- 
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] Deployment questions and little Java web dev experience

2009-06-23 Thread Naftoli Gugenhem

What's the difference between an application server and a servlet container?

-
Timothy Perrett wrote:


Yes thats pretty much right - examples of context are:

/

/something/

/yet/another/

Cheers, Tim

On Jun 23, 4:59 am, Naftoli Gugenheim  wrote:
> When you deploy a web app I think you specify a context path (at least in
> jetty) which I think is what you're looking for -- the first part of the
> path after the domain name.
>
>
>
> On Mon, Jun 22, 2009 at 11:39 PM, g-man  wrote:
>
> > I came from a similar background, but with some detours after Rails
> > through Erlang, GAE w/ Django, and web2py. It took me about 2 months
> > to finally start having fun with Lift and Scala, but I can tell you
> > now it's really nice to just sit down, write something, and watch it
> > work!
>
> > I'm no expert yet, and I'm constantly reading all the books I can
> > find, but the rewards and power are definitely there. Where I needed
> > dozens of files with Rails, I only need 3 models, 3 snippets, and 2
> > templates now, and they are far cleaner!
>
> > My advice is to slow down, do the 'ToDo' app tutorial, and then start
> > adding functionality to it. As you add features, you will research and
> > learn about new things and how to do them. As a study aid, I keep the
> > 'PocketChange' app from the book open, and look to see how similar
> > problems were solved there.
>
> > As they say, almost everything you need to know is contained in those
> > two examples. As to all the niceties of the servers and deployment to
> > a VPS, I suggest you leave that for later. The little Jetty thing
> > running on localhost will give you a taste of how Maven sets up
> > things, and how to tweak them (adding logging, comments, debugging
> > messages, etc), plus you always have the Group here for help.
>
> > Lift (and Scala) are both very young, so it will take a while for all
> > the books, websites, tutorials, and videos to come out. Imagine Rails
> > 5 years ago and you have some idea of where we are, and that's not
> > even considering the new 'Goat Rodeo' project...
>
> > No worries -- have fun!
>
> > On Jun 19, 1:09 pm, "Nolan Darilek"  wrote:
> > > Hi, all. I'm new to Lift and have a few questions about using it. For
> > > background, I'm coming from Ruby to Scala, having finally been
> > > frustrated by some aspects of the former enough to try jumping ship. I
> > > know Java syntax, but the simplicity of Ruby has always been a powerful
> > > draw for me, so when I used Java I always stayed away from Maven and
> > > other cornerstones of the Java tool community. I say all of this not to
> > > stir up Ruby vs. Scala drama (because we just don't have enough of that
> > > already :P ) but to explain that I'm mistified by much of the Java
> > > ecosystem, and a lot of what's out there seems to take it for granted
> > > that I know all of this. So please pardon my newbie questions, and feel
> > > free to point me to the FM on the subject if there is one, because I've
> > > certainly been *trying* to RTFM. :) I also recognize that these topics
> > > aren't specific to Lift, but I figure I'm likely to find more proponents
> > > of low ceremony in the Scala community than I'd find if I seeked out
> > > some more general purpose Java enterprise deployment resource.
>
> > > First...servlets? Web containers? App servers? Oh my. I want to write a
> > > few hobbyist apps with Lift and deploy them to my VPS. They may or may
> > > not take off, in which case I'd like a solution that can scale to
> > > real-world use. Not heavy real-world use, mind you, but I figure a
> > > separate VM/port for every app instance is overkill. So what do I need
> > > for this? I gather the app server is what handles arranging web apps in
> > > a single VM instance, but it's tough cutting through all the enterprise
> > > language to figure out which one of these is best for my circumstances,
> > > especially since I'm not dealing with legacy code and just want to
> > > launch hobbyist/personal projects. And I can't for the life of me figure
> > > out whether Tomcat is an app server or something else entirely. This
> > > seems so much more complicated than just throwing up a few Mongrels and
> > > a load balancer, or reading through the nicely-written Passenger manual
> > > and following the step-by-step instructions. I'm sure it has its
> > > advantages, I just can't get a grip on how it works.
>
> > > I've also been reading a lot about OSGi and it looks really nice. Am I
> > > correct in assuming that OSGi is to Java web apps what Rack is to Ruby
> > > ones? OK, maybe not exactly, and I know it's a more general-purpose
> > > mechanism (I'm toying with ScalaModules in a desktop app for providing
> > > pluggable UIs and other services) but in poking through OSGi articles,
> > > I've read a few statements hinting that this is probably the best way to
> > > deploy new apps with no legacy dependencies. Is this true? Is an app
> >

[Lift] Re: Using Mapper outside Lift?

2009-06-23 Thread Naftoli Gugenhem

I used mapper in an offline (demo) app. You have to include the util and http 
jars IIRC but it's a desktop app. If you're subcribed to scala-user, I posted 
it (I think last week) in the thread about a scala SWT DSL.

-
Timothy Perrett wrote:


Hi Joe,

Mapper does not work standalone, its not like ActiveRecord in that
sense - its tied to lift-webkit. Your best bet would be to go with
JPA; I think that will serve you better anyway.

Cheers, Tim

On Jun 23, 4:47 pm, Joe Wass  wrote:
> Good afternoon (at least in England),
>
> I'm writing an application which has a significant Lift manifestation,
> but also some stand-alone Scala (maybe even Java but I'll exclude this
> from the conversation). The stand-alone code is a set of tools that
> hang off the database and do some heavy-lifting with the data in the
> database, out of sync with the site. Something like periodic data-
> crunching from the data on the site. The question comes down to
> database mapping.
>
> I was wondering what people think is a sensible way of doing this. My
> data model is simple enough that Mapper could work and I could use the
> same classes. I'm aware there are many different ways I could do it,
> but it would be nice to do it that way for the sake of simplicity.
>
> Does this sound a sensible approach? Has anyone else written an app
> that's half online, half offline? Are there any obvious pitfalls?
>
> Cheers
>
> Joe


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