Re: [Lift] Usage patterns for Scala traits

2010-02-24 Thread Alex Boisvert
On Wed, Feb 24, 2010 at 11:53 AM, Malte Schwerhoff <
mun123456...@googlemail.com> wrote:

> I am currently working on a research project in the context of my
> Master's at the ETH Zürich. The project's (long-term) goal is to develop
> a contract language (pre-, postconditions, invariants, the usual stuff)
> to be able to verify certain aspects of Scala traits.
>
> For starters, I'd like to exemplify typical patterns (or use-cases) of
> Scala traits. So far I have the "stackable modifications" pattern, the
> "interface enrichment" pattern (both taken from the "Programming in
> Scala" book [1]) and the "functionality extension" "pattern" as
> exemplified in [2] (p. 14, German document).
>

A simple pattern that I see often is hand-coded proxies / direct delegation,
e.g.

trait Store {
  def read(key: String): Any
  def write(key: String, value: Any): Unit
}

trait ActsLikeStore extends Store {
  val store: Store
  def read(key: String) = store.read(key)
  def write(key: String, value: Any) { store.write(key, value) }
}

I'm curious to hear where in the pattern landscape you'd classify Scala
2.8's collection traits like SeqLike, MapLike and such.

alex

-- 
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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.



Re: [Lift] Is there any open source web apps based on lift ?

2010-01-28 Thread Alex Boisvert
And there's a simpler example mentioned here,
http://www.mail-archive.com/liftweb@googlegroups.com/msg15536.html

alex

On Thu, Jan 28, 2010 at 7:55 AM, Jeppe Nejsum Madsen wrote:

> Boern  writes:
>
> > Hi,all:
> > I am newbie for lift web framework and I hope * there are some open
> source
> > web apps based on lift to practice or refer ,so is there any open source
> > projects based on lift ? maybe,the offical site lists them !!!*
>
> ESME http://incubator.apache.org/esme/ is probably the most prominent
>
> /Jeppe
>
> --
> You received this message because you are subscribed to the Google Groups
> "Lift" group.
> To post to this group, send email to lift...@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.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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.



Re: [Lift] Lift logging improvements

2010-01-27 Thread Alex Boisvert
I think that's a great idea.

alex

On Wed, Jan 27, 2010 at 2:03 PM, David Pollak  wrote:

> It all sounds good to me as long as API breakage is minimal (or
> non-existent)
>
>
> On Wed, Jan 27, 2010 at 1:59 PM, Jeppe Nejsum Madsen wrote:
>
>> Hi,
>>
>> I was thinking about some improvements to Lift's logging code:
>>
>> 1) Make the slf4j logging configurable in the same way as log4j (ie with
>> dev, prod logback files)
>>
>> 2) Add support for MDC to Lift's logging interface (and the log4j &
>> slf4j backends)
>>
>> 3) Add more logging to Lift :-)
>>
>> The last part may be a bit controversial, but I find logging statements
>> immensely useful when trying to diagnose stuff that doesn't work or
>> figure out how stuff works. If separate loggers are created for
>> different areas (i.e mapper, comet, ajax, etc) it should be possible to
>> turn the needed info on & off without too much information overload.
>>
>> Performance wise it shouldn't matter much (famous last words :-) if
>> logging is disabled.
>>
>> Thoughts?
>>
>> /Jeppe
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Lift" group.
>> To post to this group, send email to lift...@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 simply functional web framework http://liftweb.net
> Beginning Scala http://www.apress.com/book/view/1430219890
> Follow me: http://twitter.com/dpp
> Surf the harmonics
>
> --
> You received this message because you are subscribed to the Google Groups
> "Lift" group.
> To post to this group, send email to lift...@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.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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.



Re: [Lift] buildr?

2010-01-26 Thread Alex Boisvert
Forgot to send this to the list earlier, I published a template project,

http://github.com/aboisvert/lift-template

which I use as basis for building Lift projects.  (Haven't updated to
2.0-SNAPSHOT yet but should only be a matter of changing a few version
numbers).

alex


On Fri, Jan 22, 2010 at 9:38 AM, Timothy Perrett wrote:

> Alex,
>
> Can I suggest you distill your own learning onto the wiki?
>
> Cheers, Tim
>
> On 22 Jan 2010, at 01:51, Alex Boisvert wrote:
>
> > On Thu, Jan 21, 2010 at 5:17 PM, David Pollak <
> feeder.of.the.be...@gmail.com> wrote:
> >
> >
> > On Thu, Jan 21, 2010 at 5:03 PM, Raoul Duke  wrote:
> > hi,
> >
> > >> whatever came of buildr for lift? i haven't stumbled across the answer
> > >> googling yet, but i'm still checking...
> > >
> > > We're not going to support Buildr for Lift.  Adding Ruby into the mix
> is a
> > > non-starter from my perspective.  There is increasing sbt support for
> > > Lift-based projects.
> >
> > thanks for the info. i will go read up on sbt now!
> >
> > [i saw your older response about disliking the ruby runtime -- i was
> > wondering if anybody else had done a buildr branch nevertheless :-)
> > e.g. http://github.com/aboisvert/liftweb# (and i wonder if jruby
> > mitigates your ruby runtime concerns at all).]
> >
> > Jruby is yet another download, install, configuration.  Making Lift as
> easy as possible to get started with and keep going with is the priority.
>  Maven gives us this.  Yes, the one line you have to copy/paste is a bear,
> but once you've typed that, things work remarkably well with Maven.  Having
> to install Jruby, is yet another barrier, yet another thing to support, etc.
> >
> >  i'm not arguing for use of buildr with lift, just providing
> information 
> >
> > buildr now has an all-in-one distribution (which uses jruby on the
> inside) and requires no more install/configuration steps than maven.
>  granted, if you already use maven, it's an extra step.
> >
> > there's also an all-in-one-jar in the works which will make buildr even
> easier to install and use.  this should be available soon after jruby 1.5.0
> is out.
> >
> > i use buildr + lift on a regular basis and find it a pleasant alternative
> to maven.  if other people want to use buildr with lift, i'm happy to share
> and help them out.
> >
> > cheers,
> > alex
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> "Lift" group.
> > To post to this group, send email to lift...@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.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Lift" group.
> To post to this group, send email to lift...@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.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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.



Re: [Lift] buildr?

2010-01-21 Thread Alex Boisvert
On Thu, Jan 21, 2010 at 5:17 PM, David Pollak  wrote:

>
>
> On Thu, Jan 21, 2010 at 5:03 PM, Raoul Duke  wrote:
>
>> hi,
>>
>> >> whatever came of buildr for lift? i haven't stumbled across the answer
>> >> googling yet, but i'm still checking...
>> >
>> > We're not going to support Buildr for Lift.  Adding Ruby into the mix is
>> a
>> > non-starter from my perspective.  There is increasing sbt support for
>> > Lift-based projects.
>>
>> thanks for the info. i will go read up on sbt now!
>>
>> [i saw your older response about disliking the ruby runtime -- i was
>> wondering if anybody else had done a buildr branch nevertheless :-)
>> e.g. http://github.com/aboisvert/liftweb# (and i wonder if jruby
>> mitigates your ruby runtime concerns at all).]
>>
>
> Jruby is yet another download, install, configuration.  Making Lift as easy
> as possible to get started with and keep going with is the priority.  Maven
> gives us this.  Yes, the one line you have to copy/paste is a bear, but once
> you've typed that, things work remarkably well with Maven.  Having to
> install Jruby, is yet another barrier, yet another thing to support, etc.
>

 i'm not arguing for use of buildr with lift, just providing
information 

buildr now has an all-in-one distribution (which uses jruby on the inside)
and requires no more install/configuration steps than maven.  granted, if
you already use maven, it's an extra step.

there's also an all-in-one-jar in the works which will make buildr even
easier to install and use.  this should be available soon after jruby 1.5.0
is out.

i use buildr + lift on a regular basis and find it a pleasant alternative to
maven.  if other people want to use buildr with lift, i'm happy to share and
help them out.

cheers,
alex

-- 
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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.



Re: [Lift] Re: Replace HTML element after AJAX call

2010-01-18 Thread Alex Boisvert
Yes, using a div or span is recommended so you can replace multiple times.

Alex

On Jan 18, 2010 9:21 AM, "greekscala"  wrote:

Hello,

I looked at the source and there is JsCmds.Replace which replaces a
Node with another.
I am always using div as containers for replacement

best regards

On 18 Jan., 17:41, ced  wrote: > Hello, > I'm
wondering if there is a way...

--
You received this message because you are subscribed to the Google Groups
"Lift" group.
To post to this group, send email to lift...@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.
-- 

You received this message because you are subscribed to the Google Groups "Lift" group.

To post to this group, send email to lift...@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.



Re: [Lift] Re: Backbutton for Ajax

2010-01-14 Thread Alex Boisvert
Depends on your application.  What would it do if it wasn't implemented with
AJAX?

This isn't a magical feature.   It's a feature that allows you to support
the back button 1) if it makes sense to you and 2) if you can figure out a
way to make it safe for the user.

For example, you click the delete button.  The snippet is replaced by "Item
deleted".  You click back button, now you're back to the item you deleted.
If you go back again, maybe you go back to the list of items you were
working with and from there you can go delete others.   So it's just a
navigation tool to support existing web idioms.

alex


On Thu, Jan 14, 2010 at 7:52 AM, Naftoli Gugenheim wrote:

> If you press delete then back what will happen?
>
> -
> Alex Boisvert wrote:
>
> On Wed, Jan 13, 2010 at 6:10 PM, Naftoli Gugenheim  >wrote:
>
> > I haven't really used Ajax much but it seems to me there are two kinds of
> > changes.
> > 1. Modifying the view, e.g., clicking an emal in Gmail, or Expand All.
> One
> > can make an analogy to a GET request, in that there's no permanent
> change.
> > 2. Taking actions, e.g., invoking an action on the server, or deleting
> the
> > viewed email in Gmail. The analogy would be to a POST.
> > It seems to me that Lift's Ajax is often used for #2. However backbutton
> > support doesn't really make sense in that scenario.
> >
>
> I think the split between 1/2 depends greatly on your application.  I'd say
> the backbutton is as useful for POST as it is for GET.   It's a navigation
> tool and sometimes the best way to get where you want is to go back two
> steps and forward in another direction.   Mind you, it's still more
> complicated to handle actions (POST) is a safe manner.  The back button
> doesn't undo and if you go forward the same way, you may trigger a
> duplicate
> action.   It's up to the application to handle such cases.
>
> I think this is applicable to the wizard stuff too.   I think back button
> support would be a very nice usability enhancement there.
>
> alex
> --
> You received this message because you are subscribed to the Google Groups
> "Lift" group.
> To post to this group, send email to lift...@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.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Lift" group.
> To post to this group, send email to lift...@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.
>
>
>
>
-- 

You received this message because you are subscribed to the Google Groups "Lift" group.

To post to this group, send email to lift...@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.



Re: [Lift] Re: Backbutton for Ajax

2010-01-14 Thread Alex Boisvert
On Wed, Jan 13, 2010 at 6:10 PM, Naftoli Gugenheim wrote:

> I haven't really used Ajax much but it seems to me there are two kinds of
> changes.
> 1. Modifying the view, e.g., clicking an emal in Gmail, or Expand All. One
> can make an analogy to a GET request, in that there's no permanent change.
> 2. Taking actions, e.g., invoking an action on the server, or deleting the
> viewed email in Gmail. The analogy would be to a POST.
> It seems to me that Lift's Ajax is often used for #2. However backbutton
> support doesn't really make sense in that scenario.
>

I think the split between 1/2 depends greatly on your application.  I'd say
the backbutton is as useful for POST as it is for GET.   It's a navigation
tool and sometimes the best way to get where you want is to go back two
steps and forward in another direction.   Mind you, it's still more
complicated to handle actions (POST) is a safe manner.  The back button
doesn't undo and if you go forward the same way, you may trigger a duplicate
action.   It's up to the application to handle such cases.

I think this is applicable to the wizard stuff too.   I think back button
support would be a very nice usability enhancement there.

alex
-- 

You received this message because you are subscribed to the Google Groups "Lift" group.

To post to this group, send email to lift...@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.



Re: [Lift] Re: Backbutton for Ajax

2010-01-13 Thread Alex Boisvert
Just thinking out loud as to how this could work...

On modern browsers, it's possible to monitor the state change of the
browser's URL hash (aka window.location.hash /  '#' / document fragment) in
the browser with the 'onhashchange' DOM event.  It gets fired whenever the
location.hash changes.  On older browsers, it's also possible to poll for
change which is less efficient but that's life.

So the idea would be to:

1) add a snippet or utility method to set up a listener on onhashchange that
would callback Scala functions associated with given hash (e.g. #foo, #bar,
...).  Hashes could support parameters too (e.g., #foo/:param1/:param2)

2) add a method S.ajaxHash(hashPath, callback): JsCmd that would bind a hash
path/pattern to a Scala function (by registering the path/pattern with the
listener)

3) add a method S.changeHash(hashPath, params): JsCmd to programmatically
change the browser's hash as a result of some AJAX processing.

I don't have time to work on this yet but I'd be happy to hear what others
think of the idea.

alex

On Wed, Jan 13, 2010 at 2:45 PM, greekscala  wrote:

> Hello,
>
> I would really would like to have this type of support from lift.
> I looked at GWT and think this is a nice way. They use url parameters
> after a '#'. I dont understand the process because I have very little
> javascript knowledge.
>
> But I am thinking, lift is creating unique function names and is
> calling them with ajax.
> Maybe there is a way to have the functions be called over a way like
> GWT?
>
> Just creating some thoughts...
>
> best regards
>
>
> On 12 Jan., 13:23, greekscala  wrote:
> > Hello Timothy,
> >
> > there is nothing stoping me from using it.
> > But when I think of a framework it would be nice to "activate"
> > backbutton support.
> > I think this is somethink a lot of people would appreciate to have and
> > not everybody
> > should have to build this from the ground up.
> >
> > I do not have to deal with this now but in near future. I will have to
> > search
> > what ways are avalable. And if I can intergrate this im my app, maybe
> > we
> > can find a way to abstract it.
> >
> > with best regards
> >
> > On 12 Jan., 00:35, Timothy Perrett  wrote:
> >
> > > I'm not sure what is stopping you using something like this in
> > > conjunction with lift?
> >
> > > If you want something baked in, can you be specific with what and how
> > > you might want it to work?
> >
> > > Cheers, Tim
> >
> > > Sent from my iPhone
> >
> > > On 11 Jan 2010, at 23:13, greekscala  wrote:
> >
> > > > Hello Alex!
> >
> > > > I will take a look at sammy.js .
> > > > I would like to have some way for this in Lift too.
> > > > Since with Lift it is easy to do alot of ajax.
> >
> > > > with best regards
> >
> > > > On 11 Jan., 23:05, Alex Boisvert  wrote:
> > > >> I've been playing with sammy.js <http://code.quirkey.com/sammy/>
> > > >> recently
> > > >> and I like the way they update the URL fragment identifier (hash)
> > > >> when doing
> > > >> AJAX which makes apps more back-button friendly, in a manner that's
>
> > > >> similar
> > > >> to GMail.
> >
> > > >> It would be nice to have something similar in Lift.
> >
> > > >> alex
> >
> > > >> On Mon, Jan 11, 2010 at 4:55 PM, greekscala
> > > >>  wrote:
> > > >>> Hello Lift people!
> >
> > > >>> I would like to know how experienced lift devs think and what they
>
> > > >>> do
> > > >>> about
> > > >>> ajax backbutton support.
> >
> > > >>> with best regards
> >
> > > >>> --
> > > >>> You received this message because you are subscribed to the Google
>
> > > >>> Groups
> > > >>> "Lift" group.
> > > >>> To post to this group, send email to lift...@googlegroups.com.
> > > >>> To unsubscribe from this group, send email to
> > > >>> liftweb+unsubscr...@googlegroups.com
>  > > >>> %2bunsubscr...@googlegroups.com>
> > > >>> .
> > > >>> For more options, visit this group at
> > > >>>http://groups.google.com/group/liftweb?hl=en.
> > > > --
> > > > You received this message because you are s

Re: [Lift] Re: NGinx and sticky sessions

2010-01-13 Thread Alex Boisvert
I'm not sure if you discussed this but based on my experience, the
JSESSIONID cookie is used most often in Jetty/Tomcat/J2EE environments for
load balancing (over using client IP).

I haven't used nginx for load balancing yet but I've used both HAProxy and
Varnish in the past.

http://haproxy.1wt.eu/download/1.2/doc/architecture.txt

alex


On Wed, Jan 13, 2010 at 4:22 AM, Timothy Perrett wrote:

> To follow up this thread for completeness, I communicated to Marius that he
> needs to use:
>
> http://wiki.nginx.org/NginxHttpUpstreamRequestHashModule
>
> Which should do what he wants.
>
> Cheers, Tim
>
> On 13 Jan 2010, at 12:02, Marius wrote:
>
> >
> >
> > On Jan 13, 1:42 pm, Timothy Perrett  wrote:
> >> Nginx offers weighted round robin requests if memory serves... what does
> your config look like? The upstream module should be cool for what you want.
> >>
> >> http://wiki.nginx.org/NginxHttpUpstreamModule
> >>
> >> See that it uses class-c ip hashing to always distribute requests to the
> same backend node... making the query string redundant :-)
> >
> > I'm not sure about that. The flow I have is this:
> >
> > 1. client sends a login request with not server_id info.
> > 2. LB needs to dispatch to any node
> > 3. The node that responds back is setting the server_id information in
> > the HTTP response header (based on config files info from each node)
> > 4. The next subsequent requests for this session will also include the
> > server_id information received and here is the balancing rules I
> > need.
> >
> > I'm not sure I should use client's IP address because clients may be
> > behind NATs etc. and this may unbalance the cluster.
> >
> > Currently I have no config, so I'm still not sure how to config my
> > case described here.
> >
> >>
> >> Cheers, Tim
> >>
> >> On 13 Jan 2010, at 11:29, Marius wrote:
> >>
> >>> Hi all,
> >>
> >>> Did anyone here used nginx with sticky sessions? What I'm looking for
> >>> is:
> >>
> >>> if a request comes in with e certain HTTP header or query string
> >>> paramers the request should be dispatched to a given node. So I have a
> >>> header like server_id=1 -> dispatch the request to node1, if
> >>> server_id=2 dispatch the request to node2 and so on.
> >>
> >>> Is it possible to configure nginx like this?
> >>
> >>> 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 lift...@googlegroups.com.
> >>> To unsubscribe from this group, send email to
> liftweb+unsubscr...@googlegroups.com
> .
> >>> For more options, visit this group athttp://
> groups.google.com/group/liftweb?hl=en.
> > --
> > You received this message because you are subscribed to the Google Groups
> "Lift" group.
> > To post to this group, send email to lift...@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.
> >
> >
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Lift" group.
> To post to this group, send email to lift...@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.
>
>
>
>
-- 

You received this message because you are subscribed to the Google Groups "Lift" group.

To post to this group, send email to lift...@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.



Re: [Lift] Nginx question

2010-01-12 Thread Alex Boisvert
follow this thread for a few suggestions:
http://nginx.org/pipermail/nginx/2009-February/009791.html

On Tue, Jan 12, 2010 at 4:33 PM, Naftoli Gugenheim wrote:

> I have nginx set up as a frontend. How can I have it display "Down for
> maintenance" instead of pointing to jetty?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Lift" group.
> To post to this group, send email to lift...@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.
>
>
>
>
-- 

You received this message because you are subscribed to the Google Groups "Lift" group.

To post to this group, send email to lift...@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.



Re: [Lift] Re: Binding a snippet in a comet actor?

2010-01-12 Thread Alex Boisvert
Yes.

The issue is here: http://github.com/dpp/liftweb/issues/closed/#issue/93

It was fixed in 1.1M7 and later.

alex


On Tue, Jan 12, 2010 at 1:47 PM, Felipe Rodrigues <
felipero.maill...@gmail.com> wrote:

>  I have a similar problem here. I didn't find this issue on github.
> Is this issue solved?
>
> Thanks,
>
> Felipe
>
>
>> On Oct 9 2009, 5:17 pm, David Pollak 
>>
>> wrote:
>> > This is a defect.  I've opened a ticket:
>> http://github.com/dpp/liftweb/issues#issue/93
>> > I'll have a fix checked in later today
>> >
>> > On Fri, Oct 9, 2009 at 1:02 AM, Somindra Bhattacharya
>>  > wrote:
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> > > David,
>> >
>> > > Thanks for responding.
>> >
>> > > I have hosted the example athttp://174.129.214.150:8080/
>> >
>> > > The code is athttp://174.129.214.150:8080/dynamicForm.tar.gz
>>
>> >
>> > > Here are the steps to reproduce the issue:
>> >
>>  > > 1. Openhttp://174.129.214.150:8080/in a browser window. This starts
>>
>> > > a comet actor which listens for messages. There is no form present on
>> > > this page.
>> >
>>  > > 2. Openhttp://174.129.214.150:8080/testdriverin another browser
>>
>>  > > window. Juxtapose these two windows.
>> >
>> > > 3. Click on the "Click here" button in the window opened in (2).
>> > > Submitting this form results into a  block being sent to
>> > > the actor on the index page. This makes the index page show a form
>> > > that was not previously present.
>> >
>> > > 4. Click on the button that has appeared on the index page. This does
>> > > not result into calling the handler at the server end.
>> >
>> > > Please let me know if you need more information.
>> >
>> > > Thanks again...
>> >
>> > > Regards,
>> > > Som
>> >
>> > > On Oct 8, 9:40 pm, David Pollak 
>> wrote:
>> > > > The chat example in demo.liftweb.net (source in examples/example)
>> has a
>> > > form
>> > > > that is presented after the initial form is rendered.  It works just
>> > > fine.
>> > > > Please put together a small example of the failure so I can see the
>> > > running
>> > > > code.
>> >
>> > > > On Wed, Oct 7, 2009 at 9:13 PM, Somindra Bhattacharya
>> > > > wrote:
>> >
>> > > > > Apologies for bumping this.
>> >
>> > > > > Is there a way to get the submit button (or an ajaxButton) to work
>> if
>> > > > > the snippet which was not originally part of the page is bound by
>> a
>> > > > > comet actor?
>> >
>> > > > > Thanks,
>> > > > > Som
>> >
>> > > > > On Oct 7, 12:32 pm, Somindra  Bhattacharya 
>> > > > > wrote:
>> > > > > > Thanks for responding, Naftoli.
>> >
>> > > > > > I tried changing the code to:
>> >
>> > > > > > def handleSubmit() =
>> > > > > > {
>> > > > > >   Log.info("GOT A SUBMIT IN INVITE")
>> > > > > >   net.liftweb.http.js.JsCmds.Run("alert('Hey')")
>> > > > > > }
>> >
>> > > > > > ajaxForm(
>> > > > > >   bind("elem", xhtml,
>> > > > > >"submit" -> submit("Click", () => handleSubmit() ),
>> > > > > >  ) ++ hidden(() => handleSubmit())
>> > > > > > )
>> >
>> > > > > > The handleSubmit method is still not called. I tried using
>> ajaxButton
>> > > > > > instead of submit but that did not help either.
>> >
>> > > > > > What am I doing wrong?
>> >
>> > > > > > On Oct 7, 5:06 am, Naftoli Gugenheim 
>> wrote:
>> >
>> > > > > > > What about an Ajax form?
>> >
>> > > > > > > On Tue, Oct 6, 2009 at 9:52 AM, Somindra  Bhattacharya
>> >
>> > > > > > >  wrote:
>> >
>> > > > > > > > Hi Everyone,
>> >
>> > > > > > > > I have a comet actor that binds XHTML. The XHTML corresponds
>> to a
>> > > > > > > > snippet:
>> >
>> > > > > > > > XHTML for comet actor ->
>> >
>> > > > > > > >  
>> > > > > > > >
>> > > > > > > >  
>> >
>> > > > > > > > When the comet actor receives a certain message, the render
>> > > method of
>> > > > > > > > the comet actor binds the following XHTML ->
>> >
>> > > > > > > >
>> > > > > > > >   
>> > > > > > > >
>> >
>> > > > > > > > The Discuss snippet's "invite" method definition is:
>> >
>> > > > > > > >  def invite(xhtml: NodeSeq): NodeSeq =
>> > > > > > > >  {
>> >
>> > > > > > > > def handleSubmit() =
>> > > > > > > > {
>> > > > > > > >Log.info("GOT A SUBMIT IN INVITE")
>> > > > > > > > }
>> >
>> > > > > > > > bind("elem", xhtml,
>> > > > > > > > "submit" -> submit("Click", () => handleSubmit()))
>> > > > > > > >  }
>> >
>> > > > > > > > The page does not contain this form when it is first loaded.
>> When
>> > > the
>> > > > > > > > actor receives a certain message, it binds the XHTML
>> > > (Discuss.invite)
>> > > > > > > > to the page and the form and the "submit" button are
>> rendered
>> > > > > > > > properly.
>> >
>> > > > > > > > However, when I click on the submit button, the
>> "handleSubmit"
>> > > method
>> > > > > > > > is not called. Instead, the browser displays a page with the
>> text
>> > > > > > > > "window.location=/".
>> > > > > > > > If I use the browser back button and re-visit the page with
>> the
>> > > comet
>> > 

Re: [Lift] Ajax forms and (multiple) submit buttons

2010-01-12 Thread Alex Boisvert
I like it a lot.   Eliminates recent confusion about submit() in ajaxForm,
prettier and semantically more correct than hidden fields and supports
multiple actions.  What's not to like?

alex


On Tue, Jan 12, 2010 at 2:39 PM, Marius  wrote:

> Dear all,
>
> Recently (and not only) there have been discussions about ajax forms
> and their submit Scala functions not being called and that's because
> JQuery's form serialization doesn't serialize  the input submits (for
> pertinent reasons). The workaround is as you know to use hidden
> fields.
>
> Adam also wanted an ajax form with multiple submit buttons taking
> different actions depending on which button is being called. This is
> also *doable* using hidden fields  but not quite from elegant.
>
> I've experimented a way to allow ajax form submission but after all
> form field functions are being called your own ajax Scala function is
> being called (with no hidden fields).  the idea is this:
>
> 1. I added an SHtml.ajaxSubmit which has the same signature with
> SHtml.submit
> 2. At js level I added a liftAjax.lift_uriSuffix
> 3. When clicking the ajaxSubmit button we set the
> liftAjax.lift_uriSuffix with the function name value. This is the
> function name of your scala function. Hence your scala function for
> ajaxSubmit will be called after form field functions are called.
>
> In short we "piggy back" the Scala function info on top of the
> serialized form info.
>
> I tested it and it works just fine for me:
>
> Using it looks something like like:
>
>  ajaxForm(bind("hello", xhtml,
>   "field1" -> text("", (s) => {println("field1 = " + s)}),
>   "field2" -> text("", (s) => {println("field2 = " + s)}),
>   "field3" -> text("", (s) => {println("field3 = " + s)}),
>   "submit" -> ajaxSubmit("Press me", () => {
>  println("my ajax func called.")
>  Noop
>}))
>
> ... you got the idea.
>
> This of course allows putting virtually any number of ajax submit
> buttons and the right function will be called on server side.
>
> I'm thinking to add this to Lift but first I'd like to know 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 lift...@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.
>
>
>
>
-- 

You received this message because you are subscribed to the Google Groups "Lift" group.

To post to this group, send email to lift...@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.



Re: [Lift] User Presence Heartbeat

2010-01-12 Thread Alex Boisvert
The current GC liveliness entrypoint is in LiftServlet.handleAjax() which
calls liftSession.updateFuncByOwner().

There's no extension point for what you want at the moment although it would
be fairly easy to add something to LiftSession.

The closest thing right now is LiftSession.onBeginServicing where you can
add you own function and correlate the request session id with the objects
in your own application.

Hope this helps,
alex


On Tue, Jan 12, 2010 at 1:02 PM, Daniel Spiewak  wrote:

> I'm looking to implement a user presence feature (think: Facebook or
> Gmail chat) in a Lift 1.0 application.  Ideally, I would like to avoid
> adding extraneous connections.  Is it possible to hook into the Lift
> Comet heartbeat which is already in use across our system?  I've
> looked at the source for CometActor, and it's just a little too
> obfuscated for me to figure this one out on my own.  :-)
>
> Alternatively, has anyone else implemented this sort of system in
> Lift?  If so, how did you go about it?  Any tips from the well-
> informed?
>
> Daniel
>
> --
> You received this message because you are subscribed to the Google Groups
> "Lift" group.
> To post to this group, send email to lift...@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.
>
>
>
>
-- 

You received this message because you are subscribed to the Google Groups "Lift" group.

To post to this group, send email to lift...@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.



Re: [Lift] Lift on Stack Overflow

2010-01-12 Thread Alex Boisvert
As someone who answers questions, I prefer email because of the "unified
inbox".  I can organize many things in a single location and refer to them
easily.   (I know I can use RSS with SO but I have yet to find a satisfying
way to organize question feeds into my existing stream of emails)

As someone who looks for or simply reads answers (I've never asked a
question on SO yet), I prefer the experience of Stack Overflow.  The answers
are ranked, organized, filtered, etc.   The main drawback for me there is
there's possibly too much stuff that draws me away from actual work ;)

alex


On Tue, Jan 12, 2010 at 11:55 AM, Timothy Perrett
wrote:

> StackOverflow tends to be peer to peer IMO; I dont believe that MUST be
> committers or whatever, as DPP says, this is the official forum, if other
> users or committers use stack overflow, then sure, but i doubt I'll be
> hanging out there massively.
>
> Cheers, Tim
>
> On 12 Jan 2010, at 16:41, David Pollak wrote:
>
> My 2 cents (and maybe this is 'cause I'm an old guy), but I don't see the
> value of supporting yet another Lift support forum.  This list is highly
> visible and the folks on this list of very helpful.  The list is searchable
> (although not taggable).  We don't do support on Twitter.  We don't
> officially do support on IRC (although a fair number of Lift committers hang
> out there).  We try to keep the energy and focus on this mailing list.
>
> Please tell me what the advantage to Stack Overflow is vs. a list like this
> one?  What kind of better experience would the asker of a question have on
> Stack Overflow?
>
> On Tue, Jan 12, 2010 at 5:27 AM, Daniel Sobral  wrote:
>
>> I gathered some stats on number of question by tag:
>>
>> java x 30950
>> asp.net x 26451
>> php x 24854
>> asp.net-mvc x 8670
>> ruby-on-rails x 8513
>> ruby x 6620 -- just to contrast with ruby-on-rails
>> django x 4550
>> flash x 3828
>> silverlight x 3365
>> spring x 1468
>> forms x 1339
>> jsp x 1326
>> wordpress x 1004
>> j2ee x 844
>> gwt x 779
>> grails x 763
>> SCALA x 698
>> coldfusion x 686
>> groovy x 607 -- just to contrast with grails
>>
>> That's from the first 5 pages of tags, and I'm left out "forks" from the
>> main tag, such as php5.
>>
>> lift is on page 43, with, coincidentally, 43 questions. There's also
>> lift-1.1 with 2 questions. (PS, I noticed one of the questions tagged Lift
>> has nothing whatsoever to do with it -- I'll be editting that question to
>> remove that tag).
>>
>> I worry that the visibility of Lift is is way below that of other
>> frameworks, particularly when one takes into account that Rails and Grails
>> have more questions than Ruby and Groovy respectively.
>>
>> Also, the answer rate on these questions is not very good. I think
>> visibility on Stack Overflow is important, so I ask you to consider
>> dedicating a little bit of time to it.
>>
>> Questions tagged with Lift can be found with the link
>> http://stackoverflow.com/questions/tagged/lift.
>> One can also get RSS, for newest questions
>> http://stackoverflow.com/feeds/tag?tagnames=lift&sort=newest, or active
>> questions (recent activity)
>> http://stackoverflow.com/feeds/tag?tagnames=lift&sort=hot.
>>
>> --
>> Daniel C. Sobral
>>
>> I travel to the future all the time.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Lift" group.
>> To post to this group, send email to lift...@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 simply functional web framework http://liftweb.net
> Beginning Scala http://www.apress.com/book/view/1430219890
> Follow me: http://twitter.com/dpp
> Surf the harmonics
> --
> You received this message because you are subscribed to the Google Groups
> "Lift" group.
> To post to this group, send email to lift...@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.
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Lift" group.
> To post to this group, send email to lift...@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.
>
>
-- 

You received this message because you are subscribed to the Google Groups "Lift" group.

To post to this group, send email to lift...@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.



Re: [Lift] Backbutton for Ajax

2010-01-11 Thread Alex Boisvert
I've been playing with sammy.js  recently
and I like the way they update the URL fragment identifier (hash) when doing
AJAX which makes apps more back-button friendly, in a manner that's similar
to GMail.

It would be nice to have something similar in Lift.

alex


On Mon, Jan 11, 2010 at 4:55 PM, greekscala  wrote:

> Hello Lift people!
>
> I would like to know how experienced lift devs think and what they do
> about
> ajax backbutton support.
>
> with best regards
>
> --
> You received this message because you are subscribed to the Google Groups
> "Lift" group.
> To post to this group, send email to lift...@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.
>
>
>
>
-- 

You received this message because you are subscribed to the Google Groups "Lift" group.

To post to this group, send email to lift...@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.



Re: [Lift] How many memory are assigned by default when starting the Jetty ?

2010-01-11 Thread Alex Boisvert
The standard jetty.sh doesn't explicitly set JVM memory settings.  It relies
on default JVM ergonomics (
http://java.sun.com/j2se/1.5.0/docs/guide/vm/gc-ergonomics.html).

You can explicitly set your memory requirements in ~/.jettyrc, e.g.,

#!/bin/sh
JAVA_OPTIONS="-noverify -javaagent:$JREBEL_HOME/jrebel.jar
-Dorg.mortbay.util.FileResource.checkAliases=false -Xmx1024m"

alex


On Fri, Jan 8, 2010 at 5:12 PM, Neil.Lv  wrote:

> Hi all,
>
>  I have a silly question about the memory of the jetty.
>
>  How many the memory are assigned by default when starting the Jetty
> server?
>
>  There is a problem that I do some operation for about 30 minutes,
> then the jetty was crashed.
>  The error message is that the memoryOutOfBound 
>
>  I use this command to start the jetty server:
> ###
>  /jetty/jetty.sh start
> ###
>
> Cheers,
>   Neil
>
> --
> You received this message because you are subscribed to the Google Groups
> "Lift" group.
> To post to this group, send email to lift...@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.
>
>
>
>
-- 

You received this message because you are subscribed to the Google Groups "Lift" group.

To post to this group, send email to lift...@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.



Re: [Lift] Re: what provides classpath/jquery.js?

2010-01-10 Thread Alex Boisvert
Understood.  I was referring to reusable snippets (e.g., flot widgets).

For your own apps, I can't think of a good reason right now.

Alex

On Jan 10, 2010 4:18 PM, "Alex Black"  wrote:

hmm.  We just upload a single WAR file to our server, its got
everything in it including JS etc.

On Jan 10, 5:16 pm, Alex Boisvert  wrote: > One
reason is to bundle html/j...

> On Jan 10, 2010 3:34 PM, "Alex Black"  wrote: > > Hi
Marius, I haven't heard of...
> liftweb+unsubscr...@googlegroups.com

>
> .
> For more options, visit this group athttp://
groups.google.com/group/liftweb?hl=en.

--
You received this message because you are subscribed to the Google Groups
"Lift" group.
To post to this group, send email to lift...@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.
-- 

You received this message because you are subscribed to the Google Groups "Lift" group.

To post to this group, send email to lift...@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.



Re: [Lift] Re: what provides classpath/jquery.js?

2010-01-10 Thread Alex Boisvert
One reason is to bundle html/js/... along with their corresponding snippet
in a jar file.

Alex

On Jan 10, 2010 3:34 PM, "Alex Black"  wrote:

Hi Marius, I haven't heard of ResourceServer before, sounds
interesting.

Right now, our CSS and JS files are just in subfolders of webapp, e.g
"src/main/webapp/js", what are the advantages of (or reasons behind)
putting js files in resources?

- Alex

On Jan 9, 3:04 am, Marius  wrote: > It is given by
LiftRules.resourceServe...

--
You received this message because you are subscribed to the Google Groups
"Lift" group.
To post to this group, send email to lift...@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.
-- 

You received this message because you are subscribed to the Google Groups "Lift" group.

To post to this group, send email to lift...@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.



Re: [Lift] Minor breaking changes -- LiftRules.getResourceAsStream and LiftRules.finder

2010-01-09 Thread Alex Boisvert
This change has now been pushed to master.

LiftRules.finder() has been removed since it offered (unsafe) duplicate
functionality.

cheers,
alex


On Mon, Jan 4, 2010 at 4:03 PM, Alex Boisvert wrote:

> Instead of:
>
>
> LiftRules.getResourceAsStream(name: String): Box[InputStream]
>
> I'd suggest:
>
>
> LiftRules.doWithResource[T](name: String)(f: InputStream => T): Box[T].
>
> And if you need laziness, you could use one of the usual suspects: "lazy
> val", unapplied function, FatLazy, etc.
>
> alex
>
>
>
> On Thu, Dec 31, 2009 at 3:48 PM, David Pollak <
> feeder.of.the.be...@gmail.com> wrote:
>
>> Folks,
>>
>> I've changed LiftRules.getResourceAsStream and LiftRules.finder to return
>> Box[Applier[InputStream]] rather than Box[InputStream].
>>
>> Applier has a single method, apply[T] which takes an InputStream => T and
>> insures the InputStream is closed.
>>
>> This change is unlikely to impact much code out there, but does make sure
>> that InputStreams are closed.
>>
>> If any of the folks out there that name things better than I do (at least
>> I didn't call it Apply_A_Tron), please feel free to suggest name changes,
>> variance changes, etc.
>>
>> 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
>> Surf the harmonics
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Lift" group.
>> To post to this group, send email to lift...@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.
>>
>
>
-- 

You received this message because you are subscribed to the Google Groups "Lift" group.

To post to this group, send email to lift...@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.



Re: [Lift] Re: SessionVars in different snippets

2010-01-06 Thread Alex Boisvert
I don't know if it's a common practice but I usually keep all my SessionVars
in the same module (aka singleton object) for easy access:

/** All session variables */
object Session {
  private def currentWeekReq = S.param("currentWeek").map(Week.parse(_))
  object currentWeek extends SessionVar[Week](currentWeekReq openOr
(Week())) {
override def is = currentWeekReq openOr super.is
  }
  object latestEntry extends SessionVar("latestEntry")
  object editEntry   extends SessionVar("editEntry")
  object failedEntry extends SessionVar("failedEntry")
  /* etc... */
}

then I just import Session._ wherever needed.

alex

On Wed, Jan 6, 2010 at 11:31 AM, greekscala  wrote:

> Hello,
>
> I dont have to use SessionVars until now, but in near future.
> But I had the same problem in mind.
>
> Is there not a central place to get the user session with all the
> values stored?
>
> I think it is ugly to have sessionVars spread all over my code.
>
> with best regards
>
> On 5 Jan., 18:13, Naftoli Gugenheim  wrote:
> > Each SessionVar is distinct. Create one -- it can be global -- and use it
> in both snippets.
> >
> > -
> >
> > michall wrote:
> >
> > I have two snippets Login and Profile, and I want to read same object
> > stored in session, when I use SessionVar it create two different
> > object:
> >
> > object user extends SessionVar[Box[User]](Empty) // same in two
> > snippets
> >
> > When I set this object in Login.scala :
> >
> >  val usr = User.find(By(User.login,login))
> > user.set(usr)
> >
> > in Profile it's still Empty
> >
> > why?
> >
> > --
> >
> > You received this message because you are subscribed to the Google Groups
> "Lift" group.
> > To post to this group, send email to lift...@googlegroups.com.
> > To unsubscribe from this group, send email to
> liftweb+unsubscr...@googlegroups.com
> .
> > For more options, visit this group athttp://
> groups.google.com/group/liftweb?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Lift" group.
> To post to this group, send email to lift...@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.
>
>
>
>
-- 

You received this message because you are subscribed to the Google Groups "Lift" group.

To post to this group, send email to lift...@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.



Re: [Lift] new line to

2010-01-05 Thread Alex Boisvert
The problem is that you're creating a String (not a NodeSeq) and the String
content is being escaped inside the wrapping elements.

Try this,

 { note.replyContent split '\n' map { Text(_) ++  } reduceLeft (_ ++
_) } 

alex

On Tue, Jan 5, 2010 at 9:24 AM, daiwhea  wrote:

> my issue is:
>
> There are some text input by users. There are new line character(\r\n)
> in these text. I want to convert those new line characters into 
>
> In the snippet, I put {note.replyContent.replaceAll("\n", "")}
> . But the converted  was changed to "
" by lift. > > So, my question is: In lift, how can I convert those new lines into > tags? > > Thanks in advance. ^_^ > > -- > > You received this message because you are subscribed to the Google Groups > "Lift" group. > To post to this group, send email to lift...@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. > > > -- You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to lift...@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.

Re: [Lift] Minor breaking changes -- LiftRules.getResourceAsStream and LiftRules.finder

2010-01-04 Thread Alex Boisvert
Instead of:

LiftRules.getResourceAsStream(name: String): Box[InputStream]

I'd suggest:

LiftRules.doWithResource[T](name: String)(f: InputStream => T): Box[T].

And if you need laziness, you could use one of the usual suspects: "lazy
val", unapplied function, FatLazy, etc.

alex


On Thu, Dec 31, 2009 at 3:48 PM, David Pollak  wrote:

> Folks,
>
> I've changed LiftRules.getResourceAsStream and LiftRules.finder to return
> Box[Applier[InputStream]] rather than Box[InputStream].
>
> Applier has a single method, apply[T] which takes an InputStream => T and
> insures the InputStream is closed.
>
> This change is unlikely to impact much code out there, but does make sure
> that InputStreams are closed.
>
> If any of the folks out there that name things better than I do (at least I
> didn't call it Apply_A_Tron), please feel free to suggest name changes,
> variance changes, etc.
>
> 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
> Surf the harmonics
>
> --
> You received this message because you are subscribed to the Google Groups
> "Lift" group.
> To post to this group, send email to lift...@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.
>

--

You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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.




Re: [Lift] Re: Form submit and Ajax

2009-12-29 Thread Alex Boisvert
On Tue, Dec 29, 2009 at 12:59 PM, greekscala  wrote:

> class Test {
>  object name extends RequestVar[String]("init")
>
>  def render(xml: NodeSeq): NodeSeq = {
>def printName(): JsCmd = {
>  Log.debug("name = " + name.is)
>
>  JsCmds.Alert("an ajax response! "+ name.is)
>}
>SHtml.ajaxForm(
>  Helpers.bind("atest", xml,
>"name" -> SHtml.text(name.is, name(_)),
>"submit" -> SHtml.submit("add", printName)
>  ), JsCmds._Noop, printName
>)
>
>/*
>SHtml.ajaxForm(
>  Helpers.bind("atest", xml,
>"name" -> SHtml.text(name.is, name(_)),
>"submit" -> SHtml.submit("add", printName)
>  ) ++ SHtml.hidden(printName)
>)
>*/
>  }
> }
>
> This is the template:
> 
>
>
>
>
> 
>
> The problem is with the uncommented ajaxForm code, when the form is
> submitted the name RequestVar is not updated. I seems that the
> function
> bound to the name-Textfield is not invoked. So I get back "an ajax
> response! init".
>

It's invoked but it's invoked before the form field callbacks have been
called so the field still holds the initial value.  (I've been wondering if
this is the right behavior myself.)

The SHtml.hidden() callback is called after the form field callbacks so
that's probably the one you want to use for now.

alex

--

You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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.




Re: [Lift] Re: Form submit and Ajax

2009-12-29 Thread Alex Boisvert
On Tue, Dec 29, 2009 at 11:46 AM, greekscala  wrote:

> Is this a "lift" way workflow?
>
> - show a page with a form
> - data is submitted to snippet
> - data is evaluated
> - get other fragments/templates and bind the values for them
> - invoke SetHtml that should replace div content on the page
>

Yes, I'd say this is fairly a recurring use case.

 > Not unless you're specifically calling templates, etc.
>
> Do I have to load my fragments with templateFinder and then
> invoke other snippet methods that are intended to process the
> templates xml or is there another way so that Lift can do it.
>

Actually, I just tested it because I wasn't sure anymore and sure enough,
Lift processes the content passed to SetHtml, so there's no need to call
templateFinder unless you need to do more dynamic things. (I forgot about
that, sorry about the wrong answer earlier)

alex

--

You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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.




Re: [Lift] Re: Lift with MS Access database

2009-12-29 Thread Alex Boisvert
On Sun, Dec 27, 2009 at 6:56 PM, Naftoli Gugenheim wrote:

> Although in general I think that instead of Lift hardcoding its set of
> drivers, it should allow anyone to subclass DriverType and supply it to
> Lift.


Already supported.

See
http://github.com/dpp/liftweb/issuesearch?state=closed&q=driver#issue/169

You can provide your own driver by overriding DriverType.calcDriver.

alex

--

You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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.




Re: [Lift] Form submit and Ajax

2009-12-29 Thread Alex Boisvert
On Tue, Dec 29, 2009 at 7:44 AM, greekscala  wrote:

> Hello,
>
> In a previous post I had the problem that my form was not send with
> ajax.
> With the help of Marius and Timothy I got it working.
> (http://groups.google.com/group/liftweb/browse_thread/thread/
> d052ed7191561ef1
> )
>
> I have to questions.
>
> Now I want, after the form is submittet, to fetch an object from my DB
> do something
> and update the site.
>
> I tried the following:
> def add(xml: NodeSeq): NodeSeq = {
>
>def addBookmark(): JsCmd = {
>  // fetch the object from DB
>
>   JsCmds.SetHtml(WebHelper.MAIN_DIV_ID,
>   TemplateFinder.findAnyTemplate
> (WebHelper.bookmarkEdit).open_!)
>}
>
>SHtml.ajaxForm(
>  bind("bookmark", xml,
>"url" -> SHtml.text(url, url = _),
>"submit" -> SHtml.submit("add", addBookmark)
>  ), JsCmds._Noop, addBookmark
>)
> }
>
> I hoped that the addBookmark method would be invoked after the form
> is submitted and that the returned SetHtml will set the new snippet
> fragment (that should be processed by lift).
> The new fragment is a new form:
> 
>
>
>
> 
>
> Is there a better way to do such ajax fragment replacements? would
> like to know more about.
>

I can't think of a better way right now;  what you're doing is pretty
standard.


> Are the NodeSeq that should be replaced with SetHtml processed by
> Lift?
>

Not unless you're specifically calling templates, etc.


> The second thing is, that when I am trying to make a browser request
> to view the page,
> the addBookmark method is already executed. Was this intended?
>

No, that's not supposed to happen.  I'm guessing you're calling
addBookmark() somewhere else in your code.

alex

--

You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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.




Re: [Lift] Re: Snippet lifetime

2009-12-29 Thread Alex Boisvert
I found RequestVar surprising/confusing at first, too, because I assumed its
scope would be a single request -- but clearly isn't.

My suggestion here would be to rename RequestVar to PageVar since that's
closer to its lifecycle and rename TransientRequestVar to RequestVar based
on my initial expectation.

I think this would make it more intuitive for newbies learning lift.

alex


On Tue, Dec 29, 2009 at 2:49 AM, Adam Warski  wrote:

> Hello,
>
> > These are the names we use in Lift - appreciate what your saying, but its
> not confusing IMHO, just different to other things you are used to. Lift is
> Lift, not RoR, or Seam, or any other framework ;-)
>
> Sure, it's just a simple terminology switch, I don't really mind if they
> are named one way or the other. The only objection I would have is that I
> would make TransientRequestVar public, and, as Naftoli wrote,
> statefullness/dispatching a trait.
>
> --
> Adam
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Lift" group.
> To post to this group, send email to lift...@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.
>
>
>

--

You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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.




Re: [Lift] Re: Snippet lifetime

2009-12-28 Thread Alex Boisvert
StatefulSnippets lifetime is manually managed and may be "chained" to other
pages by using link() or redirectTo() such that the same instance is reused
for those targets.

(And StatefulSnippet extends DispatchSnippet)

alex

On Mon, Dec 28, 2009 at 10:08 AM, Naftoli Gugenheim wrote:

> And what's the difference to a StatefulSnippet?
>
> -
> Adam Warski wrote:
>
> Hello,
>
> > RequestVar-s lifetime is expanded beyond the actual request, which is
> > not applicable for TransientRequestVar. For instance say you have a
> > page and you set some state on a RequestVar ... then you render an
> > Ajax link. After the page is rendered, when your ajax function is
> > invoked, you RequestVar state set when rendering the page is still
> > visible.
> >
> > But is there is problem you're chasing or is it just terminology?
> I understand the difference; and I think the terminology is a bit
> misleading. But right now I have two questions:
>
> 1) Can I have in lift a "true" request variable/snippet, that is such which
> has a lifetime of one request (without any ajax callbacks)? I can't use
> TransientRequestVar because it's private. It would be useful to complete my
> ajax-form example (after an item is saved, a new one should be used; I guess
> I could just store the model instance in a RequestVar and set it to a new
> object after saving, but maybe there's a nicer way).
>
> 2) Why would one want to use DispatchSnippets? The wiki says they are
> better because they are not instantiated whenever a tag is occurred. But
> right now, reflection snippets also aren't - they are instantiated at most
> once per request.
>
> > Br's,
> > Marius
> >
> > On Dec 28, 6:04 pm, Adam Warski  wrote:
> >> Hello,
> >>
> >>> Yes, the article is out of date now... Lift now makes sure that
> multiple references to a single snippet in the same request context use the
> same instance of that snippet.
> >>
> >> I see, so the rationale behind using dispatch snippets is out of date
> also. Except that you save one reflection call per page/request. So are
> there any reasons to use DispatchSnippets now?
> >>
> >>> Reflection snippets do not have the same scope as request vars...
> rather, the snippet is held in a request var.
> >>
> >> Which essentialy makes them have the same scope as request vars :)
> >>
> >> By the way, is there a "true" request-scope variable? I saw that there's
> TransientRequestVar, but it's private in the liftweb package.
> >>
> >> Adam
> >>
> >>> Cheers, Tim
> >>
> >>> On 28 Dec 2009, at 14:33, Adam Warski wrote:
> >>
>  Hello,
> >>
>  on the wiki page about reflection snippets (
> http://wiki.github.com/dpp/liftweb/about-snippets), it is written:
> >>
>  "Every time you call the reflection snippet in your markup code, a new
> instance is instantiated and the appropriate method invoked"
> >>
>  However this doesn't seem to be true (I'm using 1.1-M8). I have
> modified the example in the tutorial to use ajax to submit the form (as
> Marius and others advised me in another thread), and I discovered that after
> I add an item, then try to add another one, the first one is modified, which
> would mean that the same snippet instance is used (the snippet - TD - is a
> reflection snippet, as far as I understand the terminology).
> >>
>  That would mean that reflection snippets have the same scope as
> RequestVars, that is that there's at most one instance per rendered page.
> Marius wrote that this changes recently, so maybe it's a side-effect?
> >>
>  Also, do you think that "RequestVar" is a good name? For me it
> suggests a variable which has a lifecycle only for one http request. In the
> Seam framework, for example, there are two scopes: request and page (and
> many others), the first one being a "true" request scope, the second having
> essentially the same scope as RequestVar. So maybe it should be called
> PageVar?
> >>
>  --
>  Adam
> >>
>  --
> >>
>  You received this message because you are subscribed to the Google
> Groups "Lift" group.
>  To post to this group, send email to lift...@googlegroups.com.
>  To unsubscribe from this group, send email to
> liftweb+unsubscr...@googlegroups.com
> .
>  For more options, visit this group athttp://
> groups.google.com/group/liftweb?hl=en.
> >>
> >>> --
> >>
> >>> You received this message because you are subscribed to the Google
> Groups "Lift" group.
> >>> To post to this group, send email to lift...@googlegroups.com.
> >>> To unsubscribe from this group, send email to
> liftweb+unsubscr...@googlegroups.com
> .
> >>> For more options, visit this group athttp://
> groups.google.com/group/liftweb?hl=en.
> >
> > --
> >
> > You received this message because you are subscribed to the Google Groups
> "Lift" group.
> > To post to this group, send email to lift...@googlegroups.com.
> > To unsubscribe from this group, send email to
> liftweb+unsubscr...@googlegroups.com
> .
> > For more options, visi

Re: [Lift] Snippet lifetime

2009-12-28 Thread Alex Boisvert
On Mon, Dec 28, 2009 at 8:04 AM, Adam Warski  wrote:

> Hello,
>
> > Yes, the article is out of date now... Lift now makes sure that multiple
> references to a single snippet in the same request context use the same
> instance of that snippet.
> I see, so the rationale behind using dispatch snippets is out of date also.
> Except that you save one reflection call per page/request. So are there any
> reasons to use DispatchSnippets now?
>

DispatchSnippets support dynamic dispatch:  you can change how tags are
dispatched based on some state.

With (reflection-based) snippets, there's a direct binding between the tag
and the class name + method.  Well, unless you override
LiftRules.snippetDispatch.

alex

--

You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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.




Re: [Lift] Directory structure

2009-12-20 Thread Alex Boisvert
I don't think it's worth a lot of effort.   If it's been tried and doesn't
work nicely, I'm fine with sticking with the current structure.

At some point, though, you have to decide who's boss, you or the build
system ;)

(I love taking jabs at Maven, sorry)

alex

On Sun, Dec 20, 2009 at 12:42 PM, Indrajit Raychaudhuri  wrote:

> Alex,
>
> Yes, it's possible to have artifactId ≠ directoryName for Maven
> projects. But last time I did this Maven chose to be very cruel with me
> (site generation, relative path resolutions etc. broke).
>
> Also see the point and convergence to decision here:
> http://groups.google.com/group/liftweb/msg/73a5652a55076384
>
> In this case, I would usually type out "cd liftcore" blindly and the
> right thing would happen automatically thanks to "shopt -s cdspell" in
> my .bashrc config. But I digress.
>
> However, I won't mind re-opening this discussion on 'lift-' prefix if
> you want me to.
>
> Cheers, Indrajit
>
>
> On 21/12/09 1:29 AM, Alex Boisvert wrote:
> > While we're discussing lift-core in a separate thread, I wanted to bring
> > up a minor annoyance
> >
> > All module directories in the repository start with "lift-",
> >
> > boisv...@smudge:~/git/liftweb$ tree -L 2 | grep lift
> > |-- lift-archetypes
> > |   |-- lift-archetype-basic
> > |   |-- lift-archetype-blank
> > |   |-- lift-archetype-jpa-basic
> > |   |-- lift-archetype-jpa-blank
> > |   |-- lift-archetype-jpa-blank-single
> > |-- lift-base
> > |   |-- lift-actor
> > |   |-- lift-common
> > |   |-- lift-json
> > |   |-- lift-util
> > |   |-- lift-webkit
> > |-- lift-core
> > |-- lift-examples
> > |   |-- hellolift
> > |-- lift-misc
> > |   |-- lift-installer
> > |-- lift-modules
> > |   |-- lift-amqp
> > |   |-- lift-facebook
> > |   |-- lift-jta
> > |   |-- lift-machine
> > |   |-- lift-oauth
> > |   |-- lift-openid
> > |   |-- lift-osgi
> > |   |-- lift-paypal
> > |   |-- lift-testkit
> > |   |-- lift-textile
> > |   |-- lift-widgets
> > |   |-- lift-wizard
> > |   |-- lift-xmpp
> > |-- lift-persistence
> > |   |-- lift-jpa
> > |   |-- lift-mapper
> > |   |-- lift-record
> >
> > This naming isn't very practical when navigating the directory structure
> > since it meddles with completion.
> >
> > e.g.  cd  (beep!) lift-  (beep!) c  (finally completes
> > "core")
> >
> > Does Maven support simpler names?  Could we have something like this?
> >
> > |-- base
> > |   |-- actor
> > |   |-- common
> > |   |-- json
> > |   |-- util
> > |   |-- webkit
> > |-- modules
> > |   |-- amqp
> > |   |-- ...
> > |   |-- ...
> >
> > (I'm not suggesting change the names of the modules;  just the names of
> > the directories)
> >
> > alex
> >
> > --
> >
> > You received this message because you are subscribed to the Google
> > Groups "Lift" group.
> > To post to this group, send email to lift...@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.
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Lift" group.
> To post to this group, send email to lift...@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.
>
>
>

--

You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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] Directory structure

2009-12-20 Thread Alex Boisvert
While we're discussing lift-core in a separate thread, I wanted to bring up
a minor annoyance

All module directories in the repository start with "lift-",

boisv...@smudge:~/git/liftweb$ tree -L 2 | grep lift
|-- lift-archetypes
|   |-- lift-archetype-basic
|   |-- lift-archetype-blank
|   |-- lift-archetype-jpa-basic
|   |-- lift-archetype-jpa-blank
|   |-- lift-archetype-jpa-blank-single
|-- lift-base
|   |-- lift-actor
|   |-- lift-common
|   |-- lift-json
|   |-- lift-util
|   |-- lift-webkit
|-- lift-core
|-- lift-examples
|   |-- hellolift
|-- lift-misc
|   |-- lift-installer
|-- lift-modules
|   |-- lift-amqp
|   |-- lift-facebook
|   |-- lift-jta
|   |-- lift-machine
|   |-- lift-oauth
|   |-- lift-openid
|   |-- lift-osgi
|   |-- lift-paypal
|   |-- lift-testkit
|   |-- lift-textile
|   |-- lift-widgets
|   |-- lift-wizard
|   |-- lift-xmpp
|-- lift-persistence
|   |-- lift-jpa
|   |-- lift-mapper
|   |-- lift-record

This naming isn't very practical when navigating the directory structure
since it meddles with completion.

e.g.  cd  (beep!) lift-  (beep!) c  (finally completes
"core")

Does Maven support simpler names?  Could we have something like this?

|-- base
|   |-- actor
|   |-- common
|   |-- json
|   |-- util
|   |-- webkit
|-- modules
|   |-- amqp
|   |-- ...
|   |-- ...

(I'm not suggesting change the names of the modules;  just the names of the
directories)

alex

--

You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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.




Re: [Lift] Confused about validation

2009-12-17 Thread Alex Boisvert
I think the idea is to be a little more declarative on defining the form and
separate the low-level concerns of handling all the events to a more generic
form handler,

object ShipToForm extends Form {
  val name = Variable[String](customerName)
  val address1: Variable[String]()
  val address2: Variable[String]()
  val state: Variable[String]()
  val zip: Variable[String]()

  val form =
TextField("Name", name, StringLengthValidator(30)) ++
TextField("Address 1", address1, StringLengthValidator(20)) ++
TextField("Address 2", address2, StringLengthValiator(20)) ++
TextField("State", state, listOfStates) ++
TextField("Zip", zip, ZipCodeValidator) ++
  )  ++ FullAddressValidator(address1, address2, state, zip)

  val onSubmit = {
// everything has been validated
  }
}

bind("shipTo", AjaxifyForm(ShipToForm))

or

bind("shipTo", PlainOldForm(ShipToForm))

alex

On Thu, Dec 17, 2009 at 11:07 AM, Naftoli Gugenheim wrote:

> What would such an abstraction do?
> What code would you like to write (including templates) and what should it
> do?
>
> -
> Alex Boisvert wrote:
>
> Indeed, if you're building a lot of forms, you quickly realize that Lift
> currently requires fair amount of code for forms that are not backed by
> mapper elements.  There's space there for better abstrations / DSL
> improvements to reduce boilerplate -- similar to what David has built for
> the new wizard.
>
> alex
>
>
> On Wed, Dec 16, 2009 at 8:47 AM, greekscala 
> wrote:
>
> > Hello lift people,
> >
> > lift seems very promising. I am trying to make some tests
> > and examples because I am new to lift.
> > I wanted to add some validation to a form element and show
> > the validation error to the user.
> > But after little searching I was a little disappointet to see that
> > there
> > is no such support, exept when using Mapper. I do not want to use
> > Mapper.  I want only simple field validation with the errors messages
> > printed in a feedback panel.
> >
> > Before lift I was using Wicket. I think they did a good job with the
> > validators.
> >
> > I try to understand why lift has not such support? I do not want to
> > code
> > everything in my submit method and validate things there.
> >
> > best regards
> >
> > --
> >
> > You received this message because you are subscribed to the Google Groups
> > "Lift" group.
> > To post to this group, send email to lift...@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.
> >
> >
> >
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Lift" group.
> To post to this group, send email to lift...@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.
>
>
>

--

You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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.




Re: [Lift] heapsize

2009-12-17 Thread Alex Boisvert
On Thu, Dec 17, 2009 at 10:56 AM, jack  wrote:

> How do I increase the heapsize in Lift?
>

Nothing Lift-specific here.  Just the usual "java -Xmx2048m" (or whichever
amount you need).  If your starting Lift via Tomcat/Jetty, then usually you
place this in one of the startup scripts, or as JAVA_OPTS environment
variable.

e.g., export JAVA_OPTS="-Xmx2048m"

alex

--

You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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.




Re: [Lift] Confused about validation

2009-12-17 Thread Alex Boisvert
Indeed, if you're building a lot of forms, you quickly realize that Lift
currently requires fair amount of code for forms that are not backed by
mapper elements.  There's space there for better abstrations / DSL
improvements to reduce boilerplate -- similar to what David has built for
the new wizard.

alex


On Wed, Dec 16, 2009 at 8:47 AM, greekscala  wrote:

> Hello lift people,
>
> lift seems very promising. I am trying to make some tests
> and examples because I am new to lift.
> I wanted to add some validation to a form element and show
> the validation error to the user.
> But after little searching I was a little disappointet to see that
> there
> is no such support, exept when using Mapper. I do not want to use
> Mapper.  I want only simple field validation with the errors messages
> printed in a feedback panel.
>
> Before lift I was using Wicket. I think they did a good job with the
> validators.
>
> I try to understand why lift has not such support? I do not want to
> code
> everything in my submit method and validate things there.
>
> best regards
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Lift" group.
> To post to this group, send email to lift...@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.
>
>
>

--

You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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.




Re: [Lift] Re: Highlighting even/odd rows in a table

2009-12-17 Thread Alex Boisvert
I can recommend it too.  I've just used it in an open-source project
soon-to-be-released.

alex

On Thu, Dec 17, 2009 at 1:14 AM, Timothy Perrett wrote:

> Personally, I would just go with this:
>
> http://franca.exofire.net/jq/colorize
>
> I've used it very successfully on one of my projects.
>
> Cheers, Tim
>
> On Dec 17, 2:07 am, Ross Mellgren  wrote:
> > Oh, speaking of jquery, tablesorter also has a "zebra" plugin that does
> this, so if you're tablesorter you can use that also.
> >
> > -Ross
> >
> > On Dec 16, 2009, at 9:01 PM, Alex Boisvert wrote:
> >
> >
> >
> > > Or delegate the work to the browser using jQuery + CSS
> > >http://docs.jquery.com/Selectors/odd
> >
> > > alex
> >
> > > On Wed, Dec 16, 2009 at 4:04 PM, Ross Mellgren 
> wrote:
> > > You could use customers.zipWithIndex.flatMap({ case (customer, index)
> > > => ... instead of customers.flatMap(customer => to get the index, and
> > > then use index % 2 == 0 to see if it's an even row or an odd row. How
> > > you get that style into your template is up to you -- using an
> > > attribute bind param would probably be pretty easy, or emitting the
> > >  straight out of the snippet.
> >
> > > If you need more guidance give a shout and I'll write you up some
> > > example code.
> >
> > > Note that zipWithIndex only works on List, and it regenerates the
> > > list, so if you have a bunch of customers on the page and are
> > > concerned about performance you might want to do something different
> > > (and less convenient).
> >
> > > -Ross
> >
> > > On Dec 16, 2009, at 5:59 PM, Stevo wrote:
> >
> > > > Say for a second that in one of my Snippets I have the following
> > > > binding:
> >
> > > >   def view(xhtml: NodeSeq): NodeSeq =
> > > >   {
> > > >   val entries: NodeSeq = Customer.findAll() match
> > > >   {
> > > >   case Nil => Text("No customers currently
> defined")
> > > >   case customers =>
> > > >   customers.flatMap(customer =>
> bind("cust", chooseTemplate
> > > > ("customer", "entry", xhtml),
> > > >   "name" -> Text(emptyIfNull(
> customer.name.is)),
> > > >   "address" -> Text
> > > > (customer.workAddress.obj.open_!.singleTextLine),
> > > >   "phone" -> Text(emptyIfNull(
> customer.workPhone.is)),
> > > >   "other" -> Text(emptyIfNull(
> customer.other.is)),
> > > >   "fax" -> Text(emptyIfNull(
> customer.workFax.is)),
> > > >   "email" -> Text(emptyIfNull(
> customer.email.is)),
> > > >   "url" -> Text(emptyIfNull(
> customer.email.is
> > > >   }
> > > >   bind("customer", xhtml, "entry" -> entries)
> > > >   }
> >
> > > > Is there a way that I could apply a style to a complete
> customer:entry
> > > > with the goal of highlighting even/odd rows?
> >
> > > > Let me know and best regards to all,
> >
> > > > Steve
> >
> > > > --
> >
> > > > --
> >
> > > > You received this message because you are subscribed to the Google
> > > > Groups "Lift" group.
> > > > To post to this group, send email to lift...@googlegroups.com.
> > > > To unsubscribe from this group, send email to
> liftweb+unsubscr...@googlegroups.com
> > > > .
> > > > For more options, visit this group athttp://
> groups.google.com/group/liftweb?hl=en
> > > > .
> >
> > > --
> >
> > > You received this message because you are subscribed to the Google
> Groups "Lift" group.
> > > To post to this group, send email to lift...@googlegroups.com.
> > > To unsubscribe from this group, send email to
> liftweb+unsubscr...@googlegroups.com
> .
> > > For more options, visit this group athttp://
> groups.google.com/group/liftweb?hl=en.
> >
> > > --
> >
> > > You received this message because you are subscribed to the Google
> Groups "Lift" group.
> > > To post to this group, send email to lift...@googlegroups.com.
> > > To unsubscribe from this group, send email to
> liftweb+unsubscr...@googlegroups.com
> .
> > > For more options, visit this group athttp://
> groups.google.com/group/liftweb?hl=en.
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Lift" group.
> To post to this group, send email to lift...@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.
>
>
>

--

You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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.




Re: [Lift] Is this a defect at JqJsCmds.ModalDialog

2009-12-17 Thread Alex Boisvert
Good to hear.  Yes, it felt more natural to pass a Json object since that's
what the BlockUI API expects.

alex


On Thu, Dec 17, 2009 at 1:41 AM, Xuefeng Wu  wrote:

> OK, I found the JsObj is useful, Thanks.
>
>
> On Thu, Dec 17, 2009 at 5:28 PM, Xuefeng Wu  wrote:
>
>> Hi Alex,
>>
>> I found new ModalDialog(html: NodeSeq, css: Box[JsObj]),
>>  the parameter 'css' type is JsObj instead of String.
>>
>> Could you tell me the reason?
>>
>> I'm working on a customer widgets and have the same case.
>>
>>
>> On Thu, Dec 3, 2009 at 10:37 PM, Alex Boisvert 
>> wrote:
>>
>>> On Thu, Dec 3, 2009 at 12:40 AM, Xuefeng Wu  wrote:
>>>
>>>> Hi,
>>>>
>>>> When I use ModalDialog I want to setup the css but fail,
>>>> My code would be:
>>>> ModalDialog(someHtml, "top: '10px'")
>>>>
>>>> I found the ModalDialog code at Lift:
>>>> class ModalDialog(html: NodeSeq, css: Box[String]) extends JsCmd {
>>>> val toJsCmd = "jQuery.blockUI({ message: " +
>>>> AltXML.toXML(Group(S.session.map(s =>
>>>> s.fixHtml(s.processSurroundAndInclude("Modal Dialog",
>>>> html))).openOr(html)), false, true, S.ieMode).encJs +
>>>> (css.map(w => ",  css: '" + w + "' ").openOr("")) + "});"
>>>>   }
>>>>
>>>> the css is wrap by " '  ' " ,
>>>> but I found http://malsup.com/jquery/block/#demos
>>>> the css is wraped by "{ }"
>>>>
>>>>
>>>> Is this a defect at JqJsCmds.ModalDialog or I do something wrong?
>>>>
>>>
>>> Yes, it looks like a bug.   I'm guessing the code may have been written
>>> for BlockUI v1.x and that the API may have changed in 2.x.Please open a
>>> ticket and I'll fix it.
>>>
>>> alex
>>>
>>>  --
>>> You received this message because you are subscribed to the Google Groups
>>> "Lift" group.
>>> To post to this group, send email to lift...@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.
>>>
>>
>>
>>
>> --
>> Scala中文社区:  http://groups.google.com/group/scalacn
>>
>
>
>
> --
> Scala中文社区:  http://groups.google.com/group/scalacn
>
> --
> You received this message because you are subscribed to the Google Groups
> "Lift" group.
> To post to this group, send email to lift...@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.
>

--

You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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.




Re: [Lift] Highlighting even/odd rows in a table

2009-12-16 Thread Alex Boisvert
Or delegate the work to the browser using jQuery + CSS
http://docs.jquery.com/Selectors/odd

alex


On Wed, Dec 16, 2009 at 4:04 PM, Ross Mellgren  wrote:

> You could use customers.zipWithIndex.flatMap({ case (customer, index)
> => ... instead of customers.flatMap(customer => to get the index, and
> then use index % 2 == 0 to see if it's an even row or an odd row. How
> you get that style into your template is up to you -- using an
> attribute bind param would probably be pretty easy, or emitting the
>  straight out of the snippet.
>
> If you need more guidance give a shout and I'll write you up some
> example code.
>
> Note that zipWithIndex only works on List, and it regenerates the
> list, so if you have a bunch of customers on the page and are
> concerned about performance you might want to do something different
> (and less convenient).
>
> -Ross
>
> On Dec 16, 2009, at 5:59 PM, Stevo wrote:
>
> > Say for a second that in one of my Snippets I have the following
> > binding:
> >
> >   def view(xhtml: NodeSeq): NodeSeq =
> >   {
> >   val entries: NodeSeq = Customer.findAll() match
> >   {
> >   case Nil => Text("No customers currently defined")
> >   case customers =>
> >   customers.flatMap(customer => bind("cust",
> chooseTemplate
> > ("customer", "entry", xhtml),
> >   "name" -> Text(emptyIfNull(
> customer.name.is)),
> >   "address" -> Text
> > (customer.workAddress.obj.open_!.singleTextLine),
> >   "phone" -> Text(emptyIfNull(
> customer.workPhone.is)),
> >   "other" -> Text(emptyIfNull(
> customer.other.is)),
> >   "fax" -> Text(emptyIfNull(
> customer.workFax.is)),
> >   "email" -> Text(emptyIfNull(
> customer.email.is)),
> >   "url" -> Text(emptyIfNull(
> customer.email.is
> >   }
> >   bind("customer", xhtml, "entry" -> entries)
> >   }
> >
> > Is there a way that I could apply a style to a complete customer:entry
> > with the goal of highlighting even/odd rows?
> >
> > Let me know and best regards to all,
> >
> >
> > Steve
> >
> > --
> >
> > --
> >
> > You received this message because you are subscribed to the Google
> > Groups "Lift" group.
> > To post to this group, send email to lift...@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
> > .
> >
> >
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Lift" group.
> To post to this group, send email to lift...@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.
>
>
>

--

You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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.




Re: [Lift] Re: Documentation

2009-12-15 Thread Alex Boisvert
And from there, my suggestion would be to experiment with existing sample
Lift applications such as those in http://github.com/dpp/lift-samples to get
the "feel" for Lift from working code.

alex


On Tue, Dec 15, 2009 at 12:49 PM, Randinn  wrote:

> My suggestion is to get Programming in Scala, it explains the basics
> more than the others. Davids book and the rest are great but written
> for existing programmers. I also am learning not being a coder for
> years so I know how you feel.
>
> On Dec 16, 3:05 am, Daniel  wrote:
> > Hey,
> >
> > I'm new to both Scala and Lift, but I don't have any professional Java
> > experience. It seems that all of the documentation available for Lift
> > is aimed at folks who have considerable professional experience with
> > Java already. Is there any documentation available aimed for people
> > like me who don't have very much Java enterprise experience (I'm a
> > student)?
> >
> > I find that the Django and Rails documentation is very helpful, while
> > Lift's is somewhat impenetrable. Are there any plans to improve the
> > Lift documentation? It's the major obstacle preventing my adoption of
> > this otherwise impressive framework.
> >
> > Thanks,
> > Daniel
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Lift" group.
> To post to this group, send email to lift...@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.
>
>
>

--

You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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.




Re: [Lift] Re: Please review a simple app for displaying Flickr pictures

2009-12-13 Thread Alex Boisvert
Use LiftRules.unloadHooks.append(myShutdownHook)

>From LiftRules.scala:

 /**
   * Hooks to be run when LiftServlet.destroy is called.
   */
  val unloadHooks = RulesSeq[() => Unit]

alex

On Sun, Dec 13, 2009 at 6:45 PM, Dave Briccetti  wrote:

> Very helpful suggestions. Thanks.
>
> How can I hook into Web app shutdown/undeployment so I can shut down
> the thread pool?
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Lift" group.
> To post to this group, send email to lift...@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.
>
>
>

--

You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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.




Re: [Lift] Scala to JavaScript DSL ...

2009-12-13 Thread Alex Boisvert
scala.reflect.Code (aka expression trees / AST manipulation) would actually
be great -- what was proposed was far from it, though.

As I understand it, this approach has not advanced in about 2 years.  I'd be
happy to hear if it was a viable option, even if only on 2.8.

alex


On Sun, Dec 13, 2009 at 4:50 PM, Naftoli Gugenheim wrote:

> Looks like a neat approach.
> It would be great if it was possible to get a better syntax though. It
> might not be worth the effort or stable enough, but have you seen
> scala.reflect.Code? scalac can compile code into an AST.
>
>
> -
> Marius Danciu wrote:
>
> All,
>
> I just want to see if there is any interest in the approach discussed here.
> As you know Lift has some interesting support for building JavaScript
> constructs from Scala code usig JsExp, JsCmd etc classes. I used quite a
> lot
> this support and it's great but if your JS code that you want to send down
> to the browser (say as an Ajax or Comet partial update response) gets a bit
> more complicated then constructing the JS fragment leads IMO to some
> cumbersome Scala code. I found myselft in quite a few situation to use
> JsRaw
> to write the JavaScript fragment in order for the code reader to understand
> what JavaScript code will be generated. But of course with JsRaw we put
> everything into a String so I'm not a big fan of this approach. So I
> started
> to define a JavaScript like "DSL" that IMO is closer to JavaScript form.
> Attached is a source code smaple of how this looks like, so for instance we
> can have something like:
>
>
> val js = JsFunc('myFunc, 'param1, 'param2) {
>JsIf('param1 __< 30) {
>Var('home) := Wrap(234 __- 3) __/ 2 `;`
>Var('someArray) := JsArray(1, 2, 3, 4, 5) `;`
>'myFunc(1, 2, "do it", 'home) `;`
>$("#myID") >> 'attr("value", "123") `;`
>  } ~
>  JsForEach(Var('i) in 'someArray) {
>'console >> 'log("Hi there " __+ 'i) `;`
>  } ~
>  JsAnonFunc('arg1, 'arg2) {
>   'alert("Anonymous function " __+ 'arg1 __+ 'arg2)
>  }(1, 2) `;`
>}
>
>println(js.toJs)
>
> this yields the following JavaScript code:
>
>
> function myFunc( param1, param2 ) {
> if (param1 < 30) {
> var home = ( 234 - 3 ) / 2;
> var someArray = [ 1, 2, 3, 4, 5 ];
> myFunc(1, 2, "do it", home);
> $("#myID").attr("value", "123");
> }
> for (var i in someArray) {
> console.log("Hi there " + i);
> }
> function ( arg1, arg2 ) {
> alert("Anonymous function " + arg1 + arg2)
> }(1, 2);
> }
>
>
> ... ok I just droped nonsense code in there for exemplification. A few
> words:
>
> 1. JsIf, JsForEach describe JavaScript if and for(each) statements
> 2. Functions like __<, __>, ... __+, __- are function that alows definition
> of boolean and/or algebraic expressions.
> 3. Wrap just wraps an expression into ()
> 4. Var defined a variable
> 5 := defines an assignment
> 6. JsFunc declares a JS function
> 7. JsAnonFunc declares an anonymous function
> 8. 'myFunc(1, 2, "do it", 'home)  is simply a javascript function
> invocation
> by providing 4 parameter.
> 9. ~ is just a function that chains statements that don;t necessarily end
> in
> ;
>
>
> Do you think that something like this would be usable in Lift?
>
> 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 lift...@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.
>
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Lift" group.
> To post to this group, send email to lift...@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.
>
>
>

--

You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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.




Re: [Lift] Re: Scala to JavaScript DSL ...

2009-12-13 Thread Alex Boisvert
On Sat, Dec 12, 2009 at 11:06 AM, Marius  wrote:

> That is certainly one way to go but personally I'm not at all a fan of
> this string literals approach,. For instance if Scala would not have
> had built in XML support using XML as string literals Lift would
> probably loose some of its attractions... but that's my opinion.
>

Agreed, XML is baked-in.  It's not a DSL built on top of other features.


> Furthermore a DSL like language allows better compositionality than
> concatenating strings when we want to iteratively add JS code ... for
> instance calling the same function multiple times with different
> arguments, or collecting code fragments generated by different
> application components etc.
>

There's no guarantee of compositionality for DSLs.   You have to design it
to be, and it's quite difficult to get right.   And then you pretty much
reinvent another language.  First you have Scala, then you have Javascript,
then you have something in between which is FrankenScalaScript.Just my
opinion :)



> Also it seems to me that your approach (somehow similar with
> Velocity's) is more expensive but I admit that this is not at all a
> strong argument because we're talking about small javascript fragments
> so the delta is negligible.
>

I would beg to differ but we're so far from any implementation of either to
judge performance at this stage.

alex

--

You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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.




Re: [Lift] Jetty/Derby, unable to redeploy hot changes (FIXED)

2009-12-13 Thread Alex Boisvert
Yes, putting any JDBC driver into the container's classpath (i.e., Jetty) is
the better way.

Otherwise, if you put the driver into the .war, you'll most likely end up
with class / permgen leakage if you redeploy your webapp.   (Because
java.sql.Driver holds a reference to all loaded drivers)

alex


On Sun, Dec 13, 2009 at 5:03 PM, Tim Nelson  wrote:

> I had the same problem while using H2. I solved it by disposing the db
> connections when the servlet is destroyed. I wrote a gist about it
> here:
> http://gist.github.com/166687
>
> I don't think I've ever seen your solution, which might be a better
> way to handle it.
>
> Tim
>
> On Sun, Dec 13, 2009 at 3:41 PM, joseph hirn 
> wrote:
> > I just started looking into lift today but I ran into an issue where I
> > could not make hot changes to class files without having to restart
> > jetty because Derby would complain it was already bound. I was
> > searching around on here and found this issue:
> >
> http://groups.google.com/group/liftweb/browse_thread/thread/9dcf84464dc07cce/c0cadcc4e6a3b472?lnk=gst&q=Another+instance+of+Derby#c0cadcc4e6a3b472
> >
> > I've had simlilar issues with embedded libraries before and I was able
> > to resolve this issue by making derby a dependency in jetty rather
> > than of the app like so:
> >
> >
> > 
> >  org.mortbay.jetty
> >maven-jetty-plugin
> >
> >   /
> >   5
> >
> >
> >
> >  org.apache.derby
> >  derby
> >  10.4.2.0
> >
> >
> > 
> >
> >
> > Not only does this make Jetty manage Derby so redeploying will not
> > create a new Derby instance but it also keeps the app database
> > independent. You can then either remove Derby as a regular dependency
> > or put it as provided so that Maven will not package it
> > in your warfile.
> >
> > Is anyone else having this issue? Should I open a ticket in the issue
> > tracker for the archetype? Maybe everyone knows to do this but it was
> > annoying for a first timer like me who just started with the
> > archetype, especially after the annoyance that archetype:generate menu
> > generates an old archetype and won't upgrade to v1.0.
> >
> > Thanks!
> >
> > --
> >
> > You received this message because you are subscribed to the Google Groups
> "Lift" group.
> > To post to this group, send email to lift...@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.
> >
> >
> >
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Lift" group.
> To post to this group, send email to lift...@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.
>
>
>

--

You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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.




Re: [Lift] Re: Please review a simple app for displaying Flickr pictures

2009-12-13 Thread Alex Boisvert
One comment I would make about Parallelizer is that it creates a new thread
pool every time it's invoked.  This isn't very efficient but more
importantly, it's somewhat reckless.  Imagine if your home page or your
search function are invoked simultaneously by 10 users (or more).   The
application will try to create 10*20 threads at once and will likely run
into OutOfMemoryErrors. Users will be left with ugly HTTP 500 error pages.

I would probably use a single thread pool (either fixed size or cached with
an upper limit)  and, since you were asking about periodically running on
task(s), you should probably look into making it a
ScheduledThreadPoolExecutor and run your tasks with, e.g.,
scheduleWithFixedDelay().

Great app, btw! :)

alex

On Sun, Dec 13, 2009 at 3:52 PM, Dave Briccetti  wrote:

> I discovered I need a way to perodically reload certain cached data
> from Flickr. What sort of timer/actor/thread should I use. Every hour
> or so I want to call a method from Flickr.scala on each FlickrUser
> object.
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Lift" group.
> To post to this group, send email to lift...@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.
>
>
>

--

You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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.




Re: [Lift] Fake Data Driven Development

2009-12-13 Thread Alex Boisvert
ScalaCheck  has a nice API for
generating data where you can plug your own generators.

http://code.google.com/p/scalacheck/wiki/UserGuide

It doesn't directly generate data to the database, XML, or any other
specific format but you can use it to feed data into your own schema using
mapper, etc.

alex

On Sun, Dec 13, 2009 at 2:50 AM, ngocdaothanh wrote:

> Hi,
>
> I want to ask if there is a Scala or Java library to auto-generate
> fake data like this:
> http://faker.rubyforge.org/
>
> I searched but could not find one.
>
> A library like this helps development a lot. For web projects I have a
> development method which I call Fake Data Driven Development:
> 1. Define resources and DB schema (M part)
> 2. Auto-generate a lot of fake data
> 3. This fake data will drive UI design (V part) and URL routing to
> controllers (C part)
>
> In short, I design the M part first, then the fake data will drive me
> what to do next naturally.
>
> Thanks,
> Ngoc
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Lift" group.
> To post to this group, send email to lift...@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.
>
>
>

--

You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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.




Re: [Lift] Scala to JavaScript DSL ...

2009-12-12 Thread Alex Boisvert
Personally, I would rather go with a JavaScript literal and a simple
templating mechanism for substitution/binding of Javascript literals + Json
objects that would drive dynamic code (if conditionals, for-loops, ...).

Taking your example,

def myFunc = {"""
  function myFunc( param1, param2 ) {
if (param1 < ${limit}) {
  var home = ( ${max} - 3 ) / 2;
  var someArray = ${array};
  myFunc(1, 2, "do it", home);
  $("#myID").attr("value", "123");
}
for (var i in ${someArray}) {
  console.log("Hi there " + i);
}
function ( arg1, arg2 ) {
  alert("Anonymous function " + arg1 + arg2)
}(1, 2);
  }""".jsBind(
"max" -> max,
"array" -> array,
"someArray" -> someArray,
...
  )

Not a fully fleshed out example but you get the idea.  You'd still be able
to bind existing JsExp/JsCmds  so some parts could still be abstracted and
typed checked.

I would find this more readable and simpler that learning a quirky DSL
syntax.  And I could still copy/paste Javascript code to/from the browser
and test it easily.

alex

On Sat, Dec 12, 2009 at 2:07 AM, Marius Danciu wrote:

> All,
>
> I just want to see if there is any interest in the approach discussed here.
> As you know Lift has some interesting support for building JavaScript
> constructs from Scala code usig JsExp, JsCmd etc classes. I used quite a lot
> this support and it's great but if your JS code that you want to send down
> to the browser (say as an Ajax or Comet partial update response) gets a bit
> more complicated then constructing the JS fragment leads IMO to some
> cumbersome Scala code. I found myselft in quite a few situation to use JsRaw
> to write the JavaScript fragment in order for the code reader to understand
> what JavaScript code will be generated. But of course with JsRaw we put
> everything into a String so I'm not a big fan of this approach. So I started
> to define a JavaScript like "DSL" that IMO is closer to JavaScript form.
> Attached is a source code smaple of how this looks like, so for instance we
> can have something like:
>
>
> val js = JsFunc('myFunc, 'param1, 'param2) {
> JsIf('param1 __< 30) {
> Var('home) := Wrap(234 __- 3) __/ 2 `;`
> Var('someArray) := JsArray(1, 2, 3, 4, 5) `;`
> 'myFunc(1, 2, "do it", 'home) `;`
> $("#myID") >> 'attr("value", "123") `;`
>   } ~
>   JsForEach(Var('i) in 'someArray) {
> 'console >> 'log("Hi there " __+ 'i) `;`
>   } ~
>   JsAnonFunc('arg1, 'arg2) {
>'alert("Anonymous function " __+ 'arg1 __+ 'arg2)
>   }(1, 2) `;`
> }
>
> println(js.toJs)
>
> this yields the following JavaScript code:
>
>
> function myFunc( param1, param2 ) {
> if (param1 < 30) {
> var home = ( 234 - 3 ) / 2;
> var someArray = [ 1, 2, 3, 4, 5 ];
> myFunc(1, 2, "do it", home);
> $("#myID").attr("value", "123");
> }
> for (var i in someArray) {
> console.log("Hi there " + i);
> }
> function ( arg1, arg2 ) {
> alert("Anonymous function " + arg1 + arg2)
> }(1, 2);
> }
>
>
> ... ok I just droped nonsense code in there for exemplification. A few
> words:
>
> 1. JsIf, JsForEach describe JavaScript if and for(each) statements
> 2. Functions like __<, __>, ... __+, __- are function that alows definition
> of boolean and/or algebraic expressions.
> 3. Wrap just wraps an expression into ()
> 4. Var defined a variable
> 5 := defines an assignment
> 6. JsFunc declares a JS function
> 7. JsAnonFunc declares an anonymous function
> 8. 'myFunc(1, 2, "do it", 'home)  is simply a javascript function
> invocation by providing 4 parameter.
> 9. ~ is just a function that chains statements that don;t necessarily end
> in ;
>
>
> Do you think that something like this would be usable in Lift?
>
> 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 lift...@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.
>

--

You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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.




Re: [Lift] Re: Welcome Peter Robinett to the Lift committers

2009-12-10 Thread Alex Boisvert
Welcome Peter!

I'm also looking forward to your flot improvements :)

On Wed, Dec 9, 2009 at 11:32 PM, Marius  wrote:

> Welcome Peter !!
>
> On Dec 10, 12:08 am, David Pollak 
> wrote:
> > Folks,
> >
> > Please join me in welcoming Peter Robinett to the Lift committers.
>  Peter's
> > been active on the Lift list helping people and asking questions (a great
> > combo.)  As Peter's project has progressed, he's developed artifacts that
> he
> > is looking to contribute to Lift and I for one am looking forward to
> > enhancements (e.g., to the flot stuff) as well as other stuff that he's
> got
> > in his bag of tricks. ;-)
> >
> > Welcome Peter!
> >
> > Thanks,
> >
> > David
> >
> > --
> > Lift, the simply functional web frameworkhttp://liftweb.net
> > Beginning Scalahttp://www.apress.com/book/view/1430219890
> > Follow me:http://twitter.com/dpp
> > Surf the harmonics
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Lift" group.
> To post to this group, send email to lift...@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.
>
>
>

--

You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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.




Re: [Lift] re: what changes would need to be made so LIFT can work with HTML5

2009-12-09 Thread Alex Boisvert
Just to follow-up on this, I've now added a new built-in snippet in master
that sets the HTML5 DOCTYPE on the Lift response, just add this snippet
anywhere in your template for pages you want to be delivered as HTML5,



cheers,
alex


On Mon, Dec 7, 2009 at 8:08 PM, David Pollak
wrote:

>
>
> On Mon, Dec 7, 2009 at 3:49 PM, Alex Boisvert wrote:
>
>> On Sun, Dec 6, 2009 at 7:43 PM, James Black wrote:
>>
>>> I tried S.setDocType and got this error, using LIFT 1.0.1, with this bit
>>> of code in Boot.scala:
>>> class Boot {
>>>   def boot {
>>> if (!DB.jndiJdbcConnAvailable_?)
>>>   DB.defineConnectionManager(DefaultConnectionIdentifier, DBVendor)
>>>
>>>   S.setDocType(Box(List("")))
>>>
>>
>> Oh, and you can't use S.setDocType() in Boot.  You have to call it within
>> the scope of a session, e.g., inside a snippet.
>>
>
> Anything that accesses S is on a session-by-session (on in this case
> request-by-request) basis.
>
> However, the ResponseInfo.docType partial function is that thing that vends
> the docType.  Your best bet for changing the default of all pages is to do
> the following in Boot.scala:
>
> ResponseInfo.docType = {
>   case _ if S.skipDocType => Empty
>   case _ if S.getDocType._1 => S.getDocType._2
>   case _ => Full("")
> }
>
>
>>
>> There are also other ways to set the docType, including providing it
>> explicitly in a LiftResponse, overriding LiftRules.convertResponse, etc...
>>
>> alex
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Lift" group.
>> To post to this group, send email to lift...@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 simply functional web framework http://liftweb.net
> Beginning Scala http://www.apress.com/book/view/1430219890
> Follow me: http://twitter.com/dpp
> Surf the harmonics
>
> --
> You received this message because you are subscribed to the Google Groups
> "Lift" group.
>
> To post to this group, send email to lift...@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.
>

--

You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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.




Re: [Lift] Re: Multi-Database Transactions

2009-12-08 Thread Alex Boisvert
On Tue, Dec 8, 2009 at 11:57 AM, Jeppe Nejsum Madsen wrote:

> deadfolk  writes:
>
> > Hi Jeppe - thanks for your response.
> >
> > So, am I correct in saying that I just need to do something like
> > this?  (not tested code - just an approximation)
> >
> > //Assuming fooDb and barDb are some form of connection wrapper...
> >
> > S.addAround(List(new LoanWrapper {
> >   def apply[T](f: => T): T = {
> > fooDb.begin
> > barDb.begin
> > try {
> >   val result = f
> >   barDb.commit
> >   fooDb.commit
> >   result
> > }
> > catch {
> >   case e => {
> > barDb.rollback
> > fooDb.rollback
> >   }
> > }
> >   }
> > }))
>
> Something like that yes :-)
>


... with automatic transaction retries, and very verbose error messages if
one transaction commits and not the other? :)

alex

--

You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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.




Re: [Lift] how to keep last submited form field value

2009-12-08 Thread Alex Boisvert
You should use a SessionVar or a stateful snippet.

Here's how you would use a SessionVar,

object lastSubmittedDate extends SessionVar[Date](new Date)

...
bind(...,
"date" -> SHtml.text(lastSubmittedDate.is, lastSubmittedDate(_),
 "class" -> "datepicker"),

alex

On Tue, Dec 8, 2009 at 1:42 AM, Jarod Liu  wrote:

> I want the date field keep the last submited value.  I tried with
> below code, but it's dosn't work. The date value(display in page)
> awalys the date of today.
>
> the form:
> 
>
>
> 
>
> MySnippet:
>
> class MySnippet extends StatefulSnippet {
>  val dfmt = new SimpleDateFormat("-MM-dd")
>  var date =  dfmt.format(new Date)
>
>  val dispatch: DispatchIt = {
>case "form1" => form1 _
>  }
>
>  def form1(in: NodeSeq): NodeSeq = {
>bind("f", in,
> "date" -> SHtml.text(date, date = _,
>  "class" -> "datepicker"),
> "submit" -> SHtml.submit("submit", println("submit: " +
> date))
>)
>  }
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Lift" group.
> To post to this group, send email to lift...@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.
>
>
>

--

You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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.




Re: [Lift] re: what changes would need to be made so LIFT can work with HTML5

2009-12-07 Thread Alex Boisvert
On Sun, Dec 6, 2009 at 7:43 PM, James Black  wrote:

> I tried S.setDocType and got this error, using LIFT 1.0.1, with this bit of
> code in Boot.scala:
> class Boot {
>   def boot {
> if (!DB.jndiJdbcConnAvailable_?)
>   DB.defineConnectionManager(DefaultConnectionIdentifier, DBVendor)
>
>   S.setDocType(Box(List("")))
>

Oh, and you can't use S.setDocType() in Boot.  You have to call it within
the scope of a session, e.g., inside a snippet.

There are also other ways to set the docType, including providing it
explicitly in a LiftResponse, overriding LiftRules.convertResponse, etc...

alex

--

You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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.




Re: [Lift] Re: How can one bind value-less attributes?

2009-12-07 Thread Alex Boisvert
On Sun, Dec 6, 2009 at 8:28 PM, David Pollak
wrote:

>
> On Sun, Dec 6, 2009 at 7:25 PM, Alex Boisvert wrote:
>
>> Using the latest and greatest (master branch), I can't reproduce the
>> MatchError but I can reproduce the issue with the attribute being generated
>> if the value is null.
>>
>
> How about adding a Box alternative rather than perpetuating a paradigm
> based on null?
>

Yes, that's better.  I'll do that.

[Side diatribe:  Can't wait for a working scala.NotNull so we can implicitly
convert (non-null) literal values to Some() or Full() instance and reduce
verbosity]

alex

--

You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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.




Re: [Lift] Re: Race conditions / database transaction isolation levels

2009-12-07 Thread Alex Boisvert
On Mon, Dec 7, 2009 at 8:02 AM, cody koeninger  wrote:

>
>
> On Dec 6, 9:16 pm, Alex Boisvert  wrote:
> > Lift's mapper doesn't change the default isolation level of your
> > connections, nor does it make explicit use of pessimistic concurrency
> > control.
> > Anything beyond that we can probably implement, we just need a good
> > reason...
> >
> > alex
>
>
> Isn't the possibility of interleaved HTTP requests a sufficient
> reason?  E.g. administrator editing a field near the same time a
> customer is.  Unless the orm is writing everything it reads, even
> changing transaction isolation to serializable won't prevent certain
> types of race conditions.
>
> It seems like having the option to lock an entity when loading it from
> the database (implemented as select ... for update) would be useful.
> I haven't used Rails much, but that's my understanding of what
> ActiveRecord offers.
>

Yes, definitely, it would be useful in some cases.I should have been
more clear.  When I said "we just need a good reason" I meant "we just need
somebody who has a real need for this feature".

alex

--

You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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.




Re: [Lift] Re: How can one bind value-less attributes?

2009-12-06 Thread Alex Boisvert
Using the latest and greatest (master branch), I can't reproduce the
MatchError but I can reproduce the issue with the attribute being generated
if the value is null.

I'll fix it tomorrow morning.

alex


On Sun, Dec 6, 2009 at 5:59 AM, Alex Black  wrote:

> > If you output null for theattributevalue, theattributeis not
> > rendered:
>
> I've just upgraded from 1.0 to 1.1-M6, and this doesn't seem to work
> any more - could this be a bug in M6?
>
> Message: scala.MatchError: null
>scala.runtime.ScalaRunTime$.boxArray(ScalaRunTime.scala:136)
>net.liftweb.util.BindHelpers$class.mix$1(BindHelpers.scala:612)
>net.liftweb.util.BindHelpers$class.net$liftweb$util$BindHelpers$
> $bindByNameMixIn(BindHelpers.scala:618)
>net.liftweb.util.BindHelpers$$anonfun$bind$2$$anonfun$in_bind$1$1$
> $anonfun$apply$27.apply(BindHelpers.scala:440)
>net.liftweb.util.BindHelpers$$anonfun$bind$2$$anonfun$in_bind$1$1$
> $anonfun$apply$27.apply(BindHelpers.scala:436)
>net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:65)
>net.liftweb.util.BindHelpers$$anonfun$bind$2$$anonfun$in_bind
> $1$1.apply(BindHelpers.scala:436)
>net.liftweb.util.BindHelpers$$anonfun$bind$2$$anonfun$in_bind
> $1$1.apply(BindHelpers.scala:424)
>scala.Seq$class.flatMap(Seq.scala:294)
>scala.xml.NodeSeq.flatMap(NodeSeq.scala:34)
>net.liftweb.util.BindHelpers$$anonfun$bind$2.in_bind$1
> (BindHelpers.scala:424)
>net.liftweb.util.BindHelpers$$anonfun$bind$2$$anonfun$in_bind
> $1$1.apply(BindHelpers.scala:444)
>net.liftweb.util.BindHelpers$$anonfun$bind$2$$anonfun$in_bind
> $1$1.apply(BindHelpers.scala:424)
>scala.Seq$class.flatMap(Seq.scala:294)
>scala.xml.NodeSeq.flatMap(NodeSeq.scala:34)
>net.liftweb.util.BindHelpers$$anonfun$bind$2.in_bind$1
> (BindHelpers.scala:424)
>net.liftweb.util.BindHelpers$$anonfun$bind$2$$anonfun$in_bind
> $1$1.apply(BindHelpers.scala:444)
>net.liftweb.util.BindHelpers$$anonfun$bind$2$$anonfun$in_bind
> $1$1.apply(BindHelpers.scala:424)
>scala.Seq$class.flatMap(Seq.scala:294)
>scala.xml.NodeSeq.flatMap(NodeSeq.scala:34)
>net.liftweb.util.BindHelpers$$anonfun$bind$2.in_bind$1
> (BindHelpers.scala:424)
>net.liftweb.util.BindHelpers$$anonfun$bind$2$$anonfun$in_bind
> $1$1.apply(BindHelpers.scala:444)
>net.liftweb.util.BindHelpers$$anonfun$bind$2$$anonfun$in_bind
> $1$1.apply(BindHelpers.scala:424)
>scala.Seq$class.flatMap(Seq.scala:294)
>scala.xml.NodeSeq.flatMap(NodeSeq.scala:34)
>net.liftweb.util.BindHelpers$$anonfun$bind$2.in_bind$1
> (BindHelpers.scala:424)
>net.liftweb.util.BindHelpers$$anonfun$bind$2$$anonfun$in_bind
> $1$1.apply(BindHelpers.scala:444)
>net.liftweb.util.BindHelpers$$anonfun$bind$2$$anonfun$in_bind
> $1$1.apply(BindHelpers.scala:424)
>scala.Seq$class.flatMap(Seq.scala:294)
>scala.xml.NodeSeq.flatMap(NodeSeq.scala:34)
>net.liftweb.util.BindHelpers$$anonfun$bind$2.in_bind$1
> (BindHelpers.scala:424)
>
>  net.liftweb.util.BindHelpers$$anonfun$bind$2.apply(BindHelpers.scala:
> 449)
>
>  net.liftweb.util.BindHelpers$$anonfun$bind$2.apply(BindHelpers.scala:
> 409)
>net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:65)
>net.liftweb.util.BindHelpers$class.bind(BindHelpers.scala:409)
>net.liftweb.util.Helpers$.bind(Helpers.scala:29)
>net.liftweb.util.BindHelpers$class.bind(BindHelpers.scala:380)
>net.liftweb.util.Helpers$.bind(Helpers.scala:29)
>
>
> >
> > scala> bind("stuff", ,
> AttrBindParam("s",Text("checked"),"checked"))
> > res11: scala.xml.NodeSeq =  checked="checked">
> >
> > scala> bind("stuff", ,
> AttrBindParam("s",null,"selected"))
> > res12: scala.xml.NodeSeq = 
> >
> > /Jeppe
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Lift" group.
> To post to this group, send email to lift...@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.
>
>
>

--

You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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.




Re: [Lift] Newbie on Lift & Scala: Build in class source code?

2009-12-06 Thread Alex Boisvert
Part of the source for these objects is automatically created when you
generate your lift app using the Maven archetype.   For example, you'll find
the source to the User class unde
src/main/scala/com/liftworkshop/model/User.scala.

For classes that are part of the framework, such as MegaProtoUser etc.
you'll find the source on Github at http://github.com/dpp/liftweb/ and more
specifically look at ProtoUser.scala under
http://github.com/dpp/liftweb/tree/master/lift-persistence/lift-mapper/src/main/scala/net/liftweb/mapper/.
Also be sure to select the branch of Lift that you are using in order to
avoid confusion.

Good luck and keep asking question ;)
alex




On Sun, Dec 6, 2009 at 3:54 PM, itsjar  wrote:

> Hi,
>
> I'm considering building a web application with my software
> engineering group in Lift.
> However when I started with lift I was surprised that I received a
> whole log in / sign up website by
> just using the MegaProtoUser.
> This was at first sight fun, but I started wondering (and I'm pretty
> sure my professor will say the same): "Do I really know what I just
> did?".
>
> So I decided to try and rebuild the Log in / Sign up thing from
> scratch by using my own plain objects.
> Ive been working on that for 2 days and It's been s frustrating.
>
> I've been reading the lift book... Tutorials.. but all of them start
> with the MegaProtoUser.
> In 1.5 days time I only managed to make an index (signup) page with a
> username/password field and a button which then redirects to a new
> page.
>
> Let me tell you in advance, I am totally new to Web developing.
>
> Problems I have right now:
>   - I have no idea if my code actually created a User in my database
> and I have no idea how to check it...
>   - I have no idea how to "log in" a user. I saw code in the sample
> programs that compare the current logged in user with other users by
> using a select statement. However retrieving the current user is based
> upon the MegaProtoUser. I wonder how this is done behind my back since
> I have no idea how to keep a variable of a 'logged in user' which
> stays active across all pages..
>
> Because of these problems I thought it might be useful to see the
> source code of the classes..
> Is it possible to see the scala source code of these classes?
>
> Thanks,
> itsjar
>
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Lift" group.
> To post to this group, send email to lift...@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.
>
>
>

--

You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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.




Re: [Lift] Race conditions / database transaction isolation levels

2009-12-06 Thread Alex Boisvert
Correct.

Lift's mapper doesn't change the default isolation level of your
connections, nor does it make explicit use of pessimistic concurrency
control.

However, the default connection manager set the connection to
autocommit=false, runs a local transaction for the scope of HTTP requests
and automatically commits after the request by default. You can control the
isolation level using JDBC (e.g., passing parameters in your JDBC URL) or by
setting the isolation explicitly in a custom ConnectionManager.

Anything beyond that we can probably implement, we just need a good
reason...

alex

On Sun, Dec 6, 2009 at 6:54 PM, cody koeninger  wrote:

> Do mapper or record provide any assistance for avoiding race
> conditions caused by the database transaction isolation level?  I
> didn't notice anything in my initial skim of the lift book, and
> grepping the code for obvious suspects like "for update" didn't return
> anything.
>
> If not, what are people with production lift apps doing?  Run postgres
> in default read committed and cross your fingers?
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Lift" group.
> To post to this group, send email to lift...@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.
>
>
>

--

You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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.




Re: [Lift] Re: How to configure two database connection in Lift?

2009-12-05 Thread Alex Boisvert
I haven't used multiple connections myself, but I think you have two issues,

1) The default connection identifier is "lift" so you have to define a
connection with that name otherwise you'll have to override all Mapper
objects to use a different connection.

2) Your dbCalculateConnectionIdentifier method should look like,

override def dbCalculateConnectionIdentifier = {
   case _ => Two
}

meaning, regarless of the mapped object's value, use connection "Two".

and if you always use the same connection for all objects of a given mapper
(i.e., you're not sharding) then you can alternatively override the
MetaMapper object's dbDefaultConnectionIdentifier method.

Hope this helps,
alex

On Sat, Dec 5, 2009 at 10:38 PM, Neil.Lv  wrote:

>
>
>   Btw, there is the error message when the server is started.
> ###
> scala.MatchError: ConnectionIdentifier(lift)
> ###
>
> On Dec 6, 1:47 pm, "Neil.Lv"  wrote:
> > Hi all,
> >
> >   I want to use two databases, but i don't know how to configure it.
> >
> >   Does anybody know that how to configure two database connection in
> > Lift?
> >
> > 1:
> >   I add two ConnectionIdentifier in the Boot.class
> > ###
> > object OneDB extends ConnectionIdentifier {
> >
> >   def jndiName = "one"
> >
> > }
> >
> > object TwoDB extends ConnectionIdentifier {
> >
> >   def jndiName = "two"
> >
> > }
> >
> > ###
> >
> > 2: In the User model
> >
> >How can i write the code in the method,
> > ###
> >   override def dbCalculateConnectionIdentifier = {
> > Two
> >   }
> > ###
> >
> >   Thanks for any suggestion!
> >
> > Cheers,
> >   Neil
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Lift" group.
> To post to this group, send email to lift...@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.
>
>
>

--

You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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.




Re: [Lift] Unexpected type on a custom trait

2009-12-05 Thread Alex Boisvert
Your issue is that "u.customer" returns a MappedLongForeignKey instance, not
a Customer.

You probably want to use "u.customer.get" or "u.customer.can" or something
like that.

alex

On Sat, Dec 5, 2009 at 5:50 PM, Franz Bettag  wrote:

> Heyho,
>
> i'm running 1.1-m7 and having the following issue. i am using the
> basic user model and created a model Customer like this:
>
> class Customer extends LongKeyedMapper[Customer] with IdPK {
>def getSingleton = Customer
>
>object name extends MappedString(this, 255)
>def users: List[User] = User.findAll(By(User.customer, this.id))
>
> }
>
> object Customer extends Customer with LongKeyedMetaMapper[Customer] {
>override def fieldOrder = List(name)
>override def dbIndexes = List(Index(IndexField(name)))
>
> }
>
>
> in my user model i got:
> object customer extends MappedLongForeignKey(this, Customer)
>
>
> the idea is, that i have a trait called "Customerize" which will add a
> customer-object/field into the desired model and that those fields get
> auto-set on create depending on User.currentUser.customer.
>
> So far it looks like this:
>
> trait CustomerFields[A <: Mapper[A]] {
>this: A =>
>
>private val thisTyped = this.asInstanceOf[A]
>
>object customer extends MappedLongForeignKey(thisTyped, Customer)
> with LifecycleCallbacks {
>override def beforeCreate: Unit =
>User.currentUser match {
>case Full(u: User) => {
>u.customer match {
> ->> case Full(c:
> Customer) => this(c)
>case _ => false
>}
>}
>case _ => false
>}
>
>}
>
> }
>
> The marked line errors like the following:
>
> [ERROR] Customerize.scala:49: error: constructor cannot be
> instantiated to expected type;
> [INFO]  found   : net.liftweb.common.Full[A]
> [INFO]  required: object u.customer
> [INFO]  case Full(c:
> Customer) => this(c)
>
> [ERROR] Customerize.scala:49: error: not found: value c
> [INFO]  case Full(c:
> Customer) => this(c)
>
>
> Any ideas/suggestions? :)
>
> best regards
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Lift" group.
> To post to this group, send email to lift...@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.
>
>
>

--

You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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.




Re: [Lift] Newbie question: class not foudn

2009-12-05 Thread Alex Boisvert
The signature of a snippet should be:

  def mySnippet(xhtml: NodeSeq): NodeSeq = { ... }

So you should add the xhtml: NodeSeq argument to your snippet function.
It's always a good idea to explicitly specify the return type as well --
type inference can sometimes cause surprise.

alex

On Sat, Dec 5, 2009 at 6:45 PM, itsjar  wrote:

> I thought it might be a good exercise if I tried to write my own login
> without using all the build in features from lift.
> To make sure I understand what it does behind my back.
> However I stumbled upon a bug ive been searching for 2 hours on...
>
> WARN - Snippet Failure: SnippetFailure(/ -> ParsePath(List
> (index),,true,false),Full(userTest.returntext),Class Not Found)
>
> I figured it could only be at one of the following places, but I tried
> every possible variation... I don't see  the problem.
>
> index.html:
> 
>
> 
>
> main/scala/arxum/snippet/UserTest.scala
> package arxum.snippet
> class UserTest {
>  def returntext=  hallo daar User {new arxum.model.User}  span>
> }
>
> Boot.scala:
>// where to search snippet
>LiftRules.addToPackages("arxum")
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Lift" group.
> To post to this group, send email to lift...@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.
>
>
>

--

You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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.




Re: [Lift] re: what changes would need to be made so LIFT can work with HTML5

2009-12-05 Thread Alex Boisvert
Have you tried calling S.setDocType("") ?

alex

On Sat, Dec 5, 2009 at 8:29 PM, James Black  wrote:

> I tried to use HTML5 doctype and LIFT threw an error.
>
> It complained about line 1:
>
> 
> 
> ...
> 
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Lift" group.
> To post to this group, send email to lift...@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.
>
>
>

--

You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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.




Re: [Lift] Re: Having trouble figuring out how to get a form to submit without submitting the page, using ajaxForm

2009-12-05 Thread Alex Boisvert
I think the idiomatic way to handle ajax form submission is to use
SHtml.ajaxForm(body, onSubmit, postSubmit):

  /**
   * Takes a form and wraps it so that it will be submitted via AJAX. This
also
   * takes a parameter for script code that will be executed after the form
has been submitted.
   *
   * @param body The form body. This should not include the 
tag. * @param postSubmit Code that should be executed after a successful submission */ def ajaxForm(body : NodeSeq, onSubmit : JsCmd, postSubmit : JsCmd) = ... For example, def submitted = ... ajaxForm( bind("b", xhtml, "comment" -> text(comment, comment = _) ), _Noop, submitted ) alex On Sat, Dec 5, 2009 at 10:07 AM, Marius wrote: > can you paste the actual xhtml generated for this form? > > Br's, > marius > > On Dec 5, 5:55 pm, Jim Barrows wrote: > > This is the basic definition of the form that works, but submits the > page: > > xhtml: > > > > > > > > > > > > And the binding looks like: > > bind("contactMechanism", xhtml, > > "comment" -> text(comment, comment = _), > > "fromDate" -> text(fromDate, fromDate = _) % ("id" -> "fromDate") % > > ("maxlength" -> "15") % ("size" -> "15"), > > "thruDate" -> text(thruDate, thruDate = _) % ("id" -> "thruDate") % > > ("maxlength" -> "15") % ("size" -> "15"), > > "submit" -> submit("Add", saveContactMechanismToParty )) > > > > So, after reading the ajaxForm methods description I thought I could do > > this: > > xhtml: > > > > > > > > > > > > And the binding would look like: > > ajaxForm( bind("contactMechanism", xhtml, > > "comment" -> text(comment, comment = _), > > "fromDate" -> text(fromDate, fromDate = _) % ("id" -> "fromDate") % > > ("maxlength" -> "15") % ("size" -> "15"), > > "thruDate" -> text(thruDate, thruDate = _) % ("id" -> "thruDate") % > > ("maxlength" -> "15") % ("size" -> "15"), > > //"mechanism" -> text(dateFormat.format(new Date()), thruDate = _) > % > > ("id" -> "thruDate") % ("maxlength" -> "10") % ("size" -> "10"), > > "submit" -> submit("Add", saveContactMechanismToParty ))) > > > > However, when the submit button is clicked the > saveContactMechanismToParty > > never gets called. > > What am I missing? > > > > -- > > James A Barrows > > -- > > You received this message because you are subscribed to the Google Groups > "Lift" group. > To post to this group, send email to lift...@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. > > > -- You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to lift...@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.

Re: [Lift] Schemify has SQL Exception, IDENIFY instead of IDENTIFY is in the SQL query

2009-12-04 Thread Alex Boisvert
No need to open a ticket, I've fixed the typo directly in master.

commit 090aff91793a8b9cc67f55ff77e7407c46c2545b
Author: Alex Boisvert 
Date:   Fri Dec 4 07:05:06 2009 -0800

Fixed typo in DerbyDriver.integerIndexColumnType: IDENITY -> IDENTITY

(Change recorded in changes.xml)

alex


On Fri, Dec 4, 2009 at 12:27 AM, David Brooks wrote:

>  Hi,
>
> I've searched the 1-1-SNAPSHOT sources and found:
>
>
> lift-persistence/lift-mapper/src/main/scala/net/liftweb/mapper/Driver.scala:
>   def integerIndexColumnType = "INTEGER NOT NULL GENERATED BY DEFAULT AS
> IDENITY"
>
> so it looks as if someone's made a typo.
>
> I suggest you open a ticket at http://github.com/dpp/liftweb/issues
>
> Regards,
> Dave
>
>
> On 4/12/09 5:24 PM, James Black wrote:
>
> I had used LIFT 1.0 to build my framework, and I am curious what I
> need to do to get beyond this error.
>
> I tried to use
> mvn -U clean install compile jetty:run
>
> I had set my dependency in pom.xml to point to LIFT 1.0, 1.0.2 and
> 1.1, but none of these made any difference, so I am not certain it
> made any change.
>
> INFO - CREATE TABLE educationinfo (key_c VARCHAR(100) , school VARCHAR
> (100) , de
> gree VARCHAR(100) , startyear INTEGER NOT NULL GENERATED ALWAYS AS
> IDENITY , end
> year INTEGER NOT NULL GENERATED ALWAYS AS IDENITY , resume BIGINT , id
> BIGINT NO
> T NULL GENERATED ALWAYS AS IDENTITY)
> ERROR - Failed to Boot
>
>
>
>
>   --
> You received this message because you are subscribed to the Google Groups
> "Lift" group.
> To post to this group, send email to lift...@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.
>

--

You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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.




Re: [Lift] JSON Reponses

2009-12-03 Thread Alex Boisvert
On Thu, Dec 3, 2009 at 9:06 AM, deadfolk  wrote:

> I'm still at the evaluation stage of Lift, so please forgive my
> ignorance, but I cannot figure out how to render any non-XML reponses.
>
> I'm looking to create a simple web service which can send reponses
> back in either XML or JSON.  I have the XML side covered, but I can't
> figure out how to send a JSON response back.  Snippets take a NodeSeq
> and return a NodeSeq, so unless I'm missing something here, they are
> only good for XML.
>
> I've found various posts on JSON, but they all seem to relate to forms
> and AJAX, whereas all I really want to be able to do is render JSON
> instead of XML.
>
> Any pointers greatly appreciated,
>
>
The general process to expose web services (XML, json, ...) is to:

1) Add a new dispatch rules to LiftRules -- usually done in Boot:

LiftRules.dispatch.prepend(MyService.dispatchRules)

2) Create the service dispatch rules:

object MyService {
  def dispatchRules: LiftRules.DispatchPF = {
case Req(List("api"", "myService", someParam), "", GetRequest) =>
  () => invokeService(someParam)
  }

3) Implement the service that returns a LiftResponse:

object MyService {
  ...
  def invokeService(someParam: String): LiftResponse = {
// create appropriate LiftResponse
// e.g. JsonResponse, PlainTextResponse, ...
  }

I'd recommend reading the Lift book chapter on web services.

alex

--

You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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.




Re: [Lift] Is this a defect at JqJsCmds.ModalDialog

2009-12-03 Thread Alex Boisvert
On Thu, Dec 3, 2009 at 12:40 AM, Xuefeng Wu  wrote:

> Hi,
>
> When I use ModalDialog I want to setup the css but fail,
> My code would be:
> ModalDialog(someHtml, "top: '10px'")
>
> I found the ModalDialog code at Lift:
> class ModalDialog(html: NodeSeq, css: Box[String]) extends JsCmd {
> val toJsCmd = "jQuery.blockUI({ message: " +
> AltXML.toXML(Group(S.session.map(s =>
> s.fixHtml(s.processSurroundAndInclude("Modal Dialog",
> html))).openOr(html)), false, true, S.ieMode).encJs +
> (css.map(w => ",  css: '" + w + "' ").openOr("")) + "});"
>   }
>
> the css is wrap by " '  ' " ,
> but I found http://malsup.com/jquery/block/#demos
> the css is wraped by "{ }"
>
>
> Is this a defect at JqJsCmds.ModalDialog or I do something wrong?
>

Yes, it looks like a bug.   I'm guessing the code may have been written for
BlockUI v1.x and that the API may have changed in 2.x.Please open a
ticket and I'll fix it.

alex

--

You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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.




Re: [Lift] Jetty question

2009-12-02 Thread Alex Boisvert
Probably better asked on the Jetty mailing list... but...
http://wiki.eclipse.org/Jetty is the new site for Jetty 7+ documentation.
It's still sparse but they are moving/updating the documentation
incrementally.

Which page(s) asked you for registration?

alex


On Wed, Dec 2, 2009 at 9:55 AM, jhonig  wrote:

> Can anybody point me to the proper documentation for Jetty 7?
>
> I found that http://docs.codehaus.org/display/JETTY/Static+Content
> is outdated, the classes referred to do not exist anymore in Jetty 7.
> Just replacing mortbay by eclipse in the class names didn't help...
>
> Then Google gave me: http://wiki.eclipse.org/Jetty, but many of the
> of the documentation links require me to be a member of some
> unspecified entity...  One would think though that this wiki is the
> proper source for Jetty documentation...
>
> Job H.
>
>
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Lift" group.
> To post to this group, send email to lift...@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.
>
>
>

--

You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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.




Re: [Lift] Re: How can one bind value-less attributes?

2009-12-01 Thread Alex Boisvert
Here's one way,

Helpers.bind(...,
  "myElement" -> (if (condition)  else ))

I don't think there's a bind helper to conditionally output the attribute.
Maybe our bind experts know.

alex

On Tue, Dec 1, 2009 at 3:29 PM, Alex Black  wrote:

> Thanks Alex.  That would work, but I'm looking for a more generic
> solution.
>
> Restating the problem: Based on some condition I want to generate an
> attribute or not generate an attribute, e.g.:
>
> 
>
> OR
>
> 
>
> - Alex
>
> On Dec 1, 6:23 pm, Alex Boisvert  wrote:
> > You can use SHtml.checkbox() to easily generate the checkbox,
> >
> > bind(...,
> >   "checkbox" -> SHtml.checkbox(isChecked, checked => if (checked)
> > doSomething())
> > )
> >
> > The first parameter is whether the checkbox should be checked by default.
> >
> > The second parameter is a function to do something when form is
> submitted.
> >
> > alex
> >
> > On Tue, Dec 1, 2009 at 2:50 PM, Alex Black  wrote:
> > > Is there a good/reasonable way to conditionally output
> > > checked="checked" or output nothing?
> >
> > > My code looks like this:
> >
> > >  bind("manufacturer", xhtml,
> > >  AttrBindParam("selected", Text("selected"), "selected"))
> >
> > > I can add an if statement, and then output Text("notSelected")
> > > instead, but that doesn't seem to work - the correct  is not
> > > selected.
> >
> > > - Alex
> >
> > > On Dec 1, 5:30 pm, Ross Mellgren  wrote:
> > > > Valueless attributes are prohibited by XML. The proper XHTML
> > > > formulation is to use the name of the attribute as the value, e.g.
> > > > checked="checked"
> >
> > > > -Ross
> >
> > > > On Dec 1, 2009, at 5:28 PM, Alex Black wrote:
> >
> > > > > For example, if my html template looks like this:
> >
> > > > > 
> > > > >foobar
> > > > >
> > > > >
> > > > >
> > > > > 
> >
> > > > > I'd like to render it conditionally as:
> >
> > > > >foobar
> > > > >
> >
> > > > > Is there syntax to add the "checked" to the checkbox? perhaps
> similar
> > > > > to the syntax to bind attribute values?
> >
> > > > > Thanks!
> >
> > > > > - Alex
> >
> > > > > --
> >
> > > > > You received this message because you are subscribed to the Google
> > > > > Groups "Lift" group.
> > > > > To post to this group, send email to lift...@googlegroups.com.
> > > > > To unsubscribe from this group, send email to
> > > liftweb+unsubscr...@googlegroups.com
> 
> >
> > > > > .
> > > > > For more options, visit this group athttp://
> > > groups.google.com/group/liftweb?hl=en
> > > > > .
> >
> > > --
> >
> > > You received this message because you are subscribed to the Google
> Groups
> > > "Lift" group.
> > > To post to this group, send email to lift...@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.
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Lift" group.
> To post to this group, send email to lift...@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.
>
>
>

--

You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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.




Re: [Lift] Re: How can one bind value-less attributes?

2009-12-01 Thread Alex Boisvert
You can use SHtml.checkbox() to easily generate the checkbox,

bind(...,
  "checkbox" -> SHtml.checkbox(isChecked, checked => if (checked)
doSomething())
)

The first parameter is whether the checkbox should be checked by default.

The second parameter is a function to do something when form is submitted.

alex


On Tue, Dec 1, 2009 at 2:50 PM, Alex Black  wrote:

> Is there a good/reasonable way to conditionally output
> checked="checked" or output nothing?
>
> My code looks like this:
>
>  bind("manufacturer", xhtml,
>  AttrBindParam("selected", Text("selected"), "selected"))
>
> I can add an if statement, and then output Text("notSelected")
> instead, but that doesn't seem to work - the correct  is not
> selected.
>
> - Alex
>
>
> On Dec 1, 5:30 pm, Ross Mellgren  wrote:
> > Valueless attributes are prohibited by XML. The proper XHTML
> > formulation is to use the name of the attribute as the value, e.g.
> > checked="checked"
> >
> > -Ross
> >
> > On Dec 1, 2009, at 5:28 PM, Alex Black wrote:
> >
> > > For example, if my html template looks like this:
> >
> > > 
> > >foobar
> > >
> > >
> > >
> > > 
> >
> > > I'd like to render it conditionally as:
> >
> > >foobar
> > >
> >
> > > Is there syntax to add the "checked" to the checkbox? perhaps similar
> > > to the syntax to bind attribute values?
> >
> > > Thanks!
> >
> > > - Alex
> >
> > > --
> >
> > > You received this message because you are subscribed to the Google
> > > Groups "Lift" group.
> > > To post to this group, send email to lift...@googlegroups.com.
> > > To unsubscribe from this group, send email to
> liftweb+unsubscr...@googlegroups.com
> > > .
> > > For more options, visit this group athttp://
> groups.google.com/group/liftweb?hl=en
> > > .
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Lift" group.
> To post to this group, send email to lift...@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.
>
>
>

--

You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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.




Re: [Lift] method call from out of nowhere

2009-11-29 Thread Alex Boisvert
An easy way to determine who's calling is simply to print the call stack by
adding the following line in your method,

(new Exception).printStackTrace

alex


On Sun, Nov 29, 2009 at 9:24 PM, David Pollak  wrote:

>
>
> On Sun, Nov 29, 2009 at 7:24 AM, Hannes  wrote:
>
>> Hey Lifters,
>>
>
> How is joinOtherOrders being invoked?
>
>
>>
>> I've some really strange things going on here. Please consider this
>> method definition. I've put alot of print "debug" statements between
>> other statements. There's a while-loop that only starts, when the given
>> list (orders) is not empty. It stops when "done" is set to true. So far,
>> so good. Than, have a look at the Lift output. I put in a comment,
>> pointing out where the program runs into the while loop.
>>
>> What really shocks me, are these print statements :
>>
>> before done=false
>> after done=true
>> i += 1
>> outside while
>> INFO - Service request (GET) / took 121 Milliseconds
>> start of joinAll!
>>
>>
>> The loop ends with "outside while" and than the method gets called again
>> immediately! But who calls it? I don't
>>
>> Any ideas?
>>
>> thanks.
>>
>>
>>
>>  method definition
>> --
>>
>> def joinOtherOrders: Unit = {
>>
>>def joinAll(orders: List[LimitOrder]) = {
>>
>>println("start of joinAll!")
>>
>>var done = false
>>
>>var i = 0
>>
>>while (!orders.isEmpty && !done) {
>>
>>println("i=" + i + ", " + "orders.isEmpty=" +
>> orders.isEmpty + ", " + "done=" + done)
>>
>>if (this.lots.is == orders(i).lots.is){
>>
>>println("case-1")
>>
>>println("this=" + this + ", orders(i)=" + orders(i))
>>
>>this.open(orders(i))
>>
>>done = true
>>
>>}
>>
>>if (this.lots.is < orders(i).lots.is){
>>
>>println("case-2")
>>
>>println("this=" + this + ", orders(i)=" + orders(i))
>>
>>orders(i).reduceLots(this.lots.is)
>>
>>val newOrder = orders(i).cloneWith(this.lots.is)
>>
>>newOrder.save
>>
>>this.open(newOrder)
>>
>>println("before done=" + done)
>>
>>done = true
>>
>>println("after done=" + done)
>>
>>}
>>
>>if (this.lots.is > orders(i).lots.is){
>>
>>println("case-3")
>>
>>println("this=" + this + ", orders(i)=" + orders(i))
>>
>>this.reduceLots(orders(i).lots.is)
>>
>>val newOrder = this.cloneWith(orders(i).lots.is)
>>
>>newOrder.save
>>
>>newOrder.open(orders(i))
>>
>>}
>>
>>i += 1
>>
>>println("i += 1")
>>
>>}
>>
>>println("outside while")
>>
>>}
>>
>>def findLimitOrdersById: List[LimitOrder]  =
>>
>>this.findCandidates.map(x => LimitOrderMetaObj.findAll(
>>
>>By(LimitOrderMetaObj.id, x)).head)
>>
>>joinAll(findLimitOrdersById)
>>
>>}
>>
>>
>> -- Lift Output
>> ---
>>
>>
>> [INFO] Started Jetty Server
>> [INFO] Starting scanner at interval of 5 seconds.
>> INFO - Service request (GET) /comet_request/54834680365/y7kybsmuyv1g took
>> 64 Milliseconds
>> INFO - Service request (GET) /comet_request/85319966940/y7kybsmuyv1g took
>> 23 Milliseconds
>> INFO - Service request (GET) /favicon.ico took 86 Milliseconds
>> INFO - Service request (GET) /comet_request/41521581405/y7kybsmuyv1g took
>> 48 Milliseconds
>> INFO - Service request (GET) /comet_request/93176242746/y7kybsmuyv1g took
>> 7 Milliseconds
>> INFO - Service request (GET) /favicon.ico took 38 Milliseconds
>> INFO - Service request (GET) /favicon.ico took 5 Milliseconds
>> INFO - Service request (GET) / took 551 Milliseconds
>> INFO - Service request (GET) /comet_request/81361316835/y7kybsmuyv1g took
>> 9 Milliseconds
>> INFO - Service request (GET) /favicon.ico took 16 Milliseconds
>> INFO - Service request (GET) / took 61 Milliseconds
>> INFO - Service request (GET) /comet_request/76898140873/y7kybsmuyv1g took
>> 30 Milliseconds
>> INFO - Service request (GET) /comet_request/e8jesgmo10oq/cometAjax.js took
>> 14 Milliseconds
>> INFO - Service request (GET) / took 354 Milliseconds
>> INFO - Service request (GET) / took 734 Milliseconds
>> INFO - Service request (GET) / took 484 Milliseconds
>> INFO - Service request (GET) /images/ajax-loader.gif took 7 Milliseconds
>> INFO - Service request (GET) /favicon.ico took 4 Milliseconds
>> INFO - Service request (GET) /comet_request/78026241833/e8jesgmo10oq took
>> 55 Milliseconds
>> INFO - Service request (GET) /comet_request/28

Re: [Lift] method call from out of nowhere

2009-11-29 Thread Alex Boisvert
Where is joinOtherOrders()called within your code?

alex

On Sun, Nov 29, 2009 at 7:24 AM, Hannes  wrote:

> Hey Lifters,
>
> I've some really strange things going on here. Please consider this
> method definition. I've put alot of print "debug" statements between
> other statements. There's a while-loop that only starts, when the given
> list (orders) is not empty. It stops when "done" is set to true. So far,
> so good. Than, have a look at the Lift output. I put in a comment,
> pointing out where the program runs into the while loop.
>
> What really shocks me, are these print statements :
>
> before done=false
> after done=true
> i += 1
> outside while
> INFO - Service request (GET) / took 121 Milliseconds
> start of joinAll!
>
>
> The loop ends with "outside while" and than the method gets called again
> immediately! But who calls it? I don't
>
> Any ideas?
>
> thanks.
>
>
>
>  method definition
> --
>
> def joinOtherOrders: Unit = {
>
>def joinAll(orders: List[LimitOrder]) = {
>
>println("start of joinAll!")
>
>var done = false
>
>var i = 0
>
>while (!orders.isEmpty && !done) {
>
>println("i=" + i + ", " + "orders.isEmpty=" + orders.isEmpty
> + ", " + "done=" + done)
>
>if (this.lots.is == orders(i).lots.is){
>
>println("case-1")
>
>println("this=" + this + ", orders(i)=" + orders(i))
>
>this.open(orders(i))
>
>done = true
>
>}
>
>if (this.lots.is < orders(i).lots.is){
>
>println("case-2")
>
>println("this=" + this + ", orders(i)=" + orders(i))
>
>orders(i).reduceLots(this.lots.is)
>
>val newOrder = orders(i).cloneWith(this.lots.is)
>
>newOrder.save
>
>this.open(newOrder)
>
>println("before done=" + done)
>
>done = true
>
>println("after done=" + done)
>
>}
>
>if (this.lots.is > orders(i).lots.is){
>
>println("case-3")
>
>println("this=" + this + ", orders(i)=" + orders(i))
>
>this.reduceLots(orders(i).lots.is)
>
>val newOrder = this.cloneWith(orders(i).lots.is)
>
>newOrder.save
>
>newOrder.open(orders(i))
>
>}
>
>i += 1
>
>println("i += 1")
>
>}
>
>println("outside while")
>
>}
>
>def findLimitOrdersById: List[LimitOrder]  =
>
>this.findCandidates.map(x => LimitOrderMetaObj.findAll(
>
>By(LimitOrderMetaObj.id, x)).head)
>
>joinAll(findLimitOrdersById)
>
>}
>
>
> -- Lift Output
> ---
>
>
> [INFO] Started Jetty Server
> [INFO] Starting scanner at interval of 5 seconds.
> INFO - Service request (GET) /comet_request/54834680365/y7kybsmuyv1g took
> 64 Milliseconds
> INFO - Service request (GET) /comet_request/85319966940/y7kybsmuyv1g took
> 23 Milliseconds
> INFO - Service request (GET) /favicon.ico took 86 Milliseconds
> INFO - Service request (GET) /comet_request/41521581405/y7kybsmuyv1g took
> 48 Milliseconds
> INFO - Service request (GET) /comet_request/93176242746/y7kybsmuyv1g took 7
> Milliseconds
> INFO - Service request (GET) /favicon.ico took 38 Milliseconds
> INFO - Service request (GET) /favicon.ico took 5 Milliseconds
> INFO - Service request (GET) / took 551 Milliseconds
> INFO - Service request (GET) /comet_request/81361316835/y7kybsmuyv1g took 9
> Milliseconds
> INFO - Service request (GET) /favicon.ico took 16 Milliseconds
> INFO - Service request (GET) / took 61 Milliseconds
> INFO - Service request (GET) /comet_request/76898140873/y7kybsmuyv1g took
> 30 Milliseconds
> INFO - Service request (GET) /comet_request/e8jesgmo10oq/cometAjax.js took
> 14 Milliseconds
> INFO - Service request (GET) / took 354 Milliseconds
> INFO - Service request (GET) / took 734 Milliseconds
> INFO - Service request (GET) / took 484 Milliseconds
> INFO - Service request (GET) /images/ajax-loader.gif took 7 Milliseconds
> INFO - Service request (GET) /favicon.ico took 4 Milliseconds
> INFO - Service request (GET) /comet_request/78026241833/e8jesgmo10oq took
> 55 Milliseconds
> INFO - Service request (GET) /comet_request/28225538857/e8jesgmo10oq took
> 600 Milliseconds
> INFO - Service request (GET) /user_mgt/sign_up took 711 Milliseconds
> INFO - Service request (GET) /images/ajax-loader.gif took 2 Milliseconds
> INFO - Service request (GET) /user_mgt/login took 38 Milliseconds
> INFO - Service request (GET) /images/ajax-loader.gif took 2 Milliseconds
> INFO - Service request (P

Re: [Lift] Re: Lots of compile-time cruft

2009-11-16 Thread Alex Boisvert
On Mon, Nov 16, 2009 at 3:33 PM, Kris Nuttycombe
wrote:

> Oops... I didn't realize I'd committed the pom with that in! I've no
> problem putting the extra warnings into a profile. Does Scala have an
> equivalent of or support the @SuppressWarnings annotation that you
> have in Java?
>

I'm not aware of any annotations that would suppress these warnings.

One solution to avoid the warnings would be to declare a class such as:

class UncheckedErasure[T](implicit m: scala.reflect.Manifest[T]) {
  def unapply(x: Any) = x match {
case _ if m.erasure.isInstance(x) => Some(x.asInstanceOf[T])
case _ => None
  }
}

and everytime we  have an unchecked match, we could write, e.g.,

object uncheckedMap extends UncheckedErasure[Map[String, String]]

...

x match {
  case uncheckedMap(map) =>
// do something with map
}

This gets us the same amount of compile-time and runtime type checking,
makes the unchecked matches stand out in code, remaining easily searchable,
at practically the same runtime cost.

alex

--

You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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=.




Re: [Lift] Re: Lots of compile-time cruft

2009-11-16 Thread Alex Boisvert
On Mon, Nov 16, 2009 at 4:26 PM, David Pollak  wrote:

> Speaking of warnings, which do you prefer (see patch below):
>
>>
>> 1) Explicit types on val extractors (as it is today)
>> 2) One-liner with no types (proposed)
>>
>> We could save 4 warnings...
>>
>
> Here's the cost of the 4 warnings:
>
> If you remove the type information and the lazy calculator thing changes
> how it does calculations, you'll silently get changed types (this has
> happened before) and that breaks things.  On the other hand, if we leave the
> code with explicit types, we'll get a match warning (with the type erasure
> stuff turned back off) if the type change.
>

You get breakage if the types change in an incompatible manner in both
cases.

I don't see how you get any added safety by adding the types explicitly.  In
both cases, the compiler has the same information about the types and
perform the same amount of type checking for you.

alex

--

You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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=.




[Lift] Re: Lots of compile-time cruft

2009-11-16 Thread Alex Boisvert
On Mon, Nov 16, 2009 at 3:33 PM, Kris Nuttycombe
wrote:

>
> On Mon, Nov 16, 2009 at 4:28 PM, David Pollak
>  wrote:
> > Folks,
> >
> > I'm seeing a lot of:
> > [INFO] Unable to find resource 'javax.script:script-js:pom:1.0' in
> > repository specs-repository (http://specs.googlecode.com/svn/maven2/)
> >
> > Also, I know Kris turned on type erasure warnings because he wants to
> debug
> > them but there's just a pile that can't be fixed and these unfixable
> > warnings get in the way of real warnings... any compromise we can find on
> > this situation?
>
> Oops... I didn't realize I'd committed the pom with that in! I've no
> problem putting the extra warnings into a profile. Does Scala have an
> equivalent of or support the @SuppressWarnings annotation that you
> have in Java?
>

Speaking of warnings, which do you prefer (see patch below):

1) Explicit types on val extractors (as it is today)
2) One-liner with no types (proposed)

We could save 4 warnings...

alex

diff --git a/lift-base/lift-webkit/src/main/scala/net/liftweb/http/Req.scala
b/lift-base/lift-webkit/src/main/scala/net/liftweb/http/Req.scal
index ab574d4..2f3bf26 100644
--- a/lift-base/lift-webkit/src/main/scala/net/liftweb/http/Req.scala
+++ b/lift-base/lift-webkit/src/main/scala/net/liftweb/http/Req.scala
@@ -313,10 +313,7 @@ class Req(val path: ParsePath,
 case _ => Empty
   }

-  lazy val (paramNames: List[String],
-  params: Map[String, List[String]],
-  uploadedFiles: List[FileParamHolder],
-  body: Box[Array[Byte]]) = paramCalculator()
+  lazy val (paramNames, params, uploadedFiles, body) = paramCalculator()

   lazy val cookies = request.cookies match {
 case null => Nil

--~--~-~--~~~---~--~~
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 & Scala style.

2009-11-16 Thread Alex Boisvert
On Mon, Nov 16, 2009 at 1:00 PM, Kris Nuttycombe
wrote:

> The other thing I'm interested in is the named and default parameters
> syntax. The first place I know of that could benefit from this is in
> the multiple definitions of bind() - what others are folks aware of?
>

One that recently cropped up was XmlResponse.  See the number of
XmlResponse.apply() variants that I've created due to lack of named+default
parameters.

alex

--~--~-~--~~~---~--~~
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 & Scala style.

2009-11-16 Thread Alex Boisvert
On Mon, Nov 16, 2009 at 11:59 AM, Kris Nuttycombe  wrote:

> First, Alex Boisvert suggested that S.init be renamed to S.doWith to
> have more consistency with Req and LiftSession. At least internally, I
> think that the consensus was that this wasn't necessarily appropriate.
>

Just to clarify, I think DavidP's position was that it's wasn't worth
breaking code for this rename and that it wasn't entirely clear that
S.doWith() was appropriate given there's also S.initIfUninitted().

Personally, I think S.doWith() and S.doWithUnlessInitted() would be better
names but I can appreciate that people want the least amount of breaking
changes from one release to another.  Deprecation warnings would be good but
complexify the codebase in the near term...

I don't feel strongly about this either way.  Just curious about what other
people think with respect to this small but breaking changes.

Second, I suggested the deprecation of the pattern of using apply() on
> AnyVar to provide setter functionality, since to me using something
> that looks like function application to do a mutation seems
> ill-conceived. My initial suggestion was to piggyback our
> functionality on the update() rewriting that is done by Scala, but on
> further reflection and David's feedback I realized that this would be
> even uglier since you'd have to use myRequestVar() = "foo". So, what
> would folks think about defining the symbolic method ":=" on both
> AnyVal and within the Mapper framework instead, with the goal of
> eventual deprecation of the apply style?
>

I'm all for this, including using :=.


> Thirdly, I would like to propose that any "marker" traits (i.e. traits
> that declare no methods) within Lift either be sealed, or have the
> relevant methods tailored to the shared functionality they represent
> added (or both.) Match errors can be nasty, and sealing the traits
> (providing an extension point for users if need be) can help the
> compiler help us to eliminate that class of errors.
>

Agreed.


> Fourth, in compiling the Lift source I see far more warnings related
> to type erasure in match statements than I'm strictly comfortable
> with. My personal plan is to start working through these and
> eliminating them where possible, but in general I think that we as a
> community should start running all of our builds with all warnings
> enabled, and strive to eliminate them. The Scala type system can be
> complicated, but in my experience it is virtually always possible to
> avoid such warnings (and type unsafety!) with a bit of extra thought.
> The less we subvert the type system, the less likely we are to have
> unexpected errors.
>

Agreed.

alex

--~--~-~--~~~---~--~~
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] lift-webkit-1.1-SNAPSHOT contains duplicate classes (e.g. Box.class)

2009-11-12 Thread Alex Boisvert
Can one of our resident Maven experts quickly look at:
http://github.com/dpp/liftweb/issues/#issue/166

I took a brief look at the poms but couldn't figure why Maven was including
classes from lift-common and lift-actor into lift-webkit.  It is a feature
of the maven-bundle-plugin?

I can take care of fixing the issue if pointed towards the right direction.

thanks!
alex

--~--~-~--~~~---~--~~
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: form input tag name values changed when moving from M6 to M7

2009-11-12 Thread Alex Boisvert
Wouldn't it be better to provide a unique identifier directly in the source
for all elements that require testing?

And I don't mean somebody inputting a unique id manually everywhere but
instead using a text processing tool on your codebase that would
automatically inject unique ids where desired.

Low tech but I think it would work better in the long run than hashing stack
frames.

alex


On Wed, Nov 11, 2009 at 12:40 PM, ben  wrote:

>
> Thanks for the reply David. Below is some code which might suit both
> our requirements ...
>
>  def locateFirstUserStackElement(stack: Array[StackTraceElement]) :
> StackTraceElement = {
>  stack.foreach(element => {
>  if (!element.toString.startsWith("net.liftweb")) return
> element
>  })
>  stack(0)
>   }
>
>  def formFuncName: String = if (Props.testMode) {
>val bump: Long = ((_formGroup.is openOr 0) + 1000L) * 1L
>val num: Int = formItemNumber.is
>formItemNumber.set(num + 1)
>import _root_.java.text._
> val prefix: String = new DecimalFormat("0").format
> (bump + num)
> //M7 - "f" + prefix + "_" + Helpers.hashHex((new
> Exception).getStackTrace.toList.take(10).map(_.toString).mkString
> (",")))
>"f" + prefix + "_" +Helpers.hashHex(locateFirstUserStackElement
> (new Exception().getStackTrace).getClassName)
>   } else {
>_formGroup.is match {
>  case Full(x) => Helpers.nextFuncName(x.toLong * 1L)
>  case _ => Helpers.nextFuncName
>}
>  }
>
> >
>

--~--~-~--~~~---~--~~
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: Jetty & PermGen

2009-07-16 Thread Alex Boisvert
I'm not sure how to do this with jetty:run  (I don't use it myself).  I had
a quick look at the config page at
http://mojo.codehaus.org/jetty-maven-plugin/usage.html but there isn't any
related configuration option to specify jars outside of the webapp itself.

alex

On Thu, Jul 16, 2009 at 1:08 PM, Naftoli Gugenheim wrote:

> (Some time has elapsed, sorry...)
> That definitely could be it.
> One of my launch configurations is the default mvn jetty:run, and I have H2
> added as a dependency. It's being initialized in web.xml as per H2's
> instructions, with -tcpAllowOthers, and Boot (DBVendor) connects via TCP.
> What should I change so that H2 should be in the bootstrap classloader and
> not in lib?
> Thanks.
> -
> Alex Boisvert wrote:
>
> It typically means you are leaking classes through the classloader
> hierarchy.
>
> e.g.  A class in your webapp classloader is referenced in a parent
> classloader.
>
> Common culprits are JDBC drivers which should be placed in Jetty's
> bootstrap
> classloader and not packaged in your webapp's lib directory (due to the way
> JDBC drivers are initialized and referenced by DriverManager).
>
> alex
>
> On Tue, Jul 14, 2009 at 3:26 PM, Naftoli Gugenhem  >wrote:
>
> >
> > After mvn jetty:run reloads my changes a number of times, it runs out of
> > PermGen memory.
> > What is PermGen exactly and how can I prevent this from happening?
> >
> > >
> >
>
> >
>

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



[Lift] Re: Jetty & PermGen

2009-07-14 Thread Alex Boisvert
It typically means you are leaking classes through the classloader
hierarchy.

e.g.  A class in your webapp classloader is referenced in a parent
classloader.

Common culprits are JDBC drivers which should be placed in Jetty's bootstrap
classloader and not packaged in your webapp's lib directory (due to the way
JDBC drivers are initialized and referenced by DriverManager).

alex

On Tue, Jul 14, 2009 at 3:26 PM, Naftoli Gugenhem wrote:

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

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



[Lift] Re: organizing views of synchronous streams

2009-07-07 Thread Alex Boisvert
For what it's worth, the Business Process Modeling Notation (BPMN) uses a
similar notation to convey concurrent events, actions, etc.

http://www.scribd.com/doc/2334639/Introduction-to-BPMN  (See pages 5, 7, 9
for diagrams with pools and lanes)
http://www.eclipse.org/bpmn/images/screenshots/

Some company [cough cough] has already developed an open-source Eclipse
plugin that can can be used to programmatically or interactively design
diagrams and export them as SVG such that they can be displayed in a browser
and manipulated via JavaScript.

alex

On Tue, Jul 7, 2009 at 2:44 PM, Meredith Gregory
wrote:

> All,
>
> Here's a blog 
> postoutlining
>  a way to organize synchronous streams of information. i post it
> here to get an opinion regarding how much work you all think it might be to
> do in lift.
>
> 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: is there a name for this pattern?

2009-06-19 Thread Alex Boisvert
On Thu, Jun 18, 2009 at 11:18 PM, Eric Bowman  wrote:

>
> The basic trick where a superclass has its subclass as a type parameter,
> e.g.
>
> class User extends MegaProtoUser[User]
>
> I've run into this before, I remember struggling to "get it", then
> getting it, but I can't recall the epiphany.  But obviously this is a
> relatively common technique, so something to google is much appreciated.
>

I agree with Kris, this circular/recursive type pattern has two edges and
I'm not sure one is worth the other.

The main benefit I see with this pattern is that it enforces class User to
pass the User type parameter to Mapper, so you don't end up with a mixin
that doesn't make sense... although I doubt this error would actually happen
in reality because you'd quickly realize at design-time that calling any
method on User/MetaUser would return you something different than what you
expect.   (

The drawback is that type signatures are more verbose, complex and viral (if
you care about extensibility).   Just try explaining the type signature to
Scala newbie and they'll run away scared! :)

An alternative design would be something of the form,

trait Mapper {
  type MapperType
}

class User extends Mapper {
  type MapperType <: User
}

I think this design would be simpler to read and understand, without any
practical loss in type checking.

(As a side note, if you don't specify the correct type to Mapper with the
current design, you get an error message that's hardly helpful to newbies,
so it doesn't help much either... but I disgress.)

While I'm at it, there are also places in the code that could use
"this.type" instead of MapperType (also called "A" as parameter) to give out
an even more specific type without any tradeoffs.  A prime example of this
would be Mapper.saveMe().

Just to be clear, I'm not proposing anything be changed in Lift's current
mapper since it would break compatibility  I'm just suggesting it for
consideration in future design work... perhaps in Lift's new record module?

alex

--~--~-~--~~~---~--~~
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 hosting for demo.liftweb.net

2009-06-18 Thread Alex Boisvert
Typo:

http://www.prgmr.com/

On Thu, Jun 18, 2009 at 4:18 PM, Derek Chen-Becker wrote:

> Is it really at prgrm.com? If I go there it looks like a hacked site...
>
> http://www.prgrm.com/
>
> Derek
>
>
> On Thu, Jun 18, 2009 at 9:25 AM, David Pollak <
> feeder.of.the.be...@gmail.com> wrote:
>
>>
>>
>> On Thu, Jun 18, 2009 at 6:21 AM, TylerWeir  wrote:
>>
>>>
>>> Is it just the basic slice? 128 Megatrons of RAM?
>>
>>
>> It's running on the 512mb slice... at $12/mo it seemed like a reasonable
>> price to pay.
>>
>>
>>>
>>>
>>> On Jun 18, 1:45 am, David Pollak 
>>> wrote:
>>> > Folks,
>>> > I'm trying a Xen slice on prgrm.com I'm currently
>>> runninghttp://demo.liftweb.netthere.  Woo Hoo!
>>> >
>>> > David
>>> >
>>> > --
>>> > Lift, the simply functional web frameworkhttp://liftweb.net
>>> > Beginning Scalahttp://www.apress.com/book/view/1430219890
>>> > Follow me:http://twitter.com/dpp
>>> > Git some:http://github.com/dpp
>>>
>>>
>>
>>
>> --
>> Lift, the simply functional web framework http://liftweb.net
>> Beginning Scala http://www.apress.com/book/view/1430219890
>>
>> Follow me: http://twitter.com/dpp
>> Git some: http://github.com/dpp
>>
>>
>>
>
> >
>

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



[Lift] Re: org.mortbay.util.ajax.Continuation on GAE/J

2009-06-10 Thread Alex Boisvert
On Wed, Jun 10, 2009 at 9:15 AM, Atsuhiko Yamanaka <
atsuhiko.yaman...@gmail.com> wrote:

>
> Hi,
>
> On Thu, Jun 11, 2009 at 12:30 AM, David
> Pollak wrote:
> > Unfortunately, no.  In order to do this, we'd have to have a hard
> dependency
> > on Jetty.  It may be possible to do an external continuations module and
> you
> > are encouraged to research this.
>
> I agree with you that a hard dependecy on jetty is not acceptable.
> I will research that.


Or perhaps have some sort of pluggable factory for continuations so the hard
dependency can be moved into an optional module?  The factory class could be
configured in web.xml as a servlet init-param.

alex

--~--~-~--~~~---~--~~
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: OSGi support for Lift

2009-06-10 Thread Alex Boisvert
Quick follow-up I've since discovered you can use the 'Webapp-Context:'
manifest entry with PAX Web Extender and Spring dm Server to achieve this.

http://wiki.ops4j.org/display/paxweb/WAR+Extender
http://jira.springframework.org/browse/OSGI-468

alex

On Tue, May 12, 2009 at 12:48 PM, Alex Boisvert wrote:

> Alright, thanks for your help!   I was mostly kicking the tires to get a
> taste for the upcoming OSGi integration.  I guess my main feedback at this
> point is that it would be nice to map the app into a non-root context of
> Jetty.   e.g. http://localhost:8080/examples-osgi instead of directly
> under http://localhost:8080.This would make it possible to deploy
> several Lift apps onto the same OSGi container.
>
> alex
>
>
>
> On Tue, May 12, 2009 at 12:19 PM, Heiko Seeberger <
> heiko.seeber...@googlemail.com> wrote:
>
>> Hm, does not look good :-(Thanx for trying and please keep on!
>> I have to deal with some build issues, and will take a look at that
>> tomorrow.
>>
>> Heiko
>>
>> 2009/5/12 Alex Boisvert 
>>
>>> That was it.  I pulled again from git and now I can start the
>>> examples-osgi app.
>>>
>>> However, one more nitpick...  I can load index.htm but the snippet isn't
>>> rendered correctly because some resources can't be found.
>>>
>>> e.g.
>>> [5285...@qtp-20735553-0 - /] INFO
>>> org.ops4j.pax.web.service.internal.HttpServiceContext - getting resource:
>>> [/templates-hidden/default.htm]
>>> [5285...@qtp-20735553-0 - /] INFO
>>> org.ops4j.pax.web.service.internal.HttpServiceContext - found resource: null
>>>
>>> Is that normal?  I can see the following displayed:
>>>
>>>   From a snippet: Hi, I am a snippet from a Lift-powered OSGi
>>> bundle!
>>>
>>> but there's no surrounding   ...   so the
>>> browser complains.
>>>
>>> alex
>>>
>>> On Tue, May 12, 2009 at 11:24 AM, Heiko Seeberger <
>>> heiko.seeber...@googlemail.com> wrote:
>>>
>>>> When did you check out? I pushed again about one or two hours ago.From
>>>> the log I can see that you use an old version of hello.composite. The new
>>>> one should look like:
>>>>
>>>> scan-bundle:wrap:mvn:javax.mail/mail/1.4
>>>>
>>>> scan-bundle:wrap:mvn:javax.activation/activation/1.1
>>>> ...
>>>>
>>>> The "wrap:" is important. Pax Runner will wrap vanilla JARs into OSGi
>>>> bundles.
>>>>
>>>> Please pull again, that should help.
>>>> Heiko
>>>>
>>>> 2009/5/12 Alex Boisvert 
>>>>
>>>>> Ok, I tried again based on your suggestion but I'm getting an error
>>>>> related to javax.mail:1.4 not being a valid bundle...
>>>>>
>>>>>  -> Preparing framework [Felix 1.6.0]
>>>>>  -> Downloading bundles...
>>>>>  -> mvn:javax.mail/mail/1.4 : 388864 bytes @ [ 471kBps ]
>>>>> s @ [ 498kBps ]
>>>>>
>>>>>  ___
>>>>> /  /
>>>>>/  / Oops, there has been a problem!
>>>>>   /  /
>>>>>  /__/   org.ops4j.pax.runner.platform.PlatformException:
>>>>> [mvn:javax.mail/mail/1.4] is not a valid bundle
>>>>> ___
>>>>>/__/ Use --log=debug to see details.
>>>>>
>>>>>
>>>>> To be sure, I wiped my M2 repo under javax/mail and retried but I'm
>>>>> getting the same error.  Any idea?
>>>>>
>>>>> I'm attaching the full log in case it's helpful.
>>>>>
>>>>> alex
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> On Tue, May 12, 2009 at 10:08 AM, Heiko Seeberger <
>>>>> heiko.seeber...@googlemail.com> wrote:
>>>>>
>>>>>> Hi Alex,
>>>>>> 2009/5/12 Alex Boisvert 
>>>>>>
>>>>>> I downloaded and ran PAX runner,
>>>>>>>
>>>>>>> ./pax-run.sh --profiles=log,scala,felix.webconsole,web
>>>>>>
>>>>>>
>>>>>>>
>>>>>>> then installed the examples-osgi bundle,
>>>>>>>
>>>>>>> -> install
>>>>>>> file:///home/boisvert/git/liftweb/sites/examples-osgi/

[Lift] Re: Welcome Alexander Kiok, you're the 1,000th member of the Lift community

2009-05-22 Thread Alex Boisvert
David,

You just keep it comin' do you? :)   Congrats on Innovation Games Online!

I've ordered both Beginning Scala and the Definitive Guide to Lift yesterday
and will likely buy additional copies to pass around at the office.

Big hello to the thousand of you out there!  Hope you enjoy Lift + Scala as
much as I do...

alex

On Fri, May 22, 2009 at 4:42 AM, marius d.  wrote:

>
> WOOO H !
>
> On May 22, 7:56 am, David Pollak 
> wrote:
> > Folks,
> >
> > It's been a very good week in Lift and Scala-land:
> >
> >- The Lift community has grown to 1,000 members.  That's a huge
> milestone
> >and an indication that Lift and Scala have achieved an important level
> of
> >popularity.
> >- *Beginning Scala* and *The Definitive Guide to Lift* shipped this
> >week.  Congrats to Derek, Marius, and Tyler on their book (my copy is
> on its
> >way to Romania for an autograph).
> >- Innovation Games Online (a Scala and Lift powered serious gaming
> site)
> >went into final beta this week athttp://dev.buyafeature.com
> >- ESME (an SAP ecosystem project based on Scala and Lift) is getting
> back
> >into the development swing (thanks Vassil)
> >- And on a personal note, I got to have lunch with Adriaan Moors
> today.
> >Adrian was awarded his PhD last week and rumor has it that he'll be in
> >Laussanne in the fall.
> >
> > So, Alexander and the rest of the members of the Lift and Scala
> communities,
> > let's all look at our virtual neighbors, smile, and keep growing the
> > community and the great software that the community is creating.
> >
> > Thanks,
> >
> > David
> >
> > --
> > 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: Snippet name clashes

2009-05-20 Thread Alex Boisvert
2009/5/20 David Pollak 

>
>
> On Wed, May 20, 2009 at 9:38 AM, Alex Boisvert wrote:
>
>> Maybe an optional package attribute?
>>
>> e.g.,
>>
>> 
>> ...
>> 
>>
>
> Dude... you're so 2008 with that syntax... :-)
>

Yes, I know... I just couldn't come to terms with using dots in my XML
elements.   I guess I have issues ;)


The current syntax is:
>
> ...
>
> I guess we can add a package attribute anyway, although it breaks the whole
> Snippet lookup mechanism (not the reflection code, but the partial
> functions).
>

It seems it would be natural to use XML namespaces for mapping to Scala
packages.

LiftRules.mapNamespaceToPackage("http://com.example.myapp.widgets"; ->
"com.example.myapp.widgets")

and then,

http://com.example.myapp.snippets";>

   ... 

?

alex

--~--~-~--~~~---~--~~
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: Snippet name clashes

2009-05-20 Thread Alex Boisvert
Maybe an optional package attribute?

e.g.,


...


alex

On Wed, May 20, 2009 at 9:19 AM, David Pollak  wrote:

>
>
> On Tue, May 19, 2009 at 9:28 PM, Heiko Seeberger <
> heiko.seeber...@googlemail.com> wrote:
>
>> Hi,
>> As far as I understand it is not possible to specify the FQCN of a snippet
>> class in a snippet tag. Is this true? If so, there might be name clashes:
>> Just imagine popular names like user, customer, item, etc.
>>
>> This will be particularly important in the OSGi space where you can create
>> extensible applications: You do not know in advance, which modules are
>> added.
>>
>> Hence on the long run I think we need something like namespacing. What do
>> you think?
>>
>
> What do you propose as the syntax?
>
> It's possible to create page-specific snippets so a fair number of the name
> clashes go away, but yes, for global snippets, there might be name clashes.
>
>
>>
>> Cheers
>> Heiko
>> --
>> My blog: heikoseeberger.name
>> Follow me: twitter.com/hseeberger
>> OSGi on Scala: www.scalamodules.org
>> Lift, the simply functional web framework: liftweb.net
>>
>>
>>
>
>
> --
> 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: Why do geeks like to use the language of ancient Ashdod instead of koine Greek or simple English?

2009-05-17 Thread Alex Boisvert
Hi Johnie,

Like many other words, "funky" has loose and varying meanings.  I'm not a
native English speaker myself so I asked my wife what "funky" means and she
said "interesting", "strange" and "unusual".

The American Heritage
dictionarysays: "When
asked which words in the English language are the most difficult
to define precisely, a lexicographer would surely mention *funky."*

Yes, we could all go and use simple English but that would be a shame
because language can be so colorful.

alex


On Sun, May 17, 2009 at 2:49 PM, johnnie  wrote:
>
> A documentation author for Lift said,
>   Hmmm. I can easily make a second copy of the master file and change
> the
>   format there, but there are a lot of tables and other things that
> right now
>   are set for 8.5x11. They would all come out looking pretty funky, I
> think.
> So I suppose funky just means "very bad."
>
> But a Lift programmer said,
>   Oh man, this is going to be nice - loving your work Heiko feels
>   like this is the first brick in the road to something extremely
>   funky.
> So I suppose funky just means "very good."
>
> But interested innocent people are just very confused.
> Johnnie
>
> >
>

--~--~-~--~~~---~--~~
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: [patch] work around for errors running unit tests in IDEA/NetBeans

2009-05-17 Thread Alex Boisvert
Done.

On Sat, May 9, 2009 at 6:50 AM, David Pollak
wrote:

> Folks,
>
> I think this patch is cool.  Can one of the committers integrate it?
>
> Thanks,
>
> David
>
> On Tue, Apr 28, 2009 at 8:49 AM, James Strachan 
> wrote:
>
>>
>> I was trying out various IDEs to run the unit tests in the lift-webkit
>> module and was getting errors. I guess due to recent changes in scala
>> language version?
>>
>> Here's the trivial patch that fixes it - it seems reflection on the
>> continuation stuff was no longer working
>>
>> http://github.com/jstrachan/liftweb/commit/2ca3b683733969bd8689e36dad99a990711b4071
>>
>> --
>> James
>> ---
>> http://macstrac.blogspot.com/
>>
>> Open Source Integration
>> http://fusesource.com/
>>
>>
>>
>
>
> --
> 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: OSGi support for Lift

2009-05-13 Thread Alex Boisvert
Hi Heiko,

On Tue, May 12, 2009 at 11:21 PM, Heiko Seeberger <
heiko.seeber...@googlemail.com> wrote:

> This is an interesting requirement and could be feasible but not trivial.
> Please keep in mind, that in OSGi *each* application is (potentially) made
> up from several bundles that can be installed, updated and removed at any
> point of (run)time => Whar really leverages the power of OSGi is to have one
> *composite* web application (under one context). Because then you can do
> things like adding functionality or hot deployment which have not been
> possible before.
>

Yes, I do get that and these are exactly the things I'm looking for in
moving to OSGi.  However, as applications grow I think it's eventually
necessary to modularize and isolate them so that changing something in one
app doesn't affect another one.

Let's say I have 2 apps and I'd like one of them to run on Lift 1.0 and the
other one on Lift 1.1-SNAPSHOT, how do you see this working?  In a typical
J2EE webapp, these would be deployed as separate wars, each having a
separate web context and isolated Lift core instances.   Ideally, these
would run in the same OSGi container so the overhead of the OSGi platform
remains fixed.

(Yes, I can imagine cases where you'd want to run multiple containers for
additional isolation but I'm personally not expecting this anytime soon)

alex

--~--~-~--~~~---~--~~
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: OSGi support for Lift

2009-05-12 Thread Alex Boisvert
Alright, thanks for your help!   I was mostly kicking the tires to get a
taste for the upcoming OSGi integration.  I guess my main feedback at this
point is that it would be nice to map the app into a non-root context of
Jetty.   e.g. http://localhost:8080/examples-osgi instead of directly under
http://localhost:8080.This would make it possible to deploy several Lift
apps onto the same OSGi container.

alex


On Tue, May 12, 2009 at 12:19 PM, Heiko Seeberger <
heiko.seeber...@googlemail.com> wrote:

> Hm, does not look good :-(Thanx for trying and please keep on!
> I have to deal with some build issues, and will take a look at that
> tomorrow.
>
> Heiko
>
> 2009/5/12 Alex Boisvert 
>
>> That was it.  I pulled again from git and now I can start the
>> examples-osgi app.
>>
>> However, one more nitpick...  I can load index.htm but the snippet isn't
>> rendered correctly because some resources can't be found.
>>
>> e.g.
>> [5285...@qtp-20735553-0 - /] INFO
>> org.ops4j.pax.web.service.internal.HttpServiceContext - getting resource:
>> [/templates-hidden/default.htm]
>> [5285...@qtp-20735553-0 - /] INFO
>> org.ops4j.pax.web.service.internal.HttpServiceContext - found resource: null
>>
>> Is that normal?  I can see the following displayed:
>>
>>   From a snippet: Hi, I am a snippet from a Lift-powered OSGi
>> bundle!
>>
>> but there's no surrounding   ...   so the
>> browser complains.
>>
>> alex
>>
>> On Tue, May 12, 2009 at 11:24 AM, Heiko Seeberger <
>> heiko.seeber...@googlemail.com> wrote:
>>
>>> When did you check out? I pushed again about one or two hours ago.From
>>> the log I can see that you use an old version of hello.composite. The new
>>> one should look like:
>>>
>>> scan-bundle:wrap:mvn:javax.mail/mail/1.4
>>>
>>> scan-bundle:wrap:mvn:javax.activation/activation/1.1
>>> ...
>>>
>>> The "wrap:" is important. Pax Runner will wrap vanilla JARs into OSGi
>>> bundles.
>>>
>>> Please pull again, that should help.
>>> Heiko
>>>
>>> 2009/5/12 Alex Boisvert 
>>>
>>>> Ok, I tried again based on your suggestion but I'm getting an error
>>>> related to javax.mail:1.4 not being a valid bundle...
>>>>
>>>>  -> Preparing framework [Felix 1.6.0]
>>>>  -> Downloading bundles...
>>>>  -> mvn:javax.mail/mail/1.4 : 388864 bytes @ [ 471kBps ]
>>>> s @ [ 498kBps ]
>>>>
>>>>  ___
>>>> /  /
>>>>/  / Oops, there has been a problem!
>>>>   /  /
>>>>  /__/   org.ops4j.pax.runner.platform.PlatformException:
>>>> [mvn:javax.mail/mail/1.4] is not a valid bundle
>>>> ___
>>>>/__/ Use --log=debug to see details.
>>>>
>>>>
>>>> To be sure, I wiped my M2 repo under javax/mail and retried but I'm
>>>> getting the same error.  Any idea?
>>>>
>>>> I'm attaching the full log in case it's helpful.
>>>>
>>>> alex
>>>>
>>>>
>>>>
>>>>
>>>> On Tue, May 12, 2009 at 10:08 AM, Heiko Seeberger <
>>>> heiko.seeber...@googlemail.com> wrote:
>>>>
>>>>> Hi Alex,
>>>>> 2009/5/12 Alex Boisvert 
>>>>>
>>>>> I downloaded and ran PAX runner,
>>>>>>
>>>>>> ./pax-run.sh --profiles=log,scala,felix.webconsole,web
>>>>>
>>>>>
>>>>>>
>>>>>> then installed the examples-osgi bundle,
>>>>>>
>>>>>> -> install
>>>>>> file:///home/boisvert/git/liftweb/sites/examples-osgi/hello/target/examples-osgi-hello-1.1-SNAPSHOT.jar
>>>>>> Bundle ID: 9
>>>>>> -> [FelixDispatchQueue] DEBUG net.liftweb.examples-osgi-hello -
>>>>>> BundleEvent INSTALLED
>>>>>> start 9
>>>>>> -> [FelixDispatchQueue] DEBUG net.liftweb.examples-osgi-hello -
>>>>>> BundleEvent RESOLVED
>>>>>> [FelixDispatchQueue] DEBUG net.liftweb.examples-osgi-hello -
>>>>>> BundleEvent STARTED
>>>>>>
>>>>>
>>>>> OSGi support for Lift is implemented as "extender" in order to keep
>>>>> Lift "core" OSGi-agnostic. This means tha

[Lift] Re: OSGi support for Lift

2009-05-12 Thread Alex Boisvert
That was it.  I pulled again from git and now I can start the examples-osgi
app.

However, one more nitpick...  I can load index.htm but the snippet isn't
rendered correctly because some resources can't be found.

e.g.
[5285...@qtp-20735553-0 - /] INFO
org.ops4j.pax.web.service.internal.HttpServiceContext - getting resource:
[/templates-hidden/default.htm]
[5285...@qtp-20735553-0 - /] INFO
org.ops4j.pax.web.service.internal.HttpServiceContext - found resource: null

Is that normal?  I can see the following displayed:

  From a snippet: Hi, I am a snippet from a Lift-powered OSGi
bundle!

but there's no surrounding   ...   so the browser
complains.

alex

On Tue, May 12, 2009 at 11:24 AM, Heiko Seeberger <
heiko.seeber...@googlemail.com> wrote:

> When did you check out? I pushed again about one or two hours ago.From the
> log I can see that you use an old version of hello.composite. The new one
> should look like:
>
> scan-bundle:wrap:mvn:javax.mail/mail/1.4
>
> scan-bundle:wrap:mvn:javax.activation/activation/1.1
> ...
>
> The "wrap:" is important. Pax Runner will wrap vanilla JARs into OSGi
> bundles.
>
> Please pull again, that should help.
> Heiko
>
> 2009/5/12 Alex Boisvert 
>
>> Ok, I tried again based on your suggestion but I'm getting an error
>> related to javax.mail:1.4 not being a valid bundle...
>>
>>  -> Preparing framework [Felix 1.6.0]
>>  -> Downloading bundles...
>>  -> mvn:javax.mail/mail/1.4 : 388864 bytes @ [ 471kBps ]
>> s @ [ 498kBps ]
>>
>>  ___
>> /  /
>>/  / Oops, there has been a problem!
>>   /  /
>>  /__/   org.ops4j.pax.runner.platform.PlatformException:
>> [mvn:javax.mail/mail/1.4] is not a valid bundle
>> ___
>>/__/ Use --log=debug to see details.
>>
>>
>> To be sure, I wiped my M2 repo under javax/mail and retried but I'm
>> getting the same error.  Any idea?
>>
>> I'm attaching the full log in case it's helpful.
>>
>> alex
>>
>>
>>
>>
>> On Tue, May 12, 2009 at 10:08 AM, Heiko Seeberger <
>> heiko.seeber...@googlemail.com> wrote:
>>
>>> Hi Alex,
>>> 2009/5/12 Alex Boisvert 
>>>
>>> I downloaded and ran PAX runner,
>>>>
>>>> ./pax-run.sh --profiles=log,scala,felix.webconsole,web
>>>
>>>
>>>>
>>>> then installed the examples-osgi bundle,
>>>>
>>>> -> install
>>>> file:///home/boisvert/git/liftweb/sites/examples-osgi/hello/target/examples-osgi-hello-1.1-SNAPSHOT.jar
>>>> Bundle ID: 9
>>>> -> [FelixDispatchQueue] DEBUG net.liftweb.examples-osgi-hello -
>>>> BundleEvent INSTALLED
>>>> start 9
>>>> -> [FelixDispatchQueue] DEBUG net.liftweb.examples-osgi-hello -
>>>> BundleEvent RESOLVED
>>>> [FelixDispatchQueue] DEBUG net.liftweb.examples-osgi-hello - BundleEvent
>>>> STARTED
>>>>
>>>
>>> OSGi support for Lift is implemented as "extender" in order to keep Lift
>>> "core" OSGi-agnostic. This means that there is a special add-on bundle
>>> (lift-osgi) which must be installed and started. It will watch all bundles
>>> if they are Lift-powered which means they have got a Lift-Config manifest
>>> entry. If so, these bundles will be delegated to for resource look-ups
>>> (templates) and also (latest checkin) bootstrap.liftweb.Boot classes will be
>>> called.
>>>
>>> OK, you have got to install lift-osgi and all its prerequesites, i.e.
>>> lift-webkit, lift-util, etc. You could install the example PLUS all the
>>> required other bundles manually. But better go for Pax Runner like that
>>>
>>> pax-run.sh --profiles=web,scala, scan-composite:file:
>>>
>>> with  the path to hello.composite which is part of
>>> sites/examples-osgi/hello
>>>
>>> Cheers
>>> Heiko
>>>
>>>
>>>
>>
>>
>>
>
>
> --
> My blog: heikoseeberger.name
> Follow me: twitter.com/hseeberger
> OSGi on Scala: www.scalamodules.org
> Lift, the simply functional web framework: liftweb.net
>
> >
>

--~--~-~--~~~---~--~~
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: OSGi support for Lift

2009-05-12 Thread Alex Boisvert
Ok, I tried again based on your suggestion but I'm getting an error related
to javax.mail:1.4 not being a valid bundle...

 -> Preparing framework [Felix 1.6.0]
 -> Downloading bundles...
 -> mvn:javax.mail/mail/1.4 : 388864 bytes @ [ 471kBps ]
s @ [ 498kBps ]

 ___
/  /
   /  / Oops, there has been a problem!
  /  /
 /__/   org.ops4j.pax.runner.platform.PlatformException:
[mvn:javax.mail/mail/1.4] is not a valid bundle
___
   /__/ Use --log=debug to see details.


To be sure, I wiped my M2 repo under javax/mail and retried but I'm getting
the same error.  Any idea?

I'm attaching the full log in case it's helpful.

alex



On Tue, May 12, 2009 at 10:08 AM, Heiko Seeberger <
heiko.seeber...@googlemail.com> wrote:

> Hi Alex,
> 2009/5/12 Alex Boisvert 
>
> I downloaded and ran PAX runner,
>>
>> ./pax-run.sh --profiles=log,scala,felix.webconsole,web
>
>
>>
>> then installed the examples-osgi bundle,
>>
>> -> install
>> file:///home/boisvert/git/liftweb/sites/examples-osgi/hello/target/examples-osgi-hello-1.1-SNAPSHOT.jar
>> Bundle ID: 9
>> -> [FelixDispatchQueue] DEBUG net.liftweb.examples-osgi-hello -
>> BundleEvent INSTALLED
>> start 9
>> -> [FelixDispatchQueue] DEBUG net.liftweb.examples-osgi-hello -
>> BundleEvent RESOLVED
>> [FelixDispatchQueue] DEBUG net.liftweb.examples-osgi-hello - BundleEvent
>> STARTED
>>
>
> OSGi support for Lift is implemented as "extender" in order to keep Lift
> "core" OSGi-agnostic. This means that there is a special add-on bundle
> (lift-osgi) which must be installed and started. It will watch all bundles
> if they are Lift-powered which means they have got a Lift-Config manifest
> entry. If so, these bundles will be delegated to for resource look-ups
> (templates) and also (latest checkin) bootstrap.liftweb.Boot classes will be
> called.
>
> OK, you have got to install lift-osgi and all its prerequesites, i.e.
> lift-webkit, lift-util, etc. You could install the example PLUS all the
> required other bundles manually. But better go for Pax Runner like that
>
> pax-run.sh --profiles=web,scala, scan-composite:file:
>
> with  the path to hello.composite which is part of
> sites/examples-osgi/hello
>
> Cheers
> Heiko
>
> >
>

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

__    __  __
   / __  / /  __   / / / / /
  /  ___/ /  __   / _\ \ _/
 /  //  / /  / / _\ \
/__//__/ /__/ /_/ /_/

Pax Runner (0.19.0) from OPS4J - http://www.ops4j.org
-

 -> Using config [classpath:META-INF/runner.properties]
 -> Using only arguments from command line
 -> Scan bundles from [scan-composite:file:/home/boisvert/git/liftweb/sites/examples-osgi/hello/hello.composite]
 -> Scan bundles from [scan-bundle:mvn:javax.mail/mail/1.4]
 -> Scan bundles from [scan-bundle:mvn:javax.activation/activation/1.1]
 -> Scan bundles from [scan-bundle:mvn:commons-httpclient/commons-httpclient/3.1]
 -> Scan bundles from [scan-bundle:mvn:commons-fileupload/commons-fileupload/1.2.1]
 -> Scan bundles from [scan-bundle:mvn:commons-collections/commons-collections/3.2.1]
 -> Scan bundles from [scan-bundle:mvn:commons-codec/commons-codec/1.3]
 -> Scan bundles from [scan-bundle:mvn:commons-io/commons-io/1.3.2]
 -> Scan bundles from [scan-bundle:mvn:org.scalamodules/scalamodules-core/1.1-SNAPSHOT]
 -> Scan bundles from [scan-bundle:mvn:org.scalamodules/scalamodules-util/1.1-SNAPSHOT]
 -> Scan bundles from [scan-bundle:mvn:net.liftweb/lift-util/1.1-snaps...@update]
 -> Scan bundles from [scan-bundle:mvn:net.liftweb/lift-webkit/1.1-snaps...@update]
 -> Scan bundles from [scan-bundle:mvn:net.liftweb/lift-osgi/1.1-snaps...@update]
 -> Scan bundles from [scan-bundle:mvn:org.ops4j.pax.swissbox/pax-swissbox-extender/0.2.0]
 -> Scan bundles from [scan-bundle:mvn:org.ops4j.pax.swissbox/pax-swissbox-lifecycle/0.2.0]
 -> Scan bundles from [scan-bundle:mvn:org.ops4j.base/ops4j-base-lang/0.5.0]
 -> Scan bundles from [scan-bundle:mvn:net.liftweb/examples-osgi-hello/1.1-snaps...@update]
 -> Scan bundles from [scan-composite:mvn:org.ops4j.pax.runner.profiles/web//composite]
 -> Scan bundles from [scan-composite:mvn:org.ops4j.pax.runner.profiles/log//composite]
 -> Scan bundles from [scan-bundle:mvn:org.ops4j.pax.logging/pax-logging-api/

[Lift] Re: OSGi support for Lift

2009-05-12 Thread Alex Boisvert
Hi Heiko,

Just a few basic questions

I downloaded and ran PAX runner,

./pax-run.sh --profiles=log,scala,felix.webconsole,web

then installed the examples-osgi bundle,

-> install
file:///home/boisvert/git/liftweb/sites/examples-osgi/hello/target/examples-osgi-hello-1.1-SNAPSHOT.jar
Bundle ID: 9
-> [FelixDispatchQueue] DEBUG net.liftweb.examples-osgi-hello - BundleEvent
INSTALLED
start 9
-> [FelixDispatchQueue] DEBUG net.liftweb.examples-osgi-hello - BundleEvent
RESOLVED
[FelixDispatchQueue] DEBUG net.liftweb.examples-osgi-hello - BundleEvent
STARTED

Now how to I access the Lift app?   How does the servlet context get mapped
onto Jetty?  It is normal there's no web.xml in this project?   (I can
access the Felix admin console at http://localhost:8080/system/console)

alex

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

2009-05-11 Thread Alex Boisvert
Hi Glenn,

I don't understand where you're coming from either...  I've integrated Lift
with a different persistence layer (home-grown), another authentication
system (Tempo RBAC), integrated it with existing Java libraries and Spring
MVC components without trouble.  So far, I haven't run into a situation
where Lift got in the way of integration.   The fact that Lift uses all the
standard servlet APIs made it easy to simply add it to an existing app and
even reuse session state / cookies from existing apps.

I can see how Lift can be different from what you're used to, but I don't
see how Lift gets in the way of integrating with legacy apps.

My 2 cents...

alex

On Mon, May 11, 2009 at 1:06 PM, glenn  wrote:

>
> Just some observations from a struggling lift user...
>
> Yes, I see it's utility in delivering dynamic html to the browser. But
> in today's world of rapidly evolving technologies for mashups and flex-
> like richness and gadgetization, interoperability is the key to
> adoption in the enterprise. It's not enough to say you can selectively
> rewrite your legacy apps in lift. Lift, out of the box, is still
> another technology for building monolithing web apps (war files). Not
> the best stategy.
>
> I find the keepers of the code, in response to numerous postings on
> this site, suffer from NIH anxiety and easily dismiss interoperability
> with other frameworks, either because they believe they have a
> superior implementation, so why use someone else's, or, if you really
> feel you need it, roll your own.
>
> My response to that is, it just doesn't work that way. The best
> technologies are not just agnostic on the issue of interoperability,
> they embrace pluggability, and let the developer community choose the
> winners and losers.
>
> Lift suffers from not even having an out-of the-box declarative
> configuration capability. And, frankly no, I don't have the time or
> resources to write my own. Please, give me something other than just
> an  tag to work with.
>
>
> >
>

--~--~-~--~~~---~--~~
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: Alternating row colors

2009-05-11 Thread Alex Boisvert
Here's another approach that I used in a small project recently...

I wrote a small stateful utility class,

class OddOrEven {
  private var isEven = true
  def getAndToggle: String = {
val s = toString
isEven = (!isEven)
s
  }
  override def toString = if (isEven) "even" else "odd"
}

and I use it as such,

val oddOrEven = new OddOrEven
for (row <- rows) yield {
  
 ... 
  
}

But I generally prefer to put that presentation stuff in the CSS/Javascript
directly instead of in the code.

alex

On Mon, May 11, 2009 at 6:54 AM, marius d.  wrote:

>
> Assume that in your snippet you have a List[String] that you want to
> render as table rows such as:
>
>
> val list = "one" :: "two" :: "three" :: Nil
>
> def render(xhtml: NodeSeq): NodeSeq = {
>  {
>  list.zipWithIndex((e, idx) => {e} %
> if (idx % 2 == 0)
> Null // Null is a MetaData here
> else
> ("class" -> "my_gray_out")
>  )
>  }
> }
>
> note that i did not test the code ... so it may not compile ... but I
> hope you got the idea.
>
> Br's,
> marius
>
> On May 11, 3:52 pm, Magnus Alvestad  wrote:
> > I'm still learning lift (and scala). For my sample application I want
> > to display a table with alternating row colors. I want to put the
> > style in my CSS file and add a classname to every TR in my table to
> > indicate odd and even rows. However, I don't know how to take a value
> > from the snippet binding and assigning it to an attribute in my
> > template file. Can anyone point me in the right direction?
> >
> > -Magnus
> >
>

--~--~-~--~~~---~--~~
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: Liftweb without Maven?

2009-04-20 Thread Alex Boisvert
Hi Sean,

I've been using Lift + Buildr for a while now and I'm pretty happy with
both.

See some comments below.

On Mon, Apr 20, 2009 at 5:53 AM, Sean Reque  wrote:

> =begin
> Differences between maven pom.xml and this buildr file:
>
> 1.  I could not get buildr to build this project without setting
>my environment variable SCALA_HOME to point to my scala
> distribution.


This is a documented requirement for the Buildr Scala support.
http://buildr.apache.org/languages.html#scala

Unlike the Maven2 plugin, Buildr relies on your local Scala installation
instead of downloading the Scala jars from a repo.  Both approaches have
advantages/disadvantages.


>
> 2.  Many jars had to be specified manually that did not need not
> specified in the maven pom.xml



Correct, Buildr does not yet support transitive dependencies, so you have to
specify all dependencies explicitly.


3.  They jetty plugin seems to force it's own version, 6.1.3, though
> the  source code documentation tauntingly suggests a way to specify
> your own version


Did you try adding "build.yml" next to your Buildfile with "jetty: 6.1.15"
in it?

I tend to use an external Jetty with an exploded
war.
I find this easier to setup a separate Jetty configuration (e.g., memory,
environment, datasources, commons jars, javarebel, etc.) and basically use
the same environment for development and production.

I also have a fork  of Lift
where I builld everything through buildr, although some tests still fail (I
believe mostly related to Jetty continuations so must be an environment
setup issue) and I still have a push a few things to it...  Not enough time
right now to play with Lift...

alex

--~--~-~--~~~---~--~~
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: Newbie Scala syntax question re: parameterized types with bounds

2009-03-27 Thread Alex Boisvert
Or said another way,

MappedTextarea[ T <: Mapper[T] ]

declares a type parameter T and fixes the upper bound of the MappedTextarea
type parameter to Mapper[T], which means that the type passed to
MappedTextArea must be a subtype of Mapper.

I, too, found this notation confusing at first and wished I could write
MappedTextarea[ <: Mapper[T] ] directly but declaring the T before its use
is necessary to disambiguate it from existing class names.

alex



On Fri, Mar 27, 2009 at 1:52 PM, Stefan Scott wrote:

>
> Hi -
>
> Sorry to be asking a Scala syntax question here in the Lift group, but
> I figured somebody here would know, since this Scala syntax occurs
> quite a bit in the Lift source code.
>
> When reading some of the Lift source I come across a particular Scala
> "idiom" involving parameterized types with bounds, whose semantics I'm
> unsure of.
>
> For example:
>
> class MappedTextarea[ T <: Mapper[ T ] ] ( owner : T, maxLen: Int )
> extends
>  MappedString[ T ]( owner, maxLen ) { ... }
>
> What I'm unsure about here is the part where it says:
>
> T <: Mapper[ T ]
>
> At first, this made no sense to me - how could a type T be a subtype
> of type Mapper[ T ] ?
>
> Then I guessed that maybe the two occurrences of T are unrelated to
> each other - ie, class MappedTextarea is parameterized over a type T,
> which must be a subtype of a type Mapper[ T ] -- where the second T is
> actually in a separate scope so that it has nothing to do with the
> first T.
>
> Is that what this really means?
>
> And, if that's really the case, then I guess the other occurrences of
> T later in the text:
>
> owner : T
> MappedString[ T ]
>
> are also referring to the first occurrence of T -- the type T which is
> upper-bounded by type Mapper[ T ].
>
> Finally, does this mean that the above code could also have been
> written equivalently as follows:
>
> class MappedTextarea[ T <: Mapper[ U ] ] ( owner : T, maxLen: Int )
> extends
>  MappedString[ T ]( owner, maxLen ) { ... }
>
> using U instead of T for the type parameter that's in a separate
> scope?
>
> Thanks for any help.
>
> - Stefan Scott
>
>
>
>
>
> >
>

--~--~-~--~~~---~--~~
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: File <-> Class naming

2009-03-25 Thread Alex Boisvert
2009/3/25 Timothy Perrett 

>
> Ah ok I see this - so your not doing any splitting? just re-naming?
> What rational would you apply to decide on "most significant" class /
> object?


Yes, just renaming.

Right now, I'd say I'm picking the class that most closely matches the
current naming* and if that's not applicable then 1) if the file contain a
class hierarchy, then I pick the base trait/class or 2) the biggest public
class otherwise.

alex

* What's the rational behind the current naming? :)

--~--~-~--~~~---~--~~
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: File <-> Class naming

2009-03-25 Thread Alex Boisvert
Tim, I think you misunderstood the proposal.   There's going to be the same
number of source files overall.  They will just be named according to the
"main" (as in most significant) class they contain.


2009/3/25 Timothy Perrett 

>
> Hmm - Im a little skeptical. One of the nice things about Scala is
> that you don't need one source file per class... that really bugs me
> about Java.
>
> Can you be suscint about what stuff your splitting. Right now the
> codebase in lift feels "workable". I wouldnt want to see it split out
> into a jillion files... having to scroll through my big java code-
> bases is a royal pain in the backside.
>
> Cheers,
>
> Tim
>
> On Mar 25, 2:54 pm, Alex Boisvert  wrote:
> > I'll wait a little more before I commit the changes in case others have
> > feedback.
> >
> > I'm working my way through building each project with Buildr... and I'll
> > give everybody a heads-up before I commit the changes.   I suspect it
> will
> > affect between 15-25 files overall.
> >
> > alex
> >
> > 2009/3/25 David Pollak 
> >
> >
> >
> > > On Tue, Mar 24, 2009 at 11:04 PM, Alex Boisvert  >wrote:
> >
> > >> Hi Lifters,
> >
> > >> How would you feel about renaming .scala files to match the main
> > >> class/trait in them?
> >
> > >> Let me give you a few examples,
> >
> > >> lift/src/main/scala/net/liftweb/http/auth/Authentication.scala
> > >> currently holds a trait named HttpAuthentication.
> > >> I'd like to rename it HttpAuthentication.scala
> >
> > >> lift/src/main/scala/net/liftweb/http/Stateful.scala
> > >> currently holds the StatefulSnippet trait,
> > >> so I'd like to rename it StatefulSnippet.scala
> >
> > >> lift/src/main/scala/net/liftweb/http/Vars.scala
> > >> contains many things but the main class is AnyVar
> > >> so I'd like to rename it AnyVar.scala
> >
> > >> and so on...
> >
> > >> There are two reasons I'd like to make these changes.  First, I think
> it's
> > >> a good convention and it makes it easier to locate some of the main
> classes
> > >> more easily (my Java roots are showing) and second, which is much more
> > >> selfish at this point, is that Buildr does recompilation checks based
> on
> > >> file timestamps and the existence of a corresponding .class file in
> the
> > >> target directory and so it would help Buildr avoid recompiling
> everything
> > >> all the time even though nothing has really changed.
> >
> > >> (I do realize practically nobody besides me uses Buildr in the Lift
> > >> community at this point but I do intend to demonstrate that it's a
> great
> > >> alternative to Maven.  And no, I'm not trying to replace or eradicate
> Maven,
> > >> I'm just trying to make my own life simpler and share the results.  I
> also
> > >> realize that it's likely scalac will have better recompilation
> detection in
> > >> the future that may make the second reason for this request
> irrelevant,
> > >> although I think the first reason is sufficient)
> >
> > >> What do you think?
> >
> > > Because there is no API breakage for doing this, go right ahead.
> >
> > >> alex
> >
> > > --
> > > 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: File <-> Class naming

2009-03-25 Thread Alex Boisvert
I'll wait a little more before I commit the changes in case others have
feedback.

I'm working my way through building each project with Buildr... and I'll
give everybody a heads-up before I commit the changes.   I suspect it will
affect between 15-25 files overall.

alex


2009/3/25 David Pollak 

>
>
> On Tue, Mar 24, 2009 at 11:04 PM, Alex Boisvert wrote:
>
>> Hi Lifters,
>>
>> How would you feel about renaming .scala files to match the main
>> class/trait in them?
>>
>> Let me give you a few examples,
>>
>> lift/src/main/scala/net/liftweb/http/auth/Authentication.scala
>> currently holds a trait named HttpAuthentication.
>> I'd like to rename it HttpAuthentication.scala
>>
>> lift/src/main/scala/net/liftweb/http/Stateful.scala
>> currently holds the StatefulSnippet trait,
>> so I'd like to rename it StatefulSnippet.scala
>>
>> lift/src/main/scala/net/liftweb/http/Vars.scala
>> contains many things but the main class is AnyVar
>> so I'd like to rename it AnyVar.scala
>>
>> and so on...
>>
>> There are two reasons I'd like to make these changes.  First, I think it's
>> a good convention and it makes it easier to locate some of the main classes
>> more easily (my Java roots are showing) and second, which is much more
>> selfish at this point, is that Buildr does recompilation checks based on
>> file timestamps and the existence of a corresponding .class file in the
>> target directory and so it would help Buildr avoid recompiling everything
>> all the time even though nothing has really changed.
>>
>> (I do realize practically nobody besides me uses Buildr in the Lift
>> community at this point but I do intend to demonstrate that it's a great
>> alternative to Maven.  And no, I'm not trying to replace or eradicate Maven,
>> I'm just trying to make my own life simpler and share the results.  I also
>> realize that it's likely scalac will have better recompilation detection in
>> the future that may make the second reason for this request irrelevant,
>> although I think the first reason is sufficient)
>>
>> What do you think?
>
>
> Because there is no API breakage for doing this, go right ahead.
>
>
>>
>>
>> alex
>>
>>
>>
>>
>
>
> --
> 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
-~--~~~~--~~--~--~---



  1   2   >