[Lift] Re: jpa, emf Model and unit tests

2009-04-27 Thread Viktor Klang
Also, if you use Hibernate, you can use:

*Session.createFilter*(city.getAddresses(), "where this.name like
'S%'").list();

On Tue, Apr 28, 2009 at 5:31 AM, Derek Chen-Becker wrote:

> OK, for one, the bidirectional mapping adds no cost in terms of DB access
> other than the time it takes you to write it. Collections are lazily loaded,
> so unless your code *retrieves* City.addresses, the database never gets hit.
> JPA is really not designed with the concept of entities having access to the
> EntityManager that loaded them, although there may be some provider-specific
> way to get at it. Unfortunately, you're on your own if you want an entity to
> obtain other entities via queries or some other non-relationship means.
> Generally, if you need that kind of coverage you should do it through logic
> code that can glue things together instead of tying it to your entities.
> After all, I'd argue that if the logic isn't part of what you can express in
> the database then it doesn't belong in the entity classes anyways. When you
> say "bogged down in bidirectional mappings" are you referring simply to the
> overhead of adding the mappings to your entities, or do you think that
> there's some performance issue with bidirectional mappings (AFAIK, there
> aren't any).
>
> Derek
>
>
>
> On Mon, Apr 27, 2009 at 6:01 PM, TSP  wrote:
>
>>
>> There are two questions here. I don't really want to get bogged down
>> in bidrectional mappings I was rather hoping for suggestions on how my
>> domain objects might simply get at the right Model transparently from
>> both application and junit (in Grails it was done with Spring
>> injection - here perhaps an EMF factory (a factory-factory?)) However,
>> in answer to the bidirectional mapping question here is an example:
>>
>> class City {
>>  var name: String;
>>  var population: Int;
>>  //  var addresses: java.util.Set[Address]  // BAD because London has
>> approx 3m addresses
>>
>> }
>>
>> class Address {
>>name, street etc
>>var city: City
>> }
>>
>> object Address {
>>def matchAddress( .. unstructured input strings from ERP
>> system ...)  = {
>>,,,
>>Some[Address]
>>  else
>>None
>>   }
>> }
>>
>>
>> class Organisation {
>>var hq: Address;
>> }
>>
>> So I can easily trace from organisation to it's address and then find
>> out if the organisation is in a big city.
>> But I never need to directly fetch the city and iterate through the
>> addresses.
>>
>> There are many more examples where the many side of things runs into
>> hundreds and thousands (shipments to a daily customer over the last 2
>> years, tracking events on trucks at 1 minute intervals stored for 6
>> months).
>>
>> Again with reference to Evans Domain Driven Design for a large and
>> complex domain model (I expect to end up with well over 50 objects)
>> universal bi-directional mappings are strongly discouraged (see for
>> example discussion on p. 83)
>>
>> Now you might argue that my address matching should be delegated to a
>> service, but the techniques can be quite country specific tying in the
>> postcodes and town names for example or dealing with peculiarities
>> (from my point of view) of US street naming conventions - so I want my
>> address matching tied closely to may data objects (in that case it
>> would be Address subclasses).  Also as soon as I do get rid of bi-
>> directional mappings then any direct business logic that requires
>> traversal in the "missing" direction can be readily accomplished by
>> access to the database.
>>
>> On Apr 27, 11:00 pm, Derek Chen-Becker  wrote:
>> > I may be misunderstanding this, but if you just do bidirectional
>> mappings in
>> > JPA then the DB query is generally efficient and transparent. Could you
>> post
>> > a little snippet showing what you're trying to do?
>> >
>> > Derek
>> >
>> > On Mon, Apr 27, 2009 at 2:44 PM, TSP  wrote:
>> >
>> > > Viktor,
>> > > It's a valid point, and I would where possible but I've got quite a
>> > > lot of uni-directional references (for example, addressable locations
>> > > in a city) where using a mapping would entail very large fetches that
>> > > are better handled by querying the database. Evans in Domain Driven
>> > > Design is very keen on uni-directional references and who am I to
>> > > argue :-)
>> > > Tim
>> >
>> > > On Apr 27, 9:10 pm, Viktor Klang  wrote:
>> > > > Why don't collection mappings work?
>> >
>> > > > Also, from personal experience, mixing persistence-logic in domain
>> > > objects
>> > > > does make you feel somewhat naughty.
>> >
>> > > > On Mon, Apr 27, 2009 at 9:15 PM, Tim P 
>> wrote:
>> >
>> > > > > Hi
>> > > > > I'm looking for some guidance here and I don't think this is
>> addressed
>> > > > > in the book.
>> >
>> > > > > I've got domain classes that need to go get stuff from the
>> database
>> > > > > "list all ... " type of methods.
>> > > > > So presumably my domain class should have, or be allowed to have
>> > > > > methods that access Model
>> >

[Lift] Re: jpa, emf Model and unit tests

2009-04-27 Thread Derek Chen-Becker
OK, for one, the bidirectional mapping adds no cost in terms of DB access
other than the time it takes you to write it. Collections are lazily loaded,
so unless your code *retrieves* City.addresses, the database never gets hit.
JPA is really not designed with the concept of entities having access to the
EntityManager that loaded them, although there may be some provider-specific
way to get at it. Unfortunately, you're on your own if you want an entity to
obtain other entities via queries or some other non-relationship means.
Generally, if you need that kind of coverage you should do it through logic
code that can glue things together instead of tying it to your entities.
After all, I'd argue that if the logic isn't part of what you can express in
the database then it doesn't belong in the entity classes anyways. When you
say "bogged down in bidirectional mappings" are you referring simply to the
overhead of adding the mappings to your entities, or do you think that
there's some performance issue with bidirectional mappings (AFAIK, there
aren't any).

Derek


On Mon, Apr 27, 2009 at 6:01 PM, TSP  wrote:

>
> There are two questions here. I don't really want to get bogged down
> in bidrectional mappings I was rather hoping for suggestions on how my
> domain objects might simply get at the right Model transparently from
> both application and junit (in Grails it was done with Spring
> injection - here perhaps an EMF factory (a factory-factory?)) However,
> in answer to the bidirectional mapping question here is an example:
>
> class City {
>  var name: String;
>  var population: Int;
>  //  var addresses: java.util.Set[Address]  // BAD because London has
> approx 3m addresses
>
> }
>
> class Address {
>name, street etc
>var city: City
> }
>
> object Address {
>def matchAddress( .. unstructured input strings from ERP
> system ...)  = {
>,,,
>Some[Address]
>  else
>None
>   }
> }
>
>
> class Organisation {
>var hq: Address;
> }
>
> So I can easily trace from organisation to it's address and then find
> out if the organisation is in a big city.
> But I never need to directly fetch the city and iterate through the
> addresses.
>
> There are many more examples where the many side of things runs into
> hundreds and thousands (shipments to a daily customer over the last 2
> years, tracking events on trucks at 1 minute intervals stored for 6
> months).
>
> Again with reference to Evans Domain Driven Design for a large and
> complex domain model (I expect to end up with well over 50 objects)
> universal bi-directional mappings are strongly discouraged (see for
> example discussion on p. 83)
>
> Now you might argue that my address matching should be delegated to a
> service, but the techniques can be quite country specific tying in the
> postcodes and town names for example or dealing with peculiarities
> (from my point of view) of US street naming conventions - so I want my
> address matching tied closely to may data objects (in that case it
> would be Address subclasses).  Also as soon as I do get rid of bi-
> directional mappings then any direct business logic that requires
> traversal in the "missing" direction can be readily accomplished by
> access to the database.
>
> On Apr 27, 11:00 pm, Derek Chen-Becker  wrote:
> > I may be misunderstanding this, but if you just do bidirectional mappings
> in
> > JPA then the DB query is generally efficient and transparent. Could you
> post
> > a little snippet showing what you're trying to do?
> >
> > Derek
> >
> > On Mon, Apr 27, 2009 at 2:44 PM, TSP  wrote:
> >
> > > Viktor,
> > > It's a valid point, and I would where possible but I've got quite a
> > > lot of uni-directional references (for example, addressable locations
> > > in a city) where using a mapping would entail very large fetches that
> > > are better handled by querying the database. Evans in Domain Driven
> > > Design is very keen on uni-directional references and who am I to
> > > argue :-)
> > > Tim
> >
> > > On Apr 27, 9:10 pm, Viktor Klang  wrote:
> > > > Why don't collection mappings work?
> >
> > > > Also, from personal experience, mixing persistence-logic in domain
> > > objects
> > > > does make you feel somewhat naughty.
> >
> > > > On Mon, Apr 27, 2009 at 9:15 PM, Tim P 
> wrote:
> >
> > > > > Hi
> > > > > I'm looking for some guidance here and I don't think this is
> addressed
> > > > > in the book.
> >
> > > > > I've got domain classes that need to go get stuff from the database
> > > > > "list all ... " type of methods.
> > > > > So presumably my domain class should have, or be allowed to have
> > > > > methods that access Model
> > > > > But my unit tests need to test these methods. So I need a model
> which
> > > > > is instantiated within the test environment and so does not need to
> be
> > > > > extended with RequestVarEM which presumably would be a bad thing
> > > > > (though perhaps it's harmless).
> > > > > Any suggestions on "best practice" to 

[Lift] Re: Javascript "confirm(..)" dialog with ajaxButton

2009-04-27 Thread Chris

Hi Tim,
just one addition. Wicket has something called an ajaxcall decorator
(IAjaxCallDecorator) that allows you to modify the script and more
specifically the "decorateScript" method allows you to prepend a char-
sequence to the script. This would allow me to do exactly what I want.
Is there any way in Lift to achieve the same thing? I'd really like to
avoid dealing with JavaScript directly apart from something as trivial
as the "confirm(...)" dialog or similar.
Cheers, Chris.

On Apr 28, 9:56 am, Chris  wrote:
> Hi Tim,
> not sure if I really got across what I need. I need the AJAX
> functionality in this case as I'm displaying a large amount of data in
> a table and would like to allow the user to delete individual records
> without the refresh problem of having the button cause a POST. I also
> need to make sure the user hasn't "accidentally" pressed "delete",
> hence the "confirm(..)" dialog. Does option (1) above prevent the
> subsequent call of the ajaxButton if the user presses "cancel" on the
> JS "confirm" dialog, but allow it if he presses "OK"? Option (2) is
> just a slightly different way of doing what I've already tried (I
> added the "onclick" attribute to the ajaxButton call itself) and this
> subsequently removes the actual AJAX call itself.
> Thanks, Chris.
>
> On Apr 28, 9:22 am, Timothy Perrett  wrote:
>
> > Hey,
>
> > Seems like you have a couple of options...
>
> > 1. you could just write normal javascript irrespective of lift and
> > just put that in a JS file like normal. Something like:
>
> > $('#mybutton').click(function(e){
> >   confirm... //blah blah code here
>
> > });
>
> > 2. If you *really* want to use the on-click handler (personally I
> > wouldn't) then you could do somethig like this in your snippet:
>
> > SHtml.ajaxButton("submit", () => println("badger")) % ("onclick" ->
> > "confirm();")
>
> > I would highly recommend using option one as the functionality is
> > purely a client side concern in that sense and nothing to do with
> > lift. Does that help?
>
> > Cheers, Tim
>
> > On Apr 27, 11:29 pm, Chris  wrote:
>
> > > Hi there,
> > > I'm pretty new to Lift and Scala for that matter, but have long been
> > > on the lookout for something like seaside running on the JVM and this
> > > is just great! Now to my issue...
> > > I've hit a brick-wall in the attempt to get a confirmation dialog
> > > working before executing an ajaxButton. I've tried adding an "onclick"
> > > attribute to the ajaxButton call, but that only seems to replace the
> > > AJAX call itself rather than say prepending the call with the contents
> > > of the "onclick" attribute. I'd like to implement a "delete" button
> > > with a confirmation dialog. I've looked at ModalDialog, but due to my
> > > inexperience and lack of examples haven't found a way of achieving
> > > this. Could someone enlighten me as to how I could implement this?
> > > Cheers, Chris.
> > > PS: I hope this isn't a FAQ but I've searched this group and the web
> > > on the matter, but haven't found an answer, so sorry in advance if
> > > this has been answered before.

--~--~-~--~~~---~--~~
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: Javascript "confirm(..)" dialog with ajaxButton

2009-04-27 Thread Chris

Hi Tim,
not sure if I really got across what I need. I need the AJAX
functionality in this case as I'm displaying a large amount of data in
a table and would like to allow the user to delete individual records
without the refresh problem of having the button cause a POST. I also
need to make sure the user hasn't "accidentally" pressed "delete",
hence the "confirm(..)" dialog. Does option (1) above prevent the
subsequent call of the ajaxButton if the user presses "cancel" on the
JS "confirm" dialog, but allow it if he presses "OK"? Option (2) is
just a slightly different way of doing what I've already tried (I
added the "onclick" attribute to the ajaxButton call itself) and this
subsequently removes the actual AJAX call itself.
Thanks, Chris.

On Apr 28, 9:22 am, Timothy Perrett  wrote:
> Hey,
>
> Seems like you have a couple of options...
>
> 1. you could just write normal javascript irrespective of lift and
> just put that in a JS file like normal. Something like:
>
> $('#mybutton').click(function(e){
>   confirm... //blah blah code here
>
> });
>
> 2. If you *really* want to use the on-click handler (personally I
> wouldn't) then you could do somethig like this in your snippet:
>
> SHtml.ajaxButton("submit", () => println("badger")) % ("onclick" ->
> "confirm();")
>
> I would highly recommend using option one as the functionality is
> purely a client side concern in that sense and nothing to do with
> lift. Does that help?
>
> Cheers, Tim
>
> On Apr 27, 11:29 pm, Chris  wrote:
>
> > Hi there,
> > I'm pretty new to Lift and Scala for that matter, but have long been
> > on the lookout for something like seaside running on the JVM and this
> > is just great! Now to my issue...
> > I've hit a brick-wall in the attempt to get a confirmation dialog
> > working before executing an ajaxButton. I've tried adding an "onclick"
> > attribute to the ajaxButton call, but that only seems to replace the
> > AJAX call itself rather than say prepending the call with the contents
> > of the "onclick" attribute. I'd like to implement a "delete" button
> > with a confirmation dialog. I've looked at ModalDialog, but due to my
> > inexperience and lack of examples haven't found a way of achieving
> > this. Could someone enlighten me as to how I could implement this?
> > Cheers, Chris.
> > PS: I hope this isn't a FAQ but I've searched this group and the web
> > on the matter, but haven't found an answer, so sorry in advance if
> > this has been answered before.

--~--~-~--~~~---~--~~
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: jpa, emf Model and unit tests

2009-04-27 Thread TSP

There are two questions here. I don't really want to get bogged down
in bidrectional mappings I was rather hoping for suggestions on how my
domain objects might simply get at the right Model transparently from
both application and junit (in Grails it was done with Spring
injection - here perhaps an EMF factory (a factory-factory?)) However,
in answer to the bidirectional mapping question here is an example:

class City {
  var name: String;
  var population: Int;
  //  var addresses: java.util.Set[Address]  // BAD because London has
approx 3m addresses

}

class Address {
name, street etc
var city: City
}

object Address {
def matchAddress( .. unstructured input strings from ERP
system ...)  = {
,,,
Some[Address]
  else
None
   }
}


class Organisation {
var hq: Address;
}

So I can easily trace from organisation to it's address and then find
out if the organisation is in a big city.
But I never need to directly fetch the city and iterate through the
addresses.

There are many more examples where the many side of things runs into
hundreds and thousands (shipments to a daily customer over the last 2
years, tracking events on trucks at 1 minute intervals stored for 6
months).

Again with reference to Evans Domain Driven Design for a large and
complex domain model (I expect to end up with well over 50 objects)
universal bi-directional mappings are strongly discouraged (see for
example discussion on p. 83)

Now you might argue that my address matching should be delegated to a
service, but the techniques can be quite country specific tying in the
postcodes and town names for example or dealing with peculiarities
(from my point of view) of US street naming conventions - so I want my
address matching tied closely to may data objects (in that case it
would be Address subclasses).  Also as soon as I do get rid of bi-
directional mappings then any direct business logic that requires
traversal in the "missing" direction can be readily accomplished by
access to the database.

On Apr 27, 11:00 pm, Derek Chen-Becker  wrote:
> I may be misunderstanding this, but if you just do bidirectional mappings in
> JPA then the DB query is generally efficient and transparent. Could you post
> a little snippet showing what you're trying to do?
>
> Derek
>
> On Mon, Apr 27, 2009 at 2:44 PM, TSP  wrote:
>
> > Viktor,
> > It's a valid point, and I would where possible but I've got quite a
> > lot of uni-directional references (for example, addressable locations
> > in a city) where using a mapping would entail very large fetches that
> > are better handled by querying the database. Evans in Domain Driven
> > Design is very keen on uni-directional references and who am I to
> > argue :-)
> > Tim
>
> > On Apr 27, 9:10 pm, Viktor Klang  wrote:
> > > Why don't collection mappings work?
>
> > > Also, from personal experience, mixing persistence-logic in domain
> > objects
> > > does make you feel somewhat naughty.
>
> > > On Mon, Apr 27, 2009 at 9:15 PM, Tim P  wrote:
>
> > > > Hi
> > > > I'm looking for some guidance here and I don't think this is addressed
> > > > in the book.
>
> > > > I've got domain classes that need to go get stuff from the database
> > > > "list all ... " type of methods.
> > > > So presumably my domain class should have, or be allowed to have
> > > > methods that access Model
> > > > But my unit tests need to test these methods. So I need a model which
> > > > is instantiated within the test environment and so does not need to be
> > > > extended with RequestVarEM which presumably would be a bad thing
> > > > (though perhaps it's harmless).
> > > > Any suggestions on "best practice" to achieve this? (I'm still very
> > > > much trying to find my way round natural scala constructs)
>
> > > > Should it be mentioned in the jpa chapter in the book?
>
> > > > Tim
>
> > > --
> > > Viktor Klang
> > > Senior Systems Analyst
--~--~-~--~~~---~--~~
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: Upgrade to 2.7.4 breaks "with-param"?

2009-04-27 Thread Charles F. Munat

Can't it just be ?

David Pollak wrote:
> 
> 
> On Mon, Apr 27, 2009 at 3:25 AM, marius d.  > wrote:
> 
> 
> I'm not referring to something similar to lift:bind. Just that using
> snippets or Loc snippets, chooseTemplate etc. gives you the ability to
> to change content depending on what page you are which is with-param
> kind of does.
> 
> No worries, these are valid question and to me it kind of boils down
> to the style of designing the lift template cause there is quite a bit
> of flexibility provided so things can be done in many ways.
> 
> So I guess it needs to be determined what would replace 
> (if it will be replaced).
> 
> 
> The only thing that's being changed is  (which looks like a 
> snippet invocation) to something like: 
> 
> It's a syntactic change that has no semantic difference.
>  
> 
> 
> Personally I really don't mind  ... :)
> 
> Br's,
> Marius
> 
> On Apr 27, 1:16 pm, Timothy Perrett  wrote:
>  > Can you be specific about which other lift artefacts you want to
> replace
>  > lift:bind with? Im not fighting lift:binds corner or anything,
> rather, just
>  > interested to know what will supersede it because this kind of
> functionality
>  > is key in our template strategy.
>  >
>  > Cheers, Tim
>  >
>  > On 27/04/2009 10:13, "marius d."  > wrote:
>  >
>  >
>  >
>  > > Right now: bits me ... perhaps Dave has more input. However it
> seems
>  > > to me that what we can do with /
> today, it
>  > > can be easily done without it using the other Lift artifacts. Still
>  > > probably people got used with  style and finds this
> pretty
>  > > handy?
>  >
>  > > Br's,
>  > > Marius
> 
> 
> 
> 
> -- 
> 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: Javascript "confirm(..)" dialog with ajaxButton

2009-04-27 Thread Timothy Perrett

Hey,

Seems like you have a couple of options...

1. you could just write normal javascript irrespective of lift and
just put that in a JS file like normal. Something like:

$('#mybutton').click(function(e){
  confirm... //blah blah code here
});

2. If you *really* want to use the on-click handler (personally I
wouldn't) then you could do somethig like this in your snippet:

SHtml.ajaxButton("submit", () => println("badger")) % ("onclick" ->
"confirm();")

I would highly recommend using option one as the functionality is
purely a client side concern in that sense and nothing to do with
lift. Does that help?

Cheers, Tim

On Apr 27, 11:29 pm, Chris  wrote:
> Hi there,
> I'm pretty new to Lift and Scala for that matter, but have long been
> on the lookout for something like seaside running on the JVM and this
> is just great! Now to my issue...
> I've hit a brick-wall in the attempt to get a confirmation dialog
> working before executing an ajaxButton. I've tried adding an "onclick"
> attribute to the ajaxButton call, but that only seems to replace the
> AJAX call itself rather than say prepending the call with the contents
> of the "onclick" attribute. I'd like to implement a "delete" button
> with a confirmation dialog. I've looked at ModalDialog, but due to my
> inexperience and lack of examples haven't found a way of achieving
> this. Could someone enlighten me as to how I could implement this?
> Cheers, Chris.
> PS: I hope this isn't a FAQ but I've searched this group and the web
> on the matter, but haven't found an answer, so sorry in advance if
> this has been answered before.
--~--~-~--~~~---~--~~
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] Javascript "confirm(..)" dialog with ajaxButton

2009-04-27 Thread Chris

Hi there,
I'm pretty new to Lift and Scala for that matter, but have long been
on the lookout for something like seaside running on the JVM and this
is just great! Now to my issue...
I've hit a brick-wall in the attempt to get a confirmation dialog
working before executing an ajaxButton. I've tried adding an "onclick"
attribute to the ajaxButton call, but that only seems to replace the
AJAX call itself rather than say prepending the call with the contents
of the "onclick" attribute. I'd like to implement a "delete" button
with a confirmation dialog. I've looked at ModalDialog, but due to my
inexperience and lack of examples haven't found a way of achieving
this. Could someone enlighten me as to how I could implement this?
Cheers, Chris.
PS: I hope this isn't a FAQ but I've searched this group and the web
on the matter, but haven't found an answer, so sorry in advance if
this has been answered before.

--~--~-~--~~~---~--~~
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: Upgrade to 2.7.4 breaks "with-param"?

2009-04-27 Thread Timothy Perrett

Sounds great gents! Looking forward to the update.

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



[Lift] Re: slicing off a web front end

2009-04-27 Thread Derek Chen-Becker
Could you give me some sample ajax urls? This looks like it should be pretty
simple but I'm still a little lost in Rails.

Derek

On Sat, Apr 25, 2009 at 12:12 AM, Meredith Gregory  wrote:

> Derek,
>
> Apologies for the delay. i just saw this. The requests are in
> rails/app/controllers/pipes_controller.rb . For quick clickability, here
> you 
> go.
>
>
> Best wishes,
>
> --greg
>
>
> On Fri, Apr 24, 2009 at 2:58 PM, Derek Chen-Becker 
> wrote:
>
>> It's been a long time since I've touched Rails, and even then it was
>> brief. Could you direct me to where the Ajax requests are handled in rails?
>> Is there consistency to what the URLs look like for the Ajax callbacks?
>>
>> Derek
>>
>> On Wed, Apr 22, 2009 at 5:14 PM, Meredith Gregory <
>> lgreg.mered...@gmail.com> wrote:
>>
>>> Tim, et al,
>>>
>>> Here 's a link to
>>> the root of the project. What it does can be summarized as follows.
>>>
>>>- scrape the frontend off Yahoo Pipes
>>>- implement a JRoR app to field the Pipes requests
>>>- implement JRoR controller hands off to a piece of scala code that
>>>compiles a Pipes Graph to a CAL [1] expression and then -- if the 
>>> expression
>>>is closed (no free variables) -- evalute it and return the result
>>>- the builtin pipes are populated from CAL via a JPA model
>>>(ultimately) generated from the schema generated by the RoR app
>>>
>>>
>>> This one might not build for you as i've not uploaded a bunch of changes
>>> i've made -- so the code is in a slightly inconsistent state. But, it works
>>> to provide an actual code context (that works for me! ;-).
>>>
>>> My aim is to repeat the original scraping we did to get the frontend off
>>> of Yahoo Pipes, itself. But, this time we're replacing the RoR controllers
>>> with Lift controllers. The ideal case would be that i can simply duplicate
>>> the RoR controller semantics with Lift controller semantics and start up
>>> jetty+lift instead of webrick+jruby and a user cannot tell the difference.
>>>
>>> Best wishes,
>>>
>>> --greg
>>>
>>> [1] CAL is an open source JVM implementation of a variant of Haskell
>>>
>>> On Wed, Apr 22, 2009 at 3:54 PM, Timothy Perrett
>>>  wrote:
>>>

 Hmm Id tend to agree – you’d probably have to rewrite a lot of the JS
 away from prototype if your using RJS but from a migration POV, I think the
 main issue will be translating some of the rails black-box magic to, as
 Derek says, JsonResponses etc.

 If you provide a bit more context that would be splendid.

 Cheers, Tim

 On 22/04/2009 23:31, "Derek Chen-Becker"  wrote:

 Worst case you might be able to use custom dispatch hooks combined with
 JavaScriptResponse or JsonResponse.

 Derek

 On Wed, Apr 22, 2009 at 4:21 PM, Meredith Gregory <
 lgreg.mered...@gmail.com> wrote:

 Lifted,

 After diving into what it takes to more or less auto-generate a decent
 starting point for a midtier from the backend of a RoR (or other) website,
 i'm now interested in the least painful way to slice off the frontend of an
 existing website and paste it onto a lift(ed) midtier.

 Suppose i've got an existing RoR-based application with a relatively
 sophisticated AJAX frontend and i want to do minimal messing about with the
 front end. What is least i could do to have the existing frontend-generated
 requests end up in a lift handler?

 i can provide links to an existing code context if that will facilitate
 discussion.

 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
>>>
>>>
>>>
>>
>>
>>
>
>
> --
> 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: malformed Scala signature of User

2009-04-27 Thread erik.karls...@iki.fi

Hi,

I have noticed this and I always run mvn clean before running the
tests or just compiling them. So I get the issue even I run the clean
command.

-erik

David Pollak kirjoitti:
> Erik,
>
> Please do an:
>
> mvn clean test
>
> From the command line.
>
> The Eclipse plugin uses a different version of Scala than does Lift.  There
> will be weird errors like the one you've seen.
>
> Thanks,
>
> David
>
> On Mon, Apr 27, 2009 at 2:24 PM, erik.karls...@iki.fi <
> erik.b.karls...@gmail.com> wrote:
>
> >
> > Weird thing is  that I'm able to mock "MetaTeam":
> >
> > ---
> > trait MetaTeam extends Team with LongKeyedMetaMapper[Team] {
> >  def findByUser(user:User): List[Team]
> > }
> >
> > object Team extends MetaTeam {
> >  def findByUser(user:User): List[Team] =
> >UserTeam.findAll(
> >  By(UserTeam.user, user.id),
> >  OrderBy(UserTeam.team, Ascending)).map(_.team.obj.open_!)
> > }
> > ---
> >
> > - Erik
> >
> > On Apr 28, 12:19 am, "erik.karls...@iki.fi"
> >  wrote:
> > > Hi,
> > >
> > > I have set of specs test and I'm using mockito
> > >
> > > I noticed that if I have a list of Users (pretty much same class that
> > > is coming from archetype) and do following test:
> > >
> > > users(1).firstName must beEqualTo(name2)
> > >
> > > Then I get :
> > > [WARNING] Exception in thread "main" java.lang.RuntimeException:
> > > malformed Scala signature of User at 13798; reference type _5 of
> > >  refers to nonexisting symbol.
> > >
> > > If the line is changed to:
> > >
> > > (users(1).firstName == name2) must beTrue
> > >
> > > it compiles really nicely. Based on previous posts here it seams to be
> > > that this is scala bug (I use 2.7.4|3)
> > >
> > > Much bigger problem for me is that when trying to mock the User:
> > >
> > > var userDbMock = mock[MetaUser]
> > >
> > > causes the same issue:
> > > [WARNING] Exception in thread "main" java.lang.RuntimeException:
> > > malformed Scala signature of User at 13798; reference type _5 of
> > >  refers to nonexisting symbol.
> > >
> > > MetaUser is trait:
> > >
> > > object User extends MetaUser {
> > >
> > >   override def dbTableName = "users" // define the DB table name
> > >   override def screenWrap = Full( > > at="content">
> > >)
> > >   // define the order fields will appear in forms and output
> > >   override def fieldOrder = List(id, firstName, lastName, email,
> > >   locale, timezone, password, textArea)
> > >
> > >   // comment this line out to require email validations
> > >   override def skipEmailValidation = true
> > >
> > > }
> > >
> > > trait MetaUser extends User with MetaMegaProtoUser[User]  {
> > >
> > > }
> > >
> > > Have anybody encountered similar problem when mocking or even found a
> > > workaround for this case?
> > >
> > > br,
> > > - Erik
> > >
> > > PS. Weirdest thing is that I'm able to run the test cases in
> > > Eclipse...
> >
> > >
> >
>
>
> --
> 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: jpa, emf Model and unit tests

2009-04-27 Thread Derek Chen-Becker
I may be misunderstanding this, but if you just do bidirectional mappings in
JPA then the DB query is generally efficient and transparent. Could you post
a little snippet showing what you're trying to do?

Derek

On Mon, Apr 27, 2009 at 2:44 PM, TSP  wrote:

>
> Viktor,
> It's a valid point, and I would where possible but I've got quite a
> lot of uni-directional references (for example, addressable locations
> in a city) where using a mapping would entail very large fetches that
> are better handled by querying the database. Evans in Domain Driven
> Design is very keen on uni-directional references and who am I to
> argue :-)
> Tim
>
>
> On Apr 27, 9:10 pm, Viktor Klang  wrote:
> > Why don't collection mappings work?
> >
> > Also, from personal experience, mixing persistence-logic in domain
> objects
> > does make you feel somewhat naughty.
> >
> >
> >
> > On Mon, Apr 27, 2009 at 9:15 PM, Tim P  wrote:
> >
> > > Hi
> > > I'm looking for some guidance here and I don't think this is addressed
> > > in the book.
> >
> > > I've got domain classes that need to go get stuff from the database
> > > "list all ... " type of methods.
> > > So presumably my domain class should have, or be allowed to have
> > > methods that access Model
> > > But my unit tests need to test these methods. So I need a model which
> > > is instantiated within the test environment and so does not need to be
> > > extended with RequestVarEM which presumably would be a bad thing
> > > (though perhaps it's harmless).
> > > Any suggestions on "best practice" to achieve this? (I'm still very
> > > much trying to find my way round natural scala constructs)
> >
> > > Should it be mentioned in the jpa chapter in the book?
> >
> > > Tim
> >
> > --
> > Viktor Klang
> > Senior Systems Analyst
> >
>

--~--~-~--~~~---~--~~
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: malformed Scala signature of User

2009-04-27 Thread David Pollak
Erik,

Please do an:

mvn clean test

>From the command line.

The Eclipse plugin uses a different version of Scala than does Lift.  There
will be weird errors like the one you've seen.

Thanks,

David

On Mon, Apr 27, 2009 at 2:24 PM, erik.karls...@iki.fi <
erik.b.karls...@gmail.com> wrote:

>
> Weird thing is  that I'm able to mock "MetaTeam":
>
> ---
> trait MetaTeam extends Team with LongKeyedMetaMapper[Team] {
>  def findByUser(user:User): List[Team]
> }
>
> object Team extends MetaTeam {
>  def findByUser(user:User): List[Team] =
>UserTeam.findAll(
>  By(UserTeam.user, user.id),
>  OrderBy(UserTeam.team, Ascending)).map(_.team.obj.open_!)
> }
> ---
>
> - Erik
>
> On Apr 28, 12:19 am, "erik.karls...@iki.fi"
>  wrote:
> > Hi,
> >
> > I have set of specs test and I'm using mockito
> >
> > I noticed that if I have a list of Users (pretty much same class that
> > is coming from archetype) and do following test:
> >
> > users(1).firstName must beEqualTo(name2)
> >
> > Then I get :
> > [WARNING] Exception in thread "main" java.lang.RuntimeException:
> > malformed Scala signature of User at 13798; reference type _5 of
> >  refers to nonexisting symbol.
> >
> > If the line is changed to:
> >
> > (users(1).firstName == name2) must beTrue
> >
> > it compiles really nicely. Based on previous posts here it seams to be
> > that this is scala bug (I use 2.7.4|3)
> >
> > Much bigger problem for me is that when trying to mock the User:
> >
> > var userDbMock = mock[MetaUser]
> >
> > causes the same issue:
> > [WARNING] Exception in thread "main" java.lang.RuntimeException:
> > malformed Scala signature of User at 13798; reference type _5 of
> >  refers to nonexisting symbol.
> >
> > MetaUser is trait:
> >
> > object User extends MetaUser {
> >
> >   override def dbTableName = "users" // define the DB table name
> >   override def screenWrap = Full( > at="content">
> >)
> >   // define the order fields will appear in forms and output
> >   override def fieldOrder = List(id, firstName, lastName, email,
> >   locale, timezone, password, textArea)
> >
> >   // comment this line out to require email validations
> >   override def skipEmailValidation = true
> >
> > }
> >
> > trait MetaUser extends User with MetaMegaProtoUser[User]  {
> >
> > }
> >
> > Have anybody encountered similar problem when mocking or even found a
> > workaround for this case?
> >
> > br,
> > - Erik
> >
> > PS. Weirdest thing is that I'm able to run the test cases in
> > Eclipse...
>
> >
>


-- 
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: malformed Scala signature of User

2009-04-27 Thread erik.karls...@iki.fi

Weird thing is  that I'm able to mock "MetaTeam":

---
trait MetaTeam extends Team with LongKeyedMetaMapper[Team] {
  def findByUser(user:User): List[Team]
}

object Team extends MetaTeam {
  def findByUser(user:User): List[Team] =
UserTeam.findAll(
  By(UserTeam.user, user.id),
  OrderBy(UserTeam.team, Ascending)).map(_.team.obj.open_!)
}
---

- Erik

On Apr 28, 12:19 am, "erik.karls...@iki.fi"
 wrote:
> Hi,
>
> I have set of specs test and I'm using mockito
>
> I noticed that if I have a list of Users (pretty much same class that
> is coming from archetype) and do following test:
>
> users(1).firstName must beEqualTo(name2)
>
> Then I get :
> [WARNING] Exception in thread "main" java.lang.RuntimeException:
> malformed Scala signature of User at 13798; reference type _5 of
>  refers to nonexisting symbol.
>
> If the line is changed to:
>
> (users(1).firstName == name2) must beTrue
>
> it compiles really nicely. Based on previous posts here it seams to be
> that this is scala bug (I use 2.7.4|3)
>
> Much bigger problem for me is that when trying to mock the User:
>
> var userDbMock = mock[MetaUser]
>
> causes the same issue:
> [WARNING] Exception in thread "main" java.lang.RuntimeException:
> malformed Scala signature of User at 13798; reference type _5 of
>  refers to nonexisting symbol.
>
> MetaUser is trait:
>
> object User extends MetaUser {
>
>   override def dbTableName = "users" // define the DB table name
>   override def screenWrap = Full( at="content">
>                                )
>   // define the order fields will appear in forms and output
>   override def fieldOrder = List(id, firstName, lastName, email,
>   locale, timezone, password, textArea)
>
>   // comment this line out to require email validations
>   override def skipEmailValidation = true
>
> }
>
> trait MetaUser extends User with MetaMegaProtoUser[User]  {
>
> }
>
> Have anybody encountered similar problem when mocking or even found a
> workaround for this case?
>
> br,
> - Erik
>
> PS. Weirdest thing is that I'm able to run the test cases in
> Eclipse...

--~--~-~--~~~---~--~~
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] malformed Scala signature of User

2009-04-27 Thread erik.karls...@iki.fi

Hi,

I have set of specs test and I'm using mockito

I noticed that if I have a list of Users (pretty much same class that
is coming from archetype) and do following test:

users(1).firstName must beEqualTo(name2)

Then I get :
[WARNING] Exception in thread "main" java.lang.RuntimeException:
malformed Scala signature of User at 13798; reference type _5 of
 refers to nonexisting symbol.

If the line is changed to:

(users(1).firstName == name2) must beTrue

it compiles really nicely. Based on previous posts here it seams to be
that this is scala bug (I use 2.7.4|3)

Much bigger problem for me is that when trying to mock the User:

var userDbMock = mock[MetaUser]

causes the same issue:
[WARNING] Exception in thread "main" java.lang.RuntimeException:
malformed Scala signature of User at 13798; reference type _5 of
 refers to nonexisting symbol.

MetaUser is trait:

object User extends MetaUser {

  override def dbTableName = "users" // define the DB table name
  override def screenWrap = Full(
   )
  // define the order fields will appear in forms and output
  override def fieldOrder = List(id, firstName, lastName, email,
  locale, timezone, password, textArea)

  // comment this line out to require email validations
  override def skipEmailValidation = true
}

trait MetaUser extends User with MetaMegaProtoUser[User]  {

}

Have anybody encountered similar problem when mocking or even found a
workaround for this case?

br,
- Erik

PS. Weirdest thing is that I'm able to run the test cases in
Eclipse...



--~--~-~--~~~---~--~~
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: StatefulSnippet Beginner

2009-04-27 Thread Derek Chen-Becker
StatefulSnippet example is in now.

On Sat, Apr 18, 2009 at 8:44 PM, Derek Chen-Becker wrote:

> I'll add in an example for StatefulSnippet. We have one already in
> PocketChange, so I just need to copy the code listing in. You should be able
> to mix the two as you see fit.
>
> Derek
>
>
> On Sat, Apr 18, 2009 at 6:58 PM, bradford  wrote:
>
>>
>> Thanks, Derek.  I read the updated PDF version of the book on "The
>> Lift Book" group.  I think it looks good.  I think an example with
>> redirectTo may be better than link.  Also, personally, I'm not sure if
>> I understand StatefulSnippet now.  It doesn't seem like you can mix
>> the two.  I updated my code to no longer use StatefulSnippet and to
>> just use requestVars and the S.redirectTo with state function.  I now
>> use RequestVars to hold my form values for error validation.  I also
>> read these same values on the redirected page to confirm the values
>> back to the user, such as "you searched for 'query'".
>>
>> On Apr 18, 8:41 pm, Derek Chen-Becker  wrote:
>> > OK, I just added some more explanation on passing state between snippets
>> to
>> > section 3.15 in the book. I just uploaded a new PDF. When you have a
>> chance
>> > could you look at it and let me know if that makes sense? Also, I wasn't
>> > sure if this should be a separate section ("Passing Data Between
>> Snippets" ?
>> > ) or not. Thoughts?
>> >
>> > Derek
>> >
>> > On Sat, Apr 18, 2009 at 6:08 PM, Derek Chen-Becker <
>> dchenbec...@gmail.com>wrote:
>> >
>> > > A RequestVar is only "live" for the duration of the request, and a
>> > > redirectTo ends up sending a 307 temp redirect to the browser, which
>> results
>> > > in a new request. S.redirectTo does have an overload that allows you
>> to pass
>> > > a function that will be called when the redirected request is handled.
>> Some
>> > > skeleton code that uses this would look like:
>> >
>> > > ...
>> > > object myVar extends RequestVar[String]("")
>> >
>> > > def mySnippet (...) ... {
>> > >   def processSubmit () {
>> > > ...
>> > > val currentMyVar = myVar.is
>> > > S.redirectTo("/newPage", () => myVar(currentMyVar))
>> > >   }
>> > >   ...
>> > > }
>> >
>> > > Notice that we need to introduce a "capture" val to hold the current
>> value
>> > > so that the closure function can re-set it when the redirect is
>> processed.
>> > > We briefly discuss this in the book, but I'll see about adding a more
>> > > concrete example that discusses the approaches to passing state around
>> > > between snippets.
>> >
>> > > Derek
>> >
>> > > On Sat, Apr 18, 2009 at 3:23 PM, bradford 
>> wrote:
>> >
>> > >> Thanks, Tim.  I worked around that issue.
>> >
>> > >> I would still like to know whether or not it's possible have
>> > >> RequestVars carry over to the redirected page.  I'm attaching a
>> > >> modified demo.  If I use just a var, it will maintain the state.  If
>> I
>> > >> use RequestVar, it won't transfer the state.
>> >
>> > >> Well.. I couldn't find the attach button in Google Groups.  Here's
>> the
>> > >> pasted code:  (a modification of the Test.scala file found here:
>> >
>> > >>
>> http://groups.google.com/group/liftweb/browse_thread/thread/db1e4631a...
>> > >> ).
>> >
>> > >> package com.foo.snippet
>> >
>> > >> import scala.xml.{NodeSeq,Text}
>> >
>> > >> import net.liftweb.http._
>> > >> import net.liftweb.util.Helpers
>> > >> import S._
>> > >> import Helpers._
>> >
>> > >> class TestSnippet extends StatefulSnippet {
>> > >>  val dispatch : DispatchIt = {
>> > >>case "add" => add _
>> > >>case "show" => show _
>> > >>  }
>> >
>> > >>  object name extends RequestVar("empty")
>> >
>> > >>  def add (xhtml : NodeSeq) : NodeSeq = {
>> > >>def doSubmit () = {
>> > >>  println("Name = " + name)
>> > >>  this.redirectTo("/show")
>> > >>}
>> >
>> > >>bind("form", xhtml,
>> > >> "name" -> SHtml.text(name.is, name(_)),
>> > >> "submit" -> SHtml.submit("Add", doSubmit))
>> > >>  }
>> >
>> > >>  def show (xhtml : NodeSeq) : NodeSeq = {
>> > >>bind("display", xhtml, "name" -> Text(name.is))
>> > >>   }
>> > >> }
>> >
>> > >> On Apr 18, 2:18 pm, Timothy Perrett  wrote:
>> > >> > Its talking about Hibernate session, not lift session. Perhaps you
>> have
>> > >> a
>> > >> > detached model or something your trying to work on?
>> >
>> > >> > Cheers, Tim
>> >
>> > >> > On 18/04/2009 19:08, "bradford"  wrote:
>> >
>> > >> > >  no session or session was
>> > >> > > closed
>> >
>> > >> > > I'll look into this some more.
>> >>
>>
>

--~--~-~--~~~---~--~~
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: jpa, emf Model and unit tests

2009-04-27 Thread TSP

Viktor,
It's a valid point, and I would where possible but I've got quite a
lot of uni-directional references (for example, addressable locations
in a city) where using a mapping would entail very large fetches that
are better handled by querying the database. Evans in Domain Driven
Design is very keen on uni-directional references and who am I to
argue :-)
Tim


On Apr 27, 9:10 pm, Viktor Klang  wrote:
> Why don't collection mappings work?
>
> Also, from personal experience, mixing persistence-logic in domain objects
> does make you feel somewhat naughty.
>
>
>
> On Mon, Apr 27, 2009 at 9:15 PM, Tim P  wrote:
>
> > Hi
> > I'm looking for some guidance here and I don't think this is addressed
> > in the book.
>
> > I've got domain classes that need to go get stuff from the database
> > "list all ... " type of methods.
> > So presumably my domain class should have, or be allowed to have
> > methods that access Model
> > But my unit tests need to test these methods. So I need a model which
> > is instantiated within the test environment and so does not need to be
> > extended with RequestVarEM which presumably would be a bad thing
> > (though perhaps it's harmless).
> > Any suggestions on "best practice" to achieve this? (I'm still very
> > much trying to find my way round natural scala constructs)
>
> > Should it be mentioned in the jpa chapter in the book?
>
> > Tim
>
> --
> Viktor Klang
> Senior Systems Analyst
--~--~-~--~~~---~--~~
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: jpa, emf Model and unit tests

2009-04-27 Thread Viktor Klang
Why don't collection mappings work?

Also, from personal experience, mixing persistence-logic in domain objects
does make you feel somewhat naughty.

On Mon, Apr 27, 2009 at 9:15 PM, Tim P  wrote:

>
> Hi
> I'm looking for some guidance here and I don't think this is addressed
> in the book.
>
> I've got domain classes that need to go get stuff from the database
> "list all ... " type of methods.
> So presumably my domain class should have, or be allowed to have
> methods that access Model
> But my unit tests need to test these methods. So I need a model which
> is instantiated within the test environment and so does not need to be
> extended with RequestVarEM which presumably would be a bad thing
> (though perhaps it's harmless).
> Any suggestions on "best practice" to achieve this? (I'm still very
> much trying to find my way round natural scala constructs)
>
> Should it be mentioned in the jpa chapter in the book?
>
> Tim
>
>
>
> >
>


-- 
Viktor Klang
Senior Systems Analyst

--~--~-~--~~~---~--~~
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: Upgrade to 2.7.4 breaks "with-param"?

2009-04-27 Thread David Pollak
Go for it!

On Mon, Apr 27, 2009 at 12:53 PM, marius d.  wrote:

>
> I could implement this soon if you are too busy. Just let me know.
>
> Br's,
> Marius
>
> On Apr 27, 10:37 pm, David Pollak 
> wrote:
> > On Mon, Apr 27, 2009 at 12:33 PM, marius d. 
> wrote:
> >
> > > Good ... well then shouldn't the same rationale be applied for
> > >  since with-param is not really a snippet invocation?
> >
> > > perhaps for lift tags that are not really snippets to use:
> >
> > > 
> > > 
> >
> > Sure... the old tags should be deprecated and print out nasty messages on
> > the console when used.
> >
> >
> >
> >
> >
> > > ?
> >
> > > Br's,
> > > Marius
> >
> > > On Apr 27, 10:08 pm, David Pollak 
> > > wrote:
> > > > On Mon, Apr 27, 2009 at 3:25 AM, marius d. 
> > > wrote:
> >
> > > > > I'm not referring to something similar to lift:bind. Just that
> using
> > > > > snippets or Loc snippets, chooseTemplate etc. gives you the ability
> to
> > > > > to change content depending on what page you are which is
> with-param
> > > > > kind of does.
> >
> > > > > No worries, these are valid question and to me it kind of boils
> down
> > > > > to the style of designing the lift template cause there is quite a
> bit
> > > > > of flexibility provided so things can be done in many ways.
> >
> > > > > So I guess it needs to be determined what would replace 
> > > > > (if it will be replaced).
> >
> > > > The only thing that's being changed is  (which looks
> like a
> > > > snippet invocation) to something like: 
> >
> > > > It's a syntactic change that has no semantic difference.
> >
> > > > > Personally I really don't mind  ... :)
> >
> > > > > Br's,
> > > > > Marius
> >
> > > > > On Apr 27, 1:16 pm, Timothy Perrett 
> wrote:
> > > > > > Can you be specific about which other lift artefacts you want to
> > > replace
> > > > > > lift:bind with? Im not fighting lift:binds corner or anything,
> > > rather,
> > > > > just
> > > > > > interested to know what will supersede it because this kind of
> > > > > functionality
> > > > > > is key in our template strategy.
> >
> > > > > > Cheers, Tim
> >
> > > > > > On 27/04/2009 10:13, "marius d." 
> wrote:
> >
> > > > > > > Right now: bits me ... perhaps Dave has more input. However it
> > > seems
> > > > > > > to me that what we can do with /
> today,
> > > it
> > > > > > > can be easily done without it using the other Lift artifacts.
> Still
> > > > > > > probably people got used with  style and finds this
> > > pretty
> > > > > > > handy?
> >
> > > > > > > Br's,
> > > > > > > Marius
> >
> > > > --
> > > > Lift, the simply functional web frameworkhttp://liftweb.net
> > > > Beginning Scalahttp://www.apress.com/book/view/1430219890
> > > > Follow me:http://twitter.com/dpp
> > > > Git some:http://github.com/dpp
> >
> > --
> > Lift, the simply functional web frameworkhttp://liftweb.net
> > Beginning Scalahttp://www.apress.com/book/view/1430219890
> > Follow me:http://twitter.com/dpp
> > Git some:http://github.com/dpp
> >
>


-- 
Lift, the simply functional web 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: Upgrade to 2.7.4 breaks "with-param"?

2009-04-27 Thread marius d.

I could implement this soon if you are too busy. Just let me know.

Br's,
Marius

On Apr 27, 10:37 pm, David Pollak 
wrote:
> On Mon, Apr 27, 2009 at 12:33 PM, marius d.  wrote:
>
> > Good ... well then shouldn't the same rationale be applied for
> >  since with-param is not really a snippet invocation?
>
> > perhaps for lift tags that are not really snippets to use:
>
> > 
> > 
>
> Sure... the old tags should be deprecated and print out nasty messages on
> the console when used.
>
>
>
>
>
> > ?
>
> > Br's,
> > Marius
>
> > On Apr 27, 10:08 pm, David Pollak 
> > wrote:
> > > On Mon, Apr 27, 2009 at 3:25 AM, marius d. 
> > wrote:
>
> > > > I'm not referring to something similar to lift:bind. Just that using
> > > > snippets or Loc snippets, chooseTemplate etc. gives you the ability to
> > > > to change content depending on what page you are which is with-param
> > > > kind of does.
>
> > > > No worries, these are valid question and to me it kind of boils down
> > > > to the style of designing the lift template cause there is quite a bit
> > > > of flexibility provided so things can be done in many ways.
>
> > > > So I guess it needs to be determined what would replace 
> > > > (if it will be replaced).
>
> > > The only thing that's being changed is  (which looks like a
> > > snippet invocation) to something like: 
>
> > > It's a syntactic change that has no semantic difference.
>
> > > > Personally I really don't mind  ... :)
>
> > > > Br's,
> > > > Marius
>
> > > > On Apr 27, 1:16 pm, Timothy Perrett  wrote:
> > > > > Can you be specific about which other lift artefacts you want to
> > replace
> > > > > lift:bind with? Im not fighting lift:binds corner or anything,
> > rather,
> > > > just
> > > > > interested to know what will supersede it because this kind of
> > > > functionality
> > > > > is key in our template strategy.
>
> > > > > Cheers, Tim
>
> > > > > On 27/04/2009 10:13, "marius d."  wrote:
>
> > > > > > Right now: bits me ... perhaps Dave has more input. However it
> > seems
> > > > > > to me that what we can do with / today,
> > it
> > > > > > can be easily done without it using the other Lift artifacts. Still
> > > > > > probably people got used with  style and finds this
> > pretty
> > > > > > handy?
>
> > > > > > Br's,
> > > > > > Marius
>
> > > --
> > > Lift, the simply functional web frameworkhttp://liftweb.net
> > > Beginning Scalahttp://www.apress.com/book/view/1430219890
> > > Follow me:http://twitter.com/dpp
> > > Git some:http://github.com/dpp
>
> --
> Lift, the simply functional web frameworkhttp://liftweb.net
> Beginning Scalahttp://www.apress.com/book/view/1430219890
> Follow me:http://twitter.com/dpp
> Git some:http://github.com/dpp
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Upgrade to 2.7.4 breaks "with-param"?

2009-04-27 Thread David Pollak
On Mon, Apr 27, 2009 at 12:33 PM, marius d.  wrote:

>
> Good ... well then shouldn't the same rationale be applied for
>  since with-param is not really a snippet invocation?
>
> perhaps for lift tags that are not really snippets to use:
>
> 
> 


Sure... the old tags should be deprecated and print out nasty messages on
the console when used.


>
>
> ?
>
> Br's,
> Marius
>
> On Apr 27, 10:08 pm, David Pollak 
> wrote:
> > On Mon, Apr 27, 2009 at 3:25 AM, marius d. 
> wrote:
> >
> > > I'm not referring to something similar to lift:bind. Just that using
> > > snippets or Loc snippets, chooseTemplate etc. gives you the ability to
> > > to change content depending on what page you are which is with-param
> > > kind of does.
> >
> > > No worries, these are valid question and to me it kind of boils down
> > > to the style of designing the lift template cause there is quite a bit
> > > of flexibility provided so things can be done in many ways.
> >
> > > So I guess it needs to be determined what would replace 
> > > (if it will be replaced).
> >
> > The only thing that's being changed is  (which looks like a
> > snippet invocation) to something like: 
> >
> > It's a syntactic change that has no semantic difference.
> >
> >
> >
> >
> >
> > > Personally I really don't mind  ... :)
> >
> > > Br's,
> > > Marius
> >
> > > On Apr 27, 1:16 pm, Timothy Perrett  wrote:
> > > > Can you be specific about which other lift artefacts you want to
> replace
> > > > lift:bind with? Im not fighting lift:binds corner or anything,
> rather,
> > > just
> > > > interested to know what will supersede it because this kind of
> > > functionality
> > > > is key in our template strategy.
> >
> > > > Cheers, Tim
> >
> > > > On 27/04/2009 10:13, "marius d."  wrote:
> >
> > > > > Right now: bits me ... perhaps Dave has more input. However it
> seems
> > > > > to me that what we can do with / today,
> it
> > > > > can be easily done without it using the other Lift artifacts. Still
> > > > > probably people got used with  style and finds this
> pretty
> > > > > handy?
> >
> > > > > Br's,
> > > > > Marius
> >
> > --
> > 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: Upgrade to 2.7.4 breaks "with-param"?

2009-04-27 Thread marius d.

Good ... well then shouldn't the same rationale be applied for
 since with-param is not really a snippet invocation?

perhaps for lift tags that are not really snippets to use:




?

Br's,
Marius

On Apr 27, 10:08 pm, David Pollak 
wrote:
> On Mon, Apr 27, 2009 at 3:25 AM, marius d.  wrote:
>
> > I'm not referring to something similar to lift:bind. Just that using
> > snippets or Loc snippets, chooseTemplate etc. gives you the ability to
> > to change content depending on what page you are which is with-param
> > kind of does.
>
> > No worries, these are valid question and to me it kind of boils down
> > to the style of designing the lift template cause there is quite a bit
> > of flexibility provided so things can be done in many ways.
>
> > So I guess it needs to be determined what would replace 
> > (if it will be replaced).
>
> The only thing that's being changed is  (which looks like a
> snippet invocation) to something like: 
>
> It's a syntactic change that has no semantic difference.
>
>
>
>
>
> > Personally I really don't mind  ... :)
>
> > Br's,
> > Marius
>
> > On Apr 27, 1:16 pm, Timothy Perrett  wrote:
> > > Can you be specific about which other lift artefacts you want to replace
> > > lift:bind with? Im not fighting lift:binds corner or anything, rather,
> > just
> > > interested to know what will supersede it because this kind of
> > functionality
> > > is key in our template strategy.
>
> > > Cheers, Tim
>
> > > On 27/04/2009 10:13, "marius d."  wrote:
>
> > > > Right now: bits me ... perhaps Dave has more input. However it seems
> > > > to me that what we can do with / today, it
> > > > can be easily done without it using the other Lift artifacts. Still
> > > > probably people got used with  style and finds this pretty
> > > > handy?
>
> > > > Br's,
> > > > Marius
>
> --
> 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] jpa, emf Model and unit tests

2009-04-27 Thread Tim P

Hi
I'm looking for some guidance here and I don't think this is addressed
in the book.

I've got domain classes that need to go get stuff from the database
"list all ... " type of methods.
So presumably my domain class should have, or be allowed to have
methods that access Model
But my unit tests need to test these methods. So I need a model which
is instantiated within the test environment and so does not need to be
extended with RequestVarEM which presumably would be a bad thing
(though perhaps it's harmless).
Any suggestions on "best practice" to achieve this? (I'm still very
much trying to find my way round natural scala constructs)

Should it be mentioned in the jpa chapter in the book?

Tim



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



[Lift] Re: Upgrade to 2.7.4 breaks "with-param"?

2009-04-27 Thread David Pollak
On Mon, Apr 27, 2009 at 3:25 AM, marius d.  wrote:

>
> I'm not referring to something similar to lift:bind. Just that using
> snippets or Loc snippets, chooseTemplate etc. gives you the ability to
> to change content depending on what page you are which is with-param
> kind of does.
>
> No worries, these are valid question and to me it kind of boils down
> to the style of designing the lift template cause there is quite a bit
> of flexibility provided so things can be done in many ways.
>
> So I guess it needs to be determined what would replace 
> (if it will be replaced).
>

The only thing that's being changed is  (which looks like a
snippet invocation) to something like: 

It's a syntactic change that has no semantic difference.


>
> Personally I really don't mind  ... :)
>
> Br's,
> Marius
>
> On Apr 27, 1:16 pm, Timothy Perrett  wrote:
> > Can you be specific about which other lift artefacts you want to replace
> > lift:bind with? Im not fighting lift:binds corner or anything, rather,
> just
> > interested to know what will supersede it because this kind of
> functionality
> > is key in our template strategy.
> >
> > Cheers, Tim
> >
> > On 27/04/2009 10:13, "marius d."  wrote:
> >
> >
> >
> > > Right now: bits me ... perhaps Dave has more input. However it seems
> > > to me that what we can do with / today, it
> > > can be easily done without it using the other Lift artifacts. Still
> > > probably people got used with  style and finds this pretty
> > > handy?
> >
> > > Br's,
> > > Marius
> >
>


-- 
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: Getting started: No XML output, docs and basic restful CRUD (on GAE)

2009-04-27 Thread David Pollak
On Mon, Apr 27, 2009 at 7:53 AM, Tom  wrote:

>
> Hello List,
>
> I just started with Scala and Lift. Installation was pretty straight
> forward (I only had to fight with Debian SIDs Java .. it needed
> OpenJDK instead of what is provided as default. Maven threw exceptions
> with gnuJava)
> So far I read one book about Scala and I looked at a few howtos on the
> lift website.
> Looking at all the things Maven2 downloaded nearly scared me a little,
> but it seems to be very powerful, so it might be nice.
> I played around with a few examples and I am trying to get text only
> output. I deleted the template and removed nearly everything from the
> index.html, but I still get the XML header in the output. I just want
> my own text.


Any of the .html templates are processed by Lift's standard XHTML render
pipeline.  This pipeline renders XHTML.  While there are options for setting
the XML headers, etc., this mechanism is primarily for creating XHTML pages
for the browser to consume.

If you want to render XML, JSON, etc., you need to create a custom
dispatcher.  You can see an example result at:

http://demo.liftweb.net/webservices/all_users

You can look through the Lift source in sites/example.  Start in Boot.scala
and work from there.

I'm currently working on revising this code, so give it a day or two and
you'll see cleaner examples rather than code that's 2 1/2 years old. :-)


>
>
> I guess I have to replace surround in  with something
> else. But where do I find the docs for those options?
>
> My goal is to have basic restful CRUD operations on GAE. But what I
> could really use is a small piece of code for the get, put, delete and
> post messages(preferably with database connection.)
> The way I learn new languages and frameworks is to embrace and extent
> a piece of code that very roughly does what I want (very
> Microsoftish).
> So maybe someone has done ROR like CRUD on GAE and is willing to share
> his code?
> (Or maybe restful CRUD is not the way I should use Lift .. As I said I
> am still very new to functional programming and Scala+Lift.)


You'll find pattern matching is a much easier way to route URLs because you
have the full power of the language at your disposal, but a nice declarative
syntax:

LiftRules.dispatch.append(NamedPF("Web Services Example") {
case Req("webservices" :: "all_users" :: Nil, _, GetRequest) =>
  () => Full(all_users())

This intercepts the /webservices/all_users GET request and has it serviced
by the all_users() method.

Thanks,

David


>
>
> Thanks!
>
> >
>


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

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



[Lift] Re: Feedback on screen cast, please

2009-04-27 Thread Meredith Gregory
David,

Your screencast is very well done. There is one small change i would make to
add a layer regarding the management of complexity. Make a change to the
app: a small but noticeable change, like reorder the messages newest to
oldest with a timestamp, or something. It would be ideal if somewhere in
your modification you commit an error that is subsequently caught by typing.
These two basic points dovetail nicely into a crucial point that Bill
Venner's makes in his JavaOne presentation: types don't prove your program
correct; types prove changes to your program correct. i think you could
increase the bang-for-buck by a factor of 2 while only adding 15 - 20 secs
to the time.

Best wishes,

--greg

On Fri, Apr 24, 2009 at 8:50 AM, David Pollak  wrote:

> Folks,
>
> I did a draft of a screencast for a real-time chat app.  It's at
> http://tunaforcats.com/LiftScreenCast.avi
>
> I'd like to get some critical feedback on it so I can improve it.
>
> Thanks,
>
> David
>
> PS -- What's the best output format?  AVI, QuickTime, Flash?
>
> --
> 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
>
> >
>


-- 
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: Feedback on screen cast, please

2009-04-27 Thread Timothy Perrett

I usually upload quicktime and let blip do the flash conversion...
using QT as source means you can subscribe via itunes I do belive.

Cheers, Tim

On Apr 27, 8:34 am, Alexander Kellett  wrote:
> jfyi, it seems its not possible to download the movie via the
> "subscribe with itunes" link, maybe if you upload a mp4 version of the
> content it would? i'm certain i'm not the only one that much prefers
> to watch on a portable device / while offline.
>
> 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: How to set different response in lift

2009-04-27 Thread David Pollak
The enclosed example demonstrates how to use the Lift rendering mechanism to
generate an XML file based on a Lift template and send it back to the
browser.

Look at the lib.PageChunkServer.scala file to see how it's done.

Thanks,

David

On Mon, Apr 27, 2009 at 2:57 AM, pravin  wrote:

>
> Hi guys,
>
> i want send xml response to request
> when i click on button i should get xml file as response in browser .
> How can i do that in lift?
>
> Thanks in advanced.
>
> >
>


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



pageomatic.tgz
Description: GNU Zip compressed data


[Lift] Re: How to set different response in lift

2009-04-27 Thread marius d.

BTW ... I'm not sure why you'd prefer an XML response back instead of
JSON or JavaScript ... but it's up to you.

Br's,
Marius

On Apr 27, 8:13 pm, "marius d."  wrote:
> Of course ...  You can use:
>
> 1. DispatchPf functions and return an XmlResponse
> 2. Try this:
>
>   def ajaxButton(text: NodeSeq, func: () => NodeSeq, attrs: (String,
> String)*): Elem = {
>     attrs.foldLeft(fmapFunc(NFuncHolder(func))(name =>
>          +"=true")).toJsCmd+
>                          "; return false;"}>{text}))(_ % _)
>   }
>
> When processing Ajax requests lift automatically recognizes, JsCmd,
> NodeSeq, JsCommands, LiftResponse. So Instead of func: () => NodeSeq
> you could also say func: () => LiftResponse and have your function to
> return an XmlResponse. But NodeSeq seems easier to me.
>
> Br's,
> Marius
>
> On Apr 27, 12:57 pm, pravin  wrote:
>
> > Hi guys,
>
> > i want send xml response to request
> > when i click on button i should get xml file as response in browser .
> > How can i do that in lift?
>
> > Thanks in advanced.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: How to set different response in lift

2009-04-27 Thread marius d.

Of course ...  You can use:

1. DispatchPf functions and return an XmlResponse
2. Try this:

  def ajaxButton(text: NodeSeq, func: () => NodeSeq, attrs: (String,
String)*): Elem = {
attrs.foldLeft(fmapFunc(NFuncHolder(func))(name =>
{text}))(_ % _)
  }

When processing Ajax requests lift automatically recognizes, JsCmd,
NodeSeq, JsCommands, LiftResponse. So Instead of func: () => NodeSeq
you could also say func: () => LiftResponse and have your function to
return an XmlResponse. But NodeSeq seems easier to me.


Br's,
Marius

On Apr 27, 12:57 pm, pravin  wrote:
> Hi guys,
>
> i want send xml response to request
> when i click on button i should get xml file as response in browser .
> How can i do that in lift?
>
> Thanks in advanced.
--~--~-~--~~~---~--~~
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: from where can i get lifts sample examples

2009-04-27 Thread Timothy Perrett


Check out these:

http://is.gd/uTbj

Cheers, Tim

On 27/04/2009 13:32, "pravin"  wrote:

> 
> Hi guys,
> 
> i want sample examples of lift
> from where i will get these sample examples?
> 
> 
> 
> > 
> 



--~--~-~--~~~---~--~~
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] Getting started: No XML output, docs and basic restful CRUD (on GAE)

2009-04-27 Thread Tom

Hello List,

I just started with Scala and Lift. Installation was pretty straight
forward (I only had to fight with Debian SIDs Java .. it needed
OpenJDK instead of what is provided as default. Maven threw exceptions
with gnuJava)
So far I read one book about Scala and I looked at a few howtos on the
lift website.
Looking at all the things Maven2 downloaded nearly scared me a little,
but it seems to be very powerful, so it might be nice.
I played around with a few examples and I am trying to get text only
output. I deleted the template and removed nearly everything from the
index.html, but I still get the XML header in the output. I just want
my own text.

I guess I have to replace surround in  with something
else. But where do I find the docs for those options?

My goal is to have basic restful CRUD operations on GAE. But what I
could really use is a small piece of code for the get, put, delete and
post messages(preferably with database connection.)
The way I learn new languages and frameworks is to embrace and extent
a piece of code that very roughly does what I want (very
Microsoftish).
So maybe someone has done ROR like CRUD on GAE and is willing to share
his code?
(Or maybe restful CRUD is not the way I should use Lift .. As I said I
am still very new to functional programming and Scala+Lift.)

Thanks!

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



[Lift] from where can i get lifts sample examples

2009-04-27 Thread pravin

Hi guys,

i want sample examples of lift
from where i will get these sample examples?



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



[Lift] How to set different response in lift

2009-04-27 Thread pravin

Hi guys,

i want send xml response to request
when i click on button i should get xml file as response in browser .
How can i do that in lift?

Thanks in advanced.

--~--~-~--~~~---~--~~
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: Feedback on screen cast, please

2009-04-27 Thread James Strachan

Great stuff!

The only thing I can think of that could be improved is maybe
mentioning the JavaRebel stuff; when seeing Rails demos, there's no
stop-start-wait-30 seconds type stuff while maven does its thing -
maybe in the next screen cast the JavaRebel stuff could be shown so
that the same rails-ish RADness is possible.

2009/4/25 David Pollak :
> I've posted it at blip.tv:
>
> http://liftweb.blip.tv
>
> It seems to have good audio synchronization.
>
> On Sat, Apr 25, 2009 at 6:04 AM, Derek Chen-Becker 
> wrote:
>>
>> Hmmm. VLC on Linux worked fine viewing it for me.
>>
>> Derek
>>
>> On Fri, Apr 24, 2009 at 11:11 PM, Warren Henning
>>  wrote:
>>>
>>> On Fri, Apr 24, 2009 at 8:50 AM, David Pollak
>>>  wrote:
>>> > I'd like to get some critical feedback on it so I can improve it.
>>>
>>> I'm short on criticism - this was really cool.
>>>
>>> You might want to comment on how much compile time there is when
>>> you're rapidly updating a Lift application so people don't think you
>>> spend half your development time waiting for the computer or
>>> something.
>>>
>>> I'd like to note that for some reason when I opened the machine on my
>>> default media viewer, the video didn't work right although audio was
>>> fine - VLC 0.8.6e, Windows XP SP2. Opening in QuickTime worked fine
>>> though.
>>>
>>> Warren
>>>
>>>
>>
>>
>>
>
>
>
> --
> 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
>
> >
>



-- 
James
---
http://macstrac.blogspot.com/

Open Source Integration
http://fusesource.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: Object typecast to Mapper

2009-04-27 Thread Amit Kumar Verma

Hi All,

Thanks again, for support. Made many things more clear.

Thanks
Amit Kumar Verma

On Apr 22, 1:35 am, David Pollak 
wrote:
> Amit,
> Class.forName(...) is called reflection in Scala/Java land.  It allows you
> to get a class based on a String.  You can then create a new instance of the
> class with the newInstance() method.  However, what you get is an instance
> of Object... and you have to case it into something else before using it.
>
> In Java, there's only one way to cast things:
>
> Object o = someClass.newInstance();
> FooBar fb = (FooBar) o;
>
> In Scala, there are two ways to cast (one is safer and less verbose, the
> other is intentionally more verbose):
>
> val a: AnyRef = someClass.newInstance
> val fb: FooBar = a.asInstanceOf[FooBar]
>
> or (the radically better way)
> a match {
>   case fb: FooBar => ...
>   case _ => ...
>
> }
>
> Hope this helps.
>
> Thanks,
>
> David
>
> On Mon, Apr 20, 2009 at 4:41 AM, Amit Kumar Verma wrote:
>
>
>
>
>
> > Hi All,
>
> > This is a sample function for making an object from string at run
> > time. Here we are not casting the object but creating one. I wanted
> > the same thing for casting the object.
>
> > public static Object bindObject(Class className) {
> >        Object objOutput = null;
> >        try {
> >            String sClassName = className.getPackage().getName().concat
> > (".Wrap".concat(className.getSimpleName()));
> >            objOutput = Class.forName(sClassName.replaceFirst
> > ("com.vtech", "com.vtech.appxtension")).newInstance();
> >        } catch (Exception e) {
> >            try {
> >                objOutput = Class.forName(className.getName
> > ()).newInstance();
> >            } catch (Exception e1) {
> >                e1.printStackTrace();
> >            }
> >        }
>
> >        return objOutput;
> >    }
>
> > Thanks to all for kind support..
> > Amit Kumar Verma
>
> > On Apr 18, 8:51 pm, Timothy Perrett  wrote:
> > > So your talking about reflection right? Take a look at scala Manifests
> > > (which aide getting round type erasure) - other than that scala supports
> > all
> > > the normal reflection tooling that Java does.
>
> > > Tim
>
> > > On 18/04/2009 06:56, "Amit Kumar Verma"  wrote:
>
> > > > "Scala is a static language, so the class for casting must be known at
> > > > compile time.  It's not possible to construct a String at runtime and
> > > > cast
> > > > an object into a class represented by that String. "
>
> > > > But we use this feature in Java for casting the objects.
>
> --
> 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: Upgrade to 2.7.4 breaks "with-param"?

2009-04-27 Thread marius d.

I'm not referring to something similar to lift:bind. Just that using
snippets or Loc snippets, chooseTemplate etc. gives you the ability to
to change content depending on what page you are which is with-param
kind of does.

No worries, these are valid question and to me it kind of boils down
to the style of designing the lift template cause there is quite a bit
of flexibility provided so things can be done in many ways.

So I guess it needs to be determined what would replace 
(if it will be replaced).

Personally I really don't mind  ... :)

Br's,
Marius

On Apr 27, 1:16 pm, Timothy Perrett  wrote:
> Can you be specific about which other lift artefacts you want to replace
> lift:bind with? Im not fighting lift:binds corner or anything, rather, just
> interested to know what will supersede it because this kind of functionality
> is key in our template strategy.
>
> Cheers, Tim
>
> On 27/04/2009 10:13, "marius d."  wrote:
>
>
>
> > Right now: bits me ... perhaps Dave has more input. However it seems
> > to me that what we can do with / today, it
> > can be easily done without it using the other Lift artifacts. Still
> > probably people got used with  style and finds this pretty
> > handy?
>
> > Br's,
> > Marius
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Upgrade to 2.7.4 breaks "with-param"?

2009-04-27 Thread Timothy Perrett


Can you be specific about which other lift artefacts you want to replace
lift:bind with? Im not fighting lift:binds corner or anything, rather, just
interested to know what will supersede it because this kind of functionality
is key in our template strategy.

Cheers, Tim

On 27/04/2009 10:13, "marius d."  wrote:

> 
> Right now: bits me ... perhaps Dave has more input. However it seems
> to me that what we can do with / today, it
> can be easily done without it using the other Lift artifacts. Still
> probably people got used with  style and finds this pretty
> handy?
> 
> Br's,
> Marius



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



[Lift] Re: Upgrade to 2.7.4 breaks "with-param"?

2009-04-27 Thread marius d.

Right now: bits me ... perhaps Dave has more input. However it seems
to me that what we can do with / today, it
can be easily done without it using the other Lift artifacts. Still
probably people got used with  style and finds this pretty
handy?

Br's,
Marius

On Apr 27, 11:23 am, Timothy Perrett  wrote:
> Ah right, so your thinking that lift:bind will go, and be replaced with
> something similar that uses our existing snippet infrastructure?
>
> Cheers, Tim
>
> On 27/04/2009 07:28, "marius d."  wrote:
>
> > BTW ... there were previous discussions that for 1.1 we'll deprecate
> > lift:bind, right? ... if so with-param would also be deprecated ... or
> > am I missing something?
>
> > Br's,
> > Marius
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Upgrade to 2.7.4 breaks "with-param"?

2009-04-27 Thread Timothy Perrett


Ah right, so your thinking that lift:bind will go, and be replaced with
something similar that uses our existing snippet infrastructure?

Cheers, Tim

On 27/04/2009 07:28, "marius d."  wrote:

> BTW ... there were previous discussions that for 1.1 we'll deprecate
> lift:bind, right? ... if so with-param would also be deprecated ... or
> am I missing something?
> 
> Br's,
> Marius



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



[Lift] Re: Feedback on screen cast, please

2009-04-27 Thread Alexander Kellett

jfyi, it seems its not possible to download the movie via the
"subscribe with itunes" link, maybe if you upload a mp4 version of the
content it would? i'm certain i'm not the only one that much prefers
to watch on a portable device / while offline.

Alex

On Sat, Apr 25, 2009 at 3:10 PM, David Pollak
 wrote:
> I've posted it at blip.tv:
>
> http://liftweb.blip.tv
>
> It seems to have good audio synchronization.
>
> On Sat, Apr 25, 2009 at 6:04 AM, Derek Chen-Becker 
> wrote:
>>
>> Hmmm. VLC on Linux worked fine viewing it for me.
>>
>> Derek
>>
>> On Fri, Apr 24, 2009 at 11:11 PM, Warren Henning
>>  wrote:
>>>
>>> On Fri, Apr 24, 2009 at 8:50 AM, David Pollak
>>>  wrote:
>>> > I'd like to get some critical feedback on it so I can improve it.
>>>
>>> I'm short on criticism - this was really cool.
>>>
>>> You might want to comment on how much compile time there is when
>>> you're rapidly updating a Lift application so people don't think you
>>> spend half your development time waiting for the computer or
>>> something.
>>>
>>> I'd like to note that for some reason when I opened the machine on my
>>> default media viewer, the video didn't work right although audio was
>>> fine - VLC 0.8.6e, Windows XP SP2. Opening in QuickTime worked fine
>>> though.
>>>
>>> Warren
>>>
>>>
>>
>>
>>
>
>
>
> --
> 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
-~--~~~~--~~--~--~---