[Lift] Re: [Lift committers] Re: Meeting

2009-04-17 Thread Jonas Bonér

2009/4/16 David Pollak feeder.of.the.be...@gmail.com:
 Taking the discussion to the main list

 On Thu, Apr 16, 2009 at 10:23 AM, Jonas Bonér jo...@jonasboner.com wrote:

 2009/4/16 David Pollak feeder.of.the.be...@gmail.com:
 
 
  On Thu, Apr 16, 2009 at 7:08 AM, Jonas Bonér jo...@jonasboner.com
  wrote:
 
  2009/4/16 David Pollak feeder.of.the.be...@gmail.com:
   It'd be optimal if you could discuss the JTA stuff in the public
   forum.
    In
   terms of AOP, I'm really not kidding that AOP is not going to happen
   in
   Lift.
 
  You don't like annotations? E.g. @Transactional etc.?
 
  I'm not keen on annotations, but I can live with them.
 
  I am firmly against anything that re-writes byte-code after the
  compilation
  phase for production code.  Once the Scala-Maven plugin supports
  compiler
  plugins, then there's a lot of stuff that can be done at compile-time.

 The AOP stuff I have done is based on dynamic proxies no bytecode munging.

 OKay... I need to see some example to fully understand why a proxy needs AOP
 rather than either (1) compile-time proxy generation or (2) the built-in
 Java reflect proxy thingy.

You can impl AOP using many different techniques. I proposed the
simplest one (used by Spring, Guice etc.). Using a regular JDK Dynamic
Proxy (which is the 'build in Java reflect proxy thingy'). What is
your question?

 
  So, what does AOP give us that can't be done at another phase?

AOP is not about a specific phase. It can be done at:
* compile time
* class load time
* runtime

Can be done with:
* Bytecode mods
* Generated proxy
* Dynamic proxy
* JVM-level hooks

 

 Semantics to annotations.

 Can you help out with an example?

Annotate a class with f.e.
@transactional(type=Required)  class Foo { ..}
and have all methods in this class being invoked under a transaction
with Required semantics

or annotate a specific method
@transactional(type=RequiresNew)  def foo { ..}
to get the same behavior for a method only

Annotations is the way most JEE devs are used to handle these things
since it is the approach both Spring, Guice, EJB 3 etc. etc. has
taken.

The stuff I have written allow using AspectJ pointcuts as well.
E.g. f.e. apply transactions to all methods in the service layer:
match('* com.biz.service.*(..)')

Or to a specific method:
match('void Store.buy(Item)')

But you could just use call-by-name:

transactional(TransactionType.Required) { // tx begin
  .. // do stuff in TX
}  // tx commit or rollback

But that pollutes the code, makes it harder to change, configure and
is not declarative.
Perhaps give the user options?

But you guys choose.
I am here to serve :-)

/Jonas


 Thanks,

 David



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

 




-- 
Jonas Bonér | Crisp AB

http://jonasboner.com
http://crisp.se

--~--~-~--~~~---~--~~
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-17 Thread Amit Kumar Verma

Hi David,

thanks, this is working fine. Problem is resolved.

But dynamic binding is feature of java then why Scala don't support
this.
This is an important feature.

Thanks again
Amit Kumar Verma

On Apr 13, 10:10 pm, David Pollak feeder.of.the.be...@gmail.com
wrote:
 I think it's best to use the built-in JSON creation code and keep the code
 as JsCmd as long as possible.

 Here's a snippet that will place the JSON for all the Users in the page.
 I'm including the whole project as well:

 class HelloWorld {
   def json: NodeSeq = Script(jsonForAll(User))

   private def jsonForAll[T : Mapper[T]](meta: MetaMapper[T]): JsCmd =
   JsArray(meta.findAll.map(_.asJs) :_*)

 }

 If you have further questions, please update the project and mark the places
 in the code where you have a question and we'll work from there.

 Thanks,

 David

 On Mon, Apr 13, 2009 at 2:07 AM, Amit Kumar Verma cdac.a...@gmail.comwrote:





  Hi David,

  Thanks for ur replies, I just want to make a generic function which
  will take an object of mapper and returns the json string of the same.

  I have written only two function
  1. This will be called by ajax call :

     def getJSONString(xhtml: Group):NodeSeq = {
        getJSONStringGeneric(TestGearLogin)  // here 'TestGearLogin' is
  a mapper object
     }

  2. function to make JSON string i.e

  def getJSONStringGeneric(anyObject :Any):NodeSeq = {

        var sJSONString = {\bindings\: [;

       anyObject match {
            case mm: MetaMapper[_] =  // this line is giving error
             mm.findAll.map(userdetails = {

               var tempJSON = ;

               val ret = new StringBuilder

               ret.append({)
               ret.append(userdetails.getSingleton.appendFieldToStrings
  (userdetails))
               ret.append(})

                tempJSON = ret.toString();

               // some manipulation for making correct JSON
                tempJSON = tempJSON.replaceAll(\\{,\\{\);
               tempJSON = tempJSON.replaceAll(\\},\\\});
               tempJSON = tempJSON.replaceAll(=,\:\);
               tempJSON = tempJSON.replaceAll(, , \,\);
               tempJSON += ,;

               sJSONString +=tempJSON
           });
       }

       sJSONString = sJSONString.substring(0,sJSONString.length-1); //
  for slicing the last comma
       sJSONString += ]};

       Text(sJSONString);
   }

  I changed the code as you suggested but getting the error as I posted.
  Please advise.

  Thanks
  Amit Kumar Verma

  On Apr 10, 9:46 pm, David Pollak feeder.of.the.be...@gmail.com
  wrote:
   I think the .asJs method on all Mapper instances should give you the
  object
   in JavaScript representation.
   If you can post an entire file, I can work on helping you if the above
   doesn't work.

   On Thu, Apr 9, 2009 at 6:53 AM, Amit Kumar Verma cdac.a...@gmail.com
  wrote:

copied the the same code but getting this error

type arguments [_] do not conform to trait MetaMapper's type parameter
bounds [A : net.liftweb.mapper.Mapper[A]]
 TravelMerchantTest/src/main/
scala/com/vtech/travelmerchant/snippet  default.scala   line 142
1239284830763   85593

Actually I am trying to make the JSON object using a mapper object. My
function is this :

def getJSONStringGeneric(anyObject :Any):NodeSeq = {

     //Console.println(anyObject.getClass 
+anyObject.getClass);

     //Console.println(anyObject.getClass.getName 
+anyObject.getClass.getName);

     //var objTemp = anyObject.asInstanceOf[MetaMapper
[TestGearLogin]];

     var sJSONString = {\bindings\: [;

     anyObject match {
          case mm: MetaMapper[_] =
           mm.findAll.map(
                    (userdetails: Mapper[_]) ={

             var tempJSON = ;

             val ret = new StringBuilder

             ret.append({)

             ret.append(userdetails.getSingleton.appendFieldToStrings
(userdetails))

             ret.append(})

             // ret will be like
{username=222,password=222,audit_dt=2009-04-06
00:00:00.0,login_pid=26}

             tempJSON = ret.toString();

             tempJSON = tempJSON.replaceAll(\\{,\\{\);
             tempJSON = tempJSON.replaceAll(\\},\\\});
             tempJSON = tempJSON.replaceAll(=,\:\);
             tempJSON = tempJSON.replaceAll(, , \,\);
             tempJSON += ,;

             sJSONString +=tempJSON
                   }
                   )
     }

     sJSONString = sJSONString.substring(0,sJSONString.length-1); //
for slicing the last comma
     sJSONString += ]};

     Text(sJSONString);
 }

but not getting a way of doing this. Please advise.

Thanks
Amit Kumar Verma

On Apr 9, 6:14 pm, David Pollak feeder.of.the.be...@gmail.com wrote:
 Howdy,
 Scala is a static language, so the class for casting must be known at
 compile time.  

[Lift] Road Map of Lift

2009-04-17 Thread Amit Kumar Verma

Hi David,

We are using the lift-scala framework for our development and thinking
about it even more seriously. Can you please give some information on
Roadmap of development of Lift framework. It will be more useful if it
will give a brief description on areas on which framework is working
on.


Thanks
Amit Kumar Verma

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



[Lift] Re: Liftweb without Maven?

2009-04-17 Thread Jeppe Madsen
On Fri, Apr 17, 2009 at 10:21 AM, Alexander Kellett lypa...@gmail.comwrote:


 hey sean,

 i hope you're open to other possibilities than buildr/raven :)
 i myself have no real interest in messing with maven after my terrible
 experiences from when i was working on java code full time..
 i just verified that it takes just a few minutes to install sbt and
 get a running lift app :)
 you can find the things needed in Marks Harrah's reply to this thread
 and sbt can be found at http://code.google.com/p/simple-build-tool/


I'm also not very keen on using maven for my builds but I think it's
fine as a black box tool for generating artifacts.

Recently, we've moved all our Ant builds to Gradle which has been a
(mostly) pleasant experience. It has dependency management (and can
use maven repos) but you use a Groovy DSL to specify your build.

There's a patch to make Gradle work with scala apps (haven'tried it),
but I was wondering if anybody has used it for Scala or even Lift?

/Jeppe

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



[Lift] Re: Liftweb without Maven?

2009-04-17 Thread Mark Harrah

Well, maybe the archetype code could be generalized and go into sbt.  We can 
continue discussing that on the sbt mailing list if you are interested.  The 
remaining part is just dependency declarations for the hello-lift example.

Thanks,
Mark


On Thursday 16 April 2009, Alexander Kellett wrote:
 excellent, thanks for finishing this off mark! is it possible this
 might get into a later sbt release or does this belong somewhere in
 the lift source tree?

 thank you!
 Alex

 On Thu, Apr 16, 2009 at 7:11 PM, Mark Harrah dmhar...@gmail.com wrote:
  Hi,
 
  Thanks for putting effort into this.  The inline dependency
  declarations replace the pom.xml, so it isn't needed.  You can also
  declare the archetype as a dependency and extract and process it.  I
  have attached a project definition that does not require downloading
  the zip manually or processing with sed (it does require sbt, of
  course).
 
  Put it in 'project/build/src' directory in your new project directory.
  Then do: $ sbt
  bootstrap
  jetty-run
 
  (fill in the name and other info when prompted)
 
  Thanks again,
  -Mark
 
  On 4/16/09, Alexander Kellett lypa...@gmail.com wrote:
  attached a replacement for the sbt script provided, with inline
  comments for getting it to work. barely tested and trivial. not yet
  verified that this works without a preexisting maven install. will
  automate more at weekend.
 
  will look into getting the blocking-on-page-load modification into
  sbt/lift somehow also given that it has its own continuous compile
  system.
 
  On Thu, Apr 16, 2009 at 3:57 PM, David Pollak
 
  feeder.of.the.be...@gmail.com wrote:
  On Wed, Apr 15, 2009 at 9:37 AM, Alexander Kellett lypa...@gmail.com
 
  wrote:
  On Wed, Apr 15, 2009 at 5:26 PM, David Pollak
 
  feeder.of.the.be...@gmail.com wrote:
   While we are a community that welcomes newbies and tries to work
   with as
   many different people and with as many different styles as possible,
   there
   are things that we've collectively learned.  We've found that Maven
   is preferable for our style of development.  If you want to use Ant,
   there's
   nothing stopping you and we'd welcome some Ant scripts for building
   Lift,
   but we're not going to stop what we're doing and write one for you
   just because you demand that we do so.  Please go back and write the
   Ant scripts
   yourself and contribute to the community rather than being rude to
   us because we don't do things the way you want.  That will
   demonstrate that
   you
   are willing to contribute in rather than demand and insult when your
   demands
   are not met.
 
  many people are scared by maven. myself included after my previous
  fun with getting lift working.
 
  is there a way to get a self contained hello world zip up on github
  if it is not already there? afaiu maven also allows for local caches,
  could that that be placed in the zip, or is it simply too big?
 
  i think that might scare people much less than pasting the very opaque
  four liner which asks questions i do not know the answer to :)
 
  I am all in favor of an Ant build script or an SBT-based build script.
  Both
  would be great contributions.  I do not have time for them, but anyone
  out there who has skills with Ant and/or SBT, I'll buy you a beer or
  two if you
  spend a couple of hours putting together examples.
 
  My rant is against the attitude that somehow the Lift community should
  instantly change its priorities because one person has a different
  perspective on things.  We are not waiters in a restaurant.  We are not
  serving peoples whims.  We are a collaborative community.  Anybody who
  treats the folks in this community as wait-staff fundamentally
  misunderstands the ethos of the Lift community.
 
  The Lift community is a place that I like being because almost
  everybody is
  willing to roll up their sleeves and help.  Marius, Derek, Tyler,
  Charles, Jorge, Tim, etc. roll up their sleeves and help all comers.
   Each of these guys can be making more money and/or spending time with
  their friends and family rather than helping newbies, but when they
  came to the community, they were newbies and I helped them and they
  have perpetuated that spirit. Newbies help us by asking questions, by
  learning Lift, by making suggestions, by contributing code, and
  ultimately by helping other newbies.
  We welcome different perspectives, but we do not welcome insulting
  attitudes.
  Had the conversation gone more along the lines of any chance you'll
  change
  your priorities to support Ant? Not for 1.1, but perhaps you can
  help. I
  can write Ant Scripts, but I need some guidance about the
  dependencies... The poster would have gotten what he wanted and the
  whole Lift community would have benefited.
 
  So, yes, I am in favor of lots of different build options.  Are
  committers,
  we have limited time and will officially support Maven.  If someone
  else comes along and demonstrates Ant, SBT, etc. 

[Lift] Re: Road Map of Lift

2009-04-17 Thread TylerWeir

1.1 thread:
http://groups.google.com/group/liftweb/browse_thread/thread/aca84784b81a6a2c/5539edffc1c874d1?lnk=gstq=1.1#5539edffc1c874d1

On Apr 17, 5:27 am, Amit Kumar Verma cdac.a...@gmail.com wrote:
 Hi David,

 We are using the lift-scala framework for our development and thinking
 about it even more seriously. Can you please give some information on
 Roadmap of development of Lift framework. It will be more useful if it
 will give a brief description on areas on which framework is working
 on.

 Thanks
 Amit Kumar Verma
--~--~-~--~~~---~--~~
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: Road Map of Lift

2009-04-17 Thread David Pollak
On Fri, Apr 17, 2009 at 6:05 AM, Timothy Perrett timo...@getintheloop.euwrote:



 Just in addition to this - Lift is very community driven, if there is
 something you really believe should make it into Lift core then we'll
 gladly
 listen to people's input and discuss it openly.


That's exactly right.  We strive to be as transparent as possible with Lift
development.  Tyler pointed you to the 1.1 thread.

We respond to community need as well as the needs that we each have for the
projects that we're working on.

I place a priority on features (and defects) related to public and/or
reference Lift implementations.  I place a very very high priority on fixing
defects for production Lift sites.

Are there features or needs that you have for your project?




 Cheers, Tim

 On 17/04/2009 13:48, TylerWeir tyler.w...@gmail.com wrote:

 
  1.1 thread:
 
 http://groups.google.com/group/liftweb/browse_thread/thread/aca84784b81a6a2c/5
  539edffc1c874d1?lnk=gstq=1.1#5539edffc1c874d1
 
  On Apr 17, 5:27 am, Amit Kumar Verma cdac.a...@gmail.com wrote:
  Hi David,
 
  We are using the lift-scala framework for our development and thinking
  about it even more seriously. Can you please give some information on
  Roadmap of development of Lift framework. It will be more useful if it
  will give a brief description on areas on which framework is working
  on.
 
  Thanks
  Amit Kumar Verma
  
 



 



-- 
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: Object typecast to Mapper

2009-04-17 Thread David Pollak
On Fri, Apr 17, 2009 at 2:00 AM, Amit Kumar Verma cdac.a...@gmail.comwrote:


 Hi David,

 thanks, this is working fine. Problem is resolved.

 But dynamic binding is feature of java then why Scala don't support
 this.


I'm sorry, I don't understand what dynamic binding is.  Scala supports
casting just like Java.



 This is an important feature.

 Thanks again
 Amit Kumar Verma

 On Apr 13, 10:10 pm, David Pollak feeder.of.the.be...@gmail.com
 wrote:
  I think it's best to use the built-in JSON creation code and keep the
 code
  as JsCmd as long as possible.
 
  Here's a snippet that will place the JSON for all the Users in the page.
  I'm including the whole project as well:
 
  class HelloWorld {
def json: NodeSeq = Script(jsonForAll(User))
 
private def jsonForAll[T : Mapper[T]](meta: MetaMapper[T]): JsCmd =
JsArray(meta.findAll.map(_.asJs) :_*)
 
  }
 
  If you have further questions, please update the project and mark the
 places
  in the code where you have a question and we'll work from there.
 
  Thanks,
 
  David
 
  On Mon, Apr 13, 2009 at 2:07 AM, Amit Kumar Verma cdac.a...@gmail.com
 wrote:
 
 
 
 
 
   Hi David,
 
   Thanks for ur replies, I just want to make a generic function which
   will take an object of mapper and returns the json string of the same.
 
   I have written only two function
   1. This will be called by ajax call :
 
  def getJSONString(xhtml: Group):NodeSeq = {
 getJSONStringGeneric(TestGearLogin)  // here 'TestGearLogin' is
   a mapper object
  }
 
   2. function to make JSON string i.e
 
   def getJSONStringGeneric(anyObject :Any):NodeSeq = {
 
 var sJSONString = {\bindings\: [;
 
anyObject match {
 case mm: MetaMapper[_] =  // this line is giving error
  mm.findAll.map(userdetails = {
 
var tempJSON = ;
 
val ret = new StringBuilder
 
ret.append({)
ret.append(userdetails.getSingleton.appendFieldToStrings
   (userdetails))
ret.append(})
 
 tempJSON = ret.toString();
 
// some manipulation for making correct JSON
 tempJSON = tempJSON.replaceAll(\\{,\\{\);
tempJSON = tempJSON.replaceAll(\\},\\\});
tempJSON = tempJSON.replaceAll(=,\:\);
tempJSON = tempJSON.replaceAll(, , \,\);
tempJSON += ,;
 
sJSONString +=tempJSON
});
}
 
sJSONString = sJSONString.substring(0,sJSONString.length-1); //
   for slicing the last comma
sJSONString += ]};
 
Text(sJSONString);
}
 
   I changed the code as you suggested but getting the error as I posted.
   Please advise.
 
   Thanks
   Amit Kumar Verma
 
   On Apr 10, 9:46 pm, David Pollak feeder.of.the.be...@gmail.com
   wrote:
I think the .asJs method on all Mapper instances should give you the
   object
in JavaScript representation.
If you can post an entire file, I can work on helping you if the
 above
doesn't work.
 
On Thu, Apr 9, 2009 at 6:53 AM, Amit Kumar Verma 
 cdac.a...@gmail.com
   wrote:
 
 copied the the same code but getting this error
 
 type arguments [_] do not conform to trait MetaMapper's type
 parameter
 bounds [A : net.liftweb.mapper.Mapper[A]]
  TravelMerchantTest/src/main/
 scala/com/vtech/travelmerchant/snippet  default.scala   line 142
 1239284830763   85593
 
 Actually I am trying to make the JSON object using a mapper object.
 My
 function is this :
 
 def getJSONStringGeneric(anyObject :Any):NodeSeq = {
 
  //Console.println(anyObject.getClass 
 +anyObject.getClass);
 
  //Console.println(anyObject.getClass.getName 
 +anyObject.getClass.getName);
 
  //var objTemp = anyObject.asInstanceOf[MetaMapper
 [TestGearLogin]];
 
  var sJSONString = {\bindings\: [;
 
  anyObject match {
   case mm: MetaMapper[_] =
mm.findAll.map(
 (userdetails: Mapper[_]) ={
 
  var tempJSON = ;
 
  val ret = new StringBuilder
 
  ret.append({)
 

  ret.append(userdetails.getSingleton.appendFieldToStrings
 (userdetails))
 
  ret.append(})
 
  // ret will be like
 {username=222,password=222,audit_dt=2009-04-06
 00:00:00.0,login_pid=26}
 
  tempJSON = ret.toString();
 
  tempJSON = tempJSON.replaceAll(\\{,\\{\);
  tempJSON = tempJSON.replaceAll(\\},\\\});
  tempJSON = tempJSON.replaceAll(=,\:\);
  tempJSON = tempJSON.replaceAll(, , \,\);
  tempJSON += ,;
 
  sJSONString +=tempJSON
}
)
  }
 
  sJSONString = sJSONString.substring(0,sJSONString.length-1);
 //
 for slicing the last 

[Lift] How do you debug snippet code

2009-04-17 Thread glenn

Are there any debugging tools or techniques for stepping through
snippet code? I would be interested in hearing from anyone on this
subject.

Glenn Silverman

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



[Lift] Re: [Lift committers] Re: Meeting

2009-04-17 Thread Lee Mighdoll
I'm currently giving AOP a try
herehttp://github.com/mighdoll/aspecting/tree/master(not in lift).
I was looking for a cleaner way to create objects with
observable properties.  I like that an aspect allows for observable objects
that are idiomatic to use and write, and don't require any extra
boilerplate.


The scala class needs only to add the marker trait Observable.

  class Model extends Observable {
var prop:String = _
  }

Modifications to the instance will then trigger the aspect, notifying
an observer.

val model = new Model()
m.prop = whee

Run that and the test observer sees the change and prints:

change observed example.mo...@6abf2d5e= prop:whee


I'm getting more tempted to use aspectJ because it enables such a
simple and idiomatic
approach to writing model objects that are:
* Concise to write
* Use the normal idioms for working with mutable scala objects.
* Compatible with java libraries, including JPA...


The sources are in src.

To try it yourself, use this script which runs mvn.
./tryMe









On Fri, Apr 17, 2009 at 4:26 AM, Josh Suereth joshua.suer...@gmail.comwrote:



 You can impl AOP using many different techniques. I proposed the
 simplest one (used by Spring, Guice etc.). Using a regular JDK Dynamic
 Proxy (which is the 'build in Java reflect proxy thingy'). What is
 your question?

  
   So, what does AOP give us that can't be done at another phase?

 AOP is not about a specific phase. It can be done at:
 * compile time
 * class load time
 * runtime

 Can be done with:
 * Bytecode mods
 * Generated proxy
 * Dynamic proxy
 * JVM-level hooks

  
 
  Semantics to annotations.
 
  Can you help out with an example?

 Annotate a class with f.e.
 @transactional(type=Required)  class Foo { ..}
 and have all methods in this class being invoked under a transaction
 with Required semantics

 or annotate a specific method
 @transactional(type=RequiresNew)  def foo { ..}
 to get the same behavior for a method only

 Annotations is the way most JEE devs are used to handle these things
 since it is the approach both Spring, Guice, EJB 3 etc. etc. has
 taken.



 I use this all the time in java, because there is no other good option
 for transactions in java.  It's basically the best method.  However I don't
 believe this is the case in Scala, and I'd rather think through the options
 and determine the best one.




 The stuff I have written allow using AspectJ pointcuts as well.
 E.g. f.e. apply transactions to all methods in the service layer:
 match('* com.biz.service.*(..)')

 Or to a specific method:
 match('void Store.buy(Item)')



 Point-cuts after-the fact seem a decent use of transactions.  This is under
 the following assumptions:

 1) Your code will be used in more than one configuration type
 2) Your transaction granularity is determined by the configuration of your
 module, not by the module itself.

 Regarding 2, I think all-to-often real world problems begin to break this
 assumption, making internal business logic and external transaction
 configuration dependent on each other.



 But you could just use call-by-name:

 transactional(TransactionType.Required) { // tx begin
  .. // do stuff in TX
 }  // tx commit or rollback

 But that pollutes the code, makes it harder to change, configure and
 is not declarative.
 Perhaps give the user options?


 How is it not declarative?  I agree that Aspects really do give you better
 configuration abilities for code, however I'm not sure transactions are
 ideally suited for AOP.  I think Java is not ideally suited for
 transactional code, so we use AOP.




 I'd love to hear your response!  This is something I've been mulling
 through recently, and I'm still on the fence for Transactions should be
 done using AOP on the JVM

 -Josh


 


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



[Lift] Re: [Lift committers] Re: Meeting

2009-04-17 Thread David Pollak
Lee,

The reason that Lift has the richer MappedField and Field objects in Mapper
and Record is to programmatically add this kind of functionality to fields.
No, it's not PoJos, but it's as syntactically clean and a lot easier to
understand/debug.

Thanks,

David

On Fri, Apr 17, 2009 at 9:47 AM, Lee Mighdoll leemighd...@gmail.com wrote:

 I'm currently giving AOP a try 
 herehttp://github.com/mighdoll/aspecting/tree/master(not in lift).   I was 
 looking for a cleaner way to create objects with
 observable properties.  I like that an aspect allows for observable objects
 that are idiomatic to use and write, and don't require any extra
 boilerplate.


 The scala class needs only to add the marker trait Observable.

   class Model extends Observable {
 var prop:String = _
   }

 Modifications to the instance will then trigger the aspect, notifying an 
 observer.

 val model = new Model()
 m.prop = whee

 Run that and the test observer sees the change and prints:

 change observed example.mo...@6abf2d5e= prop:whee


 I'm getting more tempted to use aspectJ because it enables such a simple and 
 idiomatic

 approach to writing model objects that are:
 * Concise to write
 * Use the normal idioms for working with mutable scala objects.
 * Compatible with java libraries, including JPA...


 The sources are in src.

 To try it yourself, use this script which runs mvn.
 ./tryMe









 On Fri, Apr 17, 2009 at 4:26 AM, Josh Suereth joshua.suer...@gmail.comwrote:



 You can impl AOP using many different techniques. I proposed the
 simplest one (used by Spring, Guice etc.). Using a regular JDK Dynamic
 Proxy (which is the 'build in Java reflect proxy thingy'). What is
 your question?

  
   So, what does AOP give us that can't be done at another phase?

 AOP is not about a specific phase. It can be done at:
 * compile time
 * class load time
 * runtime

 Can be done with:
 * Bytecode mods
 * Generated proxy
 * Dynamic proxy
 * JVM-level hooks

  
 
  Semantics to annotations.
 
  Can you help out with an example?

 Annotate a class with f.e.
 @transactional(type=Required)  class Foo { ..}
 and have all methods in this class being invoked under a transaction
 with Required semantics

 or annotate a specific method
 @transactional(type=RequiresNew)  def foo { ..}
 to get the same behavior for a method only

 Annotations is the way most JEE devs are used to handle these things
 since it is the approach both Spring, Guice, EJB 3 etc. etc. has
 taken.



 I use this all the time in java, because there is no other good option
 for transactions in java.  It's basically the best method.  However I don't
 believe this is the case in Scala, and I'd rather think through the options
 and determine the best one.




 The stuff I have written allow using AspectJ pointcuts as well.
 E.g. f.e. apply transactions to all methods in the service layer:
 match('* com.biz.service.*(..)')

 Or to a specific method:
 match('void Store.buy(Item)')



 Point-cuts after-the fact seem a decent use of transactions.  This is
 under the following assumptions:

 1) Your code will be used in more than one configuration type
 2) Your transaction granularity is determined by the configuration of your
 module, not by the module itself.

 Regarding 2, I think all-to-often real world problems begin to break this
 assumption, making internal business logic and external transaction
 configuration dependent on each other.



 But you could just use call-by-name:

 transactional(TransactionType.Required) { // tx begin
  .. // do stuff in TX
 }  // tx commit or rollback

 But that pollutes the code, makes it harder to change, configure and
 is not declarative.
 Perhaps give the user options?


 How is it not declarative?  I agree that Aspects really do give you better
 configuration abilities for code, however I'm not sure transactions are
 ideally suited for AOP.  I think Java is not ideally suited for
 transactional code, so we use AOP.




 I'd love to hear your response!  This is something I've been mulling
 through recently, and I'm still on the fence for Transactions should be
 done using AOP on the JVM

 -Josh





 



-- 
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] getting mvn jetty:run to reload changes to snippets

2009-04-17 Thread James Strachan

Hello Lifters!

BTW apologies in advance if this is an obvious newbie question - I did
a fair bit of searching on the list and saw JavaRebel discussions etc.

I've been taking my first baby steps with Scala/Lift (this Scala/Lift
malarkey is starting to grow on me) so I followed the getting started
guide. My first surprise (after using Rails/JSP etc) was hitting
reload on a browser after changing a snippet doesn't reload the
snippet code - you've gotta stop/restart mvn jetty:run. (Though
changing the template does).

I just wondered if someone had figured out the ninja to get the
jetty:run plugin to auto-detect snippet changes? This could well be a
tooling issue (e.g. when using eclipse with its incremental compiling
generating new class files might solve the problem) - I'm using IDEA
currently.

I did wonder if we could come up with a way to configure the jetty:run
plugin to do the right thing though irrespective of your IDE; using
the scala incremental compiler maybe? I tried adding a jetty custom
scan target to the pom...

  plugin
groupIdorg.mortbay.jetty/groupId
artifactIdmaven-jetty-plugin/artifactId
configuration
  contextPath//contextPath
  scanIntervalSeconds1/scanIntervalSeconds
  scanTargetPatterns
scanTargetPattern
  directorysrc/main/scala/directory
  includes
include**/*.scala/include
  /includes
/scanTargetPattern
  /scanTargetPatterns
/configuration
  /plugin

which forces a restart fine - but it doesn't know to recompile the
Scala code. So I'm wondering if we setup the scala compiler to auto
build the code to a classes directory that the jetty plugin can then
auto-detect and restart the web app?

I just wondered if others had hit this issue  come up with an elegant
solution; to force incremental compilation of the Scala class files -
or maybe I should just switch to eclipse?

-- 
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: getting mvn jetty:run to reload changes to snippets

2009-04-17 Thread Heiko Seeberger
Switch to the one and only great IDE: Eclipse ;-)But be sure to use the
latest Scala IDE for Eclipse (2.7.4 RC1 or later).
Then you will have lots of fun!

2009/4/17 James Strachan james.strac...@gmail.com


 Hello Lifters!

 BTW apologies in advance if this is an obvious newbie question - I did
 a fair bit of searching on the list and saw JavaRebel discussions etc.

 I've been taking my first baby steps with Scala/Lift (this Scala/Lift
 malarkey is starting to grow on me) so I followed the getting started
 guide. My first surprise (after using Rails/JSP etc) was hitting
 reload on a browser after changing a snippet doesn't reload the
 snippet code - you've gotta stop/restart mvn jetty:run. (Though
 changing the template does).

 I just wondered if someone had figured out the ninja to get the
 jetty:run plugin to auto-detect snippet changes? This could well be a
 tooling issue (e.g. when using eclipse with its incremental compiling
 generating new class files might solve the problem) - I'm using IDEA
 currently.

 I did wonder if we could come up with a way to configure the jetty:run
 plugin to do the right thing though irrespective of your IDE; using
 the scala incremental compiler maybe? I tried adding a jetty custom
 scan target to the pom...

  plugin
groupIdorg.mortbay.jetty/groupId
artifactIdmaven-jetty-plugin/artifactId
configuration
  contextPath//contextPath
  scanIntervalSeconds1/scanIntervalSeconds
  scanTargetPatterns
scanTargetPattern
  directorysrc/main/scala/directory
  includes
include**/*.scala/include
  /includes
/scanTargetPattern
  /scanTargetPatterns
/configuration
  /plugin

 which forces a restart fine - but it doesn't know to recompile the
 Scala code. So I'm wondering if we setup the scala compiler to auto
 build the code to a classes directory that the jetty plugin can then
 auto-detect and restart the web app?

 I just wondered if others had hit this issue  come up with an elegant
 solution; to force incremental compilation of the Scala class files -
 or maybe I should just switch to eclipse?

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

 Open Source Integration
 http://fusesource.com/

 



-- 
Heiko Seeberger
www.heikoseeberger.name
OSGi on Scala

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



[Lift] Re: Lift works on Google App Engine (within the confines of what's possible)

2009-04-17 Thread David Pollak
On Fri, Apr 17, 2009 at 4:20 PM, Timothy Perrett timo...@getintheloop.euwrote:


  I just can't for the life of me figure out why anyone would want to put a
  Java/Scala app on GAE.

 The answer to this my good fellow, is simple: Marketing.


D'oh!  I'm such a dolt... I missed that one.




 Cheers, Tim
 



-- 
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: Lift works on Google App Engine (within the confines of what's possible)

2009-04-17 Thread Josh Suereth
On Fri, Apr 17, 2009 at 5:57 PM, David Pollak feeder.of.the.be...@gmail.com
 wrote:

 Folks,

 I've just committed a version of Lift (including the Lift Example) that
 runs on the Google App Engine.  You can see the running demo at:
 http://liftdemo.appspot.com/

 What's missing:

- Mapper and Mapper-related stuff.  You can use JPA.
- Comet.  GAE's lack of thread or message queue support is a huge
limitation.
- Actor-based session-shutdown notification is disabled on GAE.
- There's no session affinity guarantee, so there may be problems with
migrating sessions (I'll be working with the Google folks on this issue)

 Okay... so you can build apps on GAE... I have to wonder... who would want
 to?

 GAE gives you a highly scalable platform to build CRUD apps.  Without a
 back-end messaging infrastructure, long running processes, threads,
 inter-session messaging, etc. there's not much in the way of exciting apps
 to build.  Here are a list of apps that could not be built with GAE:

- Twitter (requires a message bus and back-ground processing)
- Facebook (has many of Twitter's requirements)
- GoogleTalk
- A travel site (the 30 second request duration means that looking
stuff up on a back end service is not possible)
- A multi-player game


MySQL Game http://mysqlgame.appspot.com/ is actually pretty good
multiplayer game on GAE.  Here's the description if you never played:
---

Are you tired of browser-based games that are thinly veiled interfaces for
databases? Finally, there's a game that just *is* a database!

THRILL as you insert your very own row in the rows table!

With careful selection of SQL queries, you will soon have three or even
four-digit numbers in some of the fields in your row! Other queries may
allow you to use those numbers to subtract from rows entered by other
players -- all while pushing the numbers in your own row even higher!
As you master the game, you may find that you have inserted not just one row
into the game, but several!
---

Anyway, I wouldn't discount GAE.  It's certainly not as cool as lift's comet
support, but perhaps in the future you can make that happen.  It does appear
to have different goals than lift, but again, perhaps in the future they
will be more aligned.

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

2009-04-17 Thread bradford

I'm trying to play around with the StatefulSnippets and can't get it
to hold state.  This is what I have for a test:

class Products {
  object productVar extends RequestVar(new Product())
  def selectedProduct = productVar.is

  def search(xhtml: Group): NodeSeq = {
var query = ;

def processSearch() = {
  // hard code id for now
  val product = Model.createNamedQuery[Product](findProductById,
(id - 1L)).getSingleResult()
  Log.info(processSearch:   + product.id.toString) // prints 1
  productVar(product)
  Log.info(post processSearch:   + product.id.toString) //
prints 1

  S.redirectTo(select.html)
}

val plAttrs = List((size, 40), (maxlength, 80), (style,
width: 98%))
bind(f, xhtml,
 query - SHtml.text(query, query = _),
 submit - SHtml.submit(Search, processSearch)
)
  }

  def selectedQuery(xhtml: NodeSeq): NodeSeq = {
Log.info(selectedProduct:   + selectedProduct.id.toString) //
HELP!:  prints 0
Text(selectedProduct.name(en_US) match { case Some(a) = a.name
case None = No Product Found})
  }
}

--~--~-~--~~~---~--~~
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-17 Thread bradford

I guess it would help to mention that lift:Products.search / is on
index.html and lift:Products.selectedQuery / is on select.html.

On Apr 17, 9:45 pm, bradford fingerm...@gmail.com wrote:
 I'm trying to play around with the StatefulSnippets and can't get it
 to hold state.  This is what I have for a test:

 class Products {
   object productVar extends RequestVar(new Product())
   def selectedProduct = productVar.is

   def search(xhtml: Group): NodeSeq = {
     var query = ;

     def processSearch() = {
       // hard code id for now
       val product = Model.createNamedQuery[Product](findProductById,
 (id - 1L)).getSingleResult()
       Log.info(processSearch:   + product.id.toString) // prints 1
       productVar(product)
       Log.info(post processSearch:   + product.id.toString) //
 prints 1

       S.redirectTo(select.html)
     }

     val plAttrs = List((size, 40), (maxlength, 80), (style,
 width: 98%))
     bind(f, xhtml,
          query - SHtml.text(query, query = _),
          submit - SHtml.submit(Search, processSearch)
     )
   }

   def selectedQuery(xhtml: NodeSeq): NodeSeq = {
     Log.info(selectedProduct:   + selectedProduct.id.toString) //
 HELP!:  prints 0
     Text(selectedProduct.name(en_US) match { case Some(a) = a.name
 case None = No Product Found})
   }

 }
--~--~-~--~~~---~--~~
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: Welcome Atsuhiko Yamanaka to the Lift Committers

2009-04-17 Thread marius d.

Welcome,welcome,welcome !

On Apr 18, 1:42 am, David Pollak feeder.of.the.be...@gmail.com
wrote:
 Folks,

 I am pleased at announce that Atsuhiko Yamanaka has joined the Lift
 committers.  He did some great Google App Engine work with Lift and has been
 making other enhancements to the Lift code base.  Now he can roll his
 changes in at will.

 Welcome Yamanaka-san.

 Thanks,

 David

 --
 Lift, the simply functional web frameworkhttp://liftweb.net
 Beginning Scalahttp://www.apress.com/book/view/1430219890
 Follow me:http://twitter.com/dpp
 Git some:http://github.com/dpp
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Lift works on Google App Engine (within the confines of what's possible)

2009-04-17 Thread marius d.

I'm very skeptic and reluctant to GAE right now with all due respect
for Google.I'm used to quite large apps requiring a high degree of
control, DB close to the app and tunings for the app, dedicated HW,
etc. Yeah I know Google promises lots of these things I just can't see
how they can provide HW  control for potentially millions of
applications deployed ... regardless how much money they have.

Might be good though for trivial small web sites where people just
wants to see it online ...

Br's,
Marius

On Apr 18, 12:57 am, David Pollak feeder.of.the.be...@gmail.com
wrote:
 Folks,

 I've just committed a version of Lift (including the Lift Example) that runs
 on the Google App Engine.  You can see the running demo 
 at:http://liftdemo.appspot.com/

 What's missing:

    - Mapper and Mapper-related stuff.  You can use JPA.
    - Comet.  GAE's lack of thread or message queue support is a huge
    limitation.
    - Actor-based session-shutdown notification is disabled on GAE.
    - There's no session affinity guarantee, so there may be problems with
    migrating sessions (I'll be working with the Google folks on this issue)

 Okay... so you can build apps on GAE... I have to wonder... who would want
 to?

 GAE gives you a highly scalable platform to build CRUD apps.  Without a
 back-end messaging infrastructure, long running processes, threads,
 inter-session messaging, etc. there's not much in the way of exciting apps
 to build.  Here are a list of apps that could not be built with GAE:

    - Twitter (requires a message bus and back-ground processing)
    - Facebook (has many of Twitter's requirements)
    - GoogleTalk
    - A travel site (the 30 second request duration means that looking stuff
    up on a back end service is not possible)
    - A multi-player game

 So... on a $100/mo box from CalPop, I can run a service that will scale to
 20M requests per day.  If I'm doing 20M requests per day, I've got a
 business where I want more control over my infrastructure than GAE gives
 me.  That might be Amazon EC2 where I can power-up and down boxes at will.
 There are also a number of different scalable storage solutions on Amazon.
 I just can't for the life of me figure out why anyone would want to put a
 Java/Scala app on GAE.

 Thanks,

 David

 --
 Lift, the simply functional web frameworkhttp://liftweb.net
 Beginning Scalahttp://www.apress.com/book/view/1430219890
 Follow me:http://twitter.com/dpp
 Git some:http://github.com/dpp
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---