[Lift] Re: Building war for production mode.

2009-11-28 Thread Neil.Lv
  Now the lift app runs in the production mode,

###
  put the JAVA_OPTIONS=-Drun.mode=production on the top, and it can
workd.
###

 But it will create the database in the jetty's folder
 /home/jetty6/derby.log
 /home/jetty6/lift_example

  It can's find the jdbc:mysql ?  (It the development mode it can find
the jdbc:mysql driver)

  I don't know what's the problem with it .

  Thanks for any help!

Cheers,
  Neil


On Nov 28, 3:48 pm, Neil.Lv anim...@gmail.com wrote:
 I have the same issue, is add this statement into /home/jetty6/bin/
 jetty.sh

 ###
   echo JAVA_OPTIONS=-Drun.mode=production  /home/jetty6/bin/
 jetty.sh
 ###

  then restart the jetty server, but it alwasy show the Development
 Mode information
  The requested page was not defined in your SiteMap, so access was
 blocked

   The server is CentOS 5.3

 Cheers,
   Neil

 On Nov 27, 7:13 pm, Jeppe Nejsum Madsen je...@ingolfs.dk wrote:

  Marcin Jurczuk mjurc...@gmail.com writes:
   Hello,

   I'm trying to first test deploy of my app :)

   I created package (mvn package), uploaded created war as root.war in
   webapp folder of jetty server and when running app it looks that lift
   app is running in development mode (no 404 is showed but:
   The requested page was not defined in your SiteMap, so access was
   blocked.  (This message is displayed in development mode only

   How inform maven that I'm building production package ?
   I tried mvn -Drun.mode=production package  - no effect ?

  You don't build for deployment, it is the same war (modulus any compiler
  settings or other build steps you've specified)

  The lift run mode is determined at runtime, so you need to specify the
  run.mode=production as a system property when launching jetty

  (This is what happens with the maven command above: It starts jetty with
  this system property set)

  If you happen to run jetty on a Debian based Linux you can accomplish
  this by:

  echo JAVA_OPTIONS=-Drun.mode=production /etc/default/jetty6

  /Jeppe

--

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




[Lift] Re: Building war for production mode.

2009-11-28 Thread Neil.Lv
  Now the lift app runs in the production mode,

###
  put the JAVA_OPTIONS=-Drun.mode=production on the top, and it can
workd.
###

 But it will create the database in the jetty's folder
 /home/jetty6/derby.log
 /home/jetty6/lift_example

  It can's find the jdbc:mysql ?  (It the development mode it can find
the jdbc:mysql driver)

  I don't know what's the problem with it .

  Thanks for any help!

Cheers,
  Neil


On Nov 28, 3:48 pm, Neil.Lv anim...@gmail.com wrote:
 I have the same issue, is add this statement into /home/jetty6/bin/
 jetty.sh

 ###
   echo JAVA_OPTIONS=-Drun.mode=production  /home/jetty6/bin/
 jetty.sh
 ###

  then restart the jetty server, but it alwasy show the Development
 Mode information
  The requested page was not defined in your SiteMap, so access was
 blocked

   The server is CentOS 5.3

 Cheers,
   Neil

 On Nov 27, 7:13 pm, Jeppe Nejsum Madsen je...@ingolfs.dk wrote:

  Marcin Jurczuk mjurc...@gmail.com writes:
   Hello,

   I'm trying to first test deploy of my app :)

   I created package (mvn package), uploaded created war as root.war in
   webapp folder of jetty server and when running app it looks that lift
   app is running in development mode (no 404 is showed but:
   The requested page was not defined in your SiteMap, so access was
   blocked.  (This message is displayed in development mode only

   How inform maven that I'm building production package ?
   I tried mvn -Drun.mode=production package  - no effect ?

  You don't build for deployment, it is the same war (modulus any compiler
  settings or other build steps you've specified)

  The lift run mode is determined at runtime, so you need to specify the
  run.mode=production as a system property when launching jetty

  (This is what happens with the maven command above: It starts jetty with
  this system property set)

  If you happen to run jetty on a Debian based Linux you can accomplish
  this by:

  echo JAVA_OPTIONS=-Drun.mode=production /etc/default/jetty6

  /Jeppe

--

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




[Lift] Can't find the jdbc:mysql driver in Production Mode ?

2009-11-28 Thread Neil.Lv
Hi all,

   I have a silly question about the lift app that deployed on the
Jetty server.


   Can't find the jdbc:mysql driver in Production Mode ? It will use
the derby to instead of the mysql.

  But it works fine in the Development Mode.

  I will craete the derby file in the jetty folder.
  /home/jetty6/derby.log
  /home/jetty6/lift-example

  Thanks for any suggestion!

Cheers,
  Neil

--

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




Re: [Lift] Re: Lift and LDAP

2009-11-28 Thread Timothy Perrett
What kind of integration do you want? 

Cheers, Tim

On 28 Nov 2009, at 03:20, Xuefeng Wu wrote:

 Did anyone try to integrate with SSO?
 
 On Sat, Nov 28, 2009 at 12:37 AM, Marcin Jurczuk mjurc...@gmail.com wrote:
 That is amazing :)
 
 Probably I will need to bind to AD in near future, so this module is
 like fallen from heavens :)
 
 
 On 27 Lis, 15:11, TylerWeir tyler.w...@gmail.com wrote:
  http://jgoday.wordpress.com/2009/11/27/lift-ldap/
  One of the requisites to start using Lift at my work, was to use LDAP
  authentification.
  So i wrote a little module lift-ldap for that and a sample app, it was
  damn simple!
 
  http://github.com/jgoday/lift-ldaphttp://github.com/jgoday/sample_lift_ldap
 
 --
 
 You received this message because you are subscribed to the Google Groups 
 Lift group.
 To post to this group, send email to lift...@googlegroups.com.
 To unsubscribe from this group, send email to 
 liftweb+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/liftweb?hl=en.
 
 
 
 
 
 -- 
 Scala中文社区:  http://groups.google.com/group/scalacn
 
 --
 
 You received this message because you are subscribed to the Google Groups 
 Lift group.
 To post to this group, send email to lift...@googlegroups.com.
 To unsubscribe from this group, send email to 
 liftweb+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/liftweb?hl=en.

--

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




Re: [Lift] Can't find the jdbc:mysql driver in Production Mode ?

2009-11-28 Thread Timothy Perrett

Paste your database connection object? its probably that you copied the one 
from lift examples and you are now missing the correct properties file...

Cheers, Tim

On 28 Nov 2009, at 10:26, Neil.Lv wrote:

 Hi all,
 
   I have a silly question about the lift app that deployed on the
 Jetty server.
 
 
   Can't find the jdbc:mysql driver in Production Mode ? It will use
 the derby to instead of the mysql.
 
  But it works fine in the Development Mode.
 
  I will craete the derby file in the jetty folder.
  /home/jetty6/derby.log
  /home/jetty6/lift-example
 
  Thanks for any suggestion!
 
 Cheers,
  Neil
 
 --
 
 You received this message because you are subscribed to the Google Groups 
 Lift group.
 To post to this group, send email to lift...@googlegroups.com.
 To unsubscribe from this group, send email to 
 liftweb+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/liftweb?hl=en.
 
 
 

--

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




[Lift] Foreign Key constraints are not created by schemify

2009-11-28 Thread Julian Backes
Hi,

I'm trying to get my first scala/lift app working and I have a problem: 
Schemifier.schemify(...) creates everything, i.e. tables, primary keys, 
indices but it does not create the foreign key constraints.

I've seen in Schemifier.scala SQL code for generating foreign key 
constraints so I think it should work. Or am I wrong?

I tried Lift 1.0 and 1.1-M7

I also tested the pocketchangeapp from 
http://github.com/tjweir/pocketchangeapp but still the same problem. I'm 
using PostgreSQL (postgresql-8.4-701.jdbc4.jar) and Scala 2.7.7. Server 
is PostgreSQL 8.3.7.
Here the SQL log when doing a mvn jetty:run in pocketchangeapp:

INFO - CREATE TABLE users (firstname VARCHAR(32) , lastname VARCHAR(32) 
, email VARCHAR(48) , locale VARCHAR(16) , timezone VARCHAR(32) , 
password_pw VARCHAR(48) , password_slt VARCHAR(20) , id BIGSERIAL , 
superuser BOOLEAN , validated BOOLEAN , uniqueid VARCHAR(32))
INFO - ALTER TABLE users ADD CONSTRAINT users_PK PRIMARY KEY(id)
INFO - CREATE TABLE tag (name VARCHAR(64) , id BIGSERIAL , account BIGINT)
INFO - ALTER TABLE tag ADD CONSTRAINT tag_PK PRIMARY KEY(id)
INFO - CREATE TABLE account (name VARCHAR(100) , id BIGSERIAL , 
description VARCHAR(300) , owner BIGINT , externalaccount VARCHAR(300) , 
balance DECIMAL(16,2) , is_public BOOLEAN)
INFO - ALTER TABLE account ADD CONSTRAINT account_PK PRIMARY KEY(id)
INFO - CREATE TABLE accountadmin (id BIGSERIAL , administrator BIGINT , 
account BIGINT)
INFO - ALTER TABLE accountadmin ADD CONSTRAINT accountadmin_PK PRIMARY 
KEY(id)
INFO - CREATE TABLE accountviewer (id BIGSERIAL , viewer BIGINT , 
account BIGINT)
INFO - ALTER TABLE accountviewer ADD CONSTRAINT accountviewer_PK PRIMARY 
KEY(id)
INFO - CREATE TABLE accountnote (note TEXT , id BIGSERIAL , account BIGINT)
INFO - ALTER TABLE accountnote ADD CONSTRAINT accountnote_PK PRIMARY KEY(id)
INFO - CREATE TABLE expense (dateof TIMESTAMP , amount DECIMAL(16,2) , 
description VARCHAR(100) , notes VARCHAR(1000) , id BIGSERIAL , 
serialnumber BIGINT , account BIGINT , currentbalance DECIMAL(16,2) , 
receiptmime VARCHAR(100) , receipt BYTEA)
INFO - ALTER TABLE expense ADD CONSTRAINT expense_PK PRIMARY KEY(id)
INFO - CREATE TABLE expensetag (id BIGSERIAL , tag BIGINT , expense BIGINT)
INFO - ALTER TABLE expensetag ADD CONSTRAINT expensetag_PK PRIMARY KEY(id)
INFO - CREATE INDEX users_email ON users ( email )
INFO - CREATE INDEX users_uniqueid ON users ( uniqueid )
INFO - CREATE INDEX tag_account ON tag ( account )
INFO - CREATE INDEX account_owner ON account ( owner )
INFO - CREATE INDEX accountadmin_administrator ON accountadmin ( 
administrator )
INFO - CREATE INDEX accountadmin_account ON accountadmin ( account )
INFO - CREATE INDEX accountviewer_viewer ON accountviewer ( viewer )
INFO - CREATE INDEX accountviewer_account ON accountviewer ( account )
INFO - CREATE INDEX accountnote_account ON accountnote ( account )
INFO - CREATE INDEX expense_account ON expense ( account )
INFO - CREATE INDEX expensetag_tag ON expensetag ( tag )
INFO - CREATE INDEX expensetag_expense ON expensetag ( expense )
INFO - Bootstrap up

Thanks in advance,
Julian

--

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




[Lift] Re: Building war for production mode.

2009-11-28 Thread Leo Lännenmäki
Hi,

I'm a Lift newbie so I don't know if my way is the right way but
here goes:

I generated my app using the archetype lift-archetype-basic in order
to get the database configuration stuff to Boot.scala. Then i created
two files src/main/webapp/WEB-INF/classes/props/default.props and
production.default.props. When developing I want to use an in memory
database so I added:

db.driver = org.apache.derby.jdbc.EmbeddedDriver
db.url = jdbc:derby:my_database_name;create=true

to default.props. I want to use MySQL on the production server so I
added:

db.driver = com.mysql.jdbc.Driver
db.url = jdbc:mysql://localhost:3306/my_database_name
db.user = my_user
db.password = my_pass

to production.default.props. On the production server I user Tomcat
with -Drun.mode=production.

I hope you get some ideas about my configuration.

Leo

On Nov 28, 11:02 am, Neil.Lv anim...@gmail.com wrote:
   Now the lift app runs in the production mode,

 ###
   put the JAVA_OPTIONS=-Drun.mode=production on the top, and it can
 workd.
 ###

  But it will create the database in the jetty's folder
  /home/jetty6/derby.log
  /home/jetty6/lift_example

   It can's find the jdbc:mysql ?  (It the development mode it can find
 the jdbc:mysql driver)

   I don't know what's the problem with it .

   Thanks for any help!

 Cheers,
   Neil

 On Nov 28, 3:48 pm, Neil.Lv anim...@gmail.com wrote:

  I have the same issue, is add this statement into /home/jetty6/bin/
  jetty.sh

  ###
    echo JAVA_OPTIONS=-Drun.mode=production  /home/jetty6/bin/
  jetty.sh
  ###

   then restart the jetty server, but it alwasy show the Development
  Mode information
   The requested page was not defined in your SiteMap, so access was
  blocked

    The server is CentOS 5.3

  Cheers,
    Neil

  On Nov 27, 7:13 pm, Jeppe Nejsum Madsen je...@ingolfs.dk wrote:

   Marcin Jurczuk mjurc...@gmail.com writes:
Hello,

I'm trying to first test deploy of my app :)

I created package (mvn package), uploaded created war as root.war in
webapp folder of jetty server and when running app it looks that lift
app is running in development mode (no 404 is showed but:
The requested page was not defined in your SiteMap, so access was
blocked.  (This message is displayed in development mode only

How inform maven that I'm building production package ?
I tried mvn -Drun.mode=production package  - no effect ?

   You don't build for deployment, it is the same war (modulus any compiler
   settings or other build steps you've specified)

   The lift run mode is determined at runtime, so you need to specify the
   run.mode=production as a system property when launching jetty

   (This is what happens with the maven command above: It starts jetty with
   this system property set)

   If you happen to run jetty on a Debian based Linux you can accomplish
   this by:

   echo JAVA_OPTIONS=-Drun.mode=production /etc/default/jetty6

   /Jeppe

--

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




Re: [Lift] Re: Can't find the jdbc:mysql driver in Production Mode ?

2009-11-28 Thread David Pollak
Do a println to output the value of Props.get(db.driver)

On Sat, Nov 28, 2009 at 6:06 AM, Neil.Lv anim...@gmail.com wrote:


  It generated by the archetype lift-archetype-basic.

 ##  in the Boot.scala
 object DBVendor extends ConnectionManager {
  private var pool: List[Connection] = Nil
  private var poolSize = 0
  private val maxPoolSize = 4

  private def createOne: Box[Connection] = try {
val driverName: String = Props.get(db.driver) openOr
org.apache.derby.jdbc.EmbeddedDriver

val dbUrl: String = Props.get(db.url) openOr
jdbc:derby:lift_example;create=true

Class.forName(driverName)

val dm = (Props.get(db.user), Props.get(db.password)) match {
  case (Full(user), Full(pwd)) =
DriverManager.getConnection(dbUrl, user, pwd)

  case _ = DriverManager.getConnection(dbUrl)
}

Full(dm)
  } catch {
case e: Exception = e.printStackTrace; Empty
  }

  def newConnection(name: ConnectionIdentifier): Box[Connection] =
synchronized {
  pool match {
case Nil if poolSize  maxPoolSize =
  val ret = createOne
poolSize = poolSize + 1
ret.foreach(c = pool = c :: pool)
ret

case Nil = wait(1000L); newConnection(name)
case x :: xs = try {
  x.setAutoCommit(false)
  Full(x)
} catch {
  case e = try {
pool = xs
poolSize = poolSize - 1
x.close
newConnection(name)
  } catch {
case e = newConnection(name)
  }
}
  }
}

  def releaseConnection(conn: Connection): Unit = synchronized {
pool = conn :: pool
notify
  }
 }

 ##

   And this is my default.props (In src\main\resources\props )
   Only this file in the props folder.

 ###
 db.driver=com.mysql.jdbc.Driver
 db.url=jdbc:mysql://localhost:3306/project
 db.user=root
 db.password=root
 ###

 Cheers,
  Neil


 On Nov 28, 7:57 pm, Timothy Perrett timo...@getintheloop.eu wrote:
  Paste your database connection object? its probably that you copied the
 one from lift examples and you are now missing the correct properties
 file...
 
  Cheers, Tim
 
  On 28 Nov 2009, at 10:26, Neil.Lv wrote:
 
   Hi all,
 
 I have a silly question about the lift app that deployed on the
   Jetty server.
 
 Can't find the jdbc:mysql driver in Production Mode ? It will use
   the derby to instead of the mysql.
 
But it works fine in the Development Mode.
 
I will craete the derby file in the jetty folder.
/home/jetty6/derby.log
/home/jetty6/lift-example
 
Thanks for any suggestion!
 
   Cheers,
Neil
 
   --
 
   You received this message because you are subscribed to the Google
 Groups Lift group.
   To post to this group, send email to lift...@googlegroups.com.
   To unsubscribe from this group, send email to
 liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com
 .
   For more options, visit this group athttp://
 groups.google.com/group/liftweb?hl=en.

 --

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





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

--

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




[Lift] Re: How to get the servlet context

2009-11-28 Thread jhonig
Dear Tim and Heiko,

I tested a few things under mvn jetty:run...:

  getRealPath gives me ./src/main/webapp
  the temp attribute is set to ./target/work
  and the location is ./target/classes

While the war contains classes/work which is again different...   I
didn't manage to get jetty to serve contents from any other directory
than the first one.

Didn't try to run it on the standalone jetty, since I still don't know
how
to tell jetty to serve contents that is not under the webapp
directory.
Probably have to do something with the site map which I don't fully
understand.

Guess my main problem is that I don't have any experience in this
field (jetty/lift) and thought it wouldn't be to difficult to port my
website
to lift and enhance it a little on the fly.

To be continued...

Job Honig




On Nov 28, 12:52 am, Timothy Perrett timo...@getintheloop.eu wrote:
 Here's a nugget of information for you that will help (as I do something 
 similar to what you want in one of my applications):

   val protectionDomain: ProtectionDomain = 
 classOf[bootstrap.liftweb.Boot].getProtectionDomain()
   val location: URL = protectionDomain.getCodeSource().getLocation()

 Print the value of location, and that will get you headed in the right 
 direction ;-) Moreover, if your using jetty, if there is a work directory 
 next to where the war file is, jetty will automatically expand the war into 
 that work folder... if not, it makes a temp directory in the relevant OS temp 
 directory (/var/tmp on *nix OS)

 Godspeed.

 Tim.

 On 27 Nov 2009, at 21:49, Heiko Seeberger wrote:

  Job,

  This directory is managed by the servlet container and as far as I know 
  there is little you can do to configure the location. If you use Tomcat you 
  are able to specify CATALINA_BASE and it will be somewhere beneath that 
  directory, I believe it is work/Catalina/localhost/WABAPP-NAME.

  Regarding serving images from there: Depending on the configuration of the 
  servlet container WARs are not unpacked, hence there is no standard way to 
  bring these images into your webapp. I think you will not be able to have 
  the servlet container serve these images directly. But it should be easy to 
  write a ServletFilter or something that will do it for you.

  Heiko

  2009/11/27 jhonig al...@xs4all.nl
  Heiko,

  In the meantime, I found that solution as well...   I tried it, and
  the default seems to
  be a work directory in target.  I guess I can set another value
  for the attribute
  if I manage to convince jetty to do that for me.   What I forgot to
  mention is that
  the directory is to contain images that are to be served by jetty...
  So it means
  the directory should be logically under webapp, but not in the war (of
  course).

  If I use a link from inside the war to some regular file system
  location, I'll
  probably run into the same problem as before.  Any idea how to do
  this?

  Job H.

  On Nov 27, 6:56 pm, Heiko Seeberger heiko.seeber...@googlemail.com
  wrote:
   File tempdir = (File)
   config.getServletContext().getAttribute(javax.servlet.context.tempdir)

   2009/11/27 jhonig al...@xs4all.nl

Dear Heiko,

 According to the Servlet spec each webapp has got a private temporary
 directory. I cannot remember exactly how to get this, maybe
 ServletContext.getTmpDir(). Please take a look at the spec.

I started reading the spec, but didn't find it yet.  ServletContext
doesn't
have any obvious way to get to a temporary dir, but I assumed I could
create one.  Would probably need to tweak a security policy to be able
to write to it, but that would be the next step.

Job H.

--

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

   --
   Heiko Seeberger

   My job: weiglewilczek.com
   My blog: heikoseeberger.name
   Follow me: twitter.com/hseeberger
   OSGi on Scala: scalamodules.org
   Lift, the simply functional web framework: liftweb.net

  --

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

  --
  Heiko Seeberger

  My job: weiglewilczek.com
  My blog: heikoseeberger.name
  Follow me: twitter.com/hseeberger
  OSGi on Scala: scalamodules.org
  Lift, the simply functional web framework: liftweb.net

  --

  You received this message because you are subscribed to the Google Groups 
  Lift group.
  To post to this group, send email to 

Re: [Lift] More on bind and preserving attributes

2009-11-28 Thread Jeppe Nejsum Madsen
Ross Mellgren dri...@gmail.com writes:

 I'm not sure if this addresses your points, but I figured I'd throw  
 out what I've been doing in case it helps.

It's always nice to see how others approach a problem!

 I don't use -%, but I do use something similar along with another  
 implicit so I can place the attrs in exactly the right place, and it  
 automagically combines class and style attributes correctly. Some  
 example code:

 bind(user, loginXhtml,
   email - (FocusOnLoad(input type=Text name=username  
 id=email class=text / %% currentPrefixedAttrs(input)),
   ...)

Much cleaner than my version :-)

 I think personally that the default behavior of bind is correct and  
 least surprising, since (at least for me and the applications I have)  
 it's very common that a single bound tag does not map one to one to a  
 result elem.

I don't think I disagree that the current bind is very clean and easy to
understand. I guess the bind use cases can be divided in two:

1) The bound element is (conceptually) replaced with a single element
e.g an input field. I think the example above falls in this category
even if it outputs several elements (ie input, script etc)

2) The bound element is replaced with a more complex NodeSeq.

The current bind works fine for 2), but 1) I think can be made
easier. Your approach is a step in the right direction, but I still feel
there's too much boilerplate. Basically it should be natural to always
use this approach whenever a single element is (conceptually)
output. That way it's easy to add/change attributes in the template
afterwards without changing the bind code.

/Jeppe


[...]

--

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




Re: [Lift] Re: Can't find the jdbc:mysql driver in Production Mode ?

2009-11-28 Thread Neil.Lv
  Thanks very much!

  It's in the production mode now.

  This snippet's result is production

Cheers,
  Neil


David Pollak wrote:
 Write a snippet:

 import net.liftweb.util.Props
 import scala.xml._

 class WhatMode {
   def render = Text(Props.modeName)
 }

 On a page:

 lift:WhatMode/

 And the mode will be listed (or blank for development mode)

 On Sat, Nov 28, 2009 at 6:23 AM, Neil.Lv anim...@gmail.com wrote:

 
   I missing the production.default.props file in the /src/main/
  resources/props folder
 
   I create a file named production.default.props(copy from
  default.props) in this folder.
 
   When i enter a invalid URL like:
 http://192.168.1.102/fsdf
 
   The browser will show this message:
 The Requested URL/fsdfwas not found on this server
 
Is it in the production mode now?
 
  Cheers,
   Neil
 
 
  David Pollak wrote:
   Do a println to output the value of Props.get(db.driver)
  
   On Sat, Nov 28, 2009 at 6:06 AM, Neil.Lv anim...@gmail.com wrote:
  
   
 It generated by the archetype lift-archetype-basic.
   
##  in the Boot.scala
object DBVendor extends ConnectionManager {
 private var pool: List[Connection] = Nil
 private var poolSize = 0
 private val maxPoolSize = 4
   
 private def createOne: Box[Connection] = try {
   val driverName: String = Props.get(db.driver) openOr
   org.apache.derby.jdbc.EmbeddedDriver
   
   val dbUrl: String = Props.get(db.url) openOr
   jdbc:derby:lift_example;create=true
   
   Class.forName(driverName)
   
   val dm = (Props.get(db.user), Props.get(db.password)) match {
 case (Full(user), Full(pwd)) =
   DriverManager.getConnection(dbUrl, user, pwd)
   
 case _ = DriverManager.getConnection(dbUrl)
   }
   
   Full(dm)
 } catch {
   case e: Exception = e.printStackTrace; Empty
 }
   
 def newConnection(name: ConnectionIdentifier): Box[Connection] =
   synchronized {
 pool match {
   case Nil if poolSize  maxPoolSize =
 val ret = createOne
   poolSize = poolSize + 1
   ret.foreach(c = pool = c :: pool)
   ret
   
   case Nil = wait(1000L); newConnection(name)
   case x :: xs = try {
 x.setAutoCommit(false)
 Full(x)
   } catch {
 case e = try {
   pool = xs
   poolSize = poolSize - 1
   x.close
   newConnection(name)
 } catch {
   case e = newConnection(name)
 }
   }
 }
   }
   
 def releaseConnection(conn: Connection): Unit = synchronized {
   pool = conn :: pool
   notify
 }
}
   
##
   
  And this is my default.props (In src\main\resources\props )
  Only this file in the props folder.
   
###
db.driver=com.mysql.jdbc.Driver
db.url=jdbc:mysql://localhost:3306/project
db.user=root
db.password=root
###
   
Cheers,
 Neil
   
   
On Nov 28, 7:57 pm, Timothy Perrett timo...@getintheloop.eu wrote:
 Paste your database connection object? its probably that you copied
  the
one from lift examples and you are now missing the correct properties
file...

 Cheers, Tim

 On 28 Nov 2009, at 10:26, Neil.Lv wrote:

  Hi all,

I have a silly question about the lift app that deployed on the
  Jetty server.

Can't find the jdbc:mysql driver in Production Mode ? It will use
  the derby to instead of the mysql.

   But it works fine in the Development Mode.

   I will craete the derby file in the jetty folder.
   /home/jetty6/derby.log
   /home/jetty6/lift-example

   Thanks for any suggestion!

  Cheers,
   Neil

  --

  You received this message because you are subscribed to the Google
Groups Lift group.
  To post to this group, send email to lift...@googlegroups.com.
  To unsubscribe from this group, send email to
liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com
  liftweb%2bunsubscr...@googlegroups.comliftweb%252bunsubscr...@googlegroups.com
  
.
  For more options, visit this group athttp://
groups.google.com/group/liftweb?hl=en.
   
--
   
You received this message because you are subscribed to the Google
  Groups
Lift group.
To post to this group, send email to lift...@googlegroups.com.
To unsubscribe from this group, send email to
liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com
  liftweb%2bunsubscr...@googlegroups.comliftweb%252bunsubscr...@googlegroups.com
  
.
For more options, visit this group at
http://groups.google.com/group/liftweb?hl=en.
   
   
   
  
  
   --
   Lift, the simply functional web framework http://liftweb.net
   Beginning Scala http://www.apress.com/book/view/1430219890
   Follow me: 

[Lift] Re: Building war for production mode.

2009-11-28 Thread Neil.Lv

  Thanks very much,

  I missing the production.default.props file .

Cheers,
  Neil

On Nov 28, 9:33 pm, Leo Lännenmäki leo.lannenm...@gmail.com wrote:
 Hi,

 I'm a Lift newbie so I don't know if my way is the right way but
 here goes:

 I generated my app using the archetype lift-archetype-basic in order
 to get the database configuration stuff to Boot.scala. Then i created
 two files src/main/webapp/WEB-INF/classes/props/default.props and
 production.default.props. When developing I want to use an in memory
 database so I added:

 db.driver = org.apache.derby.jdbc.EmbeddedDriver
 db.url = jdbc:derby:my_database_name;create=true

 to default.props. I want to use MySQL on the production server so I
 added:

 db.driver = com.mysql.jdbc.Driver
 db.url = jdbc:mysql://localhost:3306/my_database_name
 db.user = my_user
 db.password = my_pass

 to production.default.props. On the production server I user Tomcat
 with -Drun.mode=production.

 I hope you get some ideas about my configuration.

 Leo

 On Nov 28, 11:02 am, Neil.Lv anim...@gmail.com wrote:

    Now the lift app runs in the production mode,

  ###
    put the JAVA_OPTIONS=-Drun.mode=production on the top, and it can
  workd.
  ###

   But it will create the database in the jetty's folder
   /home/jetty6/derby.log
   /home/jetty6/lift_example

    It can's find the jdbc:mysql ?  (It the development mode it can find
  the jdbc:mysql driver)

    I don't know what's the problem with it .

    Thanks for any help!

  Cheers,
    Neil

  On Nov 28, 3:48 pm, Neil.Lv anim...@gmail.com wrote:

   I have the same issue, is add this statement into /home/jetty6/bin/
   jetty.sh

   ###
     echo JAVA_OPTIONS=-Drun.mode=production  /home/jetty6/bin/
   jetty.sh
   ###

    then restart the jetty server, but it alwasy show the Development
   Mode information
    The requested page was not defined in your SiteMap, so access was
   blocked

     The server is CentOS 5.3

   Cheers,
     Neil

   On Nov 27, 7:13 pm, Jeppe Nejsum Madsen je...@ingolfs.dk wrote:

Marcin Jurczuk mjurc...@gmail.com writes:
 Hello,

 I'm trying to first test deploy of my app :)

 I created package (mvn package), uploaded created war as root.war in
 webapp folder of jetty server and when running app it looks that lift
 app is running in development mode (no 404 is showed but:
 The requested page was not defined in your SiteMap, so access was
 blocked.  (This message is displayed in development mode only

 How inform maven that I'm building production package ?
 I tried mvn -Drun.mode=production package  - no effect ?

You don't build for deployment, it is the same war (modulus any compiler
settings or other build steps you've specified)

The lift run mode is determined at runtime, so you need to specify the
run.mode=production as a system property when launching jetty

(This is what happens with the maven command above: It starts jetty with
this system property set)

If you happen to run jetty on a Debian based Linux you can accomplish
this by:

echo JAVA_OPTIONS=-Drun.mode=production /etc/default/jetty6

/Jeppe

--

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




Re: [Lift] Re: How to get the servlet context

2009-11-28 Thread Jeppe Nejsum Madsen
jhonig al...@xs4all.nl writes:

 Dear Tim and Heiko,

 I tested a few things under mvn jetty:run...:

   getRealPath gives me ./src/main/webapp
   the temp attribute is set to ./target/work
   and the location is ./target/classes

 While the war contains classes/work which is again different...   I
 didn't manage to get jetty to serve contents from any other directory
 than the first one.

 Didn't try to run it on the standalone jetty, since I still don't know
 how
 to tell jetty to serve contents that is not under the webapp
 directory.
 Probably have to do something with the site map which I don't fully
 understand.

I think you need to figure out how your URLs map to resources in 1) your
app and 2) the tmp files you generate.

If the files in 2) is outside your app context, you configure jetty to
serve the files like this
http://docs.codehaus.org/display/JETTY/Static+Content

If the files in 2) is inside your app context, you need to make your
Lift app handle the urls with sitemap and some code that can send the
correct files based on the urls. 

I think these are the only two options if you are not using a frontend
such as nginx (highly recommended). If you do use a frontend, you can
configure all kind of url mappings there

So perhaps a few more details on the required mappings could help...

/Jeppe

--

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




[Lift] Re: How to get the servlet context

2009-11-28 Thread jhonig
Hi Jeppe,

I'm not using a front-end or any other kind of programming
environment.

I always avoided Eclipse because it usually got into my way, but with
the
lift habit of using wildcard imports I lose a lot of time tracing all
kinds of
definitions, so in this case I'm reconsidering...

As for a web-app front-end: making this website is a one-shot exercise
for me, as I'm not a web developer at all...  (Just a researcher/
software
engineer/photographer wanting to have a nice website, in case you
wonder.)  I'm going to look into more detail wrt Jetty and URL
mapping...

Thanks,

Job

On Nov 28, 3:47 pm, Jeppe Nejsum Madsen je...@ingolfs.dk wrote:
 jhonig al...@xs4all.nl writes:
  Dear Tim and Heiko,

  I tested a few things under mvn jetty:run...:

getRealPath gives me ./src/main/webapp
the temp attribute is set to ./target/work
and the location is ./target/classes

  While the war contains classes/work which is again different...   I
  didn't manage to get jetty to serve contents from any other directory
  than the first one.

  Didn't try to run it on the standalone jetty, since I still don't know
  how
  to tell jetty to serve contents that is not under the webapp
  directory.
  Probably have to do something with the site map which I don't fully
  understand.

 I think you need to figure out how your URLs map to resources in 1) your
 app and 2) the tmp files you generate.

 If the files in 2) is outside your app context, you configure jetty to
 serve the files like thishttp://docs.codehaus.org/display/JETTY/Static+Content

 If the files in 2) is inside your app context, you need to make your
 Lift app handle the urls with sitemap and some code that can send the
 correct files based on the urls.

 I think these are the only two options if you are not using a frontend
 such as nginx (highly recommended). If you do use a frontend, you can
 configure all kind of url mappings there

 So perhaps a few more details on the required mappings could help...

 /Jeppe

--

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




Re: [Lift] Re: How to get the servlet context

2009-11-28 Thread Timothy Perrett
Use explicitly imports, thus avoiding these problems:

import some.package.{ClassOne, ClassTwo}

Cheers, Tim

On 28 Nov 2009, at 14:56, jhonig wrote:

 I always avoided Eclipse because it usually got into my way, but with
 the
 lift habit of using wildcard imports I lose a lot of time tracing all
 kinds of
 definitions, so in this case I'm reconsidering...

--

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




[Lift] lift modules

2009-11-28 Thread stephanos
Hi folks,

I'm new to lift and was wondering about all the various modules like
lift-paypal etc. I found in the maven repository.
Is there an overview/documentation of them somewhere - I couldn't find
one yet.

Cheers,
Stephan

--

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




[Lift] Re: lift modules

2009-11-28 Thread Marius
The Exploring Lift book aka The Definitive guide to Lift 
discusses a good portion of those. http://groups.google.com/group/the-lift-book

Br's,
Marius

On Nov 28, 6:49 pm, stephanos stephan.beh...@googlemail.com wrote:
 Hi folks,

 I'm new to lift and was wondering about all the various modules like
 lift-paypal etc. I found in the maven repository.
 Is there an overview/documentation of them somewhere - I couldn't find
 one yet.

 Cheers,
 Stephan

--

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




[Lift] Re: lift modules

2009-11-28 Thread Timothy Perrett
Stephan,

I wrote the paypal module... what do you want to know?

Cheers, Tim

On Nov 28, 4:49 pm, stephanos stephan.beh...@googlemail.com wrote:
 Hi folks,

 I'm new to lift and was wondering about all the various modules like
 lift-paypal etc. I found in the maven repository.
 Is there an overview/documentation of them somewhere - I couldn't find
 one yet.

 Cheers,
 Stephan

--

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




Re: [Lift] More on bind and preserving attributes

2009-11-28 Thread Ross Mellgren
Okay, I wrote an implicit + operator combo that scraps most of the boilerplate.

Snippet code:

  def howdy(in: NodeSeq): NodeSeq =
  bind(foobar, in, foobaz -%% FocusOnLoad(input type=text 
name=username id=email class=text input:attrs= /))

(input:attrs= is the magic)

Template code:

lift:helloWorld.howdy
foobar:foobaz input:class=monkey /
/lift:helloWorld.howdy

Output:
input id=email name=username type=text class=text monkey 
/script type=text/javascript
// ![CDATA[
jQuery(document).ready(function() {document.getElementById(email).focus();});
// ]]
/script

The -%% operator will scan all the nodes on the right hand side looking for a 
special prefix:attrs attribute, which it will replace with all the prefixed 
attributes from the template that start with the prefix, combining style and 
class attributes as before. This gives you the same flexibility as %% 
currentPrefixedAttrs with somewhat less typing (and more magic), plus you can 
attach attributes to different nodes:

  def howdy(in: NodeSeq): NodeSeq =
  bind(foobar, in, foobaz -%% (input type=text name=username 
id=email class=text username:attrs= /
input type=text name=password 
id=email class=text password:attrs= /))

Note that I wrote it to scan only shallowly -- if you have a nested output it 
will only look at the outermost elements. A recursive version would probably be 
trivial.

I posted the entire code to git so you can take a look -- 
http://www.github.com/dridus/test-bindparams

The heart of the code is 
http://github.com/Dridus/test-bindparams/blob/master/src/main/scala/test/lib/BindParamExtensions.scala

-Ross

On Nov 28, 2009, at 9:24 AM, Jeppe Nejsum Madsen wrote:

 Ross Mellgren dri...@gmail.com writes:
 
 I'm not sure if this addresses your points, but I figured I'd throw  
 out what I've been doing in case it helps.
 
 It's always nice to see how others approach a problem!
 
 I don't use -%, but I do use something similar along with another  
 implicit so I can place the attrs in exactly the right place, and it  
 automagically combines class and style attributes correctly. Some  
 example code:
 
 bind(user, loginXhtml,
  email - (FocusOnLoad(input type=Text name=username  
 id=email class=text / %% currentPrefixedAttrs(input)),
  ...)
 
 Much cleaner than my version :-)
 
 I think personally that the default behavior of bind is correct and  
 least surprising, since (at least for me and the applications I have)  
 it's very common that a single bound tag does not map one to one to a  
 result elem.
 
 I don't think I disagree that the current bind is very clean and easy to
 understand. I guess the bind use cases can be divided in two:
 
 1) The bound element is (conceptually) replaced with a single element
 e.g an input field. I think the example above falls in this category
 even if it outputs several elements (ie input, script etc)
 
 2) The bound element is replaced with a more complex NodeSeq.
 
 The current bind works fine for 2), but 1) I think can be made
 easier. Your approach is a step in the right direction, but I still feel
 there's too much boilerplate. Basically it should be natural to always
 use this approach whenever a single element is (conceptually)
 output. That way it's easy to add/change attributes in the template
 afterwards without changing the bind code.
 
 /Jeppe
 
 
 [...]
 
 --
 
 You received this message because you are subscribed to the Google Groups 
 Lift group.
 To post to this group, send email to lift...@googlegroups.com.
 To unsubscribe from this group, send email to 
 liftweb+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/liftweb?hl=en.
 
 

--

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




[Lift] Re: How to get the servlet context

2009-11-28 Thread jhonig

 Use explicitly imports, thus avoiding these problems:

But the problem is knowing what to import :-)   When there's no IDE
support, all one
has are the scaladocs...   And *none* of the lift examples I found
uses explicit imports,
so you're on your own...

Job

--

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