[Lift] Re: Change and New Features

2008-10-01 Thread Charles F. Munat

Wow. That's a lot of work. Nice job.

Chas.

David Pollak wrote:
 Folks,
 
 I've moved the JavaScript for Comet and Ajax to separately loaded JS 
 files rather than putting them on the page.
 
 LiftRules.autoIncludeComet allows you to determine if the Comet stuff 
 will be automatically included
 LiftRules.autoIncludeAjax allows you to determine if the Ajax stuff will 
 be auto-included
 
 LiftRules.renderCometScript and LiftRules.renderAjaxScript render the 
 contents of the Script files
 
 LiftRules.renderCometPageContents renders the page-specific stuff for 
 Comet (the GUIDs and versions)
 
 LiftRules.ajaxScriptUpdateTime and LiftRules.cometScriptUpdateTime are 
 used to calculate if a new script is needed or if you can return a 304
 
 Using the above features, one can use all, some, or none of Lift's Ajax 
 and Comet stuff.
 
 On RequestState, I've added a bunch of tests:
 isIE, isIE6, isIE7, isIE8, isSafari, isSafari2, isSafari3, isIPhone, 
 isFirefox, isFirefox2, isFirefox3, isOpera, isOpera9
 
 Thanks,
 
 David
 
 
 -- 
 Lift, the simply functional web framework http://liftweb.net
 Collaborative Task Management http://much4.us
 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Caching JPA entities and JPA vs Hibernate

2008-10-01 Thread Martin Ellis

On Tue, Sep 30, 2008 at 11:54 PM, Tim Perrett [EMAIL PROTECTED] wrote:

 Having an issue with ehcache.xml being picked up. The docs say that it
 need to be on the classpath - I've tried having it in META-INF, WEB-
 INF/classes/META-INF but yet nothing seems to work. It never gets
 picked up...?

 Where can i stick it so that its forced to be read?

IIRC, it needs to be at the top of the classpath, not under META-INF.

Martin

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Change and New Features

2008-10-01 Thread Derek Chen-Becker
Dude, when are you not working? :) Seriously, though, very cool.

Derek

On Tue, Sep 30, 2008 at 5:50 PM, David Pollak [EMAIL PROTECTED]
 wrote:

 Folks,

 I've moved the JavaScript for Comet and Ajax to separately loaded JS files
 rather than putting them on the page.

 LiftRules.autoIncludeComet allows you to determine if the Comet stuff will
 be automatically included
 LiftRules.autoIncludeAjax allows you to determine if the Ajax stuff will be
 auto-included

 LiftRules.renderCometScript and LiftRules.renderAjaxScript render the
 contents of the Script files

 LiftRules.renderCometPageContents renders the page-specific stuff for Comet
 (the GUIDs and versions)

 LiftRules.ajaxScriptUpdateTime and LiftRules.cometScriptUpdateTime are used
 to calculate if a new script is needed or if you can return a 304

 Using the above features, one can use all, some, or none of Lift's Ajax and
 Comet stuff.

 On RequestState, I've added a bunch of tests:
 isIE, isIE6, isIE7, isIE8, isSafari, isSafari2, isSafari3, isIPhone,
 isFirefox, isFirefox2, isFirefox3, isOpera, isOpera9

 Thanks,

 David


 --
 Lift, the simply functional web framework http://liftweb.net
 Collaborative Task Management http://much4.us
 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Suggestion for JPA Tutorial

2008-10-01 Thread Derek Chen-Becker
One more note regarding transactions with JPA: The actual DB changes aren't
made until the current transaction completes. Because of this, in my current
code I actually aggressively close the transaction so that I can catch
things like constraint violations. If you wait until the session ends to
close the transaction (via cleanup) then you won't be able to handle cases
like this. I have a helper method on my Model class that lets me run a
method inside its own transaction and handle any JPA-related exceptions. I'm
going to put it into the JPA tutorial, but here it is for now:

  /**
   This method allows me to clean up my code a bit and only handle
JPA-related exceptions.
   An example usage would be:

   def addFood(newFood : Food) =
 wrapEM({
   Model.persist(newFood)
   S.redirectTo(/food/list)
 }, {
   case cve : ConstraintViolationException = S.error(That food already
exists!)
   case _ = S.error(Internal error adding food)
 })

   Note that if I used normal try/catch then the wildcard match would trap
the RedirectException
   thrown by S.redirectTo.
  */
  def wrapEM(f : = Unit) : Unit = wrapEM(f, { case _ = /* nop */ })
  def wrapEM[A](f : = A, handler : PartialFunction[Throwable, A]) : A = {
try {
  val tx = getEM.getTransaction()

  if (! tx.isActive() ) { tx.begin() }
  try {
val ret : A = f
ret
  } catch {
case he : HibernateException = {
  this.error(Hibernate error, he)
  handler(he)
}
case pe : PersistenceException = {
  this.error(EM Error, pe)
  handler(pe)
}
case sqle : java.sql.SQLException = {
  this.error(SQL Exception, sqle)
  handler(sqle)
}
  } finally {
// make sure that we commit even with a redirectexception
if (tx.isActive()  ! tx.getRollbackOnly()) {
  tx.commit()
} else if (tx.getRollbackOnly()) {
  tx.rollback()
}
  }
} catch {
  // Special case. Usually we want to know why it failed to commit, not
just that it failed
  case re : RollbackException = {
val (cause,message) = if (re.getCause() == null) {
  (re,No cause)
} else {
  (re.getCause(), re.getCause().getMessage())
}
this.error(EM Commit error: {}, message)
this.error(Full trace, re)
handler(cause)
  }
}
  }



On Tue, Sep 30, 2008 at 5:25 PM, Derek Chen-Becker [EMAIL PROTECTED]wrote:

 I may have some time tomorrow to get it working. My initial goal is
 actually to get JNDI and JTA working in Jetty so that we have a dev
 environment that matches the production env.

 Derek


 On Tue, Sep 30, 2008 at 5:01 PM, Tim Perrett [EMAIL PROTECTED] wrote:


 Awesome - I personally would be very interested to hear how you got on
 wtih hibernate proper.

 Perhaps you can bosh up a quick sample ;-)

 Cheers Kris

 Tim

 On Sep 30, 11:14 pm, Kris Nuttycombe [EMAIL PROTECTED]
 wrote:
  Yup, Hibernate  JTA on Glassfish, also with EJB remoting.

 



--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: HTTP Client?

2008-10-01 Thread Tim Perrett

Yea i'll probably make it the constructor - seems a bit more logical.

My plan is to implement IPN, then roll up the IPN and PDT stuff into a
maven module and release it

Cheers
Tim

On Oct 1, 5:45 pm, jon [EMAIL PROTECTED] wrote:
 Is there a way to set the authToken in the instance rather than
 globally?

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: HTTP Client?

2008-10-01 Thread jon

Is there a way to set the authToken in the instance rather than
globally?

On Sep 23, 12:29 pm, Tim Perrett [EMAIL PROTECTED] wrote:
 Hey guys,

 Ok, i've abstracted it all out into a class which you call a little
 like this:

     var paypal: PayPal = new PayPal(sandbox)
     paypal.transactionToken = S.param(tx).openOr()
     paypal.execute(pdt)

 And as your authentication token is global to your account, you can
 specify it by doing:

     PayPal.authenticationToken = dfgdfgdfgdfgdfgdfgd

 which I palced in boot. So far i've only implemented PDT, but have
 allowed for implementing IPN too - which should be a minimal amount of
 work ontop of what i already have.

 Thoughts?

 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Who wants to write Oracle, SQL Server, and MaxDB drivers for Lift?

2008-10-01 Thread jfbaro

Hi David,

I am not sure I am up to the task, but I´d love to help, mainly if I
could get some help from you about how to make it right.

If you are interested, please let me know.

Cheers

On Sep 26, 2:51 pm, David Pollak [EMAIL PROTECTED] wrote:
 Copying and pasting the below and fixing stuff:

     object MySqlDriver extends DriverType(MySQL) {
       def binaryColumnType = MEDIUMBLOB
       def clobColumnType = LONGTEXT
       def booleanColumnType = BOOLEAN
       def dateTimeColumnType = DATETIME
       def integerColumnType = INTEGER
       def integerIndexColumnType = INTEGER NOT NULL AUTO_INCREMENT UNIQUE
       def enumColumnType = BIGINT
       def longForeignKeyColumnType = BIGINT UNSIGNED
       def longIndexColumnType = BIGINT UNSIGNED NOT NULL AUTO_INCREMENT
     UNIQUE KEY
       def enumListColumnType = BIGINT
       def longColumnType = BIGINT
       def doubleColumnType = DOUBLE

       override def createTablePostpend: String =  ENGINE = InnoDB 
     }

 Writing some tests.



 Warren Henning wrote:
  On Fri, Sep 26, 2008 at 10:30 AM, David Pollak
  [EMAIL PROTECTED] wrote:

  Anyone?

  What's involved in writing a new driver?- Hide quoted text -

 - Show quoted text -

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: JPA and enumerations

2008-10-01 Thread Derek Chen-Becker
Hmmm. Oliver, I'm working on using the UserType you wrote now, but when I
try to test it, I'm getting this error:

org.hibernate.MappingException: Cannot instantiate custom type:
com.foo.jpaweb.model.EnumvType

At first I thought this was because EnumvType was abstract, but changing
that didn't do anything. I've set the property on the Book class as:

  @Type{val `type` = com.foo.jpaweb.model.EnumvType}
  var genre = Genre.unknown

Is the not correct? Any ideas? I've only ever used Hibernate Types that were
written in Java, so I wasn't sure if that might also be an issue...

Derek

On Mon, Sep 22, 2008 at 8:29 AM, Derek Chen-Becker [EMAIL PROTECTED]wrote:

 Looks good. In keeping with the theme of a Library catalog I'm going to
 rework Gender as Genre and add things like Mystery, Horror, Comedy,
 Childrens' , etc. I think I can just put the Money on as a purchase price.

 Thanks,

 Derek

 On Sun, Sep 21, 2008 at 1:19 AM, Oliver Lambert [EMAIL PROTECTED] wrote:

 Hi,

 I've extended the JPA Demo project to include hibernate mappings for
 Money and Enumerations.
 The example money is Australian, but its simple enough to add other
 currencies.
 The example enumeration is for Gender - I've mapped the name of the
 enumeration rather than
 the ordinal value and extended it to include a description field,
 valueOf method and list of name value pairs.

 Hope its of use
 Oliver

 




 On 21/09/2008, at 1:40 PM, Jorge Ortiz wrote:

 
  On Sat, Sep 20, 2008 at 9:14 AM, Oliver Lambert [EMAIL PROTECTED]
  wrote:
 
  I need this too so I might have a go at implementing it. Does lift
  persist
  enumerations (cant see a mapper it)
 
  There's a MappedEnum class in MappedInt.scala

 Thanks for this - I should have looked more
 
 
  --j
 
  --~--~-~--~~~---~--~~
  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
 [EMAIL PROTECTED][EMAIL PROTECTED]
  For more options, visit this group at
 http://groups.google.com/group/liftweb?hl=en
  -~--~~~~--~~--~--~---
 





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



[Lift] Re: JPA and enumerations

2008-10-01 Thread Oliver
You have to extend it - I did it at the top of the model, but it probably
makes sense to create a separate file(s).
So Gender would have a corresponding type
class GenderType extends EnumvType(Gender) {}

and then you can use
  @Type{val `type`=com.foo.jpaweb.model.GenderType}

I hadn't coded a user type in Scala before either and I couldn't find a way
to generically do all enumerations as one user type - Scala is just too
strict.

hope that helps

Oliver

On Thu, Oct 2, 2008 at 6:58 AM, Derek Chen-Becker [EMAIL PROTECTED]wrote:

 Hmmm. Oliver, I'm working on using the UserType you wrote now, but when I
 try to test it, I'm getting this error:

 org.hibernate.MappingException: Cannot instantiate custom type:
 com.foo.jpaweb.model.EnumvType

 At first I thought this was because EnumvType was abstract, but changing
 that didn't do anything. I've set the property on the Book class as:

   @Type{val `type` = com.foo.jpaweb.model.EnumvType}
   var genre = Genre.unknown

 Is the not correct? Any ideas? I've only ever used Hibernate Types that
 were written in Java, so I wasn't sure if that might also be an issue...

 Derek


 On Mon, Sep 22, 2008 at 8:29 AM, Derek Chen-Becker [EMAIL PROTECTED]wrote:

 Looks good. In keeping with the theme of a Library catalog I'm going to
 rework Gender as Genre and add things like Mystery, Horror, Comedy,
 Childrens' , etc. I think I can just put the Money on as a purchase price.

 Thanks,

 Derek

 On Sun, Sep 21, 2008 at 1:19 AM, Oliver Lambert [EMAIL PROTECTED] wrote:

 Hi,

 I've extended the JPA Demo project to include hibernate mappings for
 Money and Enumerations.
 The example money is Australian, but its simple enough to add other
 currencies.
 The example enumeration is for Gender - I've mapped the name of the
 enumeration rather than
 the ordinal value and extended it to include a description field,
 valueOf method and list of name value pairs.

 Hope its of use
 Oliver






 On 21/09/2008, at 1:40 PM, Jorge Ortiz wrote:

 
  On Sat, Sep 20, 2008 at 9:14 AM, Oliver Lambert [EMAIL PROTECTED]
  wrote:
 
  I need this too so I might have a go at implementing it. Does lift
  persist
  enumerations (cant see a mapper it)
 
  There's a MappedEnum class in MappedInt.scala

 Thanks for this - I should have looked more
 
 
  --j
 
   





 --~--~-~--~~~---~--~~
 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
 [EMAIL PROTECTED][EMAIL PROTECTED]
 For more options, visit this group at
 http://groups.google.com/group/liftweb?hl=en
 -~--~~~~--~~--~--~---



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