[Lift] Re: Lift (AsyncWeb || ...)

2009-07-27 Thread marius d.

I created wip-marius-http-abstractions branch and commits will follow
soon. I started the approach of decoupling Lift from HttpServletXXX
references and work with our traits HttpRequest, HttpResponse,
HttpServiceProvider etc. When Lift runs in a JEE web container the
implementation of HttpServiceProvider will sit on top of the existent
Filter approach.

I am aware that this would lead to some breaking changes but only if
the application is directly using HttpServletRequest ... but typically
I've seen that people use S.xxx functions so there probably won't be a
significant breaking change. Nonetheless let's see how this shapes
out. My goal here would be:

1. Abstract JEE references in Lift
2. Add support for AsyncWeb

Br's,
Marius

On Jul 26, 10:54 am, marius d. marius.dan...@gmail.com wrote:
 Looks like AsyncWeb model is pretty straight forward for sending down
 async responses. It doesn't have suspend/resume but we can create a
 Response object out of the request and from any thread call
 commitResponse. With this model Comet should work correctly just fine.
 Looks like currently AsyncWeb site has some problems and I can't
 download it ... bummer ... next week then :)

 Br's,
 Marius

 On Jul 25, 9:33 pm, marius d. marius.dan...@gmail.com wrote:

  On Jul 25, 9:25 pm, Timothy Perrett timo...@getintheloop.eu wrote:

   Hey Marius,

   I read your email with interest - myself and viktor were only today
   discussing all the various technologies such as this which are now 
   flooding
   the wider JEE eco-system and how lift can interoperate with them (or if
   indeed we need to / should)

   I think perhaps there is something wider to consider here: possibly 
   abstract
   things away so pluging lift into something other than HttpServlet is 
   fairly
   straight forward. You talk below about AsyncWeb, but it seems the same 
   might
   be true for the Grizzly NIO family of projects?

  Most definitely ... my goal would be to be HTTP platform agnostic.
  If the platform can deliver proper Comet support. AsyncWeb here is
  just an example that can serve as a reference implementation.

   Im not sure, nor am I
   familiar with them in great detail but your right, there are a lot of new
   options now that didn't previously exist so we should be considering them.

   Today I read a preso that was suggesting servlet 3.0 wont deliver
   feature-full cross-container comet support as everyone had hoped; if 
   that's
   the case, then sure, supporting other architectures would probably be a
   pretty good idea :-)

  I think that supporting other non JEE architectures is important
  regardless if servlet 3.0 can deliver or not their claims. Widening
  Lift underlying HTTP platform would be a huge gain IMHO.

   Cheers, Tim

   On 25/07/2009 19:06, Marius marius.dan...@gmail.com wrote:

Hi,

Did anyone played with AsyncWeb? .. Looks pretty promising but I
think having Lift working properly with it we need some adaptions. For
instance:

1. Lift uses HttpServletXXX references provided by JEE containers. One
solution that avoids vast code change is Lift is to bridge AsyncWeb
API through our own implementation of HttpServlet, HttpServletXXX etc.

2. Session management .. We'd also need a bridge for HttpSession ..
but that should be pretty straight forward. (Fortunately we have
LiftSession only bridged to HTTP session today.)

3. Comet support. Async Web fundamental concept seems to map pretty
well to Comet model. Probably they don't have the suspend/resume
mechanism as Jetty but there are some other means to do it right. Need
to look more into it ...

The point is that perhaps we should expand a bit and not depend so
much on JEE web container anymore as there are other viable
alternatives. We just need to build a flexible and transparent wiring
mechanism.

I'll probably start looking more into this path but first I'd like to
see your thoughts ...

Br's,
Marius
--~--~-~--~~~---~--~~
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: Comet DispatchPF - RestfulCometActor?

2009-07-27 Thread Timothy Perrett

Hey David,

Thanks for the response - got the impression you were swamped :-)
Looking forward to your thoughts on this.

Cheers, Tim

 I have some serious thoughts on this.  I've been swamped with client-based
 stupid over-work over the last 10 days.  I have one last set of stuff to do
 tomorrow and I'll be back on list on Tuesday afternoon.

--~--~-~--~~~---~--~~
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] Custom login

2009-07-27 Thread MrWHO


  Hi all!

  Again a probably silly question, but I haven't been able to find a
clue anywhere.

  I'd like to use my own login page for an application. I can get as
far as creating my own form - and posting to /user_mgt/login and if
the login goes right there is no problem. But if the login fails I'm
sent back to /user_mgt/login - the default page of Lift.

  I tried overriding the value of login page in the User class, but
with no luck.

  What's the proper way of defining my own login page?

  Cheers,

  Fabio

--~--~-~--~~~---~--~~
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] the question abount HelloForm2 of example darwin

2009-07-27 Thread koji

Hi, I'm trying the HelloForm2 of darwin example.
The second version of HelloForm2 that who var is RequestVar shows
correct on the rendered page, but always showing Empty in my console
using param(whofield). Am i do something wrong?

--~--~-~--~~~---~--~~
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] CircleShare Blog where?

2009-07-27 Thread Jon

At the bottom of this page http://wiki.liftweb.net/index.php/
Contribute it says:
When you see an article on Lift, help spread the word by submitting
it to digg, reddit, or hacknews. If you're looking for articles, a
great place is to start is The CircleShare Blog where user:dpp blogs
about Lift.

When I click at The CircleShare Blog, I get this:
Services for this domain have been discontinued

Has CircleShare moved, or have they cashed in?

/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: CircleShare Blog where?

2009-07-27 Thread TylerWeir

dpp's blog is here: http://blog.lostlake.org/

On Jul 27, 7:15 am, Jon jon.klei...@usit.uio.no wrote:
 At the bottom of this page http://wiki.liftweb.net/index.php/
 Contribute it says:
 When you see an article on Lift, help spread the word by submitting
 it to digg, reddit, or hacknews. If you're looking for articles, a
 great place is to start is The CircleShare Blog where user:dpp blogs
 about Lift.

 When I click at The CircleShare Blog, I get this:
 Services for this domain have been discontinued

 Has CircleShare moved, or have they cashed in?

 /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: CircleShare Blog where?

2009-07-27 Thread Timothy Perrett


Yeah I think its an old link.

We [the team] are aware that the wiki sucks and are in the process of moving
to a new wiki, with fresh new content.

Sorry for the run around.

Cheers, Tim

On 27/07/2009 12:30, TylerWeir tyler.w...@gmail.com wrote:

 
 dpp's blog is here: http://blog.lostlake.org/
 
 On Jul 27, 7:15 am, Jon jon.klei...@usit.uio.no wrote:
 At the bottom of this page http://wiki.liftweb.net/index.php/
 Contribute it says:
 When you see an article on Lift, help spread the word by submitting
 it to digg, reddit, or hacknews. If you're looking for articles, a
 great place is to start is The CircleShare Blog where user:dpp blogs
 about Lift.
 
 When I click at The CircleShare Blog, I get this:
 Services for this domain have been discontinued
 
 Has CircleShare moved, or have they cashed in?
 
 /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: the question abount HelloForm2 of example darwin

2009-07-27 Thread Timothy Perrett

Hey koji,

Perhaps this article will help: http://is.gd/sfyT

Otherwise, can you post the code your using? (perhaps onto
gist.github.com)

Cheers, Tim

On Jul 27, 11:11 am, koji koji@gmail.com wrote:
 Hi, I'm trying the HelloForm2 of darwin example.
 The second version of HelloForm2 that who var is RequestVar shows
 correct on the rendered page, but always showing Empty in my console
 using param(whofield). Am i do something wrong?
--~--~-~--~~~---~--~~
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: the question abount HelloForm2 of example darwin

2009-07-27 Thread koji

thx Tim,
I paste my code to the git.
here is the index.html http://gist.github.com/156445 and
HelloWorld.scala http://gist.github.com/156446
and param(whoField) always shows Empty

thanks, koji


On Jul 27, 10:45 pm, Timothy Perrett timo...@getintheloop.eu wrote:
 Hey koji,

 Perhaps this article will help:http://is.gd/sfyT

 Otherwise, can you post the code your using? (perhaps onto
 gist.github.com)

 Cheers, Tim

 On Jul 27, 11:11 am, koji koji@gmail.com wrote:



  Hi, I'm trying the HelloForm2 of darwin example.
  The second version of HelloForm2 that who var is RequestVar shows
  correct on the rendered page, but always showing Empty in my console
  using param(whofield). Am i do something wrong?

--~--~-~--~~~---~--~~
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] URL Rewrite and complex paths

2009-07-27 Thread José María

Hi.

I have the following problem (I'm porting a site from Python):

I've an url path that follows the patern  /something/int/text or
the pattern /something/int/int/text.

The type of the diferent parts of the url is important, in other
platforms (Python/Ruby) it's possible to use regexp to match the
urls... how is this done in Lift?

This route /company/1/2 is valid and I need to extracts 2 parameters
(id and page).
This route /company/1/hi is valid and I need to extract just 1
parameter (id).

By now my code is:

  case RewriteRequest(ParsePath(company :: id :: page :: text ::
Nil, , true, _), GetRequest, _)
= RewriteResponse(company :: Nil, Map(id - id, page -
page))

  case RewriteRequest(ParsePath(company :: id :: text :: Nil,
, true, _), GetRequest, _)
= RewriteResponse(company :: Nil, Map(id - id))

  case RewriteRequest(ParsePath(company :: id :: Nil, , true,
false), GetRequest, _)
= RewriteResponse(company :: Nil, Map(id - id))


Cheers.

--~--~-~--~~~---~--~~
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] Hear podcast interview with David Pollack about Lift

2009-07-27 Thread Goldfish

Visit http://pondjumpers.com/2009/07/27/episode-2-interview-about-lift/
to hear a podcast interview with David Pollack about Lift.

--~--~-~--~~~---~--~~
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] New features

2009-07-27 Thread Naftoli Gugenheim

I committed some code last night, which can help building mapper-based view 
snippets, with G-d's help. It includes the following classes:
(1-2) net.liftweb.mapper.OneToMany, ManyToMany: Gives a more object-oriented 
approach to managing related entites. You can manage the many side of a 1-n and 
n-n as a mutable collection of children, and the parent of a child can be set 
directly, instead of via its id. And the children are not saved to the database 
when you add them until you call save on it or its parent, nor deleted when you 
remove tem until you call delete_!, which is very helpful when you need to keep 
track of adds/removes through multiple requests. For example, if you are 
displaying a list and you can click delete, but it shouldn't be permanently 
deleted until you click save.
There is a new package, ...mapper.view, which contains a number of utilities 
for mapper-based views:
(3-4) ModelView and ModelSnippet provide a number of building blocks for views 
that are too complex to CRUDify. Inherit ModelSnippet (which extends 
StatefulSnippet) and wrap your entities in ModelView (view is used in the sense 
of a wrapper).
(5) Util provides some more building blocks that just be imported, without 
needing a ModelSnippet context.
(6-7) Paginator makes it easy to create paginated, user sortable listings. You 
can use PaginatedSnippet instead of ModelSnippet to help.
(8-10) ItemsList lets you manage a list of entities with pending additions and 
deletions. It's used by TableEditor, which is a very easy to use and 
customizable snippet to edit tables directly. It's useful for editing short 
lists, e.g., a lookup table like cities. Don't forget to register the table in 
Boot.
(11) Then there's the experimental FormProcessor, if you need your form to be 
processed in one block instead of separate closures, e.g., to surround with try.
(12) Also experimental is sitemap.XmlMenu which lets you write menus in xml.
(13) I may add CaseEnum, which lets you write case classes that automatically 
double as an Enumeration.
Questions, comments, suggestions, and constructive criticism are more than 
welcome!
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: log4j problems with Jetty

2009-07-27 Thread Derek Chen-Becker
I'm not 100% positive, but I think that jetty already has a log4j jar file
in it, so you can remove the one from webapp-lib. In your pom, add a
scopeprovided/scope for the log4j dependency.

Derek

On Sat, Jul 25, 2009 at 4:13 PM, Jeppe Nejsum Madsen je...@ingolfs.dkwrote:


 Hi,

 I'm trying to use the jetty plugin for gradle (a Groovy build tool ala
 buildr) and I'm getting the following error when loading the Lift app:

 3:52:11.276 [main] ERROR org.mortbay.log - failed LiftFilter
 java.lang.IllegalAccessError: tried to access method
 org.apache.log4j.Logger.init(Ljava/lang/String;)V from class
 org.apache.log4j.spi.RootLogger
at org.apache.log4j.spi.RootLogger.init(RootLogger.java:43)
at org.apache.log4j.LogManager.clinit(LogManager.java:78)
at net.liftweb.util.LogBoot$.log4jIsConfigured$1(Log.scala:113)
at net.liftweb.util.LogBoot$._log4JSetup(Log.scala:129)

 I assume there are some logging conflicts somewhere, but can't seem to
 figure out where. Any clues to what the issue is?

 This is the classpath used:

 23:52:08.786 [main] DEBUG org.mortbay.log -
 webapp=file:/Users/jeppe//build/jetty/webapp/
 23:52:08.787 [main] DEBUG org.mortbay.log - Path
 resource=file:/Users/jeppe//build/jetty/webapp/WEB-INF/classes/
 23:52:08.788 [main] DEBUG org.mortbay.log - Path
 resource=file:/Users/jeppe//build/jetty/webapp/WEB-INF/lib/activation-1.1.jar
 23:52:08.788 [main] DEBUG org.mortbay.log - Path
 resource=file:/Users/jeppe//build/jetty/webapp/WEB-INF/lib/avalon-framework-4.1.3.jar
 23:52:08.789 [main] DEBUG org.mortbay.log - Path
 resource=file:/Users/jeppe//build/jetty/webapp/WEB-INF/lib/commons-codec-1.3.jar
 23:52:08.789 [main] DEBUG org.mortbay.log - Path
 resource=file:/Users/jeppe//build/jetty/webapp/WEB-INF/lib/commons-collections-3.2.1.jar
 23:52:08.789 [main] DEBUG org.mortbay.log - Path
 resource=file:/Users/jeppe//build/jetty/webapp/WEB-INF/lib/commons-fileupload-1.2.1.jar
 23:52:08.789 [main] DEBUG org.mortbay.log - Path
 resource=file:/Users/jeppe//build/jetty/webapp/WEB-INF/lib/commons-httpclient-3.1.jar
 23:52:08.790 [main] DEBUG org.mortbay.log - Path
 resource=file:/Users/jeppe//build/jetty/webapp/WEB-INF/lib/commons-logging-1.1.jar
 23:52:08.790 [main] DEBUG org.mortbay.log - Path
 resource=file:/Users/jeppe//build/jetty/webapp/WEB-INF/lib/dom4j-1.6.1.jar
 23:52:08.790 [main] DEBUG org.mortbay.log - Path
 resource=file:/Users/jeppe//build/jetty/webapp/WEB-INF/lib/lift-actor-1.1-SNAPSHOT.jar
 23:52:08.790 [main] DEBUG org.mortbay.log - Path
 resource=file:/Users/jeppe//build/jetty/webapp/WEB-INF/lib/lift-mapper-1.1-SNAPSHOT.jar
 23:52:08.791 [main] DEBUG org.mortbay.log - Path
 resource=file:/Users/jeppe//build/jetty/webapp/WEB-INF/lib/lift-util-1.1-SNAPSHOT.jar
 23:52:08.792 [main] DEBUG org.mortbay.log - Path
 resource=file:/Users/jeppe//build/jetty/webapp/WEB-INF/lib/lift-webkit-1.1-SNAPSHOT.jar
 23:52:08.793 [main] DEBUG org.mortbay.log - Path
 resource=file:/Users/jeppe//build/jetty/webapp/WEB-INF/lib/lift-widgets-1.1-SNAPSHOT.jar
 23:52:08.793 [main] DEBUG org.mortbay.log - Path
 resource=file:/Users/jeppe//build/jetty/webapp/WEB-INF/lib/log4j-1.2.14.jar
 23:52:08.793 [main] DEBUG org.mortbay.log - Path
 resource=file:/Users/jeppe//build/jetty/webapp/WEB-INF/lib/logkit-1.0.1.jar
 23:52:08.794 [main] DEBUG org.mortbay.log - Path
 resource=file:/Users/jeppe//build/jetty/webapp/WEB-INF/lib/mail-1.4.jar
 23:52:08.794 [main] DEBUG org.mortbay.log - Path
 resource=file:/Users/jeppe//build/jetty/webapp/WEB-INF/lib/ooxml-schemas-1.0.jar
 23:52:08.808 [main] DEBUG org.mortbay.log - Path
 resource=file:/Users/jeppe//build/jetty/webapp/WEB-INF/lib/poi-3.5-beta6.jar
 23:52:08.808 [main] DEBUG org.mortbay.log - Path
 resource=file:/Users/jeppe//build/jetty/webapp/WEB-INF/lib/poi-ooxml-3.5-beta6.jar
 23:52:08.824 [main] DEBUG org.mortbay.log - Path
 resource=file:/Users/jeppe//build/jetty/webapp/WEB-INF/lib/postgresql-8.3-603.jdbc4.jar
 23:52:08.824 [main] DEBUG org.mortbay.log - Path
 resource=file:/Users/jeppe//build/jetty/webapp/WEB-INF/lib/scala-compiler-2.7.5.jar
 23:52:08.824 [main] DEBUG org.mortbay.log - Path
 resource=file:/Users/jeppe//build/jetty/webapp/WEB-INF/lib/scala-library-2.7.5.jar
 23:52:08.824 [main] DEBUG org.mortbay.log - Path
 resource=file:/Users/jeppe//build/jetty/webapp/WEB-INF/lib/stax-api-1.0.1.jar
 23:52:08.824 [main] DEBUG org.mortbay.log - Path
 resource=file:/Users/jeppe//build/jetty/webapp/WEB-INF/lib/xml-apis-1.0.b2.jar
 23:52:08.825 [main] DEBUG org.mortbay.log - Path
 resource=file:/Users/jeppe//build/jetty/webapp/WEB-INF/lib/xmlbeans-2.3.0.jar

 /Jeppe


 


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

[Lift] Re: Object Relationships and the .obj method

2009-07-27 Thread Grant Wood

Thank you Ross and Naftoli,

The fact that both of you offered solutions for dealing with a Box
directly through the .obj method proves that the example in master.pdf
is not accurate.  I tried several of your suggestions to see what the
trade offs were.  Since using Foreign Keys is so common, and since
Lift tries to take on much of the Heavy Lifting for you, having to
check for a null result (Empty in this case) seemed very wrong based
on an example showing direct method access to a mapped object.

Reading through many of the other newbie questions on Lift, I can
see that I'm not alone in my frustration with some parts of the
documentation. This is to be expected of course, but I think its more
frustrating for people who've used (or written) several other
frameworks and know exactly what they want to do, but cannot figure
out how Lift wants you to do it to avoid wasting energy.

Once I get though my project I may spend some time putting together
some examples that would have filled in some large gaps for me had I
had them when I started with Lift and Scala.

Thanks 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: New features

2009-07-27 Thread marius d.

Would you please add some examples on the wiki so that people can
actually visualize how these things can be used?


As far as XmlMenu goes why do we want to express menus as xml ?

Br's,
Marius

On Jul 27, 10:57 pm, Naftoli Gugenheim naftoli...@gmail.com wrote:
 I committed some code last night, which can help building mapper-based view 
 snippets, with G-d's help. It includes the following classes:
 (1-2) net.liftweb.mapper.OneToMany, ManyToMany: Gives a more object-oriented 
 approach to managing related entites. You can manage the many side of a 1-n 
 and n-n as a mutable collection of children, and the parent of a child can be 
 set directly, instead of via its id. And the children are not saved to the 
 database when you add them until you call save on it or its parent, nor 
 deleted when you remove tem until you call delete_!, which is very helpful 
 when you need to keep track of adds/removes through multiple requests. For 
 example, if you are displaying a list and you can click delete, but it 
 shouldn't be permanently deleted until you click save.
 There is a new package, ...mapper.view, which contains a number of utilities 
 for mapper-based views:
 (3-4) ModelView and ModelSnippet provide a number of building blocks for 
 views that are too complex to CRUDify. Inherit ModelSnippet (which extends 
 StatefulSnippet) and wrap your entities in ModelView (view is used in the 
 sense of a wrapper).
 (5) Util provides some more building blocks that just be imported, without 
 needing a ModelSnippet context.
 (6-7) Paginator makes it easy to create paginated, user sortable listings. 
 You can use PaginatedSnippet instead of ModelSnippet to help.
 (8-10) ItemsList lets you manage a list of entities with pending additions 
 and deletions. It's used by TableEditor, which is a very easy to use and 
 customizable snippet to edit tables directly. It's useful for editing short 
 lists, e.g., a lookup table like cities. Don't forget to register the table 
 in Boot.
 (11) Then there's the experimental FormProcessor, if you need your form to be 
 processed in one block instead of separate closures, e.g., to surround with 
 try.
 (12) Also experimental is sitemap.XmlMenu which lets you write menus in xml.
 (13) I may add CaseEnum, which lets you write case classes that automatically 
 double as an Enumeration.
 Questions, comments, suggestions, and constructive criticism are more than 
 welcome!
 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: erro: MappedDouble is not mapped to 'double precision' datatype in PostgreSQL?

2009-07-27 Thread Derek Chen-Becker
This looks like an issue with PostgreSQLDriver. The type should be DOUBLE
PRECISION. What version of Lift are you using? Let me know and I'll put a
fix in the proper place.

Derek

On Sun, Jul 26, 2009 at 5:59 AM, JanWillem Tulp janwillem.t...@gmail.comwrote:


 Still looking to find a solution for this, or at least what causes
 this behavior. I am looking at the Liftweb source code, and see in the
 BaseMetaMapper trait a function called buildMapper that does some
 pattern matching on SQL column types (colType). Just for my
 understanding, why is there a match for almost any of the basic SQL
 types, but not for Types.DOUBLE?

 Has anyone else run into this problem?

 On Jul 26, 1:34 am, JanWillem Tulp janwillem.t...@gmail.com wrote:
  Hi all,
 
  I'm not sure that I am missing something here, but the Schemifier
  cannot create a table for a model class that contains an object that
  extends from MappedDouble.
 
  This is the Lift code:
 
  class MeasureValue extends LongKeyedMapper[MeasureValue] with IdPK {
def getSingleton = MeasureValue
 
object value extends MappedDouble(this)
object measure extends MappedLongForeignKey(this, Measure)
 
  }
 
  object MeasureValue extends MeasureValue with LongKeyedMetaMapper
  [MeasureValue]
 
  I added MeasureValue to the Schemifier so that it will create a table
  when boot is executed. However, this is the stacktrace I get when I
  start the application:
 
  main INFO  lift - CREATE TABLE measurevalue (measure BIGINT , value
  DOUBLE , id BIGSERIAL)
  main ERROR lift - Failed to Boot
  org.postgresql.util.PSQLException: ERROR: type double does not exist
  at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse
  (QueryExecutorImpl.java:1592)
  at org.postgresql.core.v3.QueryExecutorImpl.processResults
  (QueryExecutorImpl.java:1327)
  at org.postgresql.core.v3.QueryExecutorImpl.execute
  (QueryExecutorImpl.java:192)
  at org.postgresql.jdbc2.AbstractJdbc2Statement.execute
  (AbstractJdbc2Statement.java:451)
  at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags
  (AbstractJdbc2Statement.java:336)
  at org.postgresql.jdbc2.AbstractJdbc2Statement.execute
  (AbstractJdbc2Statement.java:328)
  at net.liftweb.mapper.Schemifier$.net$liftweb$mapper$Schemifier$
  $maybeWrite(Schemifier.scala:150)
  at net.liftweb.mapper.Schemifier$.net$liftweb$mapper$Schemifier$
  $ensureTable(Schemifier.scala:160)
  at
 net.liftweb.mapper.Schemifier$$anonfun$schemify$1$$anonfun$1.apply
  (Schemifier.scala:60)
  at
 net.liftweb.mapper.Schemifier$$anonfun$schemify$1$$anonfun$1.apply
  (Schemifier.scala:60)
  at scala.List.foldLeft(List.scala:1066)
  at net.liftweb.mapper.Schemifier$$anonfun$schemify$1.apply
  (Schemifier.scala:60)
  at net.liftweb.mapper.Schemifier$$anonfun$schemify$1.apply
  (Schemifier.scala:54)
  at net.liftweb.mapper.DB$.use(DB.scala:305)
  at net.liftweb.mapper.Schemifier$.schemify(Schemifier.scala:53)
  at net.liftweb.mapper.Schemifier$.schemify(Schemifier.scala:36)
  at bootstrap.liftweb.Boot.boot(Boot.scala:26)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke
  (NativeMethodAccessorImpl.java:39)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke
  (DelegatingMethodAccessorImpl.java:25)
  at java.lang.reflect.Method.invoke(Method.java:597)
  at net.liftweb.util.ClassHelpers$$anonfun$createInvoker$1.apply
  (ClassHelpers.scala:392)
  at net.liftweb.util.ClassHelpers$$anonfun$createInvoker$1.apply
  (ClassHelpers.scala:390)
  at net.liftweb.http.DefaultBootstrap$$anonfun$boot$1.apply
  (LiftRules.scala:909)
  at net.liftweb.http.DefaultBootstrap$$anonfun$boot$1.apply
  (LiftRules.scala:909)
  at net.liftweb.util.Full.map(Box.scala:330)
  at net.liftweb.http.DefaultBootstrap$.boot(LiftRules.scala:909)
  at net.liftweb.http.LiftFilter.bootLift(LiftServlet.scala:573)
  at net.liftweb.http.LiftFilter.init(LiftServlet.scala:548)
  at org.apache.catalina.core.ApplicationFilterConfig.getFilter
  (ApplicationFilterConfig.java:275)
  at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef
  (ApplicationFilterConfig.java:397)
  at org.apache.catalina.core.ApplicationFilterConfig.init
  (ApplicationFilterConfig.java:108)
  at org.apache.catalina.core.StandardContext.filterStart
  (StandardContext.java:3800)
  at org.apache.catalina.core.StandardContext.start
  (StandardContext.java:4450)
  at org.apache.catalina.core.ContainerBase.addChildInternal
  (ContainerBase.java:791)
  at
 org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:
  771)
  at
 org.apache.catalina.core.StandardHost.addChild(StandardHost.java:
  526)
  at 

[Lift] Re: URL Rewrite and complex paths

2009-07-27 Thread Derek Chen-Becker
What you're doing generally looks right, although depending on the exact
syntax you might be able to make it a bit more concise. Is there something
in particular that's not working?

Derek

On Mon, Jul 27, 2009 at 12:23 PM, José María josemariar...@gmail.comwrote:


 Hi.

 I have the following problem (I'm porting a site from Python):

 I've an url path that follows the patern  /something/int/text or
 the pattern /something/int/int/text.

 The type of the diferent parts of the url is important, in other
 platforms (Python/Ruby) it's possible to use regexp to match the
 urls... how is this done in Lift?

 This route /company/1/2 is valid and I need to extracts 2 parameters
 (id and page).
 This route /company/1/hi is valid and I need to extract just 1
 parameter (id).

 By now my code is:

  case RewriteRequest(ParsePath(company :: id :: page :: text ::
 Nil, , true, _), GetRequest, _)
= RewriteResponse(company :: Nil, Map(id - id, page -
 page))

  case RewriteRequest(ParsePath(company :: id :: text :: Nil,
 , true, _), GetRequest, _)
= RewriteResponse(company :: Nil, Map(id - id))

  case RewriteRequest(ParsePath(company :: id :: Nil, , true,
 false), GetRequest, _)
= RewriteResponse(company :: Nil, Map(id - id))


 Cheers.

 


--~--~-~--~~~---~--~~
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: New features

2009-07-27 Thread Naftoli Gugenheim

I will try but I may not have a chance in the next few days. I did write up 
scaladocs, although I haven't pushed some clarifications for TableEditor.
You probably don't want to use XmlMenu, but David said I may as well throw it 
in. The advantage is if you want to read it in from an xml file.


-
marius d.marius.dan...@gmail.com wrote:


Would you please add some examples on the wiki so that people can
actually visualize how these things can be used?


As far as XmlMenu goes why do we want to express menus as xml ?

Br's,
Marius

On Jul 27, 10:57 pm, Naftoli Gugenheim naftoli...@gmail.com wrote:
 I committed some code last night, which can help building mapper-based view 
 snippets, with G-d's help. It includes the following classes:
 (1-2) net.liftweb.mapper.OneToMany, ManyToMany: Gives a more object-oriented 
 approach to managing related entites. You can manage the many side of a 1-n 
 and n-n as a mutable collection of children, and the parent of a child can be 
 set directly, instead of via its id. And the children are not saved to the 
 database when you add them until you call save on it or its parent, nor 
 deleted when you remove tem until you call delete_!, which is very helpful 
 when you need to keep track of adds/removes through multiple requests. For 
 example, if you are displaying a list and you can click delete, but it 
 shouldn't be permanently deleted until you click save.
 There is a new package, ...mapper.view, which contains a number of utilities 
 for mapper-based views:
 (3-4) ModelView and ModelSnippet provide a number of building blocks for 
 views that are too complex to CRUDify. Inherit ModelSnippet (which extends 
 StatefulSnippet) and wrap your entities in ModelView (view is used in the 
 sense of a wrapper).
 (5) Util provides some more building blocks that just be imported, without 
 needing a ModelSnippet context.
 (6-7) Paginator makes it easy to create paginated, user sortable listings. 
 You can use PaginatedSnippet instead of ModelSnippet to help.
 (8-10) ItemsList lets you manage a list of entities with pending additions 
 and deletions. It's used by TableEditor, which is a very easy to use and 
 customizable snippet to edit tables directly. It's useful for editing short 
 lists, e.g., a lookup table like cities. Don't forget to register the table 
 in Boot.
 (11) Then there's the experimental FormProcessor, if you need your form to be 
 processed in one block instead of separate closures, e.g., to surround with 
 try.
 (12) Also experimental is sitemap.XmlMenu which lets you write menus in xml.
 (13) I may add CaseEnum, which lets you write case classes that automatically 
 double as an Enumeration.
 Questions, comments, suggestions, and constructive criticism are more than 
 welcome!
 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: URL Rewrite and complex paths

2009-07-27 Thread Derek Chen-Becker
Also, you could define some helpers objects to simplify type testing:

object IntField {
  def unapply (in : String) =
try {
  Some(in.toInt)
} catch {
  case nfe : NumberFormatException = None
}
}

And then you can use it in matching statements:

scala val test = List(One, 12, four)
test: List[java.lang.String] = List(One, 12, four)


scala test match {
 |   case List(first, IntField(id), last) = println(Sum =  + (id +
2))
 |   case List(first, second, third) = println(Strings)

 | }
Sum = 14


Derek

On Mon, Jul 27, 2009 at 2:39 PM, Derek Chen-Becker dchenbec...@gmail.comwrote:

 What you're doing generally looks right, although depending on the exact
 syntax you might be able to make it a bit more concise. Is there something
 in particular that's not working?

 Derek


 On Mon, Jul 27, 2009 at 12:23 PM, José María josemariar...@gmail.comwrote:


 Hi.

 I have the following problem (I'm porting a site from Python):

 I've an url path that follows the patern  /something/int/text or
 the pattern /something/int/int/text.

 The type of the diferent parts of the url is important, in other
 platforms (Python/Ruby) it's possible to use regexp to match the
 urls... how is this done in Lift?

 This route /company/1/2 is valid and I need to extracts 2 parameters
 (id and page).
 This route /company/1/hi is valid and I need to extract just 1
 parameter (id).

 By now my code is:

  case RewriteRequest(ParsePath(company :: id :: page :: text ::
 Nil, , true, _), GetRequest, _)
= RewriteResponse(company :: Nil, Map(id - id, page -
 page))

  case RewriteRequest(ParsePath(company :: id :: text :: Nil,
 , true, _), GetRequest, _)
= RewriteResponse(company :: Nil, Map(id - id))

  case RewriteRequest(ParsePath(company :: id :: Nil, , true,
 false), GetRequest, _)
= RewriteResponse(company :: Nil, Map(id - id))


 Cheers.

 



--~--~-~--~~~---~--~~
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: URL Rewrite and complex paths

2009-07-27 Thread edgarchan

Hola.
All parameters put it on the map are available in the request, so you
can use S.param function to get them.

in your example

case RewriteRequest(ParsePath(company :: id :: page :: text ::Nil,
, true, _), GetRequest, _) = RewriteResponse(company :: Nil, Map
(id - id, page -
page))

in any of your snippet try this

class MySnippet{

   def foo:NodeSeq={
val id = S.param(id)
val page = S.param(page)
// do whatever
   }
}

id and page are now a Box .. and take a look on Helpers it has toInt,
toLong and others utlity methods to parse a desired type



On Jul 27, 1:23 pm, José María josemariar...@gmail.com wrote:
 Hi.

 I have the following problem (I'm porting a site from Python):

 I've an url path that follows the patern  /something/int/text or
 the pattern /something/int/int/text.

 The type of the diferent parts of the url is important, in other
 platforms (Python/Ruby) it's possible to use regexp to match the
 urls... how is this done in Lift?

 This route /company/1/2 is valid and I need to extracts 2 parameters
 (id and page).
 This route /company/1/hi is valid and I need to extract just 1
 parameter (id).

 By now my code is:

       case RewriteRequest(ParsePath(company :: id :: page :: text ::
 Nil, , true, _), GetRequest, _)
         = RewriteResponse(company :: Nil, Map(id - id, page -
 page))

       case RewriteRequest(ParsePath(company :: id :: text :: Nil,
 , true, _), GetRequest, _)
         = RewriteResponse(company :: Nil, Map(id - id))

       case RewriteRequest(ParsePath(company :: id :: Nil, , true,
 false), GetRequest, _)
         = RewriteResponse(company :: Nil, Map(id - id))

 Cheers.
--~--~-~--~~~---~--~~
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: Object Relationships and the .obj method

2009-07-27 Thread Derek Chen-Becker
Hi Grant,
Sorry about the frustration with that example. I'll fix the
documentation so that the example is accurate. Please feel free to send any
other feedback on Exploring Lift either to this list or to the Book's
mailing list.

Thanks,

Derek

On Mon, Jul 27, 2009 at 1:49 PM, Grant Wood smackt...@gmail.com wrote:


 Thank you Ross and Naftoli,

 The fact that both of you offered solutions for dealing with a Box
 directly through the .obj method proves that the example in master.pdf
 is not accurate.  I tried several of your suggestions to see what the
 trade offs were.  Since using Foreign Keys is so common, and since
 Lift tries to take on much of the Heavy Lifting for you, having to
 check for a null result (Empty in this case) seemed very wrong based
 on an example showing direct method access to a mapped object.

 Reading through many of the other newbie questions on Lift, I can
 see that I'm not alone in my frustration with some parts of the
 documentation. This is to be expected of course, but I think its more
 frustrating for people who've used (or written) several other
 frameworks and know exactly what they want to do, but cannot figure
 out how Lift wants you to do it to avoid wasting energy.

 Once I get though my project I may spend some time putting together
 some examples that would have filled in some large gaps for me had I
 had them when I started with Lift and Scala.

 Thanks 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: Object Relationships and the .obj method

2009-07-27 Thread Derek Chen-Becker
OK, updated PDF is on the site.

Derek

On Mon, Jul 27, 2009 at 2:56 PM, Derek Chen-Becker dchenbec...@gmail.comwrote:

 Hi Grant,
 Sorry about the frustration with that example. I'll fix the
 documentation so that the example is accurate. Please feel free to send any
 other feedback on Exploring Lift either to this list or to the Book's
 mailing list.

 Thanks,

 Derek


 On Mon, Jul 27, 2009 at 1:49 PM, Grant Wood smackt...@gmail.com wrote:


 Thank you Ross and Naftoli,

 The fact that both of you offered solutions for dealing with a Box
 directly through the .obj method proves that the example in master.pdf
 is not accurate.  I tried several of your suggestions to see what the
 trade offs were.  Since using Foreign Keys is so common, and since
 Lift tries to take on much of the Heavy Lifting for you, having to
 check for a null result (Empty in this case) seemed very wrong based
 on an example showing direct method access to a mapped object.

 Reading through many of the other newbie questions on Lift, I can
 see that I'm not alone in my frustration with some parts of the
 documentation. This is to be expected of course, but I think its more
 frustrating for people who've used (or written) several other
 frameworks and know exactly what they want to do, but cannot figure
 out how Lift wants you to do it to avoid wasting energy.

 Once I get though my project I may spend some time putting together
 some examples that would have filled in some large gaps for me had I
 had them when I started with Lift and Scala.

 Thanks 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: New features

2009-07-27 Thread glenn

Sounds great. I've been using hacks such as adding code like this to
my mapper classes just to create a Many-to-Many
relationship between say, tag and content tables (using an
intermediary ContentTag table). Similarly, I've done User/Roles
relationships.

 private object _dbTags extends HasManyThrough(this, Tag, ContentTag,
ContentTag.content, ContentTag.tag)

  private[model] var _tags : List[Tag] = _

  private val locker = new Object

  def tags : List[Tag] = locker.synchronized {
if(_tags eq null){
  _tags = _dbTags()
}
_tags
  }

  def tags(newTags:String) = locker.synchronized {
_tags = newTags.roboSplit(,).map(Tag.byName(_))
this
  }

  def tags(newTags:List[Tag]) = locker.synchronized {
_tags = newTags
this
  }

  def tagsToo:List[Tag] = ContentTag.findAll(By(ContentTag.content,
this.id)).map(_.tag.obj.open_!)

  def showTags = Text(tags.map(_.name.is).mkString(, ))

But, then I have to add code like this to the meta-mapper objects:

 def addTags(entry: Content) {
if(entry._tags ne null){
   entry._tags.foreach(ContentTag.join(_, entry))
}
  }

  def delTags(entry:Content) =
ContentTag.findAll(By(ContentTag.content, entry)).foreach
(_.delete_!)

It's not very pretty. Nor easy to duplicate.

I hope your new code is considerably less messy.

Is it in the repo-snapshot repository yet.



On Jul 27, 12:57 pm, Naftoli Gugenheim naftoli...@gmail.com wrote:
 I committed some code last night, which can help building mapper-based view 
 snippets, with G-d's help. It includes the following classes:
 (1-2) net.liftweb.mapper.OneToMany, ManyToMany: Gives a more object-oriented 
 approach to managing related entites. You can manage the many side of a 1-n 
 and n-n as a mutable collection of children, and the parent of a child can be 
 set directly, instead of via its id. And the children are not saved to the 
 database when you add them until you call save on it or its parent, nor 
 deleted when you remove tem until you call delete_!, which is very helpful 
 when you need to keep track of adds/removes through multiple requests. For 
 example, if you are displaying a list and you can click delete, but it 
 shouldn't be permanently deleted until you click save.
 There is a new package, ...mapper.view, which contains a number of utilities 
 for mapper-based views:
 (3-4) ModelView and ModelSnippet provide a number of building blocks for 
 views that are too complex to CRUDify. Inherit ModelSnippet (which extends 
 StatefulSnippet) and wrap your entities in ModelView (view is used in the 
 sense of a wrapper).
 (5) Util provides some more building blocks that just be imported, without 
 needing a ModelSnippet context.
 (6-7) Paginator makes it easy to create paginated, user sortable listings. 
 You can use PaginatedSnippet instead of ModelSnippet to help.
 (8-10) ItemsList lets you manage a list of entities with pending additions 
 and deletions. It's used by TableEditor, which is a very easy to use and 
 customizable snippet to edit tables directly. It's useful for editing short 
 lists, e.g., a lookup table like cities. Don't forget to register the table 
 in Boot.
 (11) Then there's the experimental FormProcessor, if you need your form to be 
 processed in one block instead of separate closures, e.g., to surround with 
 try.
 (12) Also experimental is sitemap.XmlMenu which lets you write menus in xml.
 (13) I may add CaseEnum, which lets you write case classes that automatically 
 double as an Enumeration.
 Questions, comments, suggestions, and constructive criticism are more than 
 welcome!
 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: URL Rewrite and complex paths

2009-07-27 Thread Timothy Perrett

FYI, I detail lift's rewriting scheme here: http://is.gd/wq4K

Cheers, Tim

On Jul 27, 9:52 pm, edgarchan edgarchancarri...@gmail.com wrote:
 Hola.
 All parameters put it on the map are available in the request, so you
 can use S.param function to get them.

 in your example

 case RewriteRequest(ParsePath(company :: id :: page :: text ::Nil,
 , true, _), GetRequest, _) = RewriteResponse(company :: Nil, Map
 (id - id, page -
 page))

 in any of your snippet try this

 class MySnippet{

    def foo:NodeSeq={
         val id = S.param(id)
         val page = S.param(page)
         // do whatever
    }

 }

 id and page are now a Box .. and take a look on Helpers it has toInt,
 toLong and others utlity methods to parse a desired type

 On Jul 27, 1:23 pm, José María josemariar...@gmail.com wrote:



  Hi.

  I have the following problem (I'm porting a site from Python):

  I've an url path that follows the patern  /something/int/text or
  the pattern /something/int/int/text.

  The type of the diferent parts of the url is important, in other
  platforms (Python/Ruby) it's possible to use regexp to match the
  urls... how is this done in Lift?

  This route /company/1/2 is valid and I need to extracts 2 parameters
  (id and page).
  This route /company/1/hi is valid and I need to extract just 1
  parameter (id).

  By now my code is:

        case RewriteRequest(ParsePath(company :: id :: page :: text ::
  Nil, , true, _), GetRequest, _)
          = RewriteResponse(company :: Nil, Map(id - id, page -
  page))

        case RewriteRequest(ParsePath(company :: id :: text :: Nil,
  , true, _), GetRequest, _)
          = RewriteResponse(company :: Nil, Map(id - id))

        case RewriteRequest(ParsePath(company :: id :: Nil, , true,
  false), GetRequest, _)
          = RewriteResponse(company :: Nil, Map(id - id))

  Cheers.
--~--~-~--~~~---~--~~
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: New features

2009-07-27 Thread Naftoli Gugenheim

I committed it last night, so I think it should be there.
To use many-to-many, simply mix ManyToMany to your mapper, then create a 
MappedManyToMany field like any other field. See the scaladocs for specifics.
Then in your view you can use the field like a collection, e.g., remove an 
element with -=, and save the mapper to apply the changes.



-
glenngl...@exmbly.com wrote:


Sounds great. I've been using hacks such as adding code like this to
my mapper classes just to create a Many-to-Many
relationship between say, tag and content tables (using an
intermediary ContentTag table). Similarly, I've done User/Roles
relationships.

 private object _dbTags extends HasManyThrough(this, Tag, ContentTag,
ContentTag.content, ContentTag.tag)

  private[model] var _tags : List[Tag] = _

  private val locker = new Object

  def tags : List[Tag] = locker.synchronized {
if(_tags eq null){
  _tags = _dbTags()
}
_tags
  }

  def tags(newTags:String) = locker.synchronized {
_tags = newTags.roboSplit(,).map(Tag.byName(_))
this
  }

  def tags(newTags:List[Tag]) = locker.synchronized {
_tags = newTags
this
  }

  def tagsToo:List[Tag] = ContentTag.findAll(By(ContentTag.content,
this.id)).map(_.tag.obj.open_!)

  def showTags = Text(tags.map(_.name.is).mkString(, ))

But, then I have to add code like this to the meta-mapper objects:

 def addTags(entry: Content) {
if(entry._tags ne null){
   entry._tags.foreach(ContentTag.join(_, entry))
}
  }

  def delTags(entry:Content) =
ContentTag.findAll(By(ContentTag.content, entry)).foreach
(_.delete_!)

It's not very pretty. Nor easy to duplicate.

I hope your new code is considerably less messy.

Is it in the repo-snapshot repository yet.



On Jul 27, 12:57 pm, Naftoli Gugenheim naftoli...@gmail.com wrote:
 I committed some code last night, which can help building mapper-based view 
 snippets, with G-d's help. It includes the following classes:
 (1-2) net.liftweb.mapper.OneToMany, ManyToMany: Gives a more object-oriented 
 approach to managing related entites. You can manage the many side of a 1-n 
 and n-n as a mutable collection of children, and the parent of a child can be 
 set directly, instead of via its id. And the children are not saved to the 
 database when you add them until you call save on it or its parent, nor 
 deleted when you remove tem until you call delete_!, which is very helpful 
 when you need to keep track of adds/removes through multiple requests. For 
 example, if you are displaying a list and you can click delete, but it 
 shouldn't be permanently deleted until you click save.
 There is a new package, ...mapper.view, which contains a number of utilities 
 for mapper-based views:
 (3-4) ModelView and ModelSnippet provide a number of building blocks for 
 views that are too complex to CRUDify. Inherit ModelSnippet (which extends 
 StatefulSnippet) and wrap your entities in ModelView (view is used in the 
 sense of a wrapper).
 (5) Util provides some more building blocks that just be imported, without 
 needing a ModelSnippet context.
 (6-7) Paginator makes it easy to create paginated, user sortable listings. 
 You can use PaginatedSnippet instead of ModelSnippet to help.
 (8-10) ItemsList lets you manage a list of entities with pending additions 
 and deletions. It's used by TableEditor, which is a very easy to use and 
 customizable snippet to edit tables directly. It's useful for editing short 
 lists, e.g., a lookup table like cities. Don't forget to register the table 
 in Boot.
 (11) Then there's the experimental FormProcessor, if you need your form to be 
 processed in one block instead of separate closures, e.g., to surround with 
 try.
 (12) Also experimental is sitemap.XmlMenu which lets you write menus in xml.
 (13) I may add CaseEnum, which lets you write case classes that automatically 
 double as an Enumeration.
 Questions, comments, suggestions, and constructive criticism are more than 
 welcome!
 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] Modularization of Lift code

2009-07-27 Thread glenn

I'm interested in abstracting out useful features from my Lift
applications for ease of reuse, but I haven't found an easy way to do
it. I find myself creating a new Lift aplication for each feature,
with all the baggage (bootstrapping, etc.), and I then have to do a
lot of code modification to the application I'm adding the feature to
in order to get it to work.

For example, suppose I want to add role-based user login to an
application that already has a User model just by dropping in a jar
file with the new feature. I don't see how to do it without some
boostrapping modifications.

Has anyone really tried to modularize their Lift development. I'd be
very interested in some suggestions.


--~--~-~--~~~---~--~~
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: Modularization of Lift code

2009-07-27 Thread Timothy Perrett

Hi Glen...

I actually do a lot of this - we have a product at work and i've just
written a bunch of abstractions for work which just require me to do:

MyLib.init

In the boot file of a new application and then everything wires up - I
couldn't think of anything more straightforward?

The vast majority of stuff in lift is done with PF's, so you can
pretty much just write them in external jars, and import them - my 3rd
part stuff usually has a lift-webkit dependency so that I can just do
the LiftRules.disptach.append stuff directly in the init method, but
its really no biggy and saves boilerplate.

So given your example, this scheme should work right?

Cheers, Tim

On Jul 27, 11:52 pm, glenn gl...@exmbly.com wrote:
 I'm interested in abstracting out useful features from my Lift
 applications for ease of reuse, but I haven't found an easy way to do
 it. I find myself creating a new Lift aplication for each feature,
 with all the baggage (bootstrapping, etc.), and I then have to do a
 lot of code modification to the application I'm adding the feature to
 in order to get it to work.

 For example, suppose I want to add role-based user login to an
 application that already has a User model just by dropping in a jar
 file with the new feature. I don't see how to do it without some
 boostrapping modifications.

 Has anyone really tried to modularize their Lift development. I'd be
 very interested in some suggestions.
--~--~-~--~~~---~--~~
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: Hear podcast interview with David Pollack about Lift

2009-07-27 Thread Timothy Perrett

Sweet link

Cheers, Tim

On Jul 27, 7:40 pm, Goldfish gregt...@mindspring.com wrote:
 Visithttp://pondjumpers.com/2009/07/27/episode-2-interview-about-lift/
 to hear a podcast interview with David Pollack about Lift.
--~--~-~--~~~---~--~~
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] Allow another servlet

2009-07-27 Thread Naftoli Gugenheim

How do you set up lift to allow access to another servlet, e.g., the H2 console?

--~--~-~--~~~---~--~~
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: Allow another servlet

2009-07-27 Thread Ross Mellgren

LiftRules.passNotFoundToChain = true

-Ross

On Jul 27, 2009, at 7:44 PM, Naftoli Gugenheim wrote:


 How do you set up lift to allow access to another servlet, e.g., the  
 H2 console?

 


--~--~-~--~~~---~--~~
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] Minimizing Memory Usage

2009-07-27 Thread Peter Robinett

Hi all,

I'm running Lift on the smallest Slicehost VPS available (256 mb RAM,
plus 512 mb swap) and I've recently run into some memory issues. I'm
also running Apache and MySQL on the machine, so Lift and its
environment is by no means the only cause, but I'd like to ask you all
about how Lift uses memory and whether I can make more efficient use
of the little memory I currently have.

I was just doing a quick-and-dirty test, so I ran Lift under jetty:
nohup mvn jetty:run 

Before I launched jetty and Lift I was using approximately 150 mb of
RAM and little if any swap space. Twelve hours later all physical and
swap memory was used up. During those twelve hours I was receiving a
POSTed message approximately every second, creating a model and then
in its createdRow method sending the new object to a singleton object
which sent it on to the appropriate actor (there being around 20 and
all of them being launched in Lift's boot method). Very rarely these
actors would have a few Comet listeners.

Looking at the nohup log I see that lots of sessions started expiring
maybe 8 hours from launch and continued in waves until I killed the
process. I also see some stack traces about Comet requests,
doContinuation, and Bail.

Does this suggest that I'm using Actors incorrectly? Do I have too
long a session timeout? Or do I just need more memory? Assuming the
latter, how would you suggest figuring out a reasonable amount?

Thanks for your help,
Peter Robinett

PS Some additional system details:
cat /proc/system
Linux version 2.6.24-19-xen (bui...@king) (gcc version 4.2.3 (Ubuntu
4.2.3-2ubuntu7)) #1 SMP Sat Jul 12 00:15:59 UTC 2008

java -version
java version 1.6.0_0
IcedTea6 1.3.1 (6b12-0ubuntu6.4) Runtime Environment (build 1.6.0_0-
b12)
OpenJDK 64-Bit Server VM (build 1.6.0_0-b12, mixed mode)
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---