[Lift] lift with MS Sequel

2009-02-09 Thread Amit Kumar Verma

Hi,

do lift support MSSQL db ?


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: lift with MS Sequel

2009-02-09 Thread Amarjeet Singh
Lift should technically work with any standard RDBMS, as long as it has a
supported JDBC driver. MSSQL does have both commercial as well as Microsoft
supplied JDBC drivers. Though I have never tested it myself, it should work.

Regards

On Mon, Feb 9, 2009 at 11:46 AM, Amit Kumar Verma cdac.a...@gmail.comwrote:


 Hi,

 do lift support MSSQL db ?


 Thanks
 Amit Kumar Verma

 



-- 
Amarjeet Singh
Phone: +91-98712-76661

--~--~-~--~~~---~--~~
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 with MS Sequel

2009-02-09 Thread Derek Chen-Becker
The MS provided JDBC driver is actually pretty high quality in my
experience. In particular, make sure you get the 2005 version of the driver:

http://msdn.microsoft.com/en-us/data/aa937724.aspx

Derek

On 2/9/09, Amarjeet Singh amarjeet.aur...@gmail.com wrote:

 Lift should technically work with any standard RDBMS, as long as it has a
 supported JDBC driver. MSSQL does have both commercial as well as Microsoft
 supplied JDBC drivers. Though I have never tested it myself, it should work.

 Regards

 On Mon, Feb 9, 2009 at 11:46 AM, Amit Kumar Verma cdac.a...@gmail.comwrote:


 Hi,

 do lift support MSSQL db ?


 Thanks
 Amit Kumar Verma





 --
 Amarjeet Singh
 Phone: +91-98712-76661


 


--~--~-~--~~~---~--~~
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 with MS Sequel

2009-02-09 Thread David Pollak
On Sun, Feb 8, 2009 at 10:16 PM, Amit Kumar Verma cdac.a...@gmail.comwrote:


 Hi,

 do lift support MSSQL db ?


Lift's mapper currently supports PostgreSQL, MySQL, Derby, H2, etc.

I'm expecting MS SQL and Oracle support by end of week.

You can use JPA for other DB support.





 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: 24 hours say the memory leaks are gone

2009-02-09 Thread David Pollak
Good stuff!

On Mon, Feb 9, 2009 at 11:26 AM, Marius marius.dan...@gmail.com wrote:


 Hi,

 I just committed the changes. There are a few new LiftRules variables

  /**
   * If a Comet request fails timeout for this period of time. Default
 value is 10 seconds
   */
  var cometFailureRetryTimeout: Long = 10 seconds


  /**
   * By default lift uses a garbage-collection mechanism of removing
 unused bound functions from LiftSesssion
   * Setting this to false will disbale this mechanims and there will
 be no Ajax polling mechanims attempted.
   */
  var enableLiftGC = true;

  /**
   * If Lift garbage collection is enabled, functions that are not
 seen in the page for this period of time
   * (given in milliseonds) will be discarded hence eligibe for
 garbage collections.
   * The default value is 10 minutes.
   */
  var unusedFunctionsLifeTime: Long = 10 minutes

  /**
   * The polling interval for background Ajax requests to keep
 functions to not be garbage collected.
   * Default value is set to 75 seconds.
   */
  var liftGCPollingInterval: Long = 75 seconds

  /**
   * The polling interval for background Ajax requests to keep
 functions to not be garbage collected.
   * This will be applied if the AJax request will fail. Default value
 is set to 15 seconds.
   */
  var liftGCFailureRetryTimeout: Long = 15 seconds


 Dave ... just wanted to also make people aware on what we just
 discussed. With the gc mechanism where unused function survive for 10
 minutes (by default ... but now can be configured) the back button
 scenarios would have a negative impact as browsers tend to reload the
 page from cache and not make a request to server. Hence Lift requests
 from that page will fail if the functions are GC-ed. We need a
 mechanism to determine the back button cases and I'll be doing some
 noodling on that. Of course creative ideas are more then welcomed !

 Br's,
 Marius

 On Feb 8, 9:13 pm, David Pollak feeder.of.the.be...@gmail.com wrote:
  On Sun, Feb 8, 2009 at 7:40 AM, Marius marius.dan...@gmail.com wrote:
 
   I can make these changes one of these days if it's fine with you.
 
  Please make them as soon as is convenient.  It's time to let the bits sit
  prior to 1.0 shipping.
 
 
 
 
 
   On Feb 8, 5:23 pm, David Pollak feeder.of.the.be...@gmail.com wrote:
On Sun, Feb 8, 2009 at 12:37 AM, Marius marius.dan...@gmail.com
 wrote:
 
 Dave this is way awesome!
 
 I have some questions/suggestions if I may
 
 1. Currently Lift purges the unseen functions that are older then
 10
 minutes. I think it might help to make this time window
 configurable
 via LiftRules so that people may adjust it to fit their specific
 application needs.
 
Sure.
 
 2. AddLiftGCToBody should probably not renders anything related
 with
 GC if the GC nodes list is empty? ... or have the ability to
 disable
 the GC support which might be quite handy for mobile web
 applications
 used for limited browsers.
 
Disable GC... cool.  Not sending the Ajax request if the list is
 empty,
cool.  But it's possible that items come onto the page via Ajax or
 Comet.
 Thus, we have to run the node walk as long as GC is enabled.
 
 3. Lift for every page is starting the JS GC daemon that
 periodically sends the GC request up (every 75 seconds for success
 or
 15 seconds for failure). Shouldn't we make these these times
 intervals
 configurable from LiftRules?
 
Sure.
 
 Thoughts?
 
 Br's,
 Marius
 
 On Feb 8, 2:05 am, David Pollak feeder.of.the.be...@gmail.com
 wrote:
  Folks,
 
  I've found and squashed a bunch of memory retention issues in the
   Lift
 comet
  stuff (and added the garbage collection for functions.)
 
  I've tested the fixes against the
 livehttp://demo.liftweb.netandthere
 has
  been no memory growth (except in Derby, but that's not Lift's
   problem)
 for
  24 hours.
 
  I've been using YouKit (http://yourkit.com/) to profile that
 application.
  I've gotta say that YourKit is awesome, even for debugging remote
   code.
  I'd
  like to thank YourKit again for contributing licenses to the Lift
  committers.
 
  I've dialed the heap size for demo.liftweb.net from 1GB to 192M.
  In
  practice, the actual heap size for the site never grew beyond
 about
   10MB.
 
  Thanks,
 
  David
 
  PS -- Yes, my confidence about making 1.0 on 2/26 is very high.
 
  --
  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 frameworkhttp://liftweb.net
  Beginning 

[Lift] Implementing RESTful web services using Lift

2009-02-09 Thread Chris Richardson
Hi,

I just started playing around with Scala and Lift and with @dpp's help wrote
a simple RESTful web service.
I wanted to share the code with this group and get feedback and suggestions
about improvements.
See below.
Thanks.

Chris


In Boot.scala you register one or more WsEndpoints (a trait that is defined
later).

I was wondering whether Lift has a way to search and register them
automatically?

class Boot {

  def boot {

val x :List[WsEndpoint] = List(ExampleApi)
x.foreach ( endpoint = LiftRules.dispatch.append
(endpoint.dispatchRules)  )

  }

}



Here is the class that defines methods that take parameters from the HTTP
request and returns XML nodes.

class ExampleApi {

 def doGet(id: String) : Node = {
   info3 id={id} /
  }

}

The companion object sets up the mapping rules, e.g. /api/item/1 -
exampleApi.doGet(1)

object ExampleApi extends WsEndpoint {

val exampleApi = new ExampleApi()

override def wsDispatchRules  =
{
  case Req(api :: item :: id :: _, _, GetRequest) = () =
exampleApi.doGet(id)
}
}

WsEndpoint is a trait that handles the conversion from what Lift expects,
i.e. () = Full[XmlResponse] to what is written above, i.e .() = Node

trait WsEndpoint {

def wsDispatchRules : PartialFunction[Req,() = Node]

def dispatchRules : PartialFunction[Req,() = Full[XmlResponse]] = {
  new MyAdapter(wsDispatchRules)
}


abstract class PartialFunctionAdapter [F, T1, T2] (adaptee:
PartialFunction[F, T1]) extends PartialFunction[F, T2] {
  override def isDefinedAt(r : F) = adaptee.isDefinedAt(r)

  override def apply(r : F)  = {
converter(adaptee.apply(r))
  }

  def converter (x : T1) : T2

}

class MyAdapter(adaptee: PartialFunction[Req, () = Node])
extends PartialFunctionAdapter[Req, () = Node, () =
Full[XmlResponse] ](adaptee)   {

   override def converter (x : () = Node)  = {
() = Full(XmlResponse(x()))
   }
}
}

--~--~-~--~~~---~--~~
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 with MS Sequel

2009-02-09 Thread Tim Perrett


There are mixed reports about that driver - personally I didn't get on very
well with and would go for JTDS :-)

On 09/02/2009 16:52, Derek Chen-Becker dchenbec...@gmail.com wrote:

 The MS provided JDBC driver is actually pretty high quality in my experience.
 In particular, make sure you get the 2005 version of the driver:
 
 http://msdn.microsoft.com/en-us/data/aa937724.aspx
 
 Derek
 
 On 2/9/09, Amarjeet Singh amarjeet.aur...@gmail.com wrote:
 Lift should technically work with any standard RDBMS, as long as it has a
 supported JDBC driver. MSSQL does have both commercial as well as Microsoft
 supplied JDBC drivers. Though I have never tested it myself, it should work.
 
 Regards
 
 On Mon, Feb 9, 2009 at 11:46 AM, Amit Kumar Verma cdac.a...@gmail.com
 wrote:
 
 Hi,
 
 do lift support MSSQL db ?
 
 
 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] JTA showSQL

2009-02-09 Thread Oliver

Hi Derek and interested parties

I know there is a showSQL option that can be enabled with
JTA/Hibernate but I find the output verbose and uninformative about
parameter replacement.

So, I have my own ScalaQuery that allows simple debugging - the main
differences are -

var queryParams: List[Pair[String,Any]] = Nil
   /*  the following method needs to be called by the various
SetParameter methods */
def addParam(one: String,two: Any) = {
query.setParameter(one, two)
queryParams = (one, two) :: queryParams
}
/*
 output the query with parameters substitued, for debugging ...
 */
def getQueryWithParams() = {
var q = queryStr
try {
queryParams.foreach{v =
var rep = v._2 match {
case d: Date = '+SUtil.formatDate(d, dd/MM/)+'
case s: String = '+s+'
case x = if (x==null)  else x.toString
}
rep = rep.replaceAll(\\$, ddDollardd) // stupid bug
q = q.replaceAll(:+v._1, rep)
}
q.replaceAll(ddDollardd, \\$)
} catch {
case e: Exception = q+ PARAMS +queryParams+  EXCEPTION +e
}
}

With this I can log the query via
 Log.info(emailQuery.getQueryWithParams())

Better still, (assuming execOnce exists in a utility object) when I
only need to see the query once in the log
/*
 execulte execFn, just once for the jvm.
 */
val execOnceSet = scala.collection.mutable.Set()
def execOnce(key: String, execFn: = Unit) = {
if (!execOnceSet.contains(key)) {
execOnceSet += key
execFn
}
}

  execOnce(findByEmail,  Log.info(emailQuery.getQueryWithParams()) )


You can add the functionality if you find it useful

cheers
Oliver

--~--~-~--~~~---~--~~
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: *** BREAKING CHANGES ***

2009-02-09 Thread Oliver

If I try to use the following, I get a reassignment to Val error - any ideas?

LiftRules.exceptionHandler.prepend = {
case (mode, state, ex) = RedirectResponse(/error)
}

On Wed, Dec 24, 2008 at 5:41 AM, Marius marius.dan...@gmail.com wrote:

 Folks,

 I just committed a couple of changes that may impact your application.

 1. LiftRules.logAndReturnExceptionToBrowser and
 LiftRules.browserResponseToException have been removed. These were two
 different variables that did pretty much the same thing in fact the
 first ultimately called the former. These have been replaced with:


 var exceptionHandler = RulesSeq[ExceptionHandlerPF]

 having

 type ExceptionHandlerPF = PartialFunction[(Props.RunModes.Value, Req,
 Throwable), LiftResponse]

 By default a partial function is appended and it is the same code that
 used to be for LiftRules.browserResponseToException.

 So up until now probably your application was using something like:

 LiftRules.logAndReturnExceptionToBrowser = {
case (state, ex) = RedirectResponse(/error)
 }

 now this turns into:

 LiftRules.exceptionHandler.prepend = {
case (mode, state, ex) = RedirectResponse(/error)
 }


 2. More unification of Ajax notices with static notices. So far to
 apply styling information (css classes etc) to Ajax notices we used
 three LiftRules variables:

  var ajaxNoticeMeta: Can[AjaxMessageMeta]
  var ajaxWarningMeta: Can[AjaxMessageMeta]
  var ajaxErrorMeta: Can[AjaxMessageMeta]

 the motivation was that in order for Lift to send down the correct
 style information for Ajax/Comet notices it needed to maintain this
 information. Now I finally found time to do it. The above variables
 are gone. Instead the same styling information that you use for
 lift:msgs and lift:msg snippets will be applied for AJax and Comet
 notices. The styling information is captured when these snippets are
 executed and used whenever you're using notices for AJax response or
 from a Comet actor.


 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: JTA showSQL

2009-02-09 Thread Derek Chen-Becker
Interesting idea. I'll look into adding something like this (configurable at
boot and/or runtime) into scalajpa.

Derek

On 2/9/09, Oliver ola...@gmail.com wrote:


 Hi Derek and interested parties

 I know there is a showSQL option that can be enabled with
 JTA/Hibernate but I find the output verbose and uninformative about
 parameter replacement.

 So, I have my own ScalaQuery that allows simple debugging - the main
 differences are -

 var queryParams: List[Pair[String,Any]] = Nil
/*  the following method needs to be called by the various
 SetParameter methods */
 def addParam(one: String,two: Any) = {
 query.setParameter(one, two)
 queryParams = (one, two) :: queryParams
 }
 /*
  output the query with parameters substitued, for debugging ...
  */
 def getQueryWithParams() = {
 var q = queryStr
 try {
 queryParams.foreach{v =
 var rep = v._2 match {
 case d: Date = '+SUtil.formatDate(d,
 dd/MM/)+'
 case s: String = '+s+'
 case x = if (x==null)  else x.toString
 }
 rep = rep.replaceAll(\\$, ddDollardd) // stupid bug
 q = q.replaceAll(:+v._1, rep)
 }
 q.replaceAll(ddDollardd, \\$)
 } catch {
 case e: Exception = q+ PARAMS +queryParams+  EXCEPTION +e
 }
 }

 With this I can log the query via
   Log.info(emailQuery.getQueryWithParams())

 Better still, (assuming execOnce exists in a utility object) when I
 only need to see the query once in the log
 /*
  execulte execFn, just once for the jvm.
  */
 val execOnceSet = scala.collection.mutable.Set()
 def execOnce(key: String, execFn: = Unit) = {
 if (!execOnceSet.contains(key)) {
 execOnceSet += key
 execFn
 }
 }

   execOnce(findByEmail,  Log.info(emailQuery.getQueryWithParams()) )


 You can add the functionality if you find it useful

 cheers
 Oliver

 


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