[Lift] Derby Identity column DDL and SQL insert scripts

2009-10-02 Thread Ewan

All

Using Derby and have hit an issue when running some SQL scripts to
insert data into a fresh mapper DB created by schemifier.
Specifically when inserting records with the id column I get a
violation:

Error: Attempt to modify an identity column 'ID'.
SQLState:  42Z23
ErrorCode: -1

i.e data can't be inserted into this column which is not helpful when
this id is the primary key and foreign key on another table.  Derby
does support auto-incremented sequence values as *default only* when
you are not providing values as opposed to always providing auto-
incremented sequence values which you are not allowed to specify your
own values.  The difference is GENERATED BY DEFAULT AS IDENTITY
instead of GENERATED ALWAYS AS IDENTITY.

To this end it looks like net.liftweb.mapper.DerbyDriver.scala needs
updating from
  def integerIndexColumnType = INTEGER NOT NULL GENERATED ALWAYS AS
IDENTITY
  def longIndexColumnType = BIGINT NOT NULL GENERATED ALWAYS AS
IDENTITY

to
  def integerIndexColumnType = INTEGER NOT NULL GENERATED BY DEFAULT
AS IDENITY
  def longIndexColumnType = BIGINT NOT NULL GENERATED BY DEFAULT AS
IDENTITY

Hope this helps

-- Ewan

--~--~-~--~~~---~--~~
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: Derby Identity column DDL and SQL insert scripts

2009-10-02 Thread Ewan

Done

On Oct 2, 1:49 pm, David Pollak feeder.of.the.be...@gmail.com wrote:
 Please open a ticket athttp://github.com/dpp/liftweb/issues



 On Fri, Oct 2, 2009 at 2:57 AM, Ewan ehar...@gmail.com wrote:

  All

  Using Derby and have hit an issue when running some SQL scripts to
  insert data into a fresh mapper DB created by schemifier.
  Specifically when inserting records with the id column I get a
  violation:

  Error: Attempt to modify an identity column 'ID'.
  SQLState:  42Z23
  ErrorCode: -1

  i.e data can't be inserted into this column which is not helpful when
  this id is the primary key and foreign key on another table.  Derby
  does support auto-incremented sequence values as *default only* when
  you are not providing values as opposed to always providing auto-
  incremented sequence values which you are not allowed to specify your
  own values.  The difference is GENERATED BY DEFAULT AS IDENTITY
  instead of GENERATED ALWAYS AS IDENTITY.

  To this end it looks like net.liftweb.mapper.DerbyDriver.scala needs
  updating from
   def integerIndexColumnType = INTEGER NOT NULL GENERATED ALWAYS AS
  IDENTITY
   def longIndexColumnType = BIGINT NOT NULL GENERATED ALWAYS AS
  IDENTITY

  to
   def integerIndexColumnType = INTEGER NOT NULL GENERATED BY DEFAULT
  AS IDENITY
   def longIndexColumnType = BIGINT NOT NULL GENERATED BY DEFAULT AS
  IDENTITY

  Hope this helps

  -- Ewan

 --
 Lift, the simply functional web frameworkhttp://liftweb.net
 Beginning Scalahttp://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 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: Binding - keepAttrs?

2009-09-18 Thread Ewan

I asked this only the day before (and got the answer) - might be worth
popping it on the wiki now.

On Sep 17, 9:58 pm, Naftoli Gugenheim naftoli...@gmail.com wrote:
 DPP added an attribute-preserving arrow: -%
 Then you can use unprefixed attributes.

 -

 Bryangerm...@gmail.com wrote:

 I am trying to update an old lift application I wrote using
 1.1-SNAPSHOT.  It looks like bind is no longer keeping the attributes
 I've defined in the template.

 bind(f, xhtml,
      pickupDate - keepAttrs(SHtml.text(pickupDate.is, pickupDate(_))),
      submit - SHtml.submit(Search, processSearch)
 )

 f:pickupDate f:id=pdate f:maxlength=10 f:size=10 /

 Renders as

 input value= type=text name=F812119230404JZF /

 But should be

 input value= type=text name=F812119230404JZF id=pdate
 maxlength=10 size=10 /

 Thanks,
 Bryan
--~--~-~--~~~---~--~~
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: Binding - keepAttrs?

2009-09-18 Thread Ewan

I'd be happy to do that.  One thing though is that the main binding
article still has examples of the old way which needs an update i.e.

# label for=first_name
#   User name example:first_name example:id=first_name /
# /label

which brings me on to a related issue where by -% does compile if the
argument is a String where as - does.  Is this intended?

/src/main/scala/org/harrow/findaholidaylet/snippet/
PropertySearch.scala:291: error: overloaded method value -% with
alternatives ((scala.xml.NodeSeq) = scala.xml.Elem)
net.liftweb.util.Helpers.FuncBindParam and (Option[scala.xml.Elem])
net.liftweb.util.Helpers.FuncBindParam and (net.liftweb.util.Box
[scala.xml.Elem])net.liftweb.util.Helpers.FuncBindParam and
(scala.xml.Elem)net.liftweb.util.Helpers.FuncBindParam cannot be
applied to (String)
   name -% r(name),
  ^
one error found


On Sep 18, 11:26 am, Naftoli Gugenheim naftoli...@gmail.com wrote:
 Or you can maybe insert it in the main binding article.

 -

 Timothy Perretttimo...@getintheloop.eu wrote:

 The wiki is open for all to edit.

 Can I suggest you call it How To: Preserve binding attributes

 Cheers, Tim

 On 18 Sep 2009, at 10:25, Ewan wrote:



  I asked this only the day before (and got the answer) - might be worth
  popping it on the wiki now.

  On Sep 17, 9:58 pm, Naftoli Gugenheim naftoli...@gmail.com wrote:
  DPP added an attribute-preserving arrow: -%
  Then you can use unprefixed attributes.

  -

  Bryangerm...@gmail.com wrote:

  I am trying to update an old lift application I wrote using
  1.1-SNAPSHOT.  It looks like bind is no longer keeping the attributes
  I've defined in the template.

  bind(f, xhtml,
       pickupDate - keepAttrs(SHtml.text(pickupDate.is, pickupDate
  (_))),
       submit - SHtml.submit(Search, processSearch)
  )

  f:pickupDate f:id=pdate f:maxlength=10 f:size=10 /

  Renders as

  input value= type=text name=F812119230404JZF /

  But should be

  input value= type=text name=F812119230404JZF id=pdate
  maxlength=10 size=10 /

  Thanks,
  Bryan


--~--~-~--~~~---~--~~
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: Binding - keepAttrs?

2009-09-18 Thread Ewan

Ah never mind... ahem strings are not xml and therefore trying to add
an attribute to them makes no sense...

On Sep 18, 12:58 pm, Ewan ehar...@gmail.com wrote:
 I'd be happy to do that.  One thing though is that the main binding
 article still has examples of the old way which needs an update i.e.

 #     label for=first_name
 #       User name example:first_name example:id=first_name /
 #     /label

 which brings me on to a related issue where by -% does compile if the
 argument is a String where as - does.  Is this intended?

 /src/main/scala/org/harrow/findaholidaylet/snippet/
 PropertySearch.scala:291: error: overloaded method value -% with
 alternatives ((scala.xml.NodeSeq) = scala.xml.Elem)
 net.liftweb.util.Helpers.FuncBindParam and (Option[scala.xml.Elem])
 net.liftweb.util.Helpers.FuncBindParam and (net.liftweb.util.Box
 [scala.xml.Elem])net.liftweb.util.Helpers.FuncBindParam and
 (scala.xml.Elem)net.liftweb.util.Helpers.FuncBindParam cannot be
 applied to (String)
                                                    name -% r(name),
                                                           ^
 one error found

 On Sep 18, 11:26 am, Naftoli Gugenheim naftoli...@gmail.com wrote:

  Or you can maybe insert it in the main binding article.

  -

  Timothy Perretttimo...@getintheloop.eu wrote:

  The wiki is open for all to edit.

  Can I suggest you call it How To: Preserve binding attributes

  Cheers, Tim

  On 18 Sep 2009, at 10:25, Ewan wrote:

   I asked this only the day before (and got the answer) - might be worth
   popping it on the wiki now.

   On Sep 17, 9:58 pm, Naftoli Gugenheim naftoli...@gmail.com wrote:
   DPP added an attribute-preserving arrow: -%
   Then you can use unprefixed attributes.

   -

   Bryangerm...@gmail.com wrote:

   I am trying to update an old lift application I wrote using
   1.1-SNAPSHOT.  It looks like bind is no longer keeping the attributes
   I've defined in the template.

   bind(f, xhtml,
        pickupDate - keepAttrs(SHtml.text(pickupDate.is, pickupDate
   (_))),
        submit - SHtml.submit(Search, processSearch)
   )

   f:pickupDate f:id=pdate f:maxlength=10 f:size=10 /

   Renders as

   input value= type=text name=F812119230404JZF /

   But should be

   input value= type=text name=F812119230404JZF id=pdate
   maxlength=10 size=10 /

   Thanks,
   Bryan


--~--~-~--~~~---~--~~
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] DB Log issue, escaping placeholders LoggedPreparedStatement.paramified()

2009-09-16 Thread Ewan

Derek

This one is for you I think.  After updating my Boot.scala with
revised DB.addLogFunc I have found an issue with logging prepared
statements.  My usecase is an insert/update that sets a MappedString -
this MappedString is to hold a url such as http://
www.northnorfolkholidaylet.com.  No problem there but if the url also
contains a query param the logger stacktraces (below).  The string
causing the problem is http://www.northnorfolkholidaylet.com?
property=33.  Looking at LoggingStatementWrappers.scala line 313 it
replaces prepared statements placeholders '?' with the the required
values but my string value introduces/injects an extra '?' which
causes it to fail badly.

Exception occured while processing /property/edit/5

Message: java.util.NoSuchElementException: key not found: 4
scala.collection.Map$class.default(Map.scala:169)
scala.collection.immutable.Map3.default(Map3.scala:22)
scala.collection.Map$class.apply(Map.scala:80)
scala.collection.immutable.Map3.apply(Map3.scala:22)
net.liftweb.mapper.LoggedPreparedStatement.substitute$1
(LoggingStatementWrappers.scala:315)
net.liftweb.mapper.LoggedPreparedStatement.net$liftweb$mapper
$LoggedPreparedStatement$$paramified(LoggingStatementWrappers.scala:
318)
net.liftweb.mapper.LoggedPreparedStatement$$anonfun$executeUpdate
$9.apply(LoggingStatementWrappers.scala:347)
net.liftweb.mapper.LoggedPreparedStatement$$anonfun$executeUpdate
$9.apply(LoggingStatementWrappers.scala:347)
net.liftweb.mapper.DBLog$class.logStatement
(LoggingStatementWrappers.scala:46)
net.liftweb.mapper.LoggedStatement.logStatement
(LoggingStatementWrappers.scala:71)
net.liftweb.mapper.LoggedPreparedStatement.executeUpdate
(LoggingStatementWrappers.scala:347)
net.liftweb.mapper.MetaMapper$$anonfun$14$$anonfun$15.apply
(MetaMapper.scala:653)
net.liftweb.mapper.MetaMapper$$anonfun$14$$anonfun$15.apply
(MetaMapper.scala:636)
net.liftweb.mapper.DB$$anonfun$runPreparedStatement$1.apply(DB.scala:
375)
net.liftweb.mapper.DB$$anonfun$runPreparedStatement$1.apply(DB.scala:
372)
net.liftweb.util.TimeHelpers$class.calcTime(TimeHelpers.scala:241)
net.liftweb.util.Helpers$.calcTime(Helpers.scala:29)
net.liftweb.mapper.DB$.runPreparedStatement(DB.scala:372)
net.liftweb.mapper.DB$.prepareStatement(DB.scala:316)
net.liftweb.mapper.MetaMapper$$anonfun$14.apply(MetaMapper.scala:635)
net.liftweb.mapper.MetaMapper$$anonfun$14.apply(MetaMapper.scala:630)
net.liftweb.mapper.DB$.use(DB.scala:389)
net.liftweb.mapper.MetaMapper$class.save(MetaMapper.scala:629)
org.harrow.findaholidaylet.model.Property$.save(Property.scala:98)

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



[Lift] How to XHTML and embedded snippets

2009-09-16 Thread Ewan

I'd like to pop the bound value from a snippet into some standard
xhtml tags but it does not parse.  In the case below I want the url to
be put into the img tag where property:imageUrl/ is bound to ta
snippet.

img src=property:imageUrl/  style=border:3px solid #CC
width=75 height=100/

I am unable to do this so as a work around I get the snippet to create
the xhtml img tag but is there a way to achieve the above as I don't
want to change scala src for every minor ui change.

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



[Lift] Re: How to XHTML and embedded snippets

2009-09-16 Thread Ewan

Thanks but I still have no joy.  My snippet binding is as follows:

property.map ({ p =
bind(property, html,
 id - p.id,
 name - p.name,
 image - img src={p.imageUrl.is}/)
}) openOr notFound

with the following xhtml:

lift:Property.view form=POST

property:image property:style=border:3px solid #CC
property:width=75 property:height=100 /

/lift:Property.view

and the result is always the img tag with the src attrib that I
supplied in the binding i.e. the style, width and height are not
merged.  Code like this in the Lift book (pops a timestamp in a div)
does not work (merge attribs) either.

Any ideas what I am doing wrong?

-- Ewan

On Sep 16, 11:56 am, Timothy Perrett timo...@getintheloop.eu wrote:
 I think id do:

 lift:MySnippet.example
   whatever:demo whatever:src=something.jpg whatever:style=border:
 black /
 /lift:MySnippet.example

 then in the scala:

 class MySnippet {
   def example(xhtml: NodeSeq):NodeSeq = bind(whatever, xhtml,
     demo - img /

 }

 Basically, when attributes are name-spaced correctly, they are merged
 into the node attributes. This is all from memory so might need a
 slight change to compile properly.

 Cheers, Tim

 On Sep 16, 11:49 am, Viktor Klang viktor.kl...@gmail.com wrote:

  On Wed, Sep 16, 2009 at 12:37 PM, Ewan ehar...@gmail.com wrote:

   I'd like to pop the bound value from a snippet into some standard
   xhtml tags but it does not parse.  In the case below I want the url to
   be put into the img tag where property:imageUrl/ is bound to ta
   snippet.

   img src=property:imageUrl/  style=border:3px solid #CC
   width=75 height=100/

  Have a snippet that simply adds the src attribute to the supplied markup

  lift:img src=imageUrl
     img style=fooo width=75 height=100/
  /lift:img

   I am unable to do this so as a work around I get the snippet to create
   the xhtml img tag but is there a way to achieve the above as I don't
   want to change scala src for every minor ui change.

   -- Ewan

  --
  Viktor Klang

  Blog: klangism.blogspot.com
  Twttr: viktorklang

  Lift Committer - liftweb.com
  AKKA Committer - akkasource.org
  Cassidy - github.com/viktorklang/Cassidy.git
  SoftPub founder:http://groups.google.com/group/softpub


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



[Lift] Re: How to XHTML and embedded snippets

2009-09-16 Thread Ewan

Thank you - all works if I replace

image - img src={p.imageUrl.is}/

with

image -% img src={p.imageUrl.is}/

which results in the expected

img src=http://clients.vc-ltd.co.uk/burnham2/photos/rose.jpg;
height=100 width=75 style=border:3px solid #CC /

-- Ewan

On Sep 16, 2:40 pm, Naftoli Gugenheim naftoli...@gmail.com wrote:
 Tim is right that it worked that way, but apparently that code was committed 
 before the review board was in place :) because DPP wasn't happy with it and 
 took it out. Instead you can use -% to bind and preserve all attributes.

 -

 Ewanehar...@gmail.com wrote:

 Thanks but I still have no joy.  My snippet binding is as follows:

 property.map ({ p =
         bind(property, html,
              id - p.id,
              name - p.name,
              image - img src={p.imageUrl.is}/)
     }) openOr notFound

 with the following xhtml:

         lift:Property.view form=POST
                 
                 property:image property:style=border:3px solid #CC
 property:width=75 property:height=100 /
                 
         /lift:Property.view

 and the result is always the img tag with the src attrib that I
 supplied in the binding i.e. the style, width and height are not
 merged.  Code like this in the Lift book (pops a timestamp in a div)
 does not work (merge attribs) either.

 Any ideas what I am doing wrong?

 -- Ewan

 On Sep 16, 11:56?am, Timothy Perrett timo...@getintheloop.eu wrote:

  I think id do:

  lift:MySnippet.example
  ? whatever:demo whatever:src=something.jpg whatever:style=border:
  black /
  /lift:MySnippet.example

  then in the scala:

  class MySnippet {
  ? def example(xhtml: NodeSeq):NodeSeq = bind(whatever, xhtml,
  ? ? demo - img /

  }

  Basically, when attributes are name-spaced correctly, they are merged
  into the node attributes. This is all from memory so might need a
  slight change to compile properly.

  Cheers, Tim

  On Sep 16, 11:49?am, Viktor Klang viktor.kl...@gmail.com wrote:

   On Wed, Sep 16, 2009 at 12:37 PM, Ewan ehar...@gmail.com wrote:

I'd like to pop the bound value from a snippet into some standard
xhtml tags but it does not parse. ?In the case below I want the url to
be put into the img tag where property:imageUrl/ is bound to ta
snippet.

img src=property:imageUrl/ ?style=border:3px solid #CC
width=75 height=100/

   Have a snippet that simply adds the src attribute to the supplied markup

   lift:img src=imageUrl
   ? ?img style=fooo width=75 height=100/
   /lift:img

I am unable to do this so as a work around I get the snippet to create
the xhtml img tag but is there a way to achieve the above as I don't
want to change scala src for every minor ui change.

-- Ewan

   --
   Viktor Klang

   Blog: klangism.blogspot.com
   Twttr: viktorklang

   Lift Committer - liftweb.com
   AKKA Committer - akkasource.org
   Cassidy - github.com/viktorklang/Cassidy.git
   SoftPub founder:http://groups.google.com/group/softpub


--~--~-~--~~~---~--~~
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: DB Log issue, escaping placeholders LoggedPreparedStatement.paramified()

2009-09-16 Thread Ewan

Thx

On Sep 16, 5:52 pm, Derek Chen-Becker dchenbec...@gmail.com wrote:
 http://reviewboard.liftweb.net/r/7/

 Once that gets approved I'll check it into trunk and Hudson will have it
 built shortly.

 Derek

 On Wed, Sep 16, 2009 at 10:35 AM, Derek Chen-Becker
 dchenbec...@gmail.comwrote:

  OK, I see where I broke things. Let me fix this.

  Derek

  On Wed, Sep 16, 2009 at 1:56 AM, Ewan ehar...@gmail.com wrote:

  Derek

  This one is for you I think.  After updating my Boot.scala with
  revised DB.addLogFunc I have found an issue with logging prepared
  statements.  My usecase is an insert/update that sets a MappedString -
  this MappedString is to hold a url such as http://
 www.northnorfolkholidaylet.com.  No problem there but if the url also
  contains a query param the logger stacktraces (below).  The string
  causing the problem is http://www.northnorfolkholidaylet.com?
  property=33.  Looking at LoggingStatementWrappers.scala line 313 it
  replaces prepared statements placeholders '?' with the the required
  values but my string value introduces/injects an extra '?' which
  causes it to fail badly.

  Exception occured while processing /property/edit/5

  Message: java.util.NoSuchElementException: key not found: 4
         scala.collection.Map$class.default(Map.scala:169)
         scala.collection.immutable.Map3.default(Map3.scala:22)
         scala.collection.Map$class.apply(Map.scala:80)
         scala.collection.immutable.Map3.apply(Map3.scala:22)
         net.liftweb.mapper.LoggedPreparedStatement.substitute$1
  (LoggingStatementWrappers.scala:315)
         net.liftweb.mapper.LoggedPreparedStatement.net$liftweb$mapper
  $LoggedPreparedStatement$$paramified(LoggingStatementWrappers.scala:
  318)
         net.liftweb.mapper.LoggedPreparedStatement$$anonfun$executeUpdate
  $9.apply(LoggingStatementWrappers.scala:347)
         net.liftweb.mapper.LoggedPreparedStatement$$anonfun$executeUpdate
  $9.apply(LoggingStatementWrappers.scala:347)
         net.liftweb.mapper.DBLog$class.logStatement
  (LoggingStatementWrappers.scala:46)
         net.liftweb.mapper.LoggedStatement.logStatement
  (LoggingStatementWrappers.scala:71)
         net.liftweb.mapper.LoggedPreparedStatement.executeUpdate
  (LoggingStatementWrappers.scala:347)
         net.liftweb.mapper.MetaMapper$$anonfun$14$$anonfun$15.apply
  (MetaMapper.scala:653)
         net.liftweb.mapper.MetaMapper$$anonfun$14$$anonfun$15.apply
  (MetaMapper.scala:636)

   net.liftweb.mapper.DB$$anonfun$runPreparedStatement$1.apply(DB.scala:
  375)

   net.liftweb.mapper.DB$$anonfun$runPreparedStatement$1.apply(DB.scala:
  372)
         net.liftweb.util.TimeHelpers$class.calcTime(TimeHelpers.scala:241)
         net.liftweb.util.Helpers$.calcTime(Helpers.scala:29)
         net.liftweb.mapper.DB$.runPreparedStatement(DB.scala:372)
         net.liftweb.mapper.DB$.prepareStatement(DB.scala:316)

   net.liftweb.mapper.MetaMapper$$anonfun$14.apply(MetaMapper.scala:635)

   net.liftweb.mapper.MetaMapper$$anonfun$14.apply(MetaMapper.scala:630)
         net.liftweb.mapper.DB$.use(DB.scala:389)
         net.liftweb.mapper.MetaMapper$class.save(MetaMapper.scala:629)
         org.harrow.findaholidaylet.model.Property$.save(Property.scala:98)

  -- Ewan


--~--~-~--~~~---~--~~
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: DB Log issue, escaping placeholders LoggedPreparedStatement.paramified()

2009-09-16 Thread Ewan

All working now.

ta

On Sep 16, 6:47 pm, Derek Chen-Becker dchenbec...@gmail.com wrote:
 It's checked into the build. Hudson is building it now.

 On Wed, Sep 16, 2009 at 11:33 AM, Ewan ehar...@gmail.com wrote:

  Thx

  On Sep 16, 5:52 pm, Derek Chen-Becker dchenbec...@gmail.com wrote:
  http://reviewboard.liftweb.net/r/7/

   Once that gets approved I'll check it into trunk and Hudson will have it
   built shortly.

   Derek

   On Wed, Sep 16, 2009 at 10:35 AM, Derek Chen-Becker
   dchenbec...@gmail.comwrote:

OK, I see where I broke things. Let me fix this.

Derek

On Wed, Sep 16, 2009 at 1:56 AM, Ewan ehar...@gmail.com wrote:

Derek

This one is for you I think.  After updating my Boot.scala with
revised DB.addLogFunc I have found an issue with logging prepared
statements.  My usecase is an insert/update that sets a MappedString -
this MappedString is to hold a url such as http://
   www.northnorfolkholidaylet.com.  No problem there but if the url also
contains a query param the logger stacktraces (below).  The string
causing the problem is http://www.northnorfolkholidaylet.com?
property=33.  Looking at LoggingStatementWrappers.scala line 313 it
replaces prepared statements placeholders '?' with the the required
values but my string value introduces/injects an extra '?' which
causes it to fail badly.

Exception occured while processing /property/edit/5

Message: java.util.NoSuchElementException: key not found: 4
       scala.collection.Map$class.default(Map.scala:169)
       scala.collection.immutable.Map3.default(Map3.scala:22)
       scala.collection.Map$class.apply(Map.scala:80)
       scala.collection.immutable.Map3.apply(Map3.scala:22)
       net.liftweb.mapper.LoggedPreparedStatement.substitute$1
(LoggingStatementWrappers.scala:315)
       net.liftweb.mapper.LoggedPreparedStatement.net$liftweb$mapper
$LoggedPreparedStatement$$paramified(LoggingStatementWrappers.scala:
318)

   net.liftweb.mapper.LoggedPreparedStatement$$anonfun$executeUpdate
$9.apply(LoggingStatementWrappers.scala:347)

   net.liftweb.mapper.LoggedPreparedStatement$$anonfun$executeUpdate
$9.apply(LoggingStatementWrappers.scala:347)
       net.liftweb.mapper.DBLog$class.logStatement
(LoggingStatementWrappers.scala:46)
       net.liftweb.mapper.LoggedStatement.logStatement
(LoggingStatementWrappers.scala:71)
       net.liftweb.mapper.LoggedPreparedStatement.executeUpdate
(LoggingStatementWrappers.scala:347)
       net.liftweb.mapper.MetaMapper$$anonfun$14$$anonfun$15.apply
(MetaMapper.scala:653)
       net.liftweb.mapper.MetaMapper$$anonfun$14$$anonfun$15.apply
(MetaMapper.scala:636)

 net.liftweb.mapper.DB$$anonfun$runPreparedStatement$1.apply(DB.scala:
375)

 net.liftweb.mapper.DB$$anonfun$runPreparedStatement$1.apply(DB.scala:
372)

   net.liftweb.util.TimeHelpers$class.calcTime(TimeHelpers.scala:241)
       net.liftweb.util.Helpers$.calcTime(Helpers.scala:29)
       net.liftweb.mapper.DB$.runPreparedStatement(DB.scala:372)
       net.liftweb.mapper.DB$.prepareStatement(DB.scala:316)

 net.liftweb.mapper.MetaMapper$$anonfun$14.apply(MetaMapper.scala:635)

 net.liftweb.mapper.MetaMapper$$anonfun$14.apply(MetaMapper.scala:630)
       net.liftweb.mapper.DB$.use(DB.scala:389)
       net.liftweb.mapper.MetaMapper$class.save(MetaMapper.scala:629)

   org.harrow.findaholidaylet.model.Property$.save(Property.scala:98)

-- Ewan


--~--~-~--~~~---~--~~
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] java.lang.ClassCastException: net.liftweb.mapper.LoggedPreparedStatement cannot be cast to java.lang.String

2009-09-15 Thread Ewan

Hi all

I see that the SQL logging has been merged in into the 1.1-SNAPSHOT.
I am finding on a reload the following exception is logged in the
console.

java.lang.ClassCastException:
net.liftweb.mapper.LoggedPreparedStatement cannot be cast to
java.lang.String
at bootstrap.liftweb.Boot$$anonfun$boot$3.apply(Boot.scala:70)
at net.liftweb.mapper.DB$$anonfun$runLogger$1.apply(DB.scala:181)
at net.liftweb.mapper.DB$$anonfun$runLogger$1.apply(DB.scala:181)
at scala.List.foreach(List.scala:841)
at net.liftweb.mapper.DB$.runLogger(DB.scala:181)
at net.liftweb.mapper.DB$.exec(DB.scala:301)
at net.liftweb.mapper.KeyedMetaMapper$$anonfun$findDb$2$$anonfun$apply
$35.apply(MetaMapper.scala:1432)
at net.liftweb.mapper.KeyedMetaMapper$$anonfun$findDb$2$$anonfun$apply
$35.apply(MetaMapper.scala:1430)
at net.liftweb.mapper.DB$$anonfun$runPreparedStatement$1.apply
(DB.scala:375)
at net.liftweb.mapper.DB$$anonfun$runPreparedStatement$1.apply
(DB.scala:372)
at net.liftweb.util.TimeHelpers$class.calcTime(TimeHelpers.scala:241)
at net.liftweb.util.Helpers$.calcTime(Helpers.scala:29)
at net.liftweb.mapper.DB$.runPreparedStatement(DB.scala:372)
at net.liftweb.mapper.DB$.prepareStatement(DB.scala:316)
at net.liftweb.mapper.KeyedMetaMapper$$anonfun$findDb$2.apply
(MetaMapper.scala:1429)
at net.liftweb.mapper.KeyedMetaMapper$$anonfun$findDb$2.apply
(MetaMapper.scala:1423)
at net.liftweb.mapper.DB$.use(DB.scala:389)
at net.liftweb.mapper.KeyedMetaMapper$class.findDb(MetaMapper.scala:
1422)
at org.harrow.findaholidaylet.model.User$.findDb(User.scala:22)
at net.liftweb.mapper.KeyedMetaMapper$class.findDb(MetaMapper.scala:
1418)
at org.harrow.findaholidaylet.model.User$.findDb(User.scala:22)
at net.liftweb.mapper.KeyedMetaMapper$class.find(MetaMapper.scala:
1415)
at org.harrow.findaholidaylet.model.User$.find(User.scala:22)
at org.harrow.findaholidaylet.model.User$.createAdminUser(User.scala:
28)
at bootstrap.liftweb.Boot.boot(Boot.scala:89)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at net.liftweb.util.ClassHelpers$$anonfun$createInvoker$1.apply
(ClassHelpers.scala:408)
at net.liftweb.util.ClassHelpers$$anonfun$createInvoker$1.apply
(ClassHelpers.scala:406)
at net.liftweb.http.DefaultBootstrap$$anonfun$boot$1.apply
(LiftRules.scala:1087)
at net.liftweb.http.DefaultBootstrap$$anonfun$boot$1.apply
(LiftRules.scala:1087)
at net.liftweb.util.Full.map(Box.scala:330)
at net.liftweb.http.DefaultBootstrap$.boot(LiftRules.scala:1087)
at net.liftweb.http.provider.HTTPProvider$class.bootLift
(HTTPProvider.scala:69)
at net.liftweb.http.LiftFilter.bootLift(LiftServlet.scala:507)
at net.liftweb.http.provider.servlet.ServletFilterProvider$class.init
(ServletFilterProvider.scala:19)
at net.liftweb.http.LiftFilter.init(LiftServlet.scala:507)
at org.mortbay.jetty.servlet.FilterHolder.doStart(FilterHolder.java:
97)
at org.mortbay.component.AbstractLifeCycle.start
(AbstractLifeCycle.java:50)
at org.mortbay.jetty.servlet.ServletHandler.initialize
(ServletHandler.java:658)
at org.mortbay.jetty.servlet.Context.startContext(Context.java:140)
at org.mortbay.jetty.webapp.WebAppContext.startContext
(WebAppContext.java:1250)
at org.mortbay.jetty.handler.ContextHandler.doStart
(ContextHandler.java:517)
at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:
467)
at org.mortbay.jetty.plugin.Jetty6PluginWebAppContext.doStart
(Jetty6PluginWebAppContext.java:124)
at org.mortbay.component.AbstractLifeCycle.start
(AbstractLifeCycle.java:50)
at org.mortbay.jetty.plugin.AbstractJettyRunMojo.restartWebApp
(AbstractJettyRunMojo.java:458)
at org.mortbay.jetty.plugin.AbstractJettyRunMojo$1.filesChanged
(AbstractJettyRunMojo.java:419)
at org.mortbay.util.Scanner.reportBulkChanges(Scanner.java:486)
at org.mortbay.util.Scanner.reportDifferences(Scanner.java:352)
at org.mortbay.util.Scanner.scan(Scanner.java:280)
at org.mortbay.util.Scanner$1.run(Scanner.java:232)
at java.util.TimerThread.mainLoop(Timer.java:512)
at java.util.TimerThread.run(Timer.java:462)
[INFO] Restart completed at Tue Sep 15 19:50:31 BST 2009

I'm running on Derby if that helps.

-- Ewan

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

[Lift] Re: java.lang.ClassCastException: net.liftweb.mapper.LoggedPreparedStatement cannot be cast to java.lang.String

2009-09-15 Thread Ewan

The culprit from Boot.scala line 70...

DB.addLogFunc((query, time) = Log.info(query+: +time+ms))

What do I need to change this for the updated SQL logging you added?

thx

-- Ewan

On Sep 15, 8:56 pm, Derek Chen-Becker dchenbec...@gmail.com wrote:
 If it still happens for you, please send me your Boot.scala file, since
 that's where the exception is being thrown (line 70)

 Derek

 On Tue, Sep 15, 2009 at 12:54 PM, Ewan ehar...@gmail.com wrote:

  Hi all

  I see that the SQL logging has been merged in into the 1.1-SNAPSHOT.
  I am finding on a reload the following exception is logged in the
  console.

  java.lang.ClassCastException:
  net.liftweb.mapper.LoggedPreparedStatement cannot be cast to
  java.lang.String
         at bootstrap.liftweb.Boot$$anonfun$boot$3.apply(Boot.scala:70)
         at net.liftweb.mapper.DB$$anonfun$runLogger$1.apply(DB.scala:181)
         at net.liftweb.mapper.DB$$anonfun$runLogger$1.apply(DB.scala:181)
         at scala.List.foreach(List.scala:841)
         at net.liftweb.mapper.DB$.runLogger(DB.scala:181)
         at net.liftweb.mapper.DB$.exec(DB.scala:301)
         at
  net.liftweb.mapper.KeyedMetaMapper$$anonfun$findDb$2$$anonfun$apply
  $35.apply(MetaMapper.scala:1432)
         at
  net.liftweb.mapper.KeyedMetaMapper$$anonfun$findDb$2$$anonfun$apply
  $35.apply(MetaMapper.scala:1430)
         at net.liftweb.mapper.DB$$anonfun$runPreparedStatement$1.apply
  (DB.scala:375)
         at net.liftweb.mapper.DB$$anonfun$runPreparedStatement$1.apply
  (DB.scala:372)
         at
  net.liftweb.util.TimeHelpers$class.calcTime(TimeHelpers.scala:241)
         at net.liftweb.util.Helpers$.calcTime(Helpers.scala:29)
         at net.liftweb.mapper.DB$.runPreparedStatement(DB.scala:372)
         at net.liftweb.mapper.DB$.prepareStatement(DB.scala:316)
         at net.liftweb.mapper.KeyedMetaMapper$$anonfun$findDb$2.apply
  (MetaMapper.scala:1429)
         at net.liftweb.mapper.KeyedMetaMapper$$anonfun$findDb$2.apply
  (MetaMapper.scala:1423)
         at net.liftweb.mapper.DB$.use(DB.scala:389)
         at net.liftweb.mapper.KeyedMetaMapper$class.findDb(MetaMapper.scala:
  1422)
         at org.harrow.findaholidaylet.model.User$.findDb(User.scala:22)
         at net.liftweb.mapper.KeyedMetaMapper$class.findDb(MetaMapper.scala:
  1418)
         at org.harrow.findaholidaylet.model.User$.findDb(User.scala:22)
         at net.liftweb.mapper.KeyedMetaMapper$class.find(MetaMapper.scala:
  1415)
         at org.harrow.findaholidaylet.model.User$.find(User.scala:22)
         at
  org.harrow.findaholidaylet.model.User$.createAdminUser(User.scala:
  28)
         at bootstrap.liftweb.Boot.boot(Boot.scala:89)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke
  (NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke
  (DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:597)
         at net.liftweb.util.ClassHelpers$$anonfun$createInvoker$1.apply
  (ClassHelpers.scala:408)
         at net.liftweb.util.ClassHelpers$$anonfun$createInvoker$1.apply
  (ClassHelpers.scala:406)
         at net.liftweb.http.DefaultBootstrap$$anonfun$boot$1.apply
  (LiftRules.scala:1087)
         at net.liftweb.http.DefaultBootstrap$$anonfun$boot$1.apply
  (LiftRules.scala:1087)
         at net.liftweb.util.Full.map(Box.scala:330)
         at net.liftweb.http.DefaultBootstrap$.boot(LiftRules.scala:1087)
         at net.liftweb.http.provider.HTTPProvider$class.bootLift
  (HTTPProvider.scala:69)
         at net.liftweb.http.LiftFilter.bootLift(LiftServlet.scala:507)
         at
  net.liftweb.http.provider.servlet.ServletFilterProvider$class.init
  (ServletFilterProvider.scala:19)
         at net.liftweb.http.LiftFilter.init(LiftServlet.scala:507)
         at org.mortbay.jetty.servlet.FilterHolder.doStart(FilterHolder.java:
  97)
         at org.mortbay.component.AbstractLifeCycle.start
  (AbstractLifeCycle.java:50)
         at org.mortbay.jetty.servlet.ServletHandler.initialize
  (ServletHandler.java:658)
         at org.mortbay.jetty.servlet.Context.startContext(Context.java:140)
         at org.mortbay.jetty.webapp.WebAppContext.startContext
  (WebAppContext.java:1250)
         at org.mortbay.jetty.handler.ContextHandler.doStart
  (ContextHandler.java:517)
         at
  org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:
  467)
         at org.mortbay.jetty.plugin.Jetty6PluginWebAppContext.doStart
  (Jetty6PluginWebAppContext.java:124)
         at org.mortbay.component.AbstractLifeCycle.start
  (AbstractLifeCycle.java:50)
         at org.mortbay.jetty.plugin.AbstractJettyRunMojo.restartWebApp
  (AbstractJettyRunMojo.java:458)
         at org.mortbay.jetty.plugin.AbstractJettyRunMojo$1.filesChanged
  (AbstractJettyRunMojo.java:419)
         at org.mortbay.util.Scanner.reportBulkChanges(Scanner.java:486

[Lift] Re: java.lang.ClassCastException: net.liftweb.mapper.LoggedPreparedStatement cannot be cast to java.lang.String

2009-09-15 Thread Ewan

Thanks I'll give that a go.

On Sep 15, 10:03 pm, Derek Chen-Becker dchenbec...@gmail.com wrote:
 See this post for some examples:

 http://groups.google.com/group/liftweb/browse_thread/thread/36b9080de...



 On Tue, Sep 15, 2009 at 2:43 PM, Ewan ehar...@gmail.com wrote:

  The culprit from Boot.scala line 70...

     DB.addLogFunc((query, time) = Log.info(query+: +time+ms))

  What do I need to change this for the updated SQL logging you added?

  thx

  -- Ewan

  On Sep 15, 8:56 pm, Derek Chen-Becker dchenbec...@gmail.com wrote:
   If it still happens for you, please send me your Boot.scala file, since
   that's where the exception is being thrown (line 70)

   Derek

   On Tue, Sep 15, 2009 at 12:54 PM, Ewan ehar...@gmail.com wrote:

Hi all

I see that the SQL logging has been merged in into the 1.1-SNAPSHOT.
I am finding on a reload the following exception is logged in the
console.

java.lang.ClassCastException:
net.liftweb.mapper.LoggedPreparedStatement cannot be cast to
java.lang.String
       at bootstrap.liftweb.Boot$$anonfun$boot$3.apply(Boot.scala:70)
       at
  net.liftweb.mapper.DB$$anonfun$runLogger$1.apply(DB.scala:181)
       at
  net.liftweb.mapper.DB$$anonfun$runLogger$1.apply(DB.scala:181)
       at scala.List.foreach(List.scala:841)
       at net.liftweb.mapper.DB$.runLogger(DB.scala:181)
       at net.liftweb.mapper.DB$.exec(DB.scala:301)
       at
net.liftweb.mapper.KeyedMetaMapper$$anonfun$findDb$2$$anonfun$apply
$35.apply(MetaMapper.scala:1432)
       at
net.liftweb.mapper.KeyedMetaMapper$$anonfun$findDb$2$$anonfun$apply
$35.apply(MetaMapper.scala:1430)
       at net.liftweb.mapper.DB$$anonfun$runPreparedStatement$1.apply
(DB.scala:375)
       at net.liftweb.mapper.DB$$anonfun$runPreparedStatement$1.apply
(DB.scala:372)
       at
net.liftweb.util.TimeHelpers$class.calcTime(TimeHelpers.scala:241)
       at net.liftweb.util.Helpers$.calcTime(Helpers.scala:29)
       at net.liftweb.mapper.DB$.runPreparedStatement(DB.scala:372)
       at net.liftweb.mapper.DB$.prepareStatement(DB.scala:316)
       at net.liftweb.mapper.KeyedMetaMapper$$anonfun$findDb$2.apply
(MetaMapper.scala:1429)
       at net.liftweb.mapper.KeyedMetaMapper$$anonfun$findDb$2.apply
(MetaMapper.scala:1423)
       at net.liftweb.mapper.DB$.use(DB.scala:389)
       at
  net.liftweb.mapper.KeyedMetaMapper$class.findDb(MetaMapper.scala:
1422)
       at org.harrow.findaholidaylet.model.User$.findDb(User.scala:22)
       at
  net.liftweb.mapper.KeyedMetaMapper$class.findDb(MetaMapper.scala:
1418)
       at org.harrow.findaholidaylet.model.User$.findDb(User.scala:22)
       at
  net.liftweb.mapper.KeyedMetaMapper$class.find(MetaMapper.scala:
1415)
       at org.harrow.findaholidaylet.model.User$.find(User.scala:22)
       at
org.harrow.findaholidaylet.model.User$.createAdminUser(User.scala:
28)
       at bootstrap.liftweb.Boot.boot(Boot.scala:89)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:597)
       at net.liftweb.util.ClassHelpers$$anonfun$createInvoker$1.apply
(ClassHelpers.scala:408)
       at net.liftweb.util.ClassHelpers$$anonfun$createInvoker$1.apply
(ClassHelpers.scala:406)
       at net.liftweb.http.DefaultBootstrap$$anonfun$boot$1.apply
(LiftRules.scala:1087)
       at net.liftweb.http.DefaultBootstrap$$anonfun$boot$1.apply
(LiftRules.scala:1087)
       at net.liftweb.util.Full.map(Box.scala:330)
       at net.liftweb.http.DefaultBootstrap$.boot(LiftRules.scala:1087)
       at net.liftweb.http.provider.HTTPProvider$class.bootLift
(HTTPProvider.scala:69)
       at net.liftweb.http.LiftFilter.bootLift(LiftServlet.scala:507)
       at
net.liftweb.http.provider.servlet.ServletFilterProvider$class.init
(ServletFilterProvider.scala:19)
       at net.liftweb.http.LiftFilter.init(LiftServlet.scala:507)
       at
  org.mortbay.jetty.servlet.FilterHolder.doStart(FilterHolder.java:
97)
       at org.mortbay.component.AbstractLifeCycle.start
(AbstractLifeCycle.java:50)
       at org.mortbay.jetty.servlet.ServletHandler.initialize
(ServletHandler.java:658)
       at
  org.mortbay.jetty.servlet.Context.startContext(Context.java:140)
       at org.mortbay.jetty.webapp.WebAppContext.startContext
(WebAppContext.java:1250)
       at org.mortbay.jetty.handler.ContextHandler.doStart
(ContextHandler.java:517)
       at
org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:
467

[Lift] Re: CMS for Lift?

2009-08-18 Thread Ewan

I've been scratching my head about that one too.  I have used both
Alfresco and opencms to produce both dynamic and static and in the
case of dynamic they have their own servlet/filter to render the
content - I've not yet spent enough time working out how and if they
can be fitted together.

For me, having used Hybris (J2EE ecommerce engine with some CMS built
in), I'd like to be able to have page fragments in a template served
from the CMS (lift snippets presumably) that would be created/
maintained with some aspect of workflow by CMS user(s) in an
associated CMS lift webapp with funky (X)HTML editor support.  My web
guys, non-lift devs, can then sprinkle cms tags where appropriate.  A
tag might be lift:cms contentId=news count=5 order=ascending/
which would render the last five news items in ascending order.

Just some thoughts

-- Ewan

On Aug 18, 10:09 pm, Terry J. Leach terry.le...@gmail.com wrote:
 I would like to know how the Lift/Scala can leveraged to with Alfresco
 or any other open source Java based CMS.

 Terry J. Leach

 On Aug 17, 2:09 pm, Stefan Scott stefanscottal...@gmail.com wrote:

  I'll chime in here since I've been evaluating several CMSs lately.

  I previously used Drupal and WordPress as my CMSs - now however I'm
  moving everything to MODx because of the increased flexibility and
  more-logical organization, and I'm also impressed with the demos of
  SilverStripe, TypoLight Typo3 - and LifeRay, which is written in Java
  instead of PHP. (LifeRay seems to be much more than a CMS - it claims
  to offer collaboration and social networking.)

  Some on-line demos here:

  MODx -http://trymodx.com/
  SilverStripe -http://demo.silverstripe.com/
  TypoLight -http://www.typolight.org/demo.html
  Typo3 -http://testsite.punkt.de/
  LifeRay -http://demo.liferay.net/web/guest/home

  It would be good to take a look at these additional CMSs as they offer
  some capabilities beyond WordPress and Drupal.

  Drupal in particular is wildly popular but it may no longer be the
  best candidate to imitate, as it is less well-organized and less
  flexible/customizable (compared say to MODx, which lets you take CSS
  from an existing site and use it for your site, and which lets you
  apply a template to a single document, unlike Drupal where a theme
  applies to the entire site). To keep up with advanced CMSs, Drupal has
  evolved to use a bunch of (often redundant or competing) modules which
  are not always compatible with current releases. Examples of things
  that Drupal treats as add-ons (modules) are: custom content (the
  CCK/Views modules, with their confusing albeit AJAX-y interface),
  multi-language, and photo galleries (I gave up on Drupal after a few
  days of trying out various photo gallery modules, none of which I
  could understand). Finally, it seems odd that Drupal, as a content
  management system, lacks something all advanced CMSs have: a
  *treeview* of the overall site content. Instead, it only has a jumbled
  *list* of content, sorted by not by location but by last edited (!),
  with all translations also scattered through the list based on last-
  edited date, and this list is buried several levels deep in the admin
  navigation system, unlike the site content treeview navigator which is
  prominently displayed (usually on the left) in advanced CMSs. (Of
  course, I don't want to veer off-topic here and start a CMS flame war
  here in this liftweb discussion. :-)

  Regarding dynamic site map creation - I do know that MODx has
  something like this, using WayFinder to create a menu from selected
  branches of the site's document tree, automatically including any
  updated sub-branches, and I believe most other advanced CMSs have
  something like this too.

  LifeRay seems very intriguing - it claims to do a lot beyond just CMS.
  Since it's written in Java (not PHP), who knows if some of its code
  could be leveraged in Scala.

  So these might be some additional interesting CMSs to keep in mind
  (beyond Drupal and WordPress) when building a new CMS using liftweb.

  - Stefan Scott

  On Aug 16, 3:13 pm, glenn gl...@exmbly.com wrote:

   Philip,

   I'm working on a cms system in Lift. Right now, it allows for content
   creation using wymeditor, which can be
   tagged and displayed as an atom feed. This code is runnable, simple as
   it is. I'm working on adding dynamic site map creation as well. Is
   this kind
   of what you have in mind by a CMS system.

   I'm very interested in workiing with others on a CMS that can compete
   with any of the PHP varieties out there, such as Drupal and Wordpress.
   Most of these simply use plugins from one ore more javascript
   libraries out there for site creation, and Lift certainly  can do
   javascript as well as, if not
   better than, these systems.

   Glenn...

   On Aug 15, 11:08 pm, philip philip14...@gmail.com wrote:

Hi,

Has anyone made a CMS for Liftweb? or I should say, in liftweb.

Thanks, Philip

[Lift] Re: CMS for Lift?

2009-08-17 Thread Ewan

Also opencms and alfresco both Java/J2EE

On Aug 17, 7:09 pm, Stefan Scott stefanscottal...@gmail.com wrote:
 I'll chime in here since I've been evaluating several CMSs lately.

 I previously used Drupal and WordPress as my CMSs - now however I'm
 moving everything to MODx because of the increased flexibility and
 more-logical organization, and I'm also impressed with the demos of
 SilverStripe, TypoLight Typo3 - and LifeRay, which is written in Java
 instead of PHP. (LifeRay seems to be much more than a CMS - it claims
 to offer collaboration and social networking.)

 Some on-line demos here:

 MODx -http://trymodx.com/
 SilverStripe -http://demo.silverstripe.com/
 TypoLight -http://www.typolight.org/demo.html
 Typo3 -http://testsite.punkt.de/
 LifeRay -http://demo.liferay.net/web/guest/home

 It would be good to take a look at these additional CMSs as they offer
 some capabilities beyond WordPress and Drupal.

 Drupal in particular is wildly popular but it may no longer be the
 best candidate to imitate, as it is less well-organized and less
 flexible/customizable (compared say to MODx, which lets you take CSS
 from an existing site and use it for your site, and which lets you
 apply a template to a single document, unlike Drupal where a theme
 applies to the entire site). To keep up with advanced CMSs, Drupal has
 evolved to use a bunch of (often redundant or competing) modules which
 are not always compatible with current releases. Examples of things
 that Drupal treats as add-ons (modules) are: custom content (the
 CCK/Views modules, with their confusing albeit AJAX-y interface),
 multi-language, and photo galleries (I gave up on Drupal after a few
 days of trying out various photo gallery modules, none of which I
 could understand). Finally, it seems odd that Drupal, as a content
 management system, lacks something all advanced CMSs have: a
 *treeview* of the overall site content. Instead, it only has a jumbled
 *list* of content, sorted by not by location but by last edited (!),
 with all translations also scattered through the list based on last-
 edited date, and this list is buried several levels deep in the admin
 navigation system, unlike the site content treeview navigator which is
 prominently displayed (usually on the left) in advanced CMSs. (Of
 course, I don't want to veer off-topic here and start a CMS flame war
 here in this liftweb discussion. :-)

 Regarding dynamic site map creation - I do know that MODx has
 something like this, using WayFinder to create a menu from selected
 branches of the site's document tree, automatically including any
 updated sub-branches, and I believe most other advanced CMSs have
 something like this too.

 LifeRay seems very intriguing - it claims to do a lot beyond just CMS.
 Since it's written in Java (not PHP), who knows if some of its code
 could be leveraged in Scala.

 So these might be some additional interesting CMSs to keep in mind
 (beyond Drupal and WordPress) when building a new CMS using liftweb.

 - Stefan Scott

 On Aug 16, 3:13 pm, glenn gl...@exmbly.com wrote:



  Philip,

  I'm working on a cms system in Lift. Right now, it allows for content
  creation using wymeditor, which can be
  tagged and displayed as an atom feed. This code is runnable, simple as
  it is. I'm working on adding dynamic site map creation as well. Is
  this kind
  of what you have in mind by a CMS system.

  I'm very interested in workiing with others on a CMS that can compete
  with any of the PHP varieties out there, such as Drupal and Wordpress.
  Most of these simply use plugins from one ore more javascript
  libraries out there for site creation, and Lift certainly  can do
  javascript as well as, if not
  better than, these systems.

  Glenn...

  On Aug 15, 11:08 pm, philip philip14...@gmail.com wrote:

   Hi,

   Has anyone made a CMS for Liftweb? or I should say, in liftweb.

   Thanks, Philip

--~--~-~--~~~---~--~~
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: Need to be able to add a css class to a form input type if field error - how?

2009-08-12 Thread Ewan

Thanks that did the trick - very cool.  As a matter of scala I created
a method to determine if an error notice had been set (cribbed from
the Msg snippet) and would have preferred to pattern match on the list
itself rather than its length.  How from a scala style point of view
could I rewrite the following?

 private def isFieldError(id: String) = {
   S.messagesById(id)(S.errors).length match {
 case 0 = false
 case _ = true
   }
 }

-- Ewan

On Aug 12, 10:09 pm, David Pollak feeder.of.the.be...@gmail.com
wrote:
 In your snippet:

 import scala.xml.Null

 SHtml.text(value, value = _) % (if (errorCondition) (class - error)
 else Null)



 On Wed, Aug 12, 2009 at 12:01 PM, Ewan ehar...@gmail.com wrote:

  Guys

  When a form field/input type is in error I would like to set the css
  class to something like error so that I can decorate it by adding a
  red border around it.  In Struts2 I used to alter the freemarker
  template, which generated the appropriate input type, by adding the
  class=error part if the field was in the list of field errors.

  Shtml does not attempt this but I guess as attributes can be supplied
  and the field errors must be available somewhere the logic could be
  coded outside of the form input creation code.  Any other ideas?

  -- Ewan

 --
 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: Need to be able to add a css class to a form input type if field error - how?

2009-08-12 Thread Ewan

Doh.  Thx again.  Keep it simple, keep it simple, keep it simple...

On Aug 12, 11:15 pm, David Pollak feeder.of.the.be...@gmail.com
wrote:
 On Wed, Aug 12, 2009 at 3:04 PM, Ewan ehar...@gmail.com wrote:

  Thanks that did the trick - very cool.  As a matter of scala I created
  a method to determine if an error notice had been set (cribbed from
  the Msg snippet) and would have preferred to pattern match on the list
  itself rather than its length.  How from a scala style point of view
  could I rewrite the following?

 !S.messagesById(id)(S.errors).isEmpty







   private def isFieldError(id: String) = {
    S.messagesById(id)(S.errors).length match {
      case 0 = false
      case _ = true
    }
   }

  -- Ewan

  On Aug 12, 10:09 pm, David Pollak feeder.of.the.be...@gmail.com
  wrote:
   In your snippet:

   import scala.xml.Null

   SHtml.text(value, value = _) % (if (errorCondition) (class - error)
   else Null)

   On Wed, Aug 12, 2009 at 12:01 PM, Ewan ehar...@gmail.com wrote:

Guys

When a form field/input type is in error I would like to set the css
class to something like error so that I can decorate it by adding a
red border around it.  In Struts2 I used to alter the freemarker
template, which generated the appropriate input type, by adding the
class=error part if the field was in the list of field errors.

Shtml does not attempt this but I guess as attributes can be supplied
and the field errors must be available somewhere the logic could be
coded outside of the form input creation code.  Any other ideas?

-- Ewan

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

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

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



[Lift] How to override lift messages?

2009-08-11 Thread Ewan

 There are a couple of cases where I would like to override the
localised messages that Lift itself users such as S.notice(S.??
(logged.in)) in MetaMegaProtoUser.login().  I was hoping I could
override by popping the name=value in my message bundle properties
file but it does not work.  I realise I could override/copy
MetaMegaProtoUser.login() and replace that one line with a key from my
own bundle but I am not a fan of copy/paste inheritance.  Would you
accept a request to change S.notice(S.??(logged.in)) etc to call
functions we can override?

-- Ewan

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



[Lift] Re: How to override lift messages?

2009-08-11 Thread Ewan


Thanks that does work but is still a maintainance issue if subsequent
Lift releases add new strings.  I suppose I want to selectively
override individual strings and if not then fall back to lift-core
resource bundle.

-- Ewan
On Aug 11, 11:53 am, marius d. marius.dan...@gmail.com wrote:
 You can specify your own ResourceBundle for Lift's strings:

 LiftRules.liftCoreResourceName which is currently set to i18n.lift-
 core

 or you can manually change lift-core.properties files from the Lift's
 jar file.

 Current Lift's strings are in lift\src\main\resources\i18n\lift-
 core.properties

 Br's,
 Marius

 On Aug 11, 1:13 pm, Ewan ehar...@gmail.com wrote:



   There are a couple of cases where I would like to override the
  localised messages that Lift itself users such as S.notice(S.??
  (logged.in)) in MetaMegaProtoUser.login().  I was hoping I could
  override by popping the name=value in my message bundle properties
  file but it does not work.  I realise I could override/copy
  MetaMegaProtoUser.login() and replace that one line with a key from my
  own bundle but I am not a fan of copy/paste inheritance.  Would you
  accept a request to change S.notice(S.??(logged.in)) etc to call
  functions we can override?

  -- Ewan

--~--~-~--~~~---~--~~
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] Odd XML parsing issue

2009-07-30 Thread Ewan

Not sure what I have messed up here but if I have a hardcoded link in
a template page where the href includes query params the lift runtime
stacktraces.  As an example a href=http://www.yahoo.com?
a=4b=5Test/a blows up - see below.  Removing the b=5 and all is
well.  The doctype is:

?xml version=1.0 encoding=UTF-8 ?
!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd
html xmlns=http://www.w3.org/1999/xhtml;
xmlns:lift=http://liftweb.net/;

Running Liftversion1.1-SNAPSHOT built on Thu Jul 30 18:14:47 BST 2009.

-- Ewan

The stacktrace...

div style=border: 1px red solidError locating template /templates-
hidden/default.html.br /  Message:  br /
pre
  java.util.NoSuchElementException
  scala.RandomAccessSeq$$anon$13.next
(RandomAccessSeq.scala:165)
scala.xml.parsing.MarkupParser$class.normalizeAttributeValue
(MarkupParser.scala:1191)
net.liftweb.util.PCDataXmlParser.normalizeAttributeValue
(PCDataMarkupParser.scala:91)
scala.xml.parsing.MarkupParser$class.xAttributeValue
(MarkupParser.scala:334)
net.liftweb.util.PCDataXmlParser.xAttributeValue
(PCDataMarkupParser.scala:91)
net.liftweb.util.PCDataXmlParser.xAttributes(PCDataMarkupParser.scala:
106)
scala.xml.parsing.MarkupParser$class.xTag(MarkupParser.scala:365)
net.liftweb.util.PCDataXmlParser.xTag(PCDataMarkupParser.scala:91)
scala.xml.parsing.MarkupParser$class.element1(MarkupParser.scala:667)
net.liftweb.util.PCDataXmlParser.element1(PCDataMarkupParser.scala:91)
scala.xml.parsing.MarkupParser$class.content1(MarkupParser.scala:481)
net.liftweb.util.PCDataXmlParser.content1(PCDataMarkupParser.scala:91)
scala.xml.parsing.MarkupParser$class.content(MarkupParser.scala:505)
net.liftweb.util.PCDataXmlParser.content(PCDataMarkupParser.scala:91)
scala.xml.parsing.MarkupParser$class.element1(MarkupParser.scala:682)
net.liftweb.util.PCDataXmlParser.element1(PCDataMarkupParser.scala:91)
scala.xml.parsing.MarkupParser$class.content1(MarkupParser.scala:481)
net.liftweb.util.PCDataXmlParser.content1(PCDataMarkupParser.scala:91)
scala.xml.parsing.MarkupParser$class.content(MarkupParser.scala:505)
net.liftweb.util.PCDataXmlParser.content(PCDataMarkupParser.scala:91)
scala.xml.parsing.MarkupParser$class.element1(MarkupParser.scala:682)
net.liftweb.util.PCDataXmlParser.element1(PCDataMarkupParser.scala:91)
scala.xml.parsing.MarkupParser$class.content1(MarkupParser.scala:481)
net.liftweb.util.PCDataXmlParser.content1(PCDataMarkupParser.scala:91)
scala.xml.parsing.MarkupParser$class.content(MarkupParser.scala:505)
net.liftweb.util.PCDataXmlParser.content(PCDataMarkupParser.scala:91)
scala.xml.parsing.MarkupParser$class.element1(MarkupParser.scala:682)
net.liftweb.util.PCDataXmlParser.element1(PCDataMarkupParser.scala:91)
scala.xml.parsing.MarkupParser$class.content1(MarkupParser.scala:481)
net.liftweb.util.PCDataXmlParser.content1(PCDataMarkupParser.scala:91)
scala.xml.parsing.MarkupParser$class.content(MarkupParser.scala:505)
net.liftweb.util.PCDataXmlParser.content(PCDataMarkupParser.scala:91)
scala.xml.parsing.MarkupParser$class.element1(MarkupParser.scala:682)
net.liftweb.util.PCDataXmlParser.element1(PCDataMarkupParser.scala:91)
scala.xml.parsing.MarkupParser$class.content1(MarkupParser.scala:481)
net.liftweb.util.PCDataXmlParser.content1(PCDataMarkupParser.scala:91)
scala.xml.parsing.MarkupParser$class.content(MarkupParser.scala:505)
net.liftweb.util.PCDataXmlParser.content(PCDataMarkupParser.scala:91)
scala.xml.parsing.MarkupParser$class.document(MarkupParser.scala:200)
net.liftweb.util.PCDataXmlParser.document(PCDataMarkupParser.scala:91)
net.liftweb.util.PCDataXmlParser$$anonfun$apply$2$$anonfun$apply$5$
$anonfun$apply$6.apply(PCDataMarkupParser.scala:181)
net.liftweb.util.PCDataXmlParser$$anonfun$apply$2$$anonfun$apply$5$
$anonfun$apply$6.apply(PCDataMarkupParser.scala:181)
net.liftweb.util.ControlHelpers$class.tryo(ControlHelpers.scala:40)
net.liftweb.util.Helpers$.tryo(Helpers.scala:29)
net.liftweb.util.ControlHelpers$class.tryo(ControlHelpers.scala:55)
net.liftweb.util.Helpers$.tryo(Helpers.scala:29)
net.liftweb.util.PCDataXmlParser$$anonfun$apply$2$$anonfun$apply
$5.apply(PCDataMarkupParser.scala:181)
net.liftweb.util.PCDataXmlParser$$anonfun$apply$2$$anonfun$apply
$5.apply(PCDataMarkupParser.scala:179)
net.liftweb.util.Full.flatMap(Box.scala:332)
net.liftweb.util.PCDataXmlParser$$anonfun$apply$2.apply
(PCDataMarkupParser.scala:179)
net.liftweb.util.PCDataXmlParser$$anonfun$apply$2.apply
(PCDataMarkupParser.scala:178)
net.liftweb.util.Full.flatMap(Box.scala:332)
net.liftweb.util.PCDataXmlParser$.apply(PCDataMarkupParser.scala:178)
net.liftweb.http.TemplateFinder$.findAnyTemplate(LiftSession.scala:
1231)
net.liftweb.http.LiftSession.findTemplate(LiftSession.scala:727)
net.liftweb.http.LiftSession.findAndMerge(LiftSession.scala:1098)
net.liftweb.builtin.snippet.Surround$$anonfun$render$1$$anonfun$apply

[Lift] Re: Odd XML parsing issue

2009-07-30 Thread Ewan

But that looks exactly like I have it...

On Jul 30, 7:02 pm, Mark McBride mark.mcbr...@gmail.com wrote:
 URLs in XML need to be XML Encoded... so try

 a href=http://www.yahoo.com?a=4b=5;Test/a

    ---Mark

 On Thu, Jul 30, 2009 at 10:53 AM, Ewanehar...@gmail.com wrote:

  Not sure what I have messed up here but if I have a hardcoded link in
  a template page where the href includes query params the lift runtime
  stacktraces.  As an example a href=http://www.yahoo.com?
  a=4b=5Test/a blows up - see below.  Removing the b=5 and all is
  well.  The doctype is:

  ?xml version=1.0 encoding=UTF-8 ?
  !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://
 www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd
  html xmlns=http://www.w3.org/1999/xhtml;
         xmlns:lift=http://liftweb.net/;

  Running Liftversion1.1-SNAPSHOT built on Thu Jul 30 18:14:47 BST 2009.

  -- Ewan

  The stacktrace...

  div style=border: 1px red solidError locating template /templates-
  hidden/default.html.br /  Message:  br /
                         pre
                                   java.util.NoSuchElementException
                                   scala.RandomAccessSeq$$anon$13.next
  (RandomAccessSeq.scala:165)
  scala.xml.parsing.MarkupParser$class.normalizeAttributeValue
  (MarkupParser.scala:1191)
  net.liftweb.util.PCDataXmlParser.normalizeAttributeValue
  (PCDataMarkupParser.scala:91)
  scala.xml.parsing.MarkupParser$class.xAttributeValue
  (MarkupParser.scala:334)
  net.liftweb.util.PCDataXmlParser.xAttributeValue
  (PCDataMarkupParser.scala:91)
  net.liftweb.util.PCDataXmlParser.xAttributes(PCDataMarkupParser.scala:
  106)
  scala.xml.parsing.MarkupParser$class.xTag(MarkupParser.scala:365)
  net.liftweb.util.PCDataXmlParser.xTag(PCDataMarkupParser.scala:91)
  scala.xml.parsing.MarkupParser$class.element1(MarkupParser.scala:667)
  net.liftweb.util.PCDataXmlParser.element1(PCDataMarkupParser.scala:91)
  scala.xml.parsing.MarkupParser$class.content1(MarkupParser.scala:481)
  net.liftweb.util.PCDataXmlParser.content1(PCDataMarkupParser.scala:91)
  scala.xml.parsing.MarkupParser$class.content(MarkupParser.scala:505)
  net.liftweb.util.PCDataXmlParser.content(PCDataMarkupParser.scala:91)
  scala.xml.parsing.MarkupParser$class.element1(MarkupParser.scala:682)
  net.liftweb.util.PCDataXmlParser.element1(PCDataMarkupParser.scala:91)
  scala.xml.parsing.MarkupParser$class.content1(MarkupParser.scala:481)
  net.liftweb.util.PCDataXmlParser.content1(PCDataMarkupParser.scala:91)
  scala.xml.parsing.MarkupParser$class.content(MarkupParser.scala:505)
  net.liftweb.util.PCDataXmlParser.content(PCDataMarkupParser.scala:91)
  scala.xml.parsing.MarkupParser$class.element1(MarkupParser.scala:682)
  net.liftweb.util.PCDataXmlParser.element1(PCDataMarkupParser.scala:91)
  scala.xml.parsing.MarkupParser$class.content1(MarkupParser.scala:481)
  net.liftweb.util.PCDataXmlParser.content1(PCDataMarkupParser.scala:91)
  scala.xml.parsing.MarkupParser$class.content(MarkupParser.scala:505)
  net.liftweb.util.PCDataXmlParser.content(PCDataMarkupParser.scala:91)
  scala.xml.parsing.MarkupParser$class.element1(MarkupParser.scala:682)
  net.liftweb.util.PCDataXmlParser.element1(PCDataMarkupParser.scala:91)
  scala.xml.parsing.MarkupParser$class.content1(MarkupParser.scala:481)
  net.liftweb.util.PCDataXmlParser.content1(PCDataMarkupParser.scala:91)
  scala.xml.parsing.MarkupParser$class.content(MarkupParser.scala:505)
  net.liftweb.util.PCDataXmlParser.content(PCDataMarkupParser.scala:91)
  scala.xml.parsing.MarkupParser$class.element1(MarkupParser.scala:682)
  net.liftweb.util.PCDataXmlParser.element1(PCDataMarkupParser.scala:91)
  scala.xml.parsing.MarkupParser$class.content1(MarkupParser.scala:481)
  net.liftweb.util.PCDataXmlParser.content1(PCDataMarkupParser.scala:91)
  scala.xml.parsing.MarkupParser$class.content(MarkupParser.scala:505)
  net.liftweb.util.PCDataXmlParser.content(PCDataMarkupParser.scala:91)
  scala.xml.parsing.MarkupParser$class.document(MarkupParser.scala:200)
  net.liftweb.util.PCDataXmlParser.document(PCDataMarkupParser.scala:91)
  net.liftweb.util.PCDataXmlParser$$anonfun$apply$2$$anonfun$apply$5$
  $anonfun$apply$6.apply(PCDataMarkupParser.scala:181)
  net.liftweb.util.PCDataXmlParser$$anonfun$apply$2$$anonfun$apply$5$
  $anonfun$apply$6.apply(PCDataMarkupParser.scala:181)
  net.liftweb.util.ControlHelpers$class.tryo(ControlHelpers.scala:40)
  net.liftweb.util.Helpers$.tryo(Helpers.scala:29)
  net.liftweb.util.ControlHelpers$class.tryo(ControlHelpers.scala:55)
  net.liftweb.util.Helpers$.tryo(Helpers.scala:29)
  net.liftweb.util.PCDataXmlParser$$anonfun$apply$2$$anonfun$apply
  $5.apply(PCDataMarkupParser.scala:181)
  net.liftweb.util.PCDataXmlParser$$anonfun$apply$2$$anonfun$apply
  $5.apply(PCDataMarkupParser.scala:179)
  net.liftweb.util.Full.flatMap(Box.scala:332)
  net.liftweb.util.PCDataXmlParser$$anonfun$apply$2.apply
  (PCDataMarkupParser.scala:179)
  net.liftweb.util.PCDataXmlParser$$anonfun$apply$2

[Lift] Re: Odd XML parsing issue

2009-07-30 Thread Ewan

thx that fixed it - I'd forgotten it was xhtml and not plain html.

On Jul 30, 7:45 pm, Mark McBride mark.mcbr...@gmail.com wrote:
 Fat fingered the paste... change  to amp;

 On Thu, Jul 30, 2009 at 11:15 AM, Ewanehar...@gmail.com wrote:

  But that looks exactly like I have it...

  On Jul 30, 7:02 pm, Mark McBride mark.mcbr...@gmail.com wrote:
  URLs in XML need to be XML Encoded... so try

  a href=http://www.yahoo.com?a=4b=5;Test/a

     ---Mark

  On Thu, Jul 30, 2009 at 10:53 AM, Ewanehar...@gmail.com wrote:

   Not sure what I have messed up here but if I have a hardcoded link in
   a template page where the href includes query params the lift runtime
   stacktraces.  As an example a href=http://www.yahoo.com?
   a=4b=5Test/a blows up - see below.  Removing the b=5 and all is
   well.  The doctype is:

   ?xml version=1.0 encoding=UTF-8 ?
   !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://
  www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd
   html xmlns=http://www.w3.org/1999/xhtml;
          xmlns:lift=http://liftweb.net/;

   Running Liftversion1.1-SNAPSHOT built on Thu Jul 30 18:14:47 BST 2009.

   -- Ewan

   The stacktrace...

   div style=border: 1px red solidError locating template /templates-
   hidden/default.html.br /  Message:  br /
                          pre
                                    java.util.NoSuchElementException
                                    scala.RandomAccessSeq$$anon$13.next
   (RandomAccessSeq.scala:165)
   scala.xml.parsing.MarkupParser$class.normalizeAttributeValue
   (MarkupParser.scala:1191)
   net.liftweb.util.PCDataXmlParser.normalizeAttributeValue
   (PCDataMarkupParser.scala:91)
   scala.xml.parsing.MarkupParser$class.xAttributeValue
   (MarkupParser.scala:334)
   net.liftweb.util.PCDataXmlParser.xAttributeValue
   (PCDataMarkupParser.scala:91)
   net.liftweb.util.PCDataXmlParser.xAttributes(PCDataMarkupParser.scala:
   106)
   scala.xml.parsing.MarkupParser$class.xTag(MarkupParser.scala:365)
   net.liftweb.util.PCDataXmlParser.xTag(PCDataMarkupParser.scala:91)
   scala.xml.parsing.MarkupParser$class.element1(MarkupParser.scala:667)
   net.liftweb.util.PCDataXmlParser.element1(PCDataMarkupParser.scala:91)
   scala.xml.parsing.MarkupParser$class.content1(MarkupParser.scala:481)
   net.liftweb.util.PCDataXmlParser.content1(PCDataMarkupParser.scala:91)
   scala.xml.parsing.MarkupParser$class.content(MarkupParser.scala:505)
   net.liftweb.util.PCDataXmlParser.content(PCDataMarkupParser.scala:91)
   scala.xml.parsing.MarkupParser$class.element1(MarkupParser.scala:682)
   net.liftweb.util.PCDataXmlParser.element1(PCDataMarkupParser.scala:91)
   scala.xml.parsing.MarkupParser$class.content1(MarkupParser.scala:481)
   net.liftweb.util.PCDataXmlParser.content1(PCDataMarkupParser.scala:91)
   scala.xml.parsing.MarkupParser$class.content(MarkupParser.scala:505)
   net.liftweb.util.PCDataXmlParser.content(PCDataMarkupParser.scala:91)
   scala.xml.parsing.MarkupParser$class.element1(MarkupParser.scala:682)
   net.liftweb.util.PCDataXmlParser.element1(PCDataMarkupParser.scala:91)
   scala.xml.parsing.MarkupParser$class.content1(MarkupParser.scala:481)
   net.liftweb.util.PCDataXmlParser.content1(PCDataMarkupParser.scala:91)
   scala.xml.parsing.MarkupParser$class.content(MarkupParser.scala:505)
   net.liftweb.util.PCDataXmlParser.content(PCDataMarkupParser.scala:91)
   scala.xml.parsing.MarkupParser$class.element1(MarkupParser.scala:682)
   net.liftweb.util.PCDataXmlParser.element1(PCDataMarkupParser.scala:91)
   scala.xml.parsing.MarkupParser$class.content1(MarkupParser.scala:481)
   net.liftweb.util.PCDataXmlParser.content1(PCDataMarkupParser.scala:91)
   scala.xml.parsing.MarkupParser$class.content(MarkupParser.scala:505)
   net.liftweb.util.PCDataXmlParser.content(PCDataMarkupParser.scala:91)
   scala.xml.parsing.MarkupParser$class.element1(MarkupParser.scala:682)
   net.liftweb.util.PCDataXmlParser.element1(PCDataMarkupParser.scala:91)
   scala.xml.parsing.MarkupParser$class.content1(MarkupParser.scala:481)
   net.liftweb.util.PCDataXmlParser.content1(PCDataMarkupParser.scala:91)
   scala.xml.parsing.MarkupParser$class.content(MarkupParser.scala:505)
   net.liftweb.util.PCDataXmlParser.content(PCDataMarkupParser.scala:91)
   scala.xml.parsing.MarkupParser$class.document(MarkupParser.scala:200)
   net.liftweb.util.PCDataXmlParser.document(PCDataMarkupParser.scala:91)
   net.liftweb.util.PCDataXmlParser$$anonfun$apply$2$$anonfun$apply$5$
   $anonfun$apply$6.apply(PCDataMarkupParser.scala:181)
   net.liftweb.util.PCDataXmlParser$$anonfun$apply$2$$anonfun$apply$5$
   $anonfun$apply$6.apply(PCDataMarkupParser.scala:181)
   net.liftweb.util.ControlHelpers$class.tryo(ControlHelpers.scala:40)
   net.liftweb.util.Helpers$.tryo(Helpers.scala:29)
   net.liftweb.util.ControlHelpers$class.tryo(ControlHelpers.scala:55)
   net.liftweb.util.Helpers$.tryo(Helpers.scala:29)
   net.liftweb.util.PCDataXmlParser$$anonfun$apply$2$$anonfun$apply
   $5.apply

[Lift] Re: SQL dumping in log?

2009-07-24 Thread Ewan

You might want to look at how p6spy do things.  From memory they
supply a proxy jdbc driver that delegates to the actual driver to do
the work.

-- Ewan

On Jul 23, 9:33 pm, Derek Chen-Becker dchenbec...@gmail.com wrote:
 Well, I'm looking at the code in DB and what we may have to do is write
 wrappers for Statement and PreparedStatement that would allow us to do the
 logging. The functions in DB mostly take user-provided functions like
 PreparedStatement = T, so there's no way to get at the parameters that are
 being provided directly. Let me noodle on this and see what I can do. We
 already have a SuperConnection, so I don't see a problem with a
 LoggingStatement and LoggingPreparedStatement. This seems common enough that
 there may already be a library of wrappers that we could use out there.

 Derek

 On Thu, Jul 23, 2009 at 1:23 PM, marius d. marius.dan...@gmail.com wrote:

  Looking a the code looks to me that the query is just a toString call
  for a Statement reference which won't yield what we'd expect. Just
  spoke with Derek about this. He'll take a look on it and eventually
  add this support soon enough.

  Br's,
  Marius

  On Jul 23, 10:01 pm, Jon jon.klei...@usit.uio.no wrote:
   On Jul 23, 8:56 pm, Jeppe Nejsum Madsen je...@ingolfs.dk wrote:

marius d. marius.dan...@gmail.com writes:
 I'm not sure if that logs the statements with the actual values. Does
 it ?

Strange, just tried it because I definitely remember seeing values
being logged, but turns out not all statements have values logged and
  it
seem just queries are logged.

/Jeppe

   I tried this:
   DB.addLogFunc((query, len) = Log.info(The query: +query+ took +len
   + milliseconds))

   ... and only got things like this:
   INFO - The query: b8450018-0122-a854-9ce5-00cde658 took 47
   milliseconds

   Not exactly what I was interested in. ;-)

   /Jon



--~--~-~--~~~---~--~~
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: SQL dumping in log?

2009-07-24 Thread Ewan

Logging works ok with MySQL but not Derby as I discovered when moving
to MySQL when playing with stax.

-- Ewan

On Jul 23, 11:27 pm, Jeppe Nejsum Madsen je...@ingolfs.dk wrote:
 Jon jon.klei...@usit.uio.no writes:
  On Jul 23, 8:56 pm, Jeppe Nejsum Madsen je...@ingolfs.dk wrote:
  marius d. marius.dan...@gmail.com writes:
   I'm not sure if that logs the statements with the actual values. Does
   it ?

  Strange, just tried it because I definitely remember seeing values
  being logged, but turns out not all statements have values logged and it
  seem just queries are logged.

  /Jeppe

  I tried this:
  DB.addLogFunc((query, len) = Log.info(The query: +query+ took +len
  + milliseconds))

  ... and only got things like this:
  INFO - The query: b8450018-0122-a854-9ce5-00cde658 took 47
  milliseconds

  Not exactly what I was interested in. ;-)

 Strange...On 1.1-SNAPSHOT I use essentially the same and get this:
   DB.addLogFunc ((q, t) = Log.info(Query(+t+): +q))

 INFO - Query(46): SELECT users.id, users.firstname, users.lastname, 
 users.email, users.locale, users.timezone, users.password_pw, 
 users.password_slt, users.account_id, users.uniqueid, users.superuser, 
 users.validated FROM users  WHERE email = demou...@xx.yy
 INFO - Query(66): SELECT users.id, users.firstname, users.lastname, 
 users.email, users.locale, users.timezone, users.password_pw, 
 users.password_slt, users.account_id, users.uniqueid, users.superuser, 
 users.validated FROM users  WHERE email = ?

 /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: Anyone tried to use Velocity with scala/lift?

2009-07-10 Thread Ewan

Thanks.  I found that myself along with scala-javautils in github by
Jorge Ortiz which helps out with the converting from Scala collections
to Java ones.

The @BeanProperty annotation works fine for val and vars but is not
helpful if your passing around mapper instances where the attribs/
props are objects.  Of course passing a mapper instance to a 3rd party
lib is probably not a good idea anyway so my solution is to add a toDto
() to my class which creates an immutable data transfer object or
value object from its state which when passed into velocity (with
@BeanProperty annotations) works as expected.

Thanks again.

On Jul 9, 10:16 pm, Marc Boschma marc+lift...@boschma.cx wrote:
 I think your right - see

 http://www.scala-lang.org/docu/files/api/scala/reflect/BeanProperty.html
 andhttp://scala.sygneca.com/code/defining-bean-properties

 for how to add the annotations to the classes for Velocity to be able  
 to see the properties...

 Marc

 On 10/07/2009, at 3:04 AM, Ewan wrote:



  Bit of googling and came across some wicket/scala folks having a
  similar problem who got around the problem with the following:

   implicit def listToJavaList[T](l: Seq[T]) = l.foldLeft(new
  java.util.ArrayList[T](l.size)){(al, e) = al.add(e); al}

  and magically I can pull out the value now.  What I can't do now are
  pull out an object's properties for example:

  #foreach($user in $headers.users)
     hello $user.firstname $user.lastname
  #end

  I reckon the problem is that Velocity must use bean introspection and
  without getters I can't get the values.

  --Ewan



--~--~-~--~~~---~--~~
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] Anyone tried to use Velocity with scala/lift?

2009-07-09 Thread Ewan

All

I am trying to create an email using a velocity template all wired up
with Apache Camel.  The camel stuff aside I can't seem to get velocity
to render Scala lists along the lines of:

#foreach($email in $headers.emailAddresses)
hello $email
#end

where headers is a map and emailAddresses is a list.  Strings in the
headers map works fine i.e. ${headers.sender}.

If I dump out the contents of headers using ${headers} the toString
for the map renders as expected.

 I have not delved into the velocity code but I wonder if tries to
create a java interator over the list which does not work in this case
- maybe?

--Ewan

--~--~-~--~~~---~--~~
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: Anyone tried to use Velocity with scala/lift?

2009-07-09 Thread Ewan

Bit of googling and came across some wicket/scala folks having a
similar problem who got around the problem with the following:

  implicit def listToJavaList[T](l: Seq[T]) = l.foldLeft(new
java.util.ArrayList[T](l.size)){(al, e) = al.add(e); al}

and magically I can pull out the value now.  What I can't do now are
pull out an object's properties for example:


#foreach($user in $headers.users)
hello $user.firstname $user.lastname
#end

I reckon the problem is that Velocity must use bean introspection and
without getters I can't get the values.

--Ewan

--~--~-~--~~~---~--~~
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] Sitemap, restricted menus and skinning a cat

2009-07-03 Thread Ewan

I wonder if anyone would care to advise of the most appropriate
solution for not rendering sitemap menu items with additional redirect
to a login page.  I have read a couple of solutions in this list but
here is what I have done cobbled together from the liftbook.

I have an If LocParam for testing if a user is logged in which is
added to a menu:

  val loggedInLocParam = If(() = User.loggedIn_?,
() = RedirectWithState(/user_mgt/login,
RedirectState(Empty, (You must login, NoticeType.Notice

this seems to achieve the effect I am looking for in that the menuitem
is not rendered and if the url was bookmarked and the user tries a GET
then they are redirected to login and a notice is added and rendered
at the top of the page accordingly.

Is this a good solution or can this cat be skinned better?  I have
read something about Loc.EarlyResponse and was hoping for an
explanation.

--Ewan

--~--~-~--~~~---~--~~
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] net.liftweb.util.ActorPingException: ActorBug could not be scheduled

2009-07-01 Thread Ewan

For the last couple of weeks I have been getting the following
exception when saving causing a jetty reload.  Seems it was raised in
May in this group with a suggested work around of setting the jetty
scan interval to 0 seconds - is this the only way?  I guess I'm only
now seeing as I recently added a SessionVar.

net.liftweb.util.ActorPingException: ActorBug could not be scheduled
on net.liftweb.http.pointlessactortoworkaroundb...@557f45
at net.liftweb.util.ActorPing$.schedule(ActorPing.scala:53)
at net.liftweb.http.PointlessActorToWorkAroundBug$.net$liftweb$http
$PointlessActorToWorkAroundBug$$ping(LiftServlet.scala:764)
at net.liftweb.http.PointlessActorToWorkAroundBug$$anonfun$act$1$
$anonfun$apply$1.apply(LiftServlet.scala:751)
at net.liftweb.http.PointlessActorToWorkAroundBug$$anonfun$act$1$
$anonfun$apply$1.apply(LiftServlet.scala:707)
at scala.actors.Reaction.run(Reaction.scala:78)
at net.liftweb.http.ActorSchedulerFixer$$anon$1$$anonfun$execute
$1.apply(LiftServlet.scala:668)
at net.liftweb.http.ActorSchedulerFixer$$anon$1$$anonfun$execute
$1.apply(LiftServlet.scala:668)
at net.liftweb.http.ActorSchedulerFixer$$anonfun$20$$anon$2.run
(LiftServlet.scala:626)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask
(ThreadPoolExecutor.java:651)
at java.util.concurrent.ThreadPoolExecutor$Worker.run
(ThreadPoolExecutor.java:676)
at java.lang.Thread.run(Thread.java:613)
Caused by: java.util.concurrent.RejectedExecutionException
at java.util.concurrent.ThreadPoolExecutor
$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:1478)
at java.util.concurrent.ThreadPoolExecutor.reject
(ThreadPoolExecutor.java:384)
at java.util.concurrent.ScheduledThreadPoolExecutor.delayedExecute
(ScheduledThreadPoolExecutor.java:181)
at java.util.concurrent.ScheduledThreadPoolExecutor.schedule
(ScheduledThreadPoolExecutor.java:338)
at java.util.concurrent.Executors
$DelegatedScheduledExecutorService.schedule(Executors.java:647)
at net.liftweb.util.ActorPing$.schedule(ActorPing.scala:51)
... 10 more

-- Ewan

--~--~-~--~~~---~--~~
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] Setting Session Timeout?

2009-07-01 Thread Ewan

I have recently started using a SessionVar and am quite happy to have
the session wiped after some predefined interval.  As an experiment I
changed the session timeout in the web.xml a la Java Servlets but this
had no effect running on jetty and since I have read that a SessionVar
is not just a wrapper around javax.servlet.http.HttpSession.  My
question is then how can I configure the timeout interval?

-- Ewan

--~--~-~--~~~---~--~~
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: Setting Session Timeout?

2009-07-01 Thread Ewan

Thanks Marius

I basically wound the session timeout down to 5 mins in the web.xml
and left it for about 30 mins but the sessionVar was still full.  Even
after some hours of no use it was the same.  There is this constant
ajax_request pinging going on - related?

-- Ewan

On Jul 1, 12:32 pm, marius d. marius.dan...@gmail.com wrote:
 LiftSession is bound to HttpSession through HttpSessionBindingListener
 and HttpSessionActivationListener

 This means that when the HTTP session terminates LiftSession will also
 terminate. To verify your SessionVar that the session was purged you
 can implement

 override protected def onShutdown(session: CleanUpParam): Unit = {
 ...

 }

 where in case of SessionVar the session parameter is really a
 LiftSession.

 The LiftSession timeout is given by
 HttpSession.getMaxInactiveInterval ... if that period is exceeded the
 LiftSession is unbound from the HttpSession. Does not necessary means
 that the HttpSession is removed by container ust that LiftSession is
 terminated.

 But is the problem the fact that HttpSession expired but you still had
 the context in the SessionVar?

 Br's,
 Marius

 On Jul 1, 12:47 pm, Ewan ehar...@gmail.com wrote:

  I have recently started using a SessionVar and am quite happy to have
  the session wiped after some predefined interval.  As an experiment I
  changed the session timeout in the web.xml a la Java Servlets but this
  had no effect running on jetty and since I have read that a SessionVar
  is not just a wrapper around javax.servlet.http.HttpSession.  My
  question is then how can I configure the timeout interval?

  -- Ewan



--~--~-~--~~~---~--~~
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: Setting Session Timeout?

2009-07-01 Thread Ewan

H I understand the issue/feature now... where by if the page
remains open then the session is kept alive by the ajax request which
is a feature and it could be argued that for almost all cases this
would be what is required.  I believe there is a use case for wanting
the session to expire after a predefined interval though - thinking
secure apps such as banking or email.  I know my bank irritates the
hell out of me by logging me off after a period of inactivity though
this might not be implemented via HttpSession but instead they persist
a timestamp of the last request and compare with the current request
time.

My app requirements can be changed to fit the current method but I can
imagine that there would be need for other projects to implement
expiration as defined above.

--Ewan

On Jul 1, 5:20 pm, David Pollak feeder.of.the.be...@gmail.com wrote:
 Ewan,

 It seems that you've done your tests with a browser open to a page in your
 Lift app.  It seems to me that you don't want to time out a session unless
 the user's browser is no longer looking at a page in the app.  Is this in
 line with your expectations/use case?

 Thanks,

 David



 On Wed, Jul 1, 2009 at 5:08 AM, Ewan ehar...@gmail.com wrote:

  My use case is that I want to save anonymous users' (users that have
  not logged on or registered) baskets in the session and don't care if
  they are removed after a period of inactivity.  In fact I would like
  the session to be expired after a while to encourage the user to sign
  up which if they do they get the benefit that the basket is persisted.

  --Ewan

  On Jul 1, 12:59 pm, marius d. marius.dan...@gmail.com wrote:
   You answered your own question :) ... Yes that is Lift GC mechanism.
   You can of course turn it off in Boot by calling 
   LiftRules.enableLiftGC=false  but I would not recommend it.

   Is there a real use case why you need this or just tying to figure out
   how Lift works ?

   Br's,
   Marius

   On Jul 1, 2:42 pm, Ewan ehar...@gmail.com wrote:

Thanks Marius

I basically wound the session timeout down to 5 mins in the web.xml
and left it for about 30 mins but the sessionVar was still full.  Even
after some hours of no use it was the same.  There is this constant
ajax_request pinging going on - related?

-- Ewan

On Jul 1, 12:32 pm, marius d. marius.dan...@gmail.com wrote:

 LiftSession is bound to HttpSession through
  HttpSessionBindingListener
 and HttpSessionActivationListener

 This means that when the HTTP session terminates LiftSession will
  also
 terminate. To verify your SessionVar that the session was purged you
 can implement

 override protected def onShutdown(session: CleanUpParam): Unit = {
 ...

 }

 where in case of SessionVar the session parameter is really a
 LiftSession.

 The LiftSession timeout is given by
 HttpSession.getMaxInactiveInterval ... if that period is exceeded the
 LiftSession is unbound from the HttpSession. Does not necessary means
 that the HttpSession is removed by container ust that LiftSession is
 terminated.

 But is the problem the fact that HttpSession expired but you still
  had
 the context in the SessionVar?

 Br's,
 Marius

 On Jul 1, 12:47 pm, Ewan ehar...@gmail.com wrote:

  I have recently started using a SessionVar and am quite happy to
  have
  the session wiped after some predefined interval.  As an experiment
  I
  changed the session timeout in the web.xml a la Java Servlets but
  this
  had no effect running on jetty and since I have read that a
  SessionVar
  is not just a wrapper around javax.servlet.http.HttpSession.  My
  question is then how can I configure the timeout interval?

  -- Ewan

 --
 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: a href... optional query params

2009-06-16 Thread Ewan

Thanks thats how I have done it now but was just checking that there
was not some magic that I had missed.

-- Ewan

On Jun 16, 1:00 am, David Pollak feeder.of.the.be...@gmail.com
wrote:
 On Mon, Jun 15, 2009 at 3:59 PM, Ewan ehar...@gmail.com wrote:

  Hi all

  I have bind that renders a link and at the moment I want the link to
  include a couple of query params ie.

  a href=/search?q1=v1q2=v2 Click me/a

  I figured I'd be able to do something like the following except the
  additional key/id is added which messes it up.

  value - SHtml.link(/search?q1=v1, () = doSearch, SText(Click
  me))

 How about just hardcoding things and using S.param(q1) to extract the
 parameters?

 While it's useful to bind to functions for stateful stuff, if you're just
 passing some hard coded parameters, it seems to me that you're best off
 using query parameters.



  Looking at the src I can't see how this would work.  I guess using a
  requestVar would be the recommended solution but how does that work
  for bookmarked urls between server restarts?

 --
 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] a href... optional query params

2009-06-15 Thread Ewan

Hi all

I have bind that renders a link and at the moment I want the link to
include a couple of query params ie.

a href=/search?q1=v1q2=v2 Click me/a

I figured I'd be able to do something like the following except the
additional key/id is added which messes it up.

value - SHtml.link(/search?q1=v1, () = doSearch, SText(Click
me))

Looking at the src I can't see how this would work.  I guess using a
requestVar would be the recommended solution but how does that work
for bookmarked urls between server restarts?

--~--~-~--~~~---~--~~
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: Attributes in Menu.item not rendered

2009-06-08 Thread Ewan

None I'm afraid.  I have:

lift:Menu.item name=helpMenu a:class=navHelp Me!/
lift:Menu.item

which results in:

a href=/help/Help Me!/a

-- Ewan

On Jun 8, 9:07 am, marius d. marius.dan...@gmail.com wrote:
 Do you see any behavior change if you put a text value such as:

 lift:Menu.item name=helpMenu a:class=nav Some tex /
 lift:Menu.item

 Br's,
 Marius

 On Jun 8, 12:55 am, Ewan ehar...@gmail.com wrote:

  I'm trying to create a menu using CSS and links that is a 
  class=nav/ which accoring to the doco I should be able to do with
  lift:Menu.item name=helpMenu a:class=nav / where helpMenu has
  been defined in the sitemap.  The link renders but the attribute does
  not.

  Which incantation did I forget?

  Rgds
  -- Ewan



--~--~-~--~~~---~--~~
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: Attributes in Menu.item not rendered

2009-06-08 Thread Ewan

I think you mean and reading the src if the page I am on is the menu
item in question don't render - correct?  If so then the attribute(s)
are still not rendered from any part of the site and indeed the link
itself is not rendered when on the page that the Loc points to.  Can
you or anyone confirm that it works for them?

Thx

-- Ewan

On Jun 8, 4:14 pm, marius d. marius.dan...@gmail.com wrote:
 Oh do you use the same name 'helpMenu' for the current loc? a:
 prefixed attributes are added only if loc.name != name.

 On Jun 8, 1:30 pm, Ewan ehar...@gmail.com wrote:

  None I'm afraid.  I have:

  lift:Menu.item name=helpMenu a:class=navHelp Me!/
  lift:Menu.item

  which results in:

  a href=/help/Help Me!/a

  -- Ewan

  On Jun 8, 9:07 am, marius d. marius.dan...@gmail.com wrote:

   Do you see any behavior change if you put a text value such as:

   lift:Menu.item name=helpMenu a:class=nav Some tex /
   lift:Menu.item

   Br's,
   Marius

   On Jun 8, 12:55 am, Ewan ehar...@gmail.com wrote:

I'm trying to create a menu using CSS and links that is a 
class=nav/ which accoring to the doco I should be able to do with
lift:Menu.item name=helpMenu a:class=nav / where helpMenu has
been defined in the sitemap.  The link renders but the attribute does
not.

Which incantation did I forget?

Rgds
-- Ewan



--~--~-~--~~~---~--~~
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: Attributes in Menu.item not rendered

2009-06-08 Thread Ewan

Yep that works fine now.  I'll now go and look to see how you did it.

cheers

-- Ewan

On Jun 8, 5:46 pm, marius d. marius.dan...@gmail.com wrote:
 Ewan,

 I just committed a fix on master. The pattern matching was actually
 failing and the attributes were never added. I gave it a try and
 worked for me. Please test and let me know if it works for you

 Br's,
 Marius

 On Jun 8, 6:58 pm, Ewan ehar...@gmail.com wrote:

  I think you mean and reading the src if the page I am on is the menu
  item in question don't render - correct?  If so then the attribute(s)
  are still not rendered from any part of the site and indeed the link
  itself is not rendered when on the page that the Loc points to.  Can
  you or anyone confirm that it works for them?

  Thx

  -- Ewan

  On Jun 8, 4:14 pm, marius d. marius.dan...@gmail.com wrote:

   Oh do you use the same name 'helpMenu' for the current loc? a:
   prefixed attributes are added only if loc.name != name.

   On Jun 8, 1:30 pm, Ewan ehar...@gmail.com wrote:

None I'm afraid.  I have:

lift:Menu.item name=helpMenu a:class=navHelp Me!/
lift:Menu.item

which results in:

a href=/help/Help Me!/a

-- Ewan

On Jun 8, 9:07 am, marius d. marius.dan...@gmail.com wrote:

 Do you see any behavior change if you put a text value such as:

 lift:Menu.item name=helpMenu a:class=nav Some tex /
 lift:Menu.item

 Br's,
 Marius

 On Jun 8, 12:55 am, Ewan ehar...@gmail.com wrote:

  I'm trying to create a menu using CSS and links that is a 
  class=nav/ which accoring to the doco I should be able to do with
  lift:Menu.item name=helpMenu a:class=nav / where helpMenu has
  been defined in the sitemap.  The link renders but the attribute 
  does
  not.

  Which incantation did I forget?

  Rgds
  -- Ewan



--~--~-~--~~~---~--~~
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] Attributes in Menu.item not rendered

2009-06-07 Thread Ewan

I'm trying to create a menu using CSS and links that is a 
class=nav/ which accoring to the doco I should be able to do with
lift:Menu.item name=helpMenu a:class=nav / where helpMenu has
been defined in the sitemap.  The link renders but the attribute does
not.

Which incantation did I forget?

Rgds
-- Ewan

--~--~-~--~~~---~--~~
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] Advice for rendering results from snippet

2009-06-01 Thread Ewan

I have a search page that contains a simple form with a single text
field and submit button.  On submit a search is performed using the
value from the textfield as a param and the results are displayed.
Easy so far except that I want to show the same page again i.e
search.html with no results - search html with results.  I have
struggled with this for a while but finally got it working by making
the snippet a stateful one but I don't really understand why it would
have to be stateful to work as I don't need to remember the results
between requests.

Am I going about the the wrong way?  In MVC land we'd show the initial
search page with an empty results table and on submit pop the results
into a list and add to the model which would be rendered by jsp tags.

Code below which is not pretty and gets results from a Solr engine as
xml:

lift:surround with=default at=content
div
lift:PropertySearch.search form=POST
div id=search
s:searchField/s:submit/
/div
s:theresults
table

theadtdId/tdtdName/tdtdLocation/tdtdHomepage/
tdtdSmoking/tdtdPets/td/thead
tbodyresult:listtrtdr:id//tdtdr:name//
tdtdr:location//tdtdr:url//tdtdr:smoking//
tdtdr:pets//td/tr/result:list/tbody
/table
/s:theresults

/lift:PropertySearch.search
/div

/lift:surround

--

class PropertySearch extends StatefulSnippet {
  var searchTxt = 
  var results = List[HashMap[String,String]]() ::: Nil

  var dispatch : DispatchIt = {
  case search = search _
  }

  def search(xhtml: NodeSeq): NodeSeq = {
def processSearch() = {
  results = List[HashMap[String,String]]() ::: Nil
  Log.info(Running camel route direct:querySolr to find docs)
  val p = RouteBuilderHelper.getTemplate
  p.start

  var resp = p.sendBodyAndHeader(direct:querySolr,
direct:querySolr, HttpProducer.QUERY, q= + searchTxt)
  val x1 = RouteBuilderHelper.camelResponseToXml(resp)

  Log.info(Received:  + x1)
  Log.info(resul...@numfound= + x1 \ result \ @numFound)

  if (hasResult(x1)) {
Log.info(found matches)
val xmlResults = x1 \ result
Log.info(xmlResults)
for(result - xmlResults \\ doc) {
  val attrMap = new HashMap[String, String]
  for(str - result \\ str) {
val attrName = (str \ @name).text
val attrVal = str.text
Log.info(attrName + = + attrVal)
attrMap += (attrName - attrVal) // add to map
  }
  for(i - result \\ int) {
val attrName = (i \ @name).text
val attrVal = i.text
Log.info(attrName + = + attrVal)
attrMap += (attrName - attrVal) // add to map
  }
  for(i - result \\ bool) {
val attrName = (i \ @name).text
val attrVal = i.text
Log.info(attrName + = + attrVal)
attrMap += (attrName - attrVal) // add to map
  }

  results = results ::: List(attrMap) // add to list
}
  } else {
Log.info(No matches)
  }

  p.stop
  Log.info(Finished results:  + results)
}

bind(s, xhtml,
 searchField - SHtml.text(searchTxt, searchTxt = _),
 theresults - results.flatMap(r = bind(r, chooseTemplate
(result,list, xhtml),
   id - r
(id),
   name - r
(name),
   location - r
(location),
   url - r(url),
   smoking - r
(smoking),pets - r(pets)
 )),
  submit - SHtml.submit(Search, processSearch)
 )
  }
}

--~--~-~--~~~---~--~~
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: Advice for rendering results from snippet

2009-06-01 Thread Ewan

ah ha moment.  I switched to using a requestVar that contains my
results list and instead of trying to bind the results to the same
snippet I have a second snippet in the same page (same src file but
diff function) that is able to access the requestVar of results and
bind the values to the tags.

On Jun 1, 11:53 am, Ewan ehar...@gmail.com wrote:
 I have a search page that contains a simple form with a single text
 field and submit button.  On submit a search is performed using the
 value from the textfield as a param and the results are displayed.
 Easy so far except that I want to show the same page again i.e
 search.html with no results - search html with results.  I have
 struggled with this for a while but finally got it working by making
 the snippet a stateful one but I don't really understand why it would
 have to be stateful to work as I don't need to remember the results
 between requests.

 Am I going about the the wrong way?  In MVC land we'd show the initial
 search page with an empty results table and on submit pop the results
 into a list and add to the model which would be rendered by jsp tags.

 Code below which is not pretty and gets results from a Solr engine as
 xml:

 lift:surround with=default at=content
     div
         lift:PropertySearch.search form=POST
         div id=search
                 s:searchField/s:submit/
         /div
                 s:theresults
                 table
                         
 theadtdId/tdtdName/tdtdLocation/tdtdHomepage/
 tdtdSmoking/tdtdPets/td/thead
                         
 tbodyresult:listtrtdr:id//tdtdr:name//
 tdtdr:location//tdtdr:url//tdtdr:smoking//
 tdtdr:pets//td/tr/result:list/tbody
                 /table
                 /s:theresults

         /lift:PropertySearch.search
     /div

 /lift:surround

 --

 class PropertySearch extends StatefulSnippet {
   var searchTxt = 
   var results = List[HashMap[String,String]]() ::: Nil

   var dispatch : DispatchIt = {
       case search = search _
   }

   def search(xhtml: NodeSeq): NodeSeq = {
     def processSearch() = {
       results = List[HashMap[String,String]]() ::: Nil
       Log.info(Running camel route direct:querySolr to find docs)
           val p = RouteBuilderHelper.getTemplate
           p.start

           var resp = p.sendBodyAndHeader(direct:querySolr,
 direct:querySolr, HttpProducer.QUERY, q= + searchTxt)
           val x1 = RouteBuilderHelper.camelResponseToXml(resp)

           Log.info(Received:  + x1)
           Log.info(resul...@numfound= + x1 \ result \ @numFound)

           if (hasResult(x1)) {
             Log.info(found matches)
             val xmlResults = x1 \ result
             Log.info(xmlResults)
             for(result - xmlResults \\ doc) {
               val attrMap = new HashMap[String, String]
               for(str - result \\ str) {
                 val attrName = (str \ @name).text
                 val attrVal = str.text
                 Log.info(attrName + = + attrVal)
                 attrMap += (attrName - attrVal) // add to map
               }
           for(i - result \\ int) {
                 val attrName = (i \ @name).text
                 val attrVal = i.text
                 Log.info(attrName + = + attrVal)
                 attrMap += (attrName - attrVal) // add to map
               }
           for(i - result \\ bool) {
                 val attrName = (i \ @name).text
                 val attrVal = i.text
                 Log.info(attrName + = + attrVal)
                 attrMap += (attrName - attrVal) // add to map
               }

           results = results ::: List(attrMap) // add to list
             }
           } else {
             Log.info(No matches)
           }

       p.stop
       Log.info(Finished results:  + results)
     }

     bind(s, xhtml,
          searchField - SHtml.text(searchTxt, searchTxt = _),
          theresults - results.flatMap(r = bind(r, chooseTemplate
 (result,list, xhtml),
                                                    id - r
 (id),
                                                    name - r
 (name),
                                                    location - r
 (location),
                                                    url - r(url),
                                                    smoking - r
 (smoking),pets - r(pets)
          )),
                   submit - SHtml.submit(Search, processSearch)
          )
   }

 }



--~--~-~--~~~---~--~~
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] LiftRules.unloadHooks problem

2009-05-23 Thread Ewan

After banging my head trying to get Jetty to shutdown cleanly having
been playing with actors I came across   this entry in the wiki
http://wiki.liftweb.net/index.php/FAQ#How_do_I_execute_code_when_my_application_is_unloaded.3F
which suggests adding your own function to LiftRules.unloadHooks
except LiftRules.unloadHooks += myUnloader _ does not compile due to
reassignment to val but LiftRules.unloadHooks.append(myUnloader)
does.  Has my lack of Scala experience got the better of me again or
has the api changed since the wiki entry was added?

-- Ewan

--~--~-~--~~~---~--~~
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] UK Postcode validation for MappedPostalCode

2009-05-21 Thread Ewan

Hi

I have a patch for UK post code validation that a committer might
care to include into MappedPostalCode.validations().  The regex has
been lifted directly from the wikipedia entry
http://en.wikipedia.org/wiki/Postal_codes_in_the_United_Kingdom#Validation.

---8-
case Countries.C184 =  valRegex
(_root_.java.util.regex.Pattern.compile([A-Z]{1,2}[0-9R][0-9A-Z]?
[0-9][ABD-HJLNP-UW-Z]{2}), S.??(invalid.postal.code)) _ ::
super.validations

---8-

It might also be appropriate to add the UK as a field:

  val UK = C184

rgds

-- Ewan

--~--~-~--~~~---~--~~
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] Cron style job support?

2009-05-20 Thread Ewan

Apologies for the cross-post with the Lift-book group but this is the
more appropriate group...

While this does not necessarily have anything to do with a webapp does
anyone have suggestions for the means to create/register and run a
cron style job?  Specifically I would like to extract data from the DB
and send to a Solr instance for searching and as I am happily using
Mapper I'd like to continue using it for ORM.  In J2EE land we used
Quartz so worst case I guess I could have a servlet that on
initialisation starts up Quartz and then code a job to that hits the
DB with JDBC and then post to a Solr instance.

-- Ewan

--~--~-~--~~~---~--~~
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] net.liftweb.mapper.Countries and United Kingdom

2009-05-12 Thread Ewan

I want to create persist an address object I have and set a
MappedCountry to the UK ie.

Address.create.address1(7).address3(Some Street).address6
(Countries.UnitedKingdom).save

except that the enumeration Countries does not have one but does for
the US and Australia and a bunch of others prefixed with 'C'.  I guess
those C codes are the international dialling prefix so the UK would be
C44 perhaps?

-- Ewan

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