[Lift] Re: Is there a bulk update function ?

2009-05-04 Thread Timothy Perrett

Hi there,

we dont have a bulkUpdate function right now - however you could just
run some SQL directly:

DB.runQuery("SQL GOES HERE")

Is that of any help?

Cheers, Tim

On May 4, 1:53 am, "sailormoo...@gmail.com" 
wrote:
> Hi :
>
>   From the Lift Book, there is a bulk delete function.
>
> Expense.bulkDelete_!!(By_<(Expense.dateOf, date))
>
>   However, I want a bulk update function, is there one or if I must to
> update it one by one?
> 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: Article about URL rewriting in Lift

2009-05-04 Thread Timothy Perrett

Hey Andrew,

Glad you found this useful - sure, feel free to link to it from the
wiki.

Cheers, Tim

On May 4, 12:37 am, Andrew Scherpbier  wrote:
> Wow, this is awesome!  Can a link to this be provided from the
> wiki/getting started guide/api docs?
>
> --Andrew

--~--~-~--~~~---~--~~
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: Lift documentation -- Attention newcomers (and everyone else)!

2009-05-04 Thread TSP

Examples, examples, examples, including scala.

The scala-lang site is a bit daunting. I think you'll get more
traction on Lift if you help people to get to grips with scala as well
as lift. I have no idea whether I'm a typical newcomer, but I have
come from Java (previously other things going back to pascal) but as
I'm not from a computer science background have no real knowledge or
understanding of functional programming. Lots of scala stuff is pretty
strange territory. People want a tool like Lift to do stuff quickly
and easily. I'm constantly having to reference my set of 4 books (3 of
which are pre-publication) just to get the "scala way" of doing
something simple. I think people should be strongly encouraged to
things they did to solve particular problems - not so much as an
example of best practice but more "I did it like this, is there a
better way?"

I personally find the discussions like the one on the scala user
mailing list  on treatment of enumerations in java vs scala useful and
interesting but they too often reference what to me are still esoteric
parts of the language that I have yet to master. So wiki pages where
you could have similar threads but with a culture of illustrating
every comment with a real example would be a great way to learn. I
suspect most people from my type of background are starting out by
writing java-style code in scala and are struggling with refactoring
it to more native scala. Somewhere we could put our fledgling code up
for constructive criticism without having to keep prefacing it with
"Newbie question: " would be good.

Tim


On Apr 21, 8:38 pm, "Charles F. Munat"  wrote:
> I am charged with coming up with a site map/information architecture for
> our hopefully-soon-to-be-updated wiki.
>
> What would most benefit you on a documentation wiki? What sorts of
> things are you having the most problems with?
>
> Please submit suggestions for a wiki outline, as well as any other ideas
> you have. For example, ideas on wiki structure are welcome. You could
> even suggest your own outline.
>
> Please participate! Yes, you, lurker! We want to know what you need.
>
> I'll collect all the ideas this weekend, consolidate them, and present a
> suggested outline (road map) for the documentation wiki.
>
> Thanks!
>
> Yes! If you are reading this, then I am talking to you. Speak up.
>
> Chas.
--~--~-~--~~~---~--~~
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 would I call a template from another template?

2009-05-04 Thread Timothy Perrett

Do you mean:



Thanks, Tim

On May 3, 7:45 pm, EmEhRKay  wrote:
> Very simple idea - I have a tags template that I put in the templates-
> hidden directory, it creates a list of tags. In one of my public
> templates I want to be able to call that template to display the tags
> (I'm sure it has been done before and I cannot find in either book
> where this is covered). How would I do this?
>
> 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: Sample applications are somewhat slow - is Lift slow ?

2009-05-04 Thread Daniel Guryca
Thank you Dave.
I'll be waiting for your complete benchmark ...

Daniel

On Mon, May 4, 2009 at 5:23 AM, David Pollak
wrote:

>
>
> On Sun, May 3, 2009 at 4:11 PM, Daniel Guryca  wrote:
>
>> I have just tried mvn -Drun.mode=production jetty:run  ... but sadly still
>> getting same performance.
>
>
> I ran a simple test (the same command line as you) on my 2.67 Ghz Core i7
> machine and saw 600 pages per second.  Granted, my machine's faster, but not
> 10x.
>
> I'll spend some time putting together a complete benchmark tomorrow so we
> can share the same executable and hopefully see the same results.
>
>
>>
>>
>> Daniel
>>
>>
>> On Sun, May 3, 2009 at 3:31 PM, David Pollak <
>> feeder.of.the.be...@gmail.com> wrote:
>>
>>>
>>>
>>> On Sun, May 3, 2009 at 6:18 AM, Daniel Guryca  wrote:
>>>
 Hi David,

 Thank you for your reply.

 How and where can I set production vs development mode in lift ?
>>>
>>>
>>> Set the "run.mode" system property to "production"  I do that with
>>> -Drun.mode=production when I start Jetty, but you may do it differently.
>>>
>>> Also, In the basic app, there's an RDBMS request for the User object on
>>> each page load and if you've got Derby configured, that's going to slow
>>> things down.
>>>
>>>
>>>

 Thank you again.
 Daniel

 On Sun, May 3, 2009 at 3:12 PM, David Pollak <
 feeder.of.the.be...@gmail.com> wrote:

> Are you running Lift in production or development mode?
> I typically see 300 pages/second to 800 pages/second when I do
> benchmarks on dual core opteron machines.
>
> I'll look into this, but you should be seeing north of 300 pages per
> second with simple pages in Lift.
>
>
> On Sat, May 2, 2009 at 1:32 PM, Dunsun  wrote:
>
>>
>> Hi,
>>
>> I'm very new to lift and scala.
>>
>> I have made some Grails intranet applications but sadly Grails or
>> better say GSP rendering part which is completely written in Groovy is
>> a very slow beast (even in comparison with Rails or Django).
>>
>> For my future big project (heavy loaded site) I need something much
>> faster.
>>
>> So I have made some quick and dirty Lift benchmarks using ApacheBench
>> + Tomcat, GlassFish (from netbeans) and even Jetty.
>> My machine - AMD X2 @ 2500Mhz, 4 GB RAM
>>
>> LIFT BASIC SAMPLE:
>> ab -c 10 -n 3000
>> http://localhost:8080/liftbasic-1.0-SNAPSHOT/user_mgt/login
>> 50 req/s
>>
>> LIFT BLANK SAMPLE:
>> ab -c 10 -n 3000 http://localhost:8080/liftblank-1.0/
>> 120 req/s
>>
>> Obtained numbers were similar for all 3 servers.
>>
>> Using Stripes and rendering similar simple pages I'm getting much much
>> higher scores (600 req/s).
>> Using Grails I'm getting little worse results but I would say it is
>> same league.
>> I would expect much better performance from Lift which is written in
>> scala.
>>
>> Why am I getting these low numbers ?
>> Am I doing something wrong ?
>> Any suggestion is very welcome.
>>
>> regards
>> Daniel
>>
>>
>>
>
>
> --
> Lift, the simply functional web framework http://liftweb.net
> Beginning Scala http://www.apress.com/book/view/1430219890
> Follow me: http://twitter.com/dpp
> Git some: http://github.com/dpp
>
>
>



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

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



[Lift] how to hide /display div tag in lift

2009-05-04 Thread pravin

HI,

I want to hide /display div tag.
how can i controlled it from my snippet?
my div tag contain table tag.

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: Lift documentation -- Attention newcomers (and everyone else)!

2009-05-04 Thread Greg

I have to agree with Richard on having soup-to-nuts examples on real-
world/pragmatic implementations of Scala/Lift.

We're all here because we 'believe' in Scala and Lift, it's just that
those who are just starting (like me and Richard) would like to see
examples on how to implement Scala/Lift in non-trivial, real-world/
common applications.

And that's more to see how to shift our 'perspective' from {insert-
framework-here} to a Scala/Lift approach.

I've been tentatively (after reading 'Programming in Scala' and
devouring any Scala and Lift tutorial/article/beta-pub) starting a new
project trying to use Scala/Lift and I've been stymied by a 'paralysis
of analysis' to try to use the complete power of Scala/Lift (FP, etc)
out the gate.

I've now decided to just get something going even if I have to use
imperative patterns and Java OO modeling, and just refactor and refine
later.

A non-trivia sample application development would be oh-so-helpful in
addressing the 'hows' and 'whys' of the mundane plumbing in Scala/Lift
without falling back into the Java comfort zone.

I'd also like to thank James M. for putting into a post most-
everything I think (from a newcomer's perspective) is needed for a
wider adoption of Lift.

Specifically, his third (#3) point of having a more thorough and
accessible coverage of having Lift in a real-world development
environment.

The seventh (#7) point of have 'recipes for Lift' would also be
extremely helpful.  Maybe even a 'FAQ' style HOW-TOs format for the
'recipes' and the explanation behind why it was done (if applicable) a
certain way as opposed to a straight Java/Ruby/Python/whatever
translation.

I think many times the people who know a topic (like Scala/Lift)
inside and out tend to have a 'blind spot' to what the newcomer might
need, thinking that 'this' or 'that' is so obvious, why would it need
to be documented or explained?

I know I've done that myself with Java and some frameworks.  I can't
answer the question, "What book should I get to learn Java?" because I
just don't know anymore.

It is refreshing to see that the many people in the Lift community
know this and ask the 'refugees' what's needed to ease the transition.

I want to thank everyone in the Scala/Lift community for all of their
work and I hope to be able to contribute once I get up to speed.

As to the registration, I don't find it a big deal.  You can lock down
certain topics (to be edited by only users in certain groups) and
leave other topics open to public editing.  MediaWiki has the
flexibility and it would make sense to have a 'mixed' editable
paradigm since the wiki is not Wikipedia and has a particular focus.

Keep up the good work,

Greg

On May 4, 8:23 am, "Charles F. Munat"  wrote:
> James,
>
> This looks more like about $20, but I'm not complaining. Your thoughts
> mirror mine in many ways. #4 is a very good idea. Even just a list of
> what is needed. Folks could add to a documentation wishlist, and then
> anyone who thought he or she could tackle an item could just do it.
>
> I'm glad that people are finally responding to this thread. I was
> beginning to think that I was on my own...
>
> Chas.
>
>
>
> James Matlik wrote:
> > Hello Charles,
>
> > This is good news.  I'm sorry I didn't see your initial email going out,
> > but I would guess it is better late than never.  I think the first thing
> > that needs to be done is to clearly define what is to be documented in
> > the wiki and where.  Here is my 2 cents:
>
> >    1. There should be a page linked to the wiki's main page providing
> >       marketing style information.  This could be a kind of "About Lift"
> >       page on steroids.  What makes Lift novel?  What features does it
> >       provide that simplify the state of the art in web development?
> >       How easily can the technology be integrated with legacy
> >       deployments?  What design goals does Lift strive for and why?
> >       Does Lift have a viable future?  What is Lift's stance on KIR
> >       support?  Once an official release is made public, will bug fixes
> >       be applied to that version going forward and for how long?  How
> >       stable is the API?
> >    2. A brief description of the Lift culture could be beneficial; a
> >       kind of "welcome to the party, this is how we roll" for the
> >       uninitiated (I'm still figuring it out).
> >    3. Make a clearly defined section for people developing applications
> >       with Lift.  Give a 100ft view of the code/compile/deploy/test
> >       development cycle, then delve into the tools that make this cycle
> >       simpler.  Provide the basics on Maven, what it is, what it does
> >       for Lift, and the commands of interest for Lift development.
> >       Describe how Maven is not required for the Maven adverse, and
> >       provide instructions on how to proceed without Maven (maybe an
> >       opportunity for sbaz?).  Up-to-date HowTo documents on standing up
> >       different editors (N

[Lift] Re: how to hide /display div tag in lift

2009-05-04 Thread marius d.

There are so many ways ...

1. Use chooseTemplate technique. I think the examples application
from /sites uses this.
2. In the snippet you have the snippet content and you can just strip
it out
3. You can have a little JavaScript that is called when the page loads
that shows or hides the div ... if you need something more dynamic.


Br's,
Marius

On May 4, 1:28 pm, pravin  wrote:
> HI,
>
> I want to hide /display div tag.
> how can i controlled it from my snippet?
> my div tag contain table tag.
>
> 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: Sample applications are somewhat slow - is Lift slow ?

2009-05-04 Thread marius d.

Dave if you're doing benchmarks can you try using the template caching
mechanism ? .. and try to see the differences ?

Br's,
Marius

On May 4, 6:23 am, David Pollak  wrote:
> On Sun, May 3, 2009 at 4:11 PM, Daniel Guryca  wrote:
> > I have just tried mvn -Drun.mode=production jetty:run  ... but sadly still
> > getting same performance.
>
> I ran a simple test (the same command line as you) on my 2.67 Ghz Core i7
> machine and saw 600 pages per second.  Granted, my machine's faster, but not
> 10x.
>
> I'll spend some time putting together a complete benchmark tomorrow so we
> can share the same executable and hopefully see the same results.
>
>
>
>
>
> > Daniel
>
> > On Sun, May 3, 2009 at 3:31 PM, David Pollak <
> > feeder.of.the.be...@gmail.com> wrote:
>
> >> On Sun, May 3, 2009 at 6:18 AM, Daniel Guryca  wrote:
>
> >>> Hi David,
>
> >>> Thank you for your reply.
>
> >>> How and where can I set production vs development mode in lift ?
>
> >> Set the "run.mode" system property to "production"  I do that with
> >> -Drun.mode=production when I start Jetty, but you may do it differently.
>
> >> Also, In the basic app, there's an RDBMS request for the User object on
> >> each page load and if you've got Derby configured, that's going to slow
> >> things down.
>
> >>> Thank you again.
> >>> Daniel
>
> >>> On Sun, May 3, 2009 at 3:12 PM, David Pollak <
> >>> feeder.of.the.be...@gmail.com> wrote:
>
>  Are you running Lift in production or development mode?
>  I typically see 300 pages/second to 800 pages/second when I do
>  benchmarks on dual core opteron machines.
>
>  I'll look into this, but you should be seeing north of 300 pages per
>  second with simple pages in Lift.
>
>  On Sat, May 2, 2009 at 1:32 PM, Dunsun  wrote:
>
> > Hi,
>
> > I'm very new to lift and scala.
>
> > I have made some Grails intranet applications but sadly Grails or
> > better say GSP rendering part which is completely written in Groovy is
> > a very slow beast (even in comparison with Rails or Django).
>
> > For my future big project (heavy loaded site) I need something much
> > faster.
>
> > So I have made some quick and dirty Lift benchmarks using ApacheBench
> > + Tomcat, GlassFish (from netbeans) and even Jetty.
> > My machine - AMD X2 @ 2500Mhz, 4 GB RAM
>
> > LIFT BASIC SAMPLE:
> > ab -c 10 -n 3000
> >http://localhost:8080/liftbasic-1.0-SNAPSHOT/user_mgt/login
> > 50 req/s
>
> > LIFT BLANK SAMPLE:
> > ab -c 10 -n 3000http://localhost:8080/liftblank-1.0/
> > 120 req/s
>
> > Obtained numbers were similar for all 3 servers.
>
> > Using Stripes and rendering similar simple pages I'm getting much much
> > higher scores (600 req/s).
> > Using Grails I'm getting little worse results but I would say it is
> > same league.
> > I would expect much better performance from Lift which is written in
> > scala.
>
> > Why am I getting these low numbers ?
> > Am I doing something wrong ?
> > Any suggestion is very welcome.
>
> > regards
> > Daniel
>
>  --
>  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
>
> --
> 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: Box and Option - what am I missing?

2009-05-04 Thread Sergey Andreev
Import net.liftweb.util.Box._ and you should get option2Box implicit

On Mon, May 4, 2009 at 5:44 PM, TSP  wrote:

>
> I've a function that returns an Option. How do I turn it into a box.
> I'm told there are implicit functions to do so, so why doesn't the
> following code work and what do I need to do to it please?
>
> import net.liftweb.util.{Failure, Full, Box}
> def myOpt(hasSome: boolean) = {
>  if (hasSome)
>Some("got it")
>  else
>None
> }
>
> val noFailure = myOpt(true) ?~ "shouldn't see me"
> println(noFailure)
> val aFailure = myOpt(false) ?~ "should fail"
> println(aFailure)
>
> 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] box of Boxes

2009-05-04 Thread Channing Walton

Hi,
I am building a web app which has a rest API. I found that I was
repeating myself like this:

val reply:Full[XmlResponse] = req.xml match {
  case Full(content) => {
a block of code that does something with the content

  }
  case _ => 
}

So I first though I would create a function to help a little:

private def handle[T](b:Box[T])(block:T => Unit):Full[XmlResponse] =
b match {
  case Full(x) => {
block(x)

  }
  case _ => 
}

which reduces the example to:

val reply:Full[XmlResponse] = handle(req.xml) { content:Elem =>
  do something with content
}

ok so far so good (I think? Is It?)

But, being REST, the url is pointing at a resource which gets loaded
as a Box, so the above will not work so nicely. We are back to:

val reply:Full[XmlResponse] = req.xml match {
  case Full(content) => {
MappedThing.find( By content attributes ) match {
  case Full(obj) => {
doSomething

   }
  case _ => 
}
  }
  case _ => 
}

nasty.

So I was now thinking that I need a crazy function whose signature is
something like this:
def crazy[X, T](a:Box[X])(block1:X => Box[T])(block2:T => Unit):Full
[XmlResponse]

and used something like this:
crazy(req.xml) (content:Elem => MappedThing.find...) {obj:MappedThing
=>
  ...
}

Does any of this makes any sense? Is this just wrong?

Also, as an exercise, I wondered if there was a type-safe way to
generalise this concept so that a chain of functions could be supplied
which took an initial Box (or Option) and applied each function to the
result of the previous function to obtain a final result?

--~--~-~--~~~---~--~~
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: Lift documentation -- Attention newcomers (and everyone else)!

2009-05-04 Thread David Pollak
On Sun, May 3, 2009 at 7:58 AM, richard.car...@me.com  wrote:

>
> My personal view is that a worked example of a fully featured
> eCommerce type site would be most useful. Even something as simple as
> a cut down Amazon style store with inventory management would be a
> great start. That would be a useful foundation for the rest of Lift's
> features (add-ons such as online chat style help).
>

So, there are 7 example applications of different stripes that come with the
Lift source distribution and there's also ESME, the Unconference example in
lift-samples (on GitHub) and PocketChange.  These example cover virtually
every part of Lift and rather than being a whole e-commerce application,
they are modules that can be woven together.  Given the pitfall of having a
complex monolithic app, we chose to highlight individual pieces of
functionality.  What pieces of functionality are missing for you?


>
> I'm looking at technologies for rewriting a web site with a lot of
> dynamic content, currently written entirely in Java 1.4 and JSPs.
> Scala and Lift look promising, but the lack of documentation and non
> trivial worked examples


The unconference code ran last year's Scala Lift Off.  The ESME code is
currently is use at a number of fortune 100 companies.

In terms of the lack of documentation, that's exactly what we're looking to
rectify.  So, what documentation do you need that are not provided between
the Getting Started Guide, Exploring Lift, and the ScalaDocs are missing?


> mean that despite Lift's "1.0" status, I don't
> feel I could use it in its current form.
>
> Hope this is of some help,
>
> Regards
>
> Richard
>
> >
>


-- 
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: box of Boxes

2009-05-04 Thread David Pollak
How about the for comprehension?

for {xml <- req.xml
   fooTag <- (xml \ "foo").firstOption
   response <- myFunction(fooTag)
  } yield response



On Mon, May 4, 2009 at 8:51 AM, Channing Walton wrote:

>
> Hi,
> I am building a web app which has a rest API. I found that I was
> repeating myself like this:
>
> val reply:Full[XmlResponse] = req.xml match {
>  case Full(content) => {
>a block of code that does something with the content
>
>  }
>  case _ => 
> }
>
> So I first though I would create a function to help a little:
>
> private def handle[T](b:Box[T])(block:T => Unit):Full[XmlResponse] =
>b match {
>  case Full(x) => {
>block(x)
>
>  }
>  case _ => 
>}
>
> which reduces the example to:
>
> val reply:Full[XmlResponse] = handle(req.xml) { content:Elem =>
>  do something with content
> }
>
> ok so far so good (I think? Is It?)
>
> But, being REST, the url is pointing at a resource which gets loaded
> as a Box, so the above will not work so nicely. We are back to:
>
> val reply:Full[XmlResponse] = req.xml match {
>  case Full(content) => {
>MappedThing.find( By content attributes ) match {
>  case Full(obj) => {
>doSomething
>
>   }
>  case _ => 
>}
>  }
>  case _ => 
> }
>
> nasty.
>
> So I was now thinking that I need a crazy function whose signature is
> something like this:
> def crazy[X, T](a:Box[X])(block1:X => Box[T])(block2:T => Unit):Full
> [XmlResponse]
>
> and used something like this:
> crazy(req.xml) (content:Elem => MappedThing.find...) {obj:MappedThing
> =>
>  ...
> }
>
> Does any of this makes any sense? Is this just wrong?
>
> Also, as an exercise, I wondered if there was a type-safe way to
> generalise this concept so that a chain of functions could be supplied
> which took an initial Box (or Option) and applied each function to the
> result of the previous function to obtain a final result?
>
> >
>


-- 
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: stuck on some scala while using jpa

2009-05-04 Thread Derek Chen-Becker
Fixed in the ScalaJPA docs. If you do need a List, just use the toList
method on the returned Seq.

Derek

On Sun, May 3, 2009 at 4:05 AM, TSP  wrote:

>
> OK to answer own question in case anyone has similar problems:
> ScalaEntityManager returns a bufferWrapper from the jcl.Conversions
> not a List. However, it can be treated as a Seq[Postcode]
> >
>

--~--~-~--~~~---~--~~
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] Box and Option - what am I missing?

2009-05-04 Thread TSP

I've a function that returns an Option. How do I turn it into a box.
I'm told there are implicit functions to do so, so why doesn't the
following code work and what do I need to do to it please?

import net.liftweb.util.{Failure, Full, Box}
def myOpt(hasSome: boolean) = {
  if (hasSome)
Some("got it")
  else
None
}

val noFailure = myOpt(true) ?~ "shouldn't see me"
println(noFailure)
val aFailure = myOpt(false) ?~ "should fail"
println(aFailure)

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: box of Boxes

2009-05-04 Thread Derek Chen-Becker
Comment below:

On Mon, May 4, 2009 at 9:51 AM, Channing Walton wrote:

>
> Hi,
> I am building a web app which has a rest API. I found that I was
> repeating myself like this:
>
> val reply:Full[XmlResponse] = req.xml match {
>  case Full(content) => {
>a block of code that does something with the content
>
>  }
>  case _ => 
> }


This actually looks like a great place for map + openOr:

val reply = Full(req.xml.map({ content => ...; }) openOr )

--~--~-~--~~~---~--~~
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] unable to find in classpath

2009-05-04 Thread TSP

Hi
This is a general ignorance question about web apps I suspect:

I've got multiple databases and I'm using JPA.
In my persistence.xml file I've got under my persistence-unit
  ukpostcodesOrm.xml

In my META-INF folder I've got the file ukpostcodesOrm.xml

but for some reason or other I get the error message:

javax.persistence.PersistenceException: [PersistenceUnit: ukpostcodes]
Unable to find XML mapping file in classpath: ukpostcodesOrm.xml

What is responsible for putting the mapping file in the classpath at
runtime? I thought stuff in META-INF got there automatically

I tried changing the file name back to orm.xml and leaving the mapping-
file reference in - it still fails. But if there is no mapping-file
element, the orm.xml is found just fine.

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: unable to find in classpath

2009-05-04 Thread TSP

I'll answer my own question:
META-INF contents are not on the classpath. I needed META-INF/ukpostcodesOrm.xml
after which it all works again.

--~--~-~--~~~---~--~~
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: box of Boxes

2009-05-04 Thread Channing Walton

Thanks David and Derek, I will tinker with those ideas.

--~--~-~--~~~---~--~~
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: Sample applications are somewhat slow - is Lift slow ?

2009-05-04 Thread David Pollak
Daniel,

I did a little measurement of Lift and did some tuning.  On my Core 920
machine with 12GB of RAM running Ubuntu 9.04 and the JDK 1.6.0_13 in 64 bit
mode with Tomcat 6.0.18 (I ran into some bugs in Jetty while measuring with
ab).  My baseline running (both locally and across the network)

ab -c 10 -n 2 http://yak.local:8080/user_mgt/login

I was seeing about 1,500 pages/second.  I used YourKit to do some profiling
and improved performance on my box to about 2,200 pages/second.  Here are
the steps I went through.  I created a new project:

d...@yak:~/benchmark$ mvn archetype:create -U
-DarchetypeGroupId=net.liftweb -DarchetypeArtifactId=lift-archetype-basic
-DarchetypeVersion=1.1-SNAPSHOT -DremoteRepositories=
http://scala-tools.org/repo-snapshots   -DgroupId=com.liftcode
-DartifactId=benchmark

I cd'ed into benchmark and typed "mvn clean install"  I copied the
"target/benchmark-1.0-SNAPSHOT" directory into Tomcat's webapps directory
and renamed the directory "ROOT".  I did export
JAVA_OPTS="-Drun.mode=production" to make sure Lift runs in production
mode.  I started Tomcat with ./bin/startup.sh

Then I ran:

d...@yak:~/tmp$ ab -c 10 -n 2 http://localhost:8080/user_mgt/login

I did this and discarded the results because this will "warm up" the HotSpot
compiler.  At the end of this run, the JVM should have optimized most of the
Lift-related classes.  Next, I re-ran the command:
d...@yak:~/tmp$ ab -c 10 -n 2 http://localhost:8080/user_mgt/login
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking localhost (be patient)
Completed 2000 requests
Completed 4000 requests
Completed 6000 requests
Completed 8000 requests
Completed 1 requests
Completed 12000 requests
Completed 14000 requests
Completed 16000 requests
Completed 18000 requests
Completed 2 requests
Finished 2 requests


Server Software:Apache-Coyote/1.1
Server Hostname:localhost
Server Port:8080

Document Path:  /user_mgt/login
Document Length:3768 bytes

Concurrency Level:  10
Time taken for tests:   9.156 seconds
Complete requests:  2
Failed requests:0
Write errors:   0
Total transferred:  8362 bytes
HTML transferred:   7536 bytes
Requests per second:2184.33 [#/sec] (mean)
Time per request:   4.578 [ms] (mean)
Time per request:   0.458 [ms] (mean, across all concurrent requests)
Transfer rate:  8918.62 [Kbytes/sec] received

Connection Times (ms)
  min  mean[+/-sd] median   max
Connect:01   0.9  0   8
Processing: 14  18.5  3 788
Waiting:04  18.4  2 788
Total:  15  18.5  3 788
WARNING: The median and mean for the initial connection time are not within
a normal deviation
These results are probably not that reliable.

Percentage of the requests served within a certain time (ms)
  50%  3
  66%  4
  75%  4
  80%  5
  90%  6
  95%  8
  98% 11
  99% 16
 100%788 (longest request)
d...@yak:~/tmp$

I also ran the command remotely over a gigabit LAN:
d...@horse:~$ ab -c 10 -n 2 http://yak.local:8080/user_mgt/login
This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $> apache-2.0
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright 2006 The Apache Software Foundation, http://www.apache.org/

Benchmarking yak.local (be patient)
Completed 2000 requests
Completed 4000 requests
Completed 6000 requests
Completed 8000 requests
Completed 1 requests
Completed 12000 requests
Completed 14000 requests
Completed 16000 requests
Completed 18000 requests
Finished 2 requests


Server Software:Apache-Coyote/1.1
Server Hostname:yak.local
Server Port:8080

Document Path:  /user_mgt/login
Document Length:3768 bytes

Concurrency Level:  10
Time taken for tests:   10.305721 seconds
Complete requests:  2
Failed requests:0
Write errors:   0
Total transferred:  8362 bytes
HTML transferred:   7536 bytes
Requests per second:1940.67 [#/sec] (mean)
Time per request:   5.153 [ms] (mean)
Time per request:   0.515 [ms] (mean, across all concurrent requests)
Transfer rate:  7923.75 [Kbytes/sec] received

Connection Times (ms)
  min  mean[+/-sd] median   max
Connect:00   0.6  0   4
Processing: 14  25.9  3 840
Waiting:13  25.6  2 816
Total:  14  25.9  3 840

Percentage of the requests served within a certain time (ms)
  50%  3
  66%  4
  75%  4
  80%  4
  90%  6
  95%  8
  98% 11
  99% 17
 100%840 (longest request)


I'm currently setting up a test machine with a 2 core AMD processor, 1GB of
RAM and Ubunt

[Lift] Re: Sample applications are somewhat slow - is Lift slow ?

2009-05-04 Thread Derek Chen-Becker
Just to throw in another data point, I ran the tests on my AMD Phenom X2 720
(3 cores, 6GB of RAM):

I generated the archetype exactly as you have it here.

Ran "mvn -Drun.mode=production -Djetty.port=9090 jetty:run"

Output from Apache Bench:

$ ab -c 10 -n 2 http://192.168.2.254:9090/user_mgt/login
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking 192.168.2.254 (be patient)
Completed 2000 requests
Completed 4000 requests
Completed 6000 requests
Completed 8000 requests
Completed 1 requests
Completed 12000 requests
Completed 14000 requests
Completed 16000 requests
Completed 18000 requests
Completed 2 requests
Finished 2 requests


Server Software:Jetty(6.1.16)
Server Hostname:192.168.2.254
Server Port:9090

Document Path:  /user_mgt/login
Document Length:3635 bytes

Concurrency Level:  10
Time taken for tests:   37.110 seconds
Complete requests:  2
Failed requests:10191
   (Connect: 0, Receive: 0, Length: 10191, Exceptions: 0)
Write errors:   0
Total transferred:  79276096 bytes
HTML transferred:   72626584 bytes
Requests per second:538.94 [#/sec] (mean)
Time per request:   18.555 [ms] (mean)
Time per request:   1.855 [ms] (mean, across all concurrent requests)
Transfer rate:  2086.18 [Kbytes/sec] received

Connection Times (ms)
  min  mean[+/-sd] median   max
Connect:00   0.0  0   1
Processing: 1   18  40.8 111428
Waiting:1   18  39.9 111414
Total:  1   19  40.8 111428

Percentage of the requests served within a certain time (ms)
  50% 11
  66% 16
  75% 20
  80% 23
  90% 36
  95% 54
  98% 78
  99%100
 100%   1428 (longest request)


On Mon, May 4, 2009 at 3:16 PM, David Pollak
wrote:

> Daniel,
>
> I did a little measurement of Lift and did some tuning.  On my Core 920
> machine with 12GB of RAM running Ubuntu 9.04 and the JDK 1.6.0_13 in 64 bit
> mode with Tomcat 6.0.18 (I ran into some bugs in Jetty while measuring with
> ab).  My baseline running (both locally and across the network)
>
> ab -c 10 -n 2 http://yak.local:8080/user_mgt/login
>
> I was seeing about 1,500 pages/second.  I used YourKit to do some profiling
> and improved performance on my box to about 2,200 pages/second.  Here are
> the steps I went through.  I created a new project:
>
> d...@yak:~/benchmark$ mvn archetype:create -U
> -DarchetypeGroupId=net.liftweb -DarchetypeArtifactId=lift-archetype-basic
> -DarchetypeVersion=1.1-SNAPSHOT -DremoteRepositories=
> http://scala-tools.org/repo-snapshots   -DgroupId=com.liftcode
> -DartifactId=benchmark
>
> I cd'ed into benchmark and typed "mvn clean install"  I copied the
> "target/benchmark-1.0-SNAPSHOT" directory into Tomcat's webapps directory
> and renamed the directory "ROOT".  I did export
> JAVA_OPTS="-Drun.mode=production" to make sure Lift runs in production
> mode.  I started Tomcat with ./bin/startup.sh
>
> Then I ran:
>
> d...@yak:~/tmp$ ab -c 10 -n 2 http://localhost:8080/user_mgt/login
>
> I did this and discarded the results because this will "warm up" the
> HotSpot compiler.  At the end of this run, the JVM should have optimized
> most of the Lift-related classes.  Next, I re-ran the command:
> d...@yak:~/tmp$ ab -c 10 -n 2 http://localhost:8080/user_mgt/login
> This is ApacheBench, Version 2.3 <$Revision: 655654 $>
> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
> Licensed to The Apache Software Foundation, http://www.apache.org/
>
> Benchmarking localhost (be patient)
> Completed 2000 requests
> Completed 4000 requests
> Completed 6000 requests
> Completed 8000 requests
> Completed 1 requests
> Completed 12000 requests
> Completed 14000 requests
> Completed 16000 requests
> Completed 18000 requests
> Completed 2 requests
> Finished 2 requests
>
>
> Server Software:Apache-Coyote/1.1
> Server Hostname:localhost
> Server Port:8080
>
> Document Path:  /user_mgt/login
> Document Length:3768 bytes
>
> Concurrency Level:  10
> Time taken for tests:   9.156 seconds
> Complete requests:  2
> Failed requests:0
> Write errors:   0
> Total transferred:  8362 bytes
> HTML transferred:   7536 bytes
> Requests per second:2184.33 [#/sec] (mean)
> Time per request:   4.578 [ms] (mean)
> Time per request:   0.458 [ms] (mean, across all concurrent requests)
> Transfer rate:  8918.62 [Kbytes/sec] received
>
> Connection Times (ms)
>   min  mean[+/-sd] median   max
> Connect:01   0.9  0   8
> Processing: 14  18.5  3 788
> Waiting:04  18.4  2 788
> Total:  15  18.5  3 788
> WARNIN

[Lift] Re: how to hide /display div tag in lift

2009-05-04 Thread Timothy Perrett

Just my two pence, but id got for chooseTemplate. If it helps, I
discuss using chooseTemplate in this article: http://is.gd/sfyT

Cheers, Tim

On May 4, 3:33 pm, "marius d."  wrote:
> There are so many ways ...
>
> 1. Use chooseTemplate technique. I think the examples application
> from /sites uses this.
> 2. In the snippet you have the snippet content and you can just strip
> it out
> 3. You can have a little JavaScript that is called when the page loads
> that shows or hides the div ... if you need something more dynamic.
>
> Br's,
> Marius
>
> On May 4, 1:28 pm, pravin  wrote:
>
>
>
> > HI,
>
> > I want to hide /display div tag.
> > how can i controlled it from my snippet?
> > my div tag contain table tag.
>
> > 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: Sample applications are somewhat slow - is Lift slow ?

2009-05-04 Thread David Pollak
Derek,
Please note that about half of the requests failed in Jetty.  Jetty does not
seem to be explicitly closing the NIO sockets leading to an out of IO
descriptor problem... that's why I used Tomcat.

Thanks,

David

On Mon, May 4, 2009 at 2:47 PM, Derek Chen-Becker wrote:

> Just to throw in another data point, I ran the tests on my AMD Phenom X2
> 720 (3 cores, 6GB of RAM):
>
> I generated the archetype exactly as you have it here.
>
> Ran "mvn -Drun.mode=production -Djetty.port=9090 jetty:run"
>
> Output from Apache Bench:
>
> $ ab -c 10 -n 2 http://192.168.2.254:9090/user_mgt/login
> This is ApacheBench, Version 2.3 <$Revision: 655654 $>
> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
> Licensed to The Apache Software Foundation, http://www.apache.org/
>
> Benchmarking 192.168.2.254 (be patient)
> Completed 2000 requests
> Completed 4000 requests
> Completed 6000 requests
> Completed 8000 requests
> Completed 1 requests
> Completed 12000 requests
> Completed 14000 requests
> Completed 16000 requests
> Completed 18000 requests
> Completed 2 requests
> Finished 2 requests
>
>
> Server Software:Jetty(6.1.16)
> Server Hostname:192.168.2.254
> Server Port:9090
>
> Document Path:  /user_mgt/login
> Document Length:3635 bytes
>
> Concurrency Level:  10
> Time taken for tests:   37.110 seconds
> Complete requests:  2
> Failed requests:10191
>(Connect: 0, Receive: 0, Length: 10191, Exceptions: 0)
> Write errors:   0
> Total transferred:  79276096 bytes
> HTML transferred:   72626584 bytes
> Requests per second:538.94 [#/sec] (mean)
> Time per request:   18.555 [ms] (mean)
> Time per request:   1.855 [ms] (mean, across all concurrent requests)
> Transfer rate:  2086.18 [Kbytes/sec] received
>
> Connection Times (ms)
>   min  mean[+/-sd] median   max
> Connect:00   0.0  0   1
> Processing: 1   18  40.8 111428
> Waiting:1   18  39.9 111414
> Total:  1   19  40.8 111428
>
> Percentage of the requests served within a certain time (ms)
>   50% 11
>   66% 16
>   75% 20
>   80% 23
>   90% 36
>   95% 54
>   98% 78
>   99%100
>  100%   1428 (longest request)
>
>
> On Mon, May 4, 2009 at 3:16 PM, David Pollak <
> feeder.of.the.be...@gmail.com> wrote:
>
>> Daniel,
>>
>> I did a little measurement of Lift and did some tuning.  On my Core 920
>> machine with 12GB of RAM running Ubuntu 9.04 and the JDK 1.6.0_13 in 64 bit
>> mode with Tomcat 6.0.18 (I ran into some bugs in Jetty while measuring with
>> ab).  My baseline running (both locally and across the network)
>>
>> ab -c 10 -n 2 http://yak.local:8080/user_mgt/login
>>
>> I was seeing about 1,500 pages/second.  I used YourKit to do some
>> profiling and improved performance on my box to about 2,200 pages/second.
>> Here are the steps I went through.  I created a new project:
>>
>> d...@yak:~/benchmark$ mvn archetype:create -U
>> -DarchetypeGroupId=net.liftweb -DarchetypeArtifactId=lift-archetype-basic
>> -DarchetypeVersion=1.1-SNAPSHOT -DremoteRepositories=
>> http://scala-tools.org/repo-snapshots   -DgroupId=com.liftcode
>> -DartifactId=benchmark
>>
>> I cd'ed into benchmark and typed "mvn clean install"  I copied the
>> "target/benchmark-1.0-SNAPSHOT" directory into Tomcat's webapps directory
>> and renamed the directory "ROOT".  I did export
>> JAVA_OPTS="-Drun.mode=production" to make sure Lift runs in production
>> mode.  I started Tomcat with ./bin/startup.sh
>>
>> Then I ran:
>>
>> d...@yak:~/tmp$ ab -c 10 -n 2 http://localhost:8080/user_mgt/login
>>
>> I did this and discarded the results because this will "warm up" the
>> HotSpot compiler.  At the end of this run, the JVM should have optimized
>> most of the Lift-related classes.  Next, I re-ran the command:
>> d...@yak:~/tmp$ ab -c 10 -n 2 http://localhost:8080/user_mgt/login
>> This is ApacheBench, Version 2.3 <$Revision: 655654 $>
>> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
>> Licensed to The Apache Software Foundation, http://www.apache.org/
>>
>> Benchmarking localhost (be patient)
>> Completed 2000 requests
>> Completed 4000 requests
>> Completed 6000 requests
>> Completed 8000 requests
>> Completed 1 requests
>> Completed 12000 requests
>> Completed 14000 requests
>> Completed 16000 requests
>> Completed 18000 requests
>> Completed 2 requests
>> Finished 2 requests
>>
>>
>> Server Software:Apache-Coyote/1.1
>> Server Hostname:localhost
>> Server Port:8080
>>
>> Document Path:  /user_mgt/login
>> Document Length:3768 bytes
>>
>> Concurrency Level:  10
>> Time taken for tests:   9.156 seconds
>> Complete requests:  2
>> Failed requests:0
>> Write errors:   0
>> Total transferred:  8362 bytes
>> HTML transferred:   7536

[Lift] Re: Sample applications are somewhat slow - is Lift slow ?

2009-05-04 Thread Derek Chen-Becker
Yeah, I just noticed that on my jetty console. Bummer.

On Mon, May 4, 2009 at 3:59 PM, David Pollak
wrote:

> Derek,
> Please note that about half of the requests failed in Jetty.  Jetty does
> not seem to be explicitly closing the NIO sockets leading to an out of IO
> descriptor problem... that's why I used Tomcat.
>
> Thanks,
>
> David
>
>
> On Mon, May 4, 2009 at 2:47 PM, Derek Chen-Becker 
> wrote:
>
>> Just to throw in another data point, I ran the tests on my AMD Phenom X2
>> 720 (3 cores, 6GB of RAM):
>>
>> I generated the archetype exactly as you have it here.
>>
>> Ran "mvn -Drun.mode=production -Djetty.port=9090 jetty:run"
>>
>> Output from Apache Bench:
>>
>> $ ab -c 10 -n 2 http://192.168.2.254:9090/user_mgt/login
>> This is ApacheBench, Version 2.3 <$Revision: 655654 $>
>> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
>> Licensed to The Apache Software Foundation, http://www.apache.org/
>>
>> Benchmarking 192.168.2.254 (be patient)
>> Completed 2000 requests
>> Completed 4000 requests
>> Completed 6000 requests
>> Completed 8000 requests
>> Completed 1 requests
>> Completed 12000 requests
>> Completed 14000 requests
>> Completed 16000 requests
>> Completed 18000 requests
>> Completed 2 requests
>> Finished 2 requests
>>
>>
>> Server Software:Jetty(6.1.16)
>> Server Hostname:192.168.2.254
>> Server Port:9090
>>
>> Document Path:  /user_mgt/login
>> Document Length:3635 bytes
>>
>> Concurrency Level:  10
>> Time taken for tests:   37.110 seconds
>> Complete requests:  2
>> Failed requests:10191
>>(Connect: 0, Receive: 0, Length: 10191, Exceptions: 0)
>> Write errors:   0
>> Total transferred:  79276096 bytes
>> HTML transferred:   72626584 bytes
>> Requests per second:538.94 [#/sec] (mean)
>> Time per request:   18.555 [ms] (mean)
>> Time per request:   1.855 [ms] (mean, across all concurrent requests)
>> Transfer rate:  2086.18 [Kbytes/sec] received
>>
>> Connection Times (ms)
>>   min  mean[+/-sd] median   max
>> Connect:00   0.0  0   1
>> Processing: 1   18  40.8 111428
>> Waiting:1   18  39.9 111414
>> Total:  1   19  40.8 111428
>>
>> Percentage of the requests served within a certain time (ms)
>>   50% 11
>>   66% 16
>>   75% 20
>>   80% 23
>>   90% 36
>>   95% 54
>>   98% 78
>>   99%100
>>  100%   1428 (longest request)
>>
>>
>>  On Mon, May 4, 2009 at 3:16 PM, David Pollak <
>> feeder.of.the.be...@gmail.com> wrote:
>>
>>>  Daniel,
>>>
>>> I did a little measurement of Lift and did some tuning.  On my Core 920
>>> machine with 12GB of RAM running Ubuntu 9.04 and the JDK 1.6.0_13 in 64 bit
>>> mode with Tomcat 6.0.18 (I ran into some bugs in Jetty while measuring with
>>> ab).  My baseline running (both locally and across the network)
>>>
>>> ab -c 10 -n 2 http://yak.local:8080/user_mgt/login
>>>
>>> I was seeing about 1,500 pages/second.  I used YourKit to do some
>>> profiling and improved performance on my box to about 2,200 pages/second.
>>> Here are the steps I went through.  I created a new project:
>>>
>>> d...@yak:~/benchmark$ mvn archetype:create -U
>>> -DarchetypeGroupId=net.liftweb -DarchetypeArtifactId=lift-archetype-basic
>>> -DarchetypeVersion=1.1-SNAPSHOT -DremoteRepositories=
>>> http://scala-tools.org/repo-snapshots   -DgroupId=com.liftcode
>>> -DartifactId=benchmark
>>>
>>> I cd'ed into benchmark and typed "mvn clean install"  I copied the
>>> "target/benchmark-1.0-SNAPSHOT" directory into Tomcat's webapps directory
>>> and renamed the directory "ROOT".  I did export
>>> JAVA_OPTS="-Drun.mode=production" to make sure Lift runs in production
>>> mode.  I started Tomcat with ./bin/startup.sh
>>>
>>> Then I ran:
>>>
>>> d...@yak:~/tmp$ ab -c 10 -n 2 http://localhost:8080/user_mgt/login
>>>
>>> I did this and discarded the results because this will "warm up" the
>>> HotSpot compiler.  At the end of this run, the JVM should have optimized
>>> most of the Lift-related classes.  Next, I re-ran the command:
>>> d...@yak:~/tmp$ ab -c 10 -n 2 http://localhost:8080/user_mgt/login
>>> This is ApacheBench, Version 2.3 <$Revision: 655654 $>
>>> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
>>> Licensed to The Apache Software Foundation, http://www.apache.org/
>>>
>>> Benchmarking localhost (be patient)
>>> Completed 2000 requests
>>> Completed 4000 requests
>>> Completed 6000 requests
>>> Completed 8000 requests
>>> Completed 1 requests
>>> Completed 12000 requests
>>> Completed 14000 requests
>>> Completed 16000 requests
>>> Completed 18000 requests
>>> Completed 2 requests
>>> Finished 2 requests
>>>
>>>
>>> Server Software:Apache-Coyote/1.1
>>> Server Hostname:localhost
>>> Server Port:8080
>>>
>>> Document Path:  /user_mgt/login
>>> Document Len

[Lift] Re: Sample applications are somewhat slow - is Lift slow ?

2009-05-04 Thread David Pollak
On my AMD box (AMD Athlon(tm) 64 X2 Dual Core Processor 3800+) with about
800MB of RAM (part of the RAM is used for the video controller), I started
Tomcat with:

export JAVA_OPTS="-Drun.mode=production -server -Xmx650M "

and here are the results:

d...@testomatic:~/apache-tomcat-6.0.18$ ab -c 10 -n 2
http://localhost:8080/user_mgt/login
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking localhost (be patient)
Completed 2000 requests
Completed 4000 requests
Completed 6000 requests
Completed 8000 requests
Completed 1 requests
Completed 12000 requests
Completed 14000 requests
Completed 16000 requests
Completed 18000 requests
Completed 2 requests
Finished 2 requests


Server Software:Apache-Coyote/1.1
Server Hostname:localhost
Server Port:8080

Document Path:  /user_mgt/login
Document Length:3768 bytes

Concurrency Level:  10
Time taken for tests:   54.032 seconds
Complete requests:  2
Failed requests:0
Write errors:   0
Total transferred:  8362 bytes
HTML transferred:   7536 bytes
Requests per second:370.15 [#/sec] (mean)
Time per request:   27.016 [ms] (mean)
Time per request:   2.702 [ms] (mean, across all concurrent requests)
Transfer rate:  1511.33 [Kbytes/sec] received

Connection Times (ms)
  min  mean[+/-sd] median   max
Connect:00   1.4  0  35
Processing: 2   27  42.5  9 974
Waiting:0   25  40.6  8 974
Total:  2   27  42.5 10 974

Percentage of the requests served within a certain time (ms)
  50% 10
  66% 23
  75% 35
  80% 44
  90% 72
  95% 97
  98%132
  99%156
 100%974 (longest request)

So, on a box similar to yours, I'm seeing about 6x better performance.

Thanks,

David

On Mon, May 4, 2009 at 2:16 PM, David Pollak
wrote:

> Daniel,
>
> I did a little measurement of Lift and did some tuning.  On my Core 920
> machine with 12GB of RAM running Ubuntu 9.04 and the JDK 1.6.0_13 in 64 bit
> mode with Tomcat 6.0.18 (I ran into some bugs in Jetty while measuring with
> ab).  My baseline running (both locally and across the network)
>
> ab -c 10 -n 2 http://yak.local:8080/user_mgt/login
>
> I was seeing about 1,500 pages/second.  I used YourKit to do some profiling
> and improved performance on my box to about 2,200 pages/second.  Here are
> the steps I went through.  I created a new project:
>
> d...@yak:~/benchmark$ mvn archetype:create -U
> -DarchetypeGroupId=net.liftweb -DarchetypeArtifactId=lift-archetype-basic
> -DarchetypeVersion=1.1-SNAPSHOT -DremoteRepositories=
> http://scala-tools.org/repo-snapshots   -DgroupId=com.liftcode
> -DartifactId=benchmark
>
> I cd'ed into benchmark and typed "mvn clean install"  I copied the
> "target/benchmark-1.0-SNAPSHOT" directory into Tomcat's webapps directory
> and renamed the directory "ROOT".  I did export
> JAVA_OPTS="-Drun.mode=production" to make sure Lift runs in production
> mode.  I started Tomcat with ./bin/startup.sh
>
> Then I ran:
>
> d...@yak:~/tmp$ ab -c 10 -n 2 http://localhost:8080/user_mgt/login
>
> I did this and discarded the results because this will "warm up" the
> HotSpot compiler.  At the end of this run, the JVM should have optimized
> most of the Lift-related classes.  Next, I re-ran the command:
> d...@yak:~/tmp$ ab -c 10 -n 2 http://localhost:8080/user_mgt/login
> This is ApacheBench, Version 2.3 <$Revision: 655654 $>
> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
> Licensed to The Apache Software Foundation, http://www.apache.org/
>
> Benchmarking localhost (be patient)
> Completed 2000 requests
> Completed 4000 requests
> Completed 6000 requests
> Completed 8000 requests
> Completed 1 requests
> Completed 12000 requests
> Completed 14000 requests
> Completed 16000 requests
> Completed 18000 requests
> Completed 2 requests
> Finished 2 requests
>
>
> Server Software:Apache-Coyote/1.1
> Server Hostname:localhost
> Server Port:8080
>
> Document Path:  /user_mgt/login
> Document Length:3768 bytes
>
> Concurrency Level:  10
> Time taken for tests:   9.156 seconds
> Complete requests:  2
> Failed requests:0
> Write errors:   0
> Total transferred:  8362 bytes
> HTML transferred:   7536 bytes
> Requests per second:2184.33 [#/sec] (mean)
> Time per request:   4.578 [ms] (mean)
> Time per request:   0.458 [ms] (mean, across all concurrent requests)
> Transfer rate:  8918.62 [Kbytes/sec] received
>
> Connection Times (ms)
>   min  mean[+/-sd] median   max
> Connect:01   0.9  0   8
> Processing: 14  18.5  3 788
> Waiting:04  18.4  2   

[Lift] Re: Sample applications are somewhat slow - is Lift slow ?

2009-05-04 Thread Timothy Perrett
I presume this is a known jetty 6 defect? - perhaps jetty 7 would  
perform better?

Cheers, Tim

Sent from my iPhone

On 4 May 2009, at 23:04, Derek Chen-Becker   
wrote:

> Yeah, I just noticed that on my jetty console. Bummer.
>
> On Mon, May 4, 2009 at 3:59 PM, David Pollak  > wrote:
> Derek,
>
> Please note that about half of the requests failed in Jetty.  Jetty  
> does not seem to be explicitly closing the NIO sockets leading to an  
> out of IO descriptor problem... that's why I used Tomcat.
>
> Thanks,
>
> David
>
>
> On Mon, May 4, 2009 at 2:47 PM, Derek Chen-Becker  > wrote:
> Just to throw in another data point, I ran the tests on my AMD  
> Phenom X2 720 (3 cores, 6GB of RAM):
>
> I generated the archetype exactly as you have it here.
>
> Ran "mvn -Drun.mode=production -Djetty.port=9090 jetty:run"
>
> Output from Apache Bench:
>
> $ ab -c 10 -n 2 http://192.168.2.254:9090/user_mgt/login
>
> This is ApacheBench, Version 2.3 <$Revision: 655654 $>
> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
> Licensed to The Apache Software Foundation, http://www.apache.org/
>
> Benchmarking 192.168.2.254 (be patient)
>
> Completed 2000 requests
> Completed 4000 requests
> Completed 6000 requests
> Completed 8000 requests
> Completed 1 requests
> Completed 12000 requests
> Completed 14000 requests
> Completed 16000 requests
> Completed 18000 requests
> Completed 2 requests
> Finished 2 requests
>
>
> Server Software:Jetty(6.1.16)
> Server Hostname:192.168.2.254
> Server Port:9090
>
>
> Document Path:  /user_mgt/login
> Document Length:3635 bytes
>
> Concurrency Level:  10
> Time taken for tests:   37.110 seconds
> Complete requests:  2
> Failed requests:10191
>(Connect: 0, Receive: 0, Length: 10191, Exceptions: 0)
> Write errors:   0
> Total transferred:  79276096 bytes
> HTML transferred:   72626584 bytes
> Requests per second:538.94 [#/sec] (mean)
> Time per request:   18.555 [ms] (mean)
> Time per request:   1.855 [ms] (mean, across all concurrent  
> requests)
> Transfer rate:  2086.18 [Kbytes/sec] received
>
>
> Connection Times (ms)
>   min  mean[+/-sd] median   max
> Connect:00   0.0  0   1
> Processing: 1   18  40.8 111428
> Waiting:1   18  39.9 111414
> Total:  1   19  40.8 111428
>
>
> Percentage of the requests served within a certain time (ms)
>   50% 11
>   66% 16
>   75% 20
>   80% 23
>   90% 36
>   95% 54
>   98% 78
>   99%100
>  100%   1428 (longest request)
>
>
> On Mon, May 4, 2009 at 3:16 PM, David Pollak  > wrote:
> Daniel,
>
> I did a little measurement of Lift and did some tuning.  On my Core  
> 920 machine with 12GB of RAM running Ubuntu 9.04 and the JDK  
> 1.6.0_13 in 64 bit mode with Tomcat 6.0.18 (I ran into some bugs in  
> Jetty while measuring with ab).  My baseline running (both locally  
> and across the network)
>
> ab -c 10 -n 2 http://yak.local:8080/user_mgt/login
>
> I was seeing about 1,500 pages/second.  I used YourKit to do some  
> profiling and improved performance on my box to about 2,200 pages/ 
> second.  Here are the steps I went through.  I created a new project:
>
> d...@yak:~/benchmark$ mvn archetype:create -U   - 
> DarchetypeGroupId=net.liftweb -DarchetypeArtifactId=lift-archetype- 
> basic -DarchetypeVersion=1.1-SNAPSHOT 
> -DremoteRepositories=http://scala-tools.org/repo-snapshots 
>-DgroupId=com.liftcode -DartifactId=benchmark
>
> I cd'ed into benchmark and typed "mvn clean install"  I copied the  
> "target/benchmark-1.0-SNAPSHOT" directory into Tomcat's webapps  
> directory and renamed the directory "ROOT".  I did export  
> JAVA_OPTS="-Drun.mode=production" to make sure Lift runs in  
> production mode.  I started Tomcat with ./bin/startup.sh
>
> Then I ran:
>
> d...@yak:~/tmp$ ab -c 10 -n 2 http://localhost:8080/user_mgt/login
>
> I did this and discarded the results because this will "warm up" the  
> HotSpot compiler.  At the end of this run, the JVM should have  
> optimized most of the Lift-related classes.  Next, I re-ran the  
> command:
> d...@yak:~/tmp$ ab -c 10 -n 2 http://localhost:8080/user_mgt/login
> This is ApacheBench, Version 2.3 <$Revision: 655654 $>
> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
> Licensed to The Apache Software Foundation, http://www.apache.org/
>
> Benchmarking localhost (be patient)
> Completed 2000 requests
> Completed 4000 requests
> Completed 6000 requests
> Completed 8000 requests
> Completed 1 requests
> Completed 12000 requests
> Completed 14000 requests
> Completed 16000 requests
> Completed 18000 requests
> Completed 2 requests
> Finished 2 requests
>
>
> Server Software:Apache-Coyote/1.1
> Server Hostname:localhost
> Server Port:8080
>
> Document Path:  /user_mgt/l

[Lift] Some Lift enhancements

2009-05-04 Thread David Pollak
Folks,

Based on feedback, I've made some enhancements to Lift:

   - Template caching is on by default when in Production mode
   - Method lookup caching is on by default in Production mode for snippet
   dispatching
   - In development mode, snippet failures will be displayed in the browser
   nice and friendly like
   - In development mode, pages not served because they are not listed in
   SiteMap will result in 403's with friendly error messages

While I was profiling the code today, I found some code paths that we can
tighten up.  There are 3 or 4 times per page render that the DOM is
re-written.  We should be able to get that down to 1 time and that should
double the speed of page rendering... although 400 or so pages/per second on
an Amazon EC2-style box ain't too shabby.

Thanks,

David

-- 
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: Cannot access html files other than index.html in GAE using lift

2009-05-04 Thread David Pollak
Dan,

You'll now receive a much more helpful 403 message if you're running in
development mode.

Thanks,

David

On Sun, May 3, 2009 at 12:21 PM, Dan Greening  wrote:

>
> I just broke my teeth on this problem also (and 2 days wasted later I
> discover this thread).  I would say "Doh!", but this is hardly a Doh
> type of thing.
>
> Security is important, but also as a new framework, you want rapid
> uptake by people who won't read 5 chapters of a book before trying
> something out.  Many of us (most of us?) read the minimum amount
> before jumping in and trying something.
>
> Here is my proposed user story:  As a new Lift user, I can copy-paste
> lift-archetype-blank files into my existing web site and gradually add
> Lift functionality while unmodified static and JSP content continues
> to work.
>
> Perhaps this could be done by having a simple method on SiteMap to
> disable access control.  (And then use it in lift-archetype-blank,
> with comments of course.)
>
> Many people will likely do what I did, trying to figure out how to
> turn on logging levels, etc. because the behavior they expect is not
> what Lift delivers, and then they blame themselves for doing something
> obviously stupid.  (But failing to read 5 chapters is not "obviously
> stupid".)
>
> Dan Greening
>
> On Apr 23, 10:01 am, David Pollak 
> wrote:
> > On Thu, Apr 23, 2009 at 9:59 AM, Lee Mighdoll 
> wrote:
> > > Ah, thanks for the explanation.
> >
> > > Perhaps a site map entry for /static in the default archtetype?
> >
> > K... added
> >
> >
> >
> >
> >
> > > Lee
> >
> > > On Thu, Apr 23, 2009 at 9:51 AM, David Pollak <
> > > feeder.of.the.be...@gmail.com> wrote:
> >
> > >> On Thu, Apr 23, 2009 at 9:48 AM, Lee Mighdoll  >wrote:
> >
> > >>> Since lift is a servlet filter, can it simply pass through requests
> for
> > >>> unmapped html pages and let the web container serve them or send a
> 404?  I
> > >>> don't quite understand the security issue, though.
> >
> > >> Security issues:
> >
> > >>- Serving "turd" pages left behind by the developers or from an
> older
> > >>version of the app
> > >>- Serving pages that can only be viewed if you're logged in
> >
> > >>> Lee
> >
> > >>> re: documentation, I tripped on this getting started as well.
> >
> > >>> On Thu, Apr 23, 2009 at 8:45 AM, David Pollak <
> > >>> feeder.of.the.be...@gmail.com> wrote:
> >
> >  On Thu, Apr 23, 2009 at 8:30 AM, Andrew Scherpbier <
> >  and...@scherpbier.org> wrote:
> >
> > > Hi kkarad,
> > > I'm a fellow newbie to lift (and scala) and ran into the same
> issue.  I
> > > believe the solution is simple:  You need to create entries in your
> > > SiteMap for every page.  You'll need to do that in your Boot.scala.
> > > Make them Hidden if you don't want them displayed in the menu; you
> > > still
> > > need those entries though.
> >
> > > I suggest reading chapter 5 in the "Exploring Lift" book that is
> > > available as a draft PDF.
> > > BTW, to the authors of that book:  I spent a lot of time trying to
> > > figure out this exact same issue.  Could you make this more
> prominent?
> > > Some examples of using multiple pages would be helpful.  Since the
> > > SiteMap is so important, I think it would be good to add more
> coverage
> > > of it in chapter 3.
> >
> >  Andrew,
> >
> >  Thanks for your comments.
> >
> >  There's a tension in Lift between quick & simple and maintainable &
> >  secure.  SiteMap is a little heavier weight than simple routing
> tables (or
> >  doing things by default).  On the other hand, SiteMap gives you
> security,
> >  menu generation, bread crumbs, and much, much more.  Perhaps I'll
> add
> >  something to the 404 when running in development mode (or bespin
> mode).
> >
> >  Thanks,
> >
> >  David
> >
> > > Cheers!
> >
> > > --Andrew
> >
> > > kkarad wrote:
> > > > Hi all,
> >
> > > > I am new to lift web framework. Recently I started working on a
> test
> > > > project using google app engine for java and lift. I followed the
> > > > Atsuhiko Yamanaka's instructions and I was able to deploy and run
> the
> > > > helloworld example on the google app cloud.
> >
> > > > The problem I am facing now is that I cannot access deployed html
> > > > files other than the default (index.html). The problem occurs in
> the
> > > > dev_appserver provided by the google app engine sdk.
> >
> > > > For instance, the fileupload.xthml file under the webapp folder
> > > cannot
> > > > be accessed using thehttp://localhost:8080/fileupload[or with the
> > > > suffix]. The error message I get back is: The Requested URL / was
> not
> > > > found on this server
> >
> > > > Due to my lack of lift knowledge I am not able to identify if its
> a
> > > > lift or gae/j problem. Could you please help me?
> >
> > > > Bellow I include the content of web.xml, appengine-web.xml and
> the

[Lift] Re: Some Lift enhancements

2009-05-04 Thread Derek Chen-Becker
Very nice.

On Mon, May 4, 2009 at 4:29 PM, David Pollak
wrote:

> Folks,
>
> Based on feedback, I've made some enhancements to Lift:
>
>- Template caching is on by default when in Production mode
>- Method lookup caching is on by default in Production mode for snippet
>dispatching
>- In development mode, snippet failures will be displayed in the
>browser nice and friendly like
>- In development mode, pages not served because they are not listed in
>SiteMap will result in 403's with friendly error messages
>
> While I was profiling the code today, I found some code paths that we can
> tighten up.  There are 3 or 4 times per page render that the DOM is
> re-written.  We should be able to get that down to 1 time and that should
> double the speed of page rendering... although 400 or so pages/per second on
> an Amazon EC2-style box ain't too shabby.
>
> Thanks,
>
> David
>
> --
> 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] Compile error with 1.1-M1 and CRUDify

2009-05-04 Thread jon

Hi,

I saw the following after moving my project from lift 1.0 to 1.1-M1:

[WARNING]  self-type com.company.model.City does not conform to
net.liftweb.mapper.CRUDify[Long,com.company.model.City]'s selftype
net.liftweb.mapper.CRUDify[Long,com.company.model.City] with
com.company.model.City with net.liftweb.mapper.KeyedMetaMapper
[Long,com.company.model.City]
[WARNING] class City extends LongKeyedMapper[City] with IdPK with
CRUDify[Long, City] {

I fixed by moving the CRUDify trait from the class to the meta object
definition.  Is that correct usage?

Was the CRUDify trait always supposed to be used on the meta object
(the liftbook example shows the trait on the class)?

Thanks,

Jon

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



[Lift] Re: Compile error with 1.1-M1 and CRUDify

2009-05-04 Thread David Pollak
On Mon, May 4, 2009 at 4:10 PM, jon  wrote:

>
> Hi,
>
> I saw the following after moving my project from lift 1.0 to 1.1-M1:
>
> [WARNING]  self-type com.company.model.City does not conform to
> net.liftweb.mapper.CRUDify[Long,com.company.model.City]'s selftype
> net.liftweb.mapper.CRUDify[Long,com.company.model.City] with
> com.company.model.City with net.liftweb.mapper.KeyedMetaMapper
> [Long,com.company.model.City]
> [WARNING] class City extends LongKeyedMapper[City] with IdPK with
> CRUDify[Long, City] {
>

CRUDify should be on the Meta object, not on the model class.  I updated
CRUDify to require that in the trait.


>
> I fixed by moving the CRUDify trait from the class to the meta object
> definition.  Is that correct usage?


Yes.


>
>
> Was the CRUDify trait always supposed to be used on the meta object
> (the liftbook example shows the trait on the class)?
>
> Thanks,
>
> Jon
>
> >
>


-- 
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: Some Lift enhancements

2009-05-04 Thread sailormoo...@gmail.com

Hi :

  Can you explain a bit more how template caching works?

--~--~-~--~~~---~--~~
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: Lift documentation -- Attention newcomers (and everyone else)!

2009-05-04 Thread Chris H.

Hi Chas,

Glad to see that there will be some time spent expanding and refining
the Lift documentation, good docs are definitely the sign of a well
run project. I am one of those lurkers you speak about, so I thought
I'd speak up and give my input.

I would like to see explanations on creating various concepts, useful
across many different site types, with a discussion on the how and why
they would be implemented the way they are in Lift.

This post from David:

http://groups.google.com/group/liftweb/browse_thread/thread/17e08ec0422721db#

which explains both why there is no baked in User concept in Lift and
how one would go about creating a User concept is exactly what I mean.
If this type of thing was formalized into some documentation I think
it would help greatly in understanding Lift.

-Chris

On Apr 21, 3:38 pm, "Charles F. Munat"  wrote:
> I am charged with coming up with a site map/information architecture for
> our hopefully-soon-to-be-updated wiki.
>
> What would most benefit you on a documentation wiki? What sorts of
> things are you having the most problems with?
>
> Please submit suggestions for a wiki outline, as well as any other ideas
> you have. For example, ideas on wiki structure are welcome. You could
> even suggest your own outline.
>
> Please participate! Yes, you, lurker! We want to know what you need.
>
> I'll collect all the ideas this weekend, consolidate them, and present a
> suggested outline (road map) for the documentation wiki.
>
> Thanks!
>
> Yes! If you are reading this, then I am talking to you. Speak up.
>
> Chas.

--~--~-~--~~~---~--~~
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: Cannot access html files other than index.html in GAE using lift

2009-05-04 Thread Dan Greening

Thanks David,

Here are two user stories I would like Lift to implement (and I think
would be highly beneficial for Lift uptake):

1. As an application developer, I can easily add Lift to my existing
static web site. My existing static content continues to be displayed
properly, while Lift specific content (registered in SiteMap, contains
lift:XXX XML content) is properly rendered by Lift.

2. As an application developer, I can easily add Lift to my existing
JSP-powered web site. My existing JSP content continues to be
displayed properly, while Lift specific content (registered in
SiteMap, contains lift:XXX XML content) is properly rendered by Lift.

I am actually going through an exercise of rendering all my static
content via Lift 1.1-M1 and it is really painful.  Either I don't know
what I'm doing (entirely possible) or it is not designed to do this
(but it should be).  [Does anyone know which one it is?]

Dan

On May 4, 3:36 pm, David Pollak  wrote:
> Dan,
>
> You'll now receive a much more helpful 403 message if you're running in
> development mode.
>
> Thanks,
>
> David
>
>
>
> On Sun, May 3, 2009 at 12:21 PM, Dan Greening  wrote:
>
> > I just broke my teeth on this problem also (and 2 days wasted later I
> > discover this thread).  I would say "Doh!", but this is hardly a Doh
> > type of thing.
>
> > Security is important, but also as a new framework, you want rapid
> > uptake by people who won't read 5 chapters of a book before trying
> > something out.  Many of us (most of us?) read the minimum amount
> > before jumping in and trying something.
>
> > Here is my proposed user story:  As a new Lift user, I can copy-paste
> > lift-archetype-blank files into my existing web site and gradually add
> > Lift functionality while unmodified static and JSP content continues
> > to work.
>
> > Perhaps this could be done by having a simple method on SiteMap to
> > disable access control.  (And then use it in lift-archetype-blank,
> > with comments of course.)
>
> > Many people will likely do what I did, trying to figure out how to
> > turn on logging levels, etc. because the behavior they expect is not
> > what Lift delivers, and then they blame themselves for doing something
> > obviously stupid.  (But failing to read 5 chapters is not "obviously
> > stupid".)
>
> > Dan Greening
>
> > On Apr 23, 10:01 am, David Pollak 
> > wrote:
> > > On Thu, Apr 23, 2009 at 9:59 AM, Lee Mighdoll 
> > wrote:
> > > > Ah, thanks for the explanation.
>
> > > > Perhaps a site map entry for /static in the default archtetype?
>
> > > K... added
>
> > > > Lee
>
> > > > On Thu, Apr 23, 2009 at 9:51 AM, David Pollak <
> > > > feeder.of.the.be...@gmail.com> wrote:
>
> > > >> On Thu, Apr 23, 2009 at 9:48 AM, Lee Mighdoll  > >wrote:
>
> > > >>> Since lift is a servlet filter, can it simply pass through requests
> > for
> > > >>> unmapped html pages and let the web container serve them or send a
> > 404?  I
> > > >>> don't quite understand the security issue, though.
>
> > > >> Security issues:
>
> > > >>    - Serving "turd" pages left behind by the developers or from an
> > older
> > > >>    version of the app
> > > >>    - Serving pages that can only be viewed if you're logged in
>
> > > >>> Lee
>
> > > >>> re: documentation, I tripped on this getting started as well.
>
> > > >>> On Thu, Apr 23, 2009 at 8:45 AM, David Pollak <
> > > >>> feeder.of.the.be...@gmail.com> wrote:
>
> > >  On Thu, Apr 23, 2009 at 8:30 AM, Andrew Scherpbier <
> > >  and...@scherpbier.org> wrote:
>
> > > > Hi kkarad,
> > > > I'm a fellow newbie to lift (and scala) and ran into the same
> > issue.  I
> > > > believe the solution is simple:  You need to create entries in your
> > > > SiteMap for every page.  You'll need to do that in your Boot.scala.
> > > > Make them Hidden if you don't want them displayed in the menu; you
> > > > still
> > > > need those entries though.
>
> > > > I suggest reading chapter 5 in the "Exploring Lift" book that is
> > > > available as a draft PDF.
> > > > BTW, to the authors of that book:  I spent a lot of time trying to
> > > > figure out this exact same issue.  Could you make this more
> > prominent?
> > > > Some examples of using multiple pages would be helpful.  Since the
> > > > SiteMap is so important, I think it would be good to add more
> > coverage
> > > > of it in chapter 3.
>
> > >  Andrew,
>
> > >  Thanks for your comments.
>
> > >  There's a tension in Lift between quick & simple and maintainable &
> > >  secure.  SiteMap is a little heavier weight than simple routing
> > tables (or
> > >  doing things by default).  On the other hand, SiteMap gives you
> > security,
> > >  menu generation, bread crumbs, and much, much more.  Perhaps I'll
> > add
> > >  something to the 404 when running in development mode (or bespin
> > mode).
>
> > >  Thanks,
>
> > >  David
>
> > > > Cheers!
>
> > > > --Andrew
>
> > > > kk

[Lift] Re: Cannot access html files other than index.html in GAE using lift

2009-05-04 Thread David Pollak
To get both of these user stories, either:
Set the web.xml file to only send Lift-related URLs to the Lift servlet
filter.

Set LiftRules.passNotFoundToChain = true in Boot.scala

The former uses your container's features to only send particular requests.
 The latter tells Lift to pass requests that Lift does not service up the
request chain.


On Mon, May 4, 2009 at 6:35 PM, Dan Greening  wrote:

>
> Thanks David,
>
> Here are two user stories I would like Lift to implement (and I think
> would be highly beneficial for Lift uptake):
>
> 1. As an application developer, I can easily add Lift to my existing
> static web site. My existing static content continues to be displayed
> properly, while Lift specific content (registered in SiteMap, contains
> lift:XXX XML content) is properly rendered by Lift.
>
> 2. As an application developer, I can easily add Lift to my existing
> JSP-powered web site. My existing JSP content continues to be
> displayed properly, while Lift specific content (registered in
> SiteMap, contains lift:XXX XML content) is properly rendered by Lift.
>
> I am actually going through an exercise of rendering all my static
> content via Lift 1.1-M1 and it is really painful.  Either I don't know
> what I'm doing (entirely possible) or it is not designed to do this
> (but it should be).  [Does anyone know which one it is?]
>
> Dan
>
> On May 4, 3:36 pm, David Pollak  wrote:
> > Dan,
> >
> > You'll now receive a much more helpful 403 message if you're running in
> > development mode.
> >
> > Thanks,
> >
> > David
> >
> >
> >
> > On Sun, May 3, 2009 at 12:21 PM, Dan Greening 
> wrote:
> >
> > > I just broke my teeth on this problem also (and 2 days wasted later I
> > > discover this thread).  I would say "Doh!", but this is hardly a Doh
> > > type of thing.
> >
> > > Security is important, but also as a new framework, you want rapid
> > > uptake by people who won't read 5 chapters of a book before trying
> > > something out.  Many of us (most of us?) read the minimum amount
> > > before jumping in and trying something.
> >
> > > Here is my proposed user story:  As a new Lift user, I can copy-paste
> > > lift-archetype-blank files into my existing web site and gradually add
> > > Lift functionality while unmodified static and JSP content continues
> > > to work.
> >
> > > Perhaps this could be done by having a simple method on SiteMap to
> > > disable access control.  (And then use it in lift-archetype-blank,
> > > with comments of course.)
> >
> > > Many people will likely do what I did, trying to figure out how to
> > > turn on logging levels, etc. because the behavior they expect is not
> > > what Lift delivers, and then they blame themselves for doing something
> > > obviously stupid.  (But failing to read 5 chapters is not "obviously
> > > stupid".)
> >
> > > Dan Greening
> >
> > > On Apr 23, 10:01 am, David Pollak 
> > > wrote:
> > > > On Thu, Apr 23, 2009 at 9:59 AM, Lee Mighdoll  >
> > > wrote:
> > > > > Ah, thanks for the explanation.
> >
> > > > > Perhaps a site map entry for /static in the default archtetype?
> >
> > > > K... added
> >
> > > > > Lee
> >
> > > > > On Thu, Apr 23, 2009 at 9:51 AM, David Pollak <
> > > > > feeder.of.the.be...@gmail.com> wrote:
> >
> > > > >> On Thu, Apr 23, 2009 at 9:48 AM, Lee Mighdoll <
> leemighd...@gmail.com
> > > >wrote:
> >
> > > > >>> Since lift is a servlet filter, can it simply pass through
> requests
> > > for
> > > > >>> unmapped html pages and let the web container serve them or send
> a
> > > 404?  I
> > > > >>> don't quite understand the security issue, though.
> >
> > > > >> Security issues:
> >
> > > > >>- Serving "turd" pages left behind by the developers or from an
> > > older
> > > > >>version of the app
> > > > >>- Serving pages that can only be viewed if you're logged in
> >
> > > > >>> Lee
> >
> > > > >>> re: documentation, I tripped on this getting started as well.
> >
> > > > >>> On Thu, Apr 23, 2009 at 8:45 AM, David Pollak <
> > > > >>> feeder.of.the.be...@gmail.com> wrote:
> >
> > > >  On Thu, Apr 23, 2009 at 8:30 AM, Andrew Scherpbier <
> > > >  and...@scherpbier.org> wrote:
> >
> > > > > Hi kkarad,
> > > > > I'm a fellow newbie to lift (and scala) and ran into the same
> > > issue.  I
> > > > > believe the solution is simple:  You need to create entries in
> your
> > > > > SiteMap for every page.  You'll need to do that in your
> Boot.scala.
> > > > > Make them Hidden if you don't want them displayed in the menu;
> you
> > > > > still
> > > > > need those entries though.
> >
> > > > > I suggest reading chapter 5 in the "Exploring Lift" book that
> is
> > > > > available as a draft PDF.
> > > > > BTW, to the authors of that book:  I spent a lot of time trying
> to
> > > > > figure out this exact same issue.  Could you make this more
> > > prominent?
> > > > > Some examples of using multiple pages would be helpful.  Since
> the
> > > > > SiteMap is so impor

[Lift] Re: Some Lift enhancements

2009-05-04 Thread David Pollak
On Mon, May 4, 2009 at 6:27 PM, sailormoo...@gmail.com <
sailormoo...@gmail.com> wrote:

>
> Hi :
>
>  Can you explain a bit more how template caching works?


The first time a template is accessed, it's put into a hashtable so that the
next time its accessed, it doesn't have to be loaded as a resource and it
doesn't have to be parsed.


>
>
> >
>


-- 
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] 1st draft of response to Martin's code challenge for scalable componentized lambda evaluator

2009-05-04 Thread Meredith Gregory
Lifted, Scalad and lasses,

Recently Martin passed along a little code challenge regarding scalable
abstractions for building a little lambda calculus evaluator. i've finally
put together a 1st draft response. i've still got a lot of debugging to do,
but the solution  is
end-to-end.

   - there is a parser and evaluator hosted inside a lift-based
   web-container
   - the parser is built using BNFC and can target
   Java/C#/OCaml/Haskell/F#/...
   - the parser comes with visitor pattern support
   - the evaluator is built in a two-level type style and demonstrates that
   the only OO you need is just enough to make Scala happy -- the abstractions
   are all FP-based

As i said, this is very much a draft and the code falls over most of the
time. But, at this point, it's really a pedagogical device and framework for
hosting and evaluating different solutions.

Again, one the main reasons i see for using Scala is it's seamless interop
with Java. The OCaml solution is intriguing (though ther are some
strangenesses in it that i've yet to grok), but i would like to see that
solution hosted in this manner.

Best wishes,

--greg

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

+1 206.650.3740

http://biosimilarity.blogspot.com

--~--~-~--~~~---~--~~
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: Cannot access html files other than index.html in GAE using lift

2009-05-04 Thread Dan Greening

Thanks, it works!  (It is not in Exploring Lift. Who do I lobby to get
it in?)

I have a feeling there are many hidden treasures in Lift.  I must love
Scala, because I wrote a huge recursive thing to populate a SiteMap.
LOL

Dan

On May 4, 6:43 pm, David Pollak  wrote:
> To get both of these user stories, either:
> Set the web.xml file to only send Lift-related URLs to the Lift servlet
> filter.
>
> Set LiftRules.passNotFoundToChain = true in Boot.scala
>
> The former uses your container's features to only send particular requests.
>  The latter tells Lift to pass requests that Lift does not service up the
> request chain.
>
> On Mon, May 4, 2009 at 6:35 PM, Dan Greening  wrote:
>
> > Thanks David,
>
> > Here are two user stories I would like Lift to implement (and I think
> > would be highly beneficial for Lift uptake):
>
> > 1. As an application developer, I can easily add Lift to my existing
> > static web site. My existing static content continues to be displayed
> > properly, while Lift specific content (registered in SiteMap, contains
> > lift:XXX XML content) is properly rendered by Lift.
>
> > 2. As an application developer, I can easily add Lift to my existing
> > JSP-powered web site. My existing JSP content continues to be
> > displayed properly, while Lift specific content (registered in
> > SiteMap, contains lift:XXX XML content) is properly rendered by Lift.
>
> > I am actually going through an exercise of rendering all my static
> > content via Lift 1.1-M1 and it is really painful.  Either I don't know
> > what I'm doing (entirely possible) or it is not designed to do this
> > (but it should be).  [Does anyone know which one it is?]
>
> > Dan
>
> > On May 4, 3:36 pm, David Pollak  wrote:
> > > Dan,
>
> > > You'll now receive a much more helpful 403 message if you're running in
> > > development mode.
>
> > > Thanks,
>
> > > David
>
> > > On Sun, May 3, 2009 at 12:21 PM, Dan Greening 
> > wrote:
>
> > > > I just broke my teeth on this problem also (and 2 days wasted later I
> > > > discover this thread).  I would say "Doh!", but this is hardly a Doh
> > > > type of thing.
>
> > > > Security is important, but also as a new framework, you want rapid
> > > > uptake by people who won't read 5 chapters of a book before trying
> > > > something out.  Many of us (most of us?) read the minimum amount
> > > > before jumping in and trying something.
>
> > > > Here is my proposed user story:  As a new Lift user, I can copy-paste
> > > > lift-archetype-blank files into my existing web site and gradually add
> > > > Lift functionality while unmodified static and JSP content continues
> > > > to work.
>
> > > > Perhaps this could be done by having a simple method on SiteMap to
> > > > disable access control.  (And then use it in lift-archetype-blank,
> > > > with comments of course.)
>
> > > > Many people will likely do what I did, trying to figure out how to
> > > > turn on logging levels, etc. because the behavior they expect is not
> > > > what Lift delivers, and then they blame themselves for doing something
> > > > obviously stupid.  (But failing to read 5 chapters is not "obviously
> > > > stupid".)
>
> > > > Dan Greening
>
> > > > On Apr 23, 10:01 am, David Pollak 
> > > > wrote:
> > > > > On Thu, Apr 23, 2009 at 9:59 AM, Lee Mighdoll 
> > > > wrote:
> > > > > > Ah, thanks for the explanation.
>
> > > > > > Perhaps a site map entry for /static in the default archtetype?
>
> > > > > K... added
>
> > > > > > Lee
>
> > > > > > On Thu, Apr 23, 2009 at 9:51 AM, David Pollak <
> > > > > > feeder.of.the.be...@gmail.com> wrote:
>
> > > > > >> On Thu, Apr 23, 2009 at 9:48 AM, Lee Mighdoll <
> > leemighd...@gmail.com
> > > > >wrote:
>
> > > > > >>> Since lift is a servlet filter, can it simply pass through
> > requests
> > > > for
> > > > > >>> unmapped html pages and let the web container serve them or send
> > a
> > > > 404?  I
> > > > > >>> don't quite understand the security issue, though.
>
> > > > > >> Security issues:
>
> > > > > >>    - Serving "turd" pages left behind by the developers or from an
> > > > older
> > > > > >>    version of the app
> > > > > >>    - Serving pages that can only be viewed if you're logged in
>
> > > > > >>> Lee
>
> > > > > >>> re: documentation, I tripped on this getting started as well.
>
> > > > > >>> On Thu, Apr 23, 2009 at 8:45 AM, David Pollak <
> > > > > >>> feeder.of.the.be...@gmail.com> wrote:
>
> > > > >  On Thu, Apr 23, 2009 at 8:30 AM, Andrew Scherpbier <
> > > > >  and...@scherpbier.org> wrote:
>
> > > > > > Hi kkarad,
> > > > > > I'm a fellow newbie to lift (and scala) and ran into the same
> > > > issue.  I
> > > > > > believe the solution is simple:  You need to create entries in
> > your
> > > > > > SiteMap for every page.  You'll need to do that in your
> > Boot.scala.
> > > > > > Make them Hidden if you don't want them displayed in the menu;
> > you
> > > > > > still
> > > > > > need those entries though.
>
> > > > > >

[Lift] binder

2009-05-04 Thread Bryan

How can I create a "widget" to render a customized .  This is
probably trivial, but I failed on my first attempt.

object MyButton {
  def red(value: String, func: () => Unit, attrs: (String, String)*):
Elem =
fmapFunc(NFuncHolder(func))(funcName =>
  ... a few
images will go here ... )

and in my snippet

bind("f", xhtml, ...
  "submit" -> MyButton.red("Search", processSearch))

Thanks,
Bryan

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