[Lift] how to redirect with OpenIdVendor

2009-09-14 Thread night_stalker

hi all, excuse me for asking another newbie question.
I'm integrating openID with net.liftweb.openid, how to redirect or run
some js in the postLogin method?

// import my packages of User and UserOp
trait CustomOpenId extends OpenIdVendor {
  type UserType = User

  // note: in lift 1.1, use OpenIdConsumer instead (downcase d)
  type ConsumerType = OpenIDConsumer[UserType]

  def currentUser = UserOp.current

  def postLogin(id: Box[Identifier], res: VerificationResult) {
id match {
  case Full(id) =
UserOp.openIdLogin(id.getIdentifier)
if(UserOp.logined) {
  redirectTo(/) // doesn't work
} else {
  ...
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Getting Maven Offline Mode Working

2009-09-14 Thread Kevin Wright
Glad I could help :)Hope the flight goes okay...

On Mon, Sep 14, 2009 at 1:33 AM, Peter Robinett pe...@bubblefoundry.comwrote:


 Thanks, Kevin. Dropping in the latest version didn't seem to work (mvn
 --version kept saying I still had 2.0.9) but switching to 1.1-M5 did.

 Peter

 On Sep 13, 4:00 pm, Kevin Wright kev.lee.wri...@googlemail.com
 wrote:
  Maven is essentially a java application, so you *should* just be able to
  download and run.  I'm afraid I can't really give better advice for OS-X
  though.
  One other idea is to work with 1.1-M5, which should let you go offline on
  the older maven version - assuming you have no other snapshot
 dependencies.
 
  On Sun, Sep 13, 2009 at 10:51 PM, Peter Robinett 
 pe...@bubblefoundry.comwrote:
 
 
 
   Thanks. I have version 2.0.9, which was installed by the Lift OS X
   installer. What is the best way to upgrade to 2.2.1?
 
   Peter
 
   On Sep 13, 12:57 pm, Kevin Wright kev.lee.wri...@googlemail.com
   wrote:
Try updating to the latest maven, older versions have known issues
 with
offline behaviour for snapshots.
 
On Sun, Sep 13, 2009 at 8:55 PM, Peter Robinett 
 pe...@bubblefoundry.com
   wrote:
 
 Hi all,
 
 I'm having problems running mvn -o jetty:run with my version of
 Lift
 (1.1-SNAPSHOT) because Maven thinks that
 net.liftweb:lift-core:jar:1.1-
 SNAPSHOT is missing. How do I fix that? My pom.xml is here:
http://gist.github.com/186293
 
 I've got an international plane flight in 24 hours, so I'd love to
 have offline mode working for then. Thanks for the help!
 
 Peter
 


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



[Lift] Re: Lift deal breakers

2009-09-14 Thread valotas



On Sep 14, 3:43 am, marius d. marius.dan...@gmail.com wrote:
 I kinda used the term js file a bit too loosely. It is true that each
 page would likely have different functions there and even the same
 page on subsequent load would have different content so the file can
 not really be cached.

 I'm thinking that instead of:

 button onclick=liftAjax.lift_ajaxHandler
 ('F1029758482780OTA=true',null, null, null); return false;Press me/
 button

 We could have:

 button onclick=liftAjax('F1029758482780OTA')Press me/button

 ...

 .. and at the end of the page:

 script type=text/javascript

 function liftAjax(id) {
    liftAjax.lift_ajaxHandler(id + '=true',null, null, null); return
 false;}

 ...

 /script


With this approach you still have an onclick event binded to the dom
element (in this case button) with html and this is bad practice for
javascript development. Additionally you create another function
called liftAjax at the window scope witch is again bad practice!

What I described on my previous post is that good javascript
development practice means that there should be nothing that has to do
with javascript except script tags inside the html. Now If you can to
get as less script tags as possible inside html is also better.


 Likely there will be more synthetic functions that would need to be
 generated depending on specific cases. This approach would result in a
 slightly larger markup but I'm not sure if the impact is negligible or
 not. In essence we are replacing a function call with another one more
 concise which helps just in having a more concise function calls in
 the markup.

 BUT most likely for functions like liftAjax above we should put them
 in liftAjax.js that lift generates and those would just be helper
 function. This means that the script block above will not be needed
 anymore. Thoughts?

 Thanks Xavi for the good points.

 Br's,
 Marius

 On Sep 13, 7:03 pm, Xavi Ramirez xavi@gmail.com wrote:

  If I understand everything correctly, the proposal is to dynamically
  create a js file for each page request to add event handlers?

  If this is true, then I'm against the proposal for the following two 
  reasons:

  1. Every page will load slower

  Since the js file is dynamically create on each request, the js file
  will be un-cacheable.  This means the browser be will forced to make
  an addition HTTP request to the server to render each page.  This adds
  roughly 150ms to the page load time (50ms to 200ms for network lag,
  50ms for download, 10ms for js execution).

This is partially true. If you have a page that can be cached except
some javascript for example it is better to have the javascript as an
external file. If not you could ad the dynamically created javascript
inside the html body but it is still better to load it at the end of
your html document.


  2. Each page will be more fragile

  Requiring the synthetic js file will add another point of failure.
  Even now-a-days with the ubiquity of broadband, connects still get
  lost and files still get corrupted.

  It's true that most modern web pages already depend a number of
  external JS and CSS files, but typically these files are static and
  easily cached.

  Just adding my 2 cents.

  -Xavi

  On Sun, Sep 13, 2009 at 5:41 PM, marius d. marius.dan...@gmail.com wrote:

   I think so too. Does anyone have an opinion against this? I'll
   probably have some time this week or next weekend to work on it.

   Br's,
   Marius

   On Sep 13, 2:59 pm, Timothy Perrett timo...@getintheloop.eu wrote:
   A synthetic file sounds good to me and would probably be preferable.

   Cheers, Tim

   On 13 Sep 2009, at 20:31, marius d. wrote:

That looks a little cleaner but we'll have to look more into it if
we'd want to go on this path. Perhaps accumulate those function into
synthetic js file .. we'll see

In my opinion what should be a high priority in this thread is to
strip the javascript of the html elements and bind the javascript
events from within one javascript snippet written at the end of the
html page or as an exernal js file and only if the user wants to.

That is my 2 cents!
Yoryos

--~--~-~--~~~---~--~~
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: Why isn't this a trait in lift-json?

2009-09-14 Thread Joni Freeman

On Sep 14, 8:14 am, Naftoli Gugenheim naftoli...@gmail.com wrote:
 Can't you require back ticks and name the case class members the same as in 
 the JSON?

This works pretty well, thanks for pointing out this solution! I added
name demangling to support back ticks and removed @path annotation.
It is no longer necessary since there is two workarounds (back ticks
and map function).

The relevant commit which needs to be reviewed:
http://github.com/jonifreeman/liftweb/commit/b452c56f2d4d4b3e289cffdf389b862cfad4da98

Other pending commits which are not pushed to dpp's master yet and
needs to be reviewed:
http://github.com/jonifreeman/liftweb/commit/4dd150c089d834912b1025e350161aa23beb9fb9
http://github.com/jonifreeman/liftweb/commit/a6ce11916e0c08eb00769cbd7a358bf508c5f064
http://github.com/jonifreeman/liftweb/commit/18a667371271cb5a7a9fd1e6d26ec3d06010937d
http://github.com/jonifreeman/liftweb/commit/cee2a1f41503f3e6865d1fd091b4c6aefee82b41

Cheers Joni

--~--~-~--~~~---~--~~
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: Master build failing...

2009-09-14 Thread Timothy Perrett

Just pushed a fix.

Cheers, Tim

On Sep 14, 9:23 am, Timothy Perrett timo...@getintheloop.eu wrote:
 Guys,

 Master build on hudson is now failing Naftoli, it looks like your
 commit has broken the build. Could you please take a look and correct
 it asap?

 We have a process by which you must complete a full local build of
 lift before committing anything to lift master; moreover, we now have
 a process by which you need another committer to complete a code
 review on your branch before merging to HEAD.

 [WARNING] /Users/timperrett/repositories/lift/lift-framework/lift-
 mapper/src/main/scala/net/liftweb/mapper/view/TableEditor.scala:179:
 error: value bind is not a member of scala.xml.NodeSeq
 [WARNING]     xhtml.bind(header,
 [WARNING]           ^
 [WARNING] one error found

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



[Lift] Re: Nested binding

2009-09-14 Thread Heiko Seeberger
Jose,
please take it from here:
http://wiki.github.com/dpp/liftweb/how-to-binding-view-content-to-code

Cheers,

Heiko

2009/9/14 José María josemariar...@gmail.com


 Hi,

 I want to render the content of some tables one after another:

 table 1
  data
 table 2
  data
 table 3
  data

 I want to separate the XHTML from the code, so I'm trying to use
 binding. My problem is that each table is rendered with the same XHTML
 template, as every row.

 If I use bind to bind the tables:

 lift:mysnippet.tables
 
 /lift:mysnippet.tables

 What can I do to bind the rows inside this snippet so I can render
 them? This is what I tried/want/expect:

 lift:mysnippet.tables
  table:name/
 table:rows?
   row:name??
 /table:rows ?
 /lift:mysnippet.tables

 Best regards.
 



-- 
Heiko Seeberger

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

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



[Lift] Re: Lift deal breakers

2009-09-14 Thread Indrajit Raychaudhuri



On Sep 14, 7:35 am, Charles F. Munat c...@munat.com wrote:

 But we've got a desideratum, anyway. Maybe down the road someone will
 have time to look at it.

 Thanks for the clarification!

And also enable somebody (myself) take a pause and (re-)learn/
understand many important concepts in the way.
Thank you very much everybody!

Cheers, Indrajit

--~--~-~--~~~---~--~~
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: Ajax example from the book

2009-09-14 Thread Daniel Nelson

If you're referring to the Exploring Lift book, have a look at Section
3.11.1 Binding Values in Snippets where it explains bind. (I'm new
to Lift myself and hopefully not leading you astray.)

1. myFunc's html parameter is fed automatically by the HTML Lift
Template.  In the follow example, everything between
lift:SomeClass.myFunc and /lift:SomeClass.myFunc is passed to
myFunc.

lift:surround with=default at=content
h2Hello World/h2
lift:SomeClass.myFunc form=POST
p Some Text hello:description //p
hello:button /
/lift:SomeClass.myFunc
/lift:surround


2. hello is a prefix for referring to template elements by name. The
HTML Lift template should have some like hello:button / which will
get replaced by the evaluation after - within bind().

3. I'm not sure what you mean How does the div work.


On Sep 13, 10:24 pm, jack jack.wid...@gmail.com wrote:
 Could somebody please explain to me how this example from the book
 works.

  def myFunc(html:NodeSeq):NodeSeq  = {
         bind(hello,html,button -
          ajaxButton(Text(Press me),
                     { () =
                       println(Got an Ajax call.)
                      SetHtml(my-div, Text(That's it))
                    })
        )
   }

 In particular, what do I pass in as the html parameter?
 What is 'hello'?
 How does the div work?

 I don't understand 'bind'.

--~--~-~--~~~---~--~~
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: MappedDate.setFromAny only works with strings?

2009-09-14 Thread Kevin Wright
IIRC, scala-time is a wrapper over joda-time anyway
I vote +100 for moving away from Java's dates and all the associated
problems.  0-indexed month numbers and thread-unsafe parsing are just the
tip of that particular iceberg...


On Mon, Sep 14, 2009 at 5:23 PM, Derek Chen-Becker dchenbec...@gmail.comwrote:

 Anyone else care to comment? Joda Time and Scala Time are both licensed
 Apache, so I don't think there would be any issues there, but this would be
 a significant change. Would anyone here strongly prefer to stay with
 java.util.Date?

 Derek


 On Sat, Sep 12, 2009 at 12:56 PM, Charles F. Munat c...@munat.com wrote:


 +1 for joda or scala time if it's not too disruptive

 Chas.

 Indrajit Raychaudhuri wrote:
  Also, the LiftRules.parseDate function currently does DateTime
  parsing, so I would have to make a breaking change to rename it to
  parseDateTime and add new parseDate and parseTime (and associated
  format methods). Thoughts?
  I think this is the right solution. Don't know how much will break
  because of this though. But hey, if we're breaking things anyway, why
  not put in Joda time (or maybe scala-timehttp://
 github.com/jorgeortiz85/scala-time/tree/master;-)
 
  Although not belonging to breaking changers camp, breaking changes are
  great when it's for a cause. IMHO, scala time is a darn good cause and
  worth the break!
 
  Cheers, Indrajit
 
  /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: MappedDate.setFromAny only works with strings?

2009-09-14 Thread Derek Chen-Becker
Anyone else care to comment? Joda Time and Scala Time are both licensed
Apache, so I don't think there would be any issues there, but this would be
a significant change. Would anyone here strongly prefer to stay with
java.util.Date?

Derek

On Sat, Sep 12, 2009 at 12:56 PM, Charles F. Munat c...@munat.com wrote:


 +1 for joda or scala time if it's not too disruptive

 Chas.

 Indrajit Raychaudhuri wrote:
  Also, the LiftRules.parseDate function currently does DateTime
  parsing, so I would have to make a breaking change to rename it to
  parseDateTime and add new parseDate and parseTime (and associated
  format methods). Thoughts?
  I think this is the right solution. Don't know how much will break
  because of this though. But hey, if we're breaking things anyway, why
  not put in Joda time (or maybe scala-timehttp://
 github.com/jorgeortiz85/scala-time/tree/master;-)
 
  Although not belonging to breaking changers camp, breaking changes are
  great when it's for a cause. IMHO, scala time is a darn good cause and
  worth the break!
 
  Cheers, Indrajit
 
  /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: Nested binding

2009-09-14 Thread José María

That's what I need Heiko!!

But I've another problem, the following code:

def estante1 (xhtml : NodeSeq ) : NodeSeq =  this.estante(xhtml,
Peluches, List(180L,34L,55L) )

def estante (xhtml: NodeSeq, nombre: String, listaProductos : List
[Long]) : NodeSeq = {
bind(estante, xhtml,
 nombre -- nombre,
 productos -- listaProductos.flatMap( id =
  Producto.find(id) match {
  case Full(producto) = bind(p,
chooseTemplate(producto,datos,xhtml),
  nombre --
producto.nombre)

  case _ = NodeSeq.Empty
  }))
  }

Applied to:

lift:estantes.estante1
div class=Estante
h3estante:nombre//h3
ul
estante:productos
producto:datos
p:nombre/
/producto:datos
/estante:productos
/ul
/div
/lift:estantes.estante1

Generates this xhtml:


div class=Estante
h3Peluches/h3
ul
   List(
, Peluche de la E. Coli (Escherichi Coli),
,
, Peluche del Resfriado común (Rhinovirus),
,
, Peluche de la Sífilis (Treponema pallidum),
   )
/ul
/div

Looks like a serialization of the NodeSeq, as if it doesn't concat the
nodes.

Cheers




On Sep 14, 12:48 pm, Heiko Seeberger heiko.seeber...@googlemail.com
wrote:
 Jose,
 please take it from 
 here:http://wiki.github.com/dpp/liftweb/how-to-binding-view-content-to-code

 Cheers,

 Heiko

 2009/9/14 José María josemariar...@gmail.com





  Hi,

  I want to render the content of some tables one after another:

  table 1
   data
  table 2
   data
  table 3
   data

  I want to separate the XHTML from the code, so I'm trying to use
  binding. My problem is that each table is rendered with the same XHTML
  template, as every row.

  If I use bind to bind the tables:

  lift:mysnippet.tables
  
  /lift:mysnippet.tables

  What can I do to bind the rows inside this snippet so I can render
  them? This is what I tried/want/expect:

  lift:mysnippet.tables
   table:name/
  table:rows?
    row:name??
  /table:rows ?
  /lift:mysnippet.tables

  Best regards.

 --
 Heiko Seeberger

 My job: weiglewilczek.com
 My blog: heikoseeberger.name
 Follow me: twitter.com/hseeberger
 OSGi on Scala: scalamodules.org
 Lift, the simply functional web framework: liftweb.net
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to 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: MappedDate.setFromAny only works with strings?

2009-09-14 Thread Timothy Perrett
java.util.Date isnt thread safe so its probably best we move away from  
that anyways...

Cheers, Tim

On 14 Sep 2009, at 17:23, Derek Chen-Becker wrote:

 Anyone else care to comment? Joda Time and Scala Time are both  
 licensed Apache, so I don't think there would be any issues there,  
 but this would be a significant change. Would anyone here strongly  
 prefer to stay with java.util.Date?

 Derek

 On Sat, Sep 12, 2009 at 12:56 PM, Charles F. Munat c...@munat.com  
 wrote:

 +1 for joda or scala time if it's not too disruptive

 Chas.

 Indrajit Raychaudhuri wrote:
  Also, the LiftRules.parseDate function currently does DateTime
  parsing, so I would have to make a breaking change to rename it to
  parseDateTime and add new parseDate and parseTime (and associated
  format methods). Thoughts?
  I think this is the right solution. Don't know how much will break
  because of this though. But hey, if we're breaking things anyway,  
 why
  not put in Joda time (or maybe 
  scala-timehttp://github.com/jorgeortiz85/scala-time/tree 
 /master;-)
 
  Although not belonging to breaking changers camp, breaking changes  
 are
  great when it's for a cause. IMHO, scala time is a darn good cause  
 and
  worth the break!
 
  Cheers, Indrajit
 
  /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: Lift deal breakers

2009-09-14 Thread David Pollak
On Sat, Sep 12, 2009 at 11:48 AM, Charles F. Munat c...@munat.com wrote:


 I, too, would like to be able to move the liftAjax script call to the
 bottom of the page.


Open a ticket and I'll see what I can do... it shouldn't be too hard



 Chas.

 Dustin Whitney wrote:
  Hey, I like Lift so in an effort to improve it I am submitting some
  criticism.
 
  Obtrusive javascript:
 
  when I create an ajaxButton I get this html:
 
  button
 onclick=liftAjax.lift_ajaxHandler(quot;F1029758482780OTA=truequot;, null,
 null, null); return false;Press me/button
 
  That onclick is not ok.  It's bad for SEO and makes the page harder to
  read.  Ideally, no javascript should appear on the page whatsoever.
 
  Client Side Load Time:
 
  I strive for that A in Y-Slow, so when I see
 
  script type=text/javascript src=/ajax_request/liftAjax.js
 view-source:http://localhost:8080/ajax_request/liftAjax.js/script
 
  at the top of the page, I feel a little uneasy, and there is nothing I
  can do (I think) to move it to the bottom of the page.
 
  -Dustin
 
  

 



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

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



[Lift] Re: Lift deal breakers

2009-09-14 Thread David Pollak
On Sat, Sep 12, 2009 at 7:21 AM, Indrajit Raychaudhuri
indraj...@gmail.comwrote:




 On Sep 12, 7:02 pm, marius d. marius.dan...@gmail.com wrote:
  On Sep 12, 8:34 am, Indrajit Raychaudhuri indraj...@gmail.com wrote:
 
   Even if we assumed that Lift managed to do all the hard work, we still
   have a contradictory situation: the body/ being completely devoid of
   scripts but still have 'JS loaded at the end of the page'. It still
   has to be before the close of body tag and thereby sneaking into the
   body/. Worse, it's going to be incredibly difficult to implement a
   rich client interface (Cappuccino, Dojo, Sproutcore etc. - those who
   want to take complete control over the DOM) without the developer
   constantly having to prevent Lift and the UI framework not wrestle and
   step into the each other. A web *application* (like CMS) can get away
   with that, but not a *framework* (like Lift).
 
  What control of Lift over the DOM are you talking about. Lift's
  generated scripts in HTML is minimal, and it is about Comet mostly.
  Lift scripts do not really stay in other frameworks way. If you have a
  concrete example where Lift's stays in the way of integrating other
  tools please be specific about the problem and we'll see what/if we
  can do something about it. What is the exact wrestle here?

 My comment was in addition to your point:
 If we'd still want this style but be JS library agnostic we'd have to
 do our own DOM manipulation etc which just adds more overhead without
 any practical gain.

 Currently, Lift *doesn't* do any DOM manipulation at all, just
 generates valid XHTML content and thus *doesn't* stay in the way of
 integration, which is a healthy thing. And that was my point.


Just to underscore this point, I did Cappuccino integration in  1 day (and
that included learning Cap, figuring out how to serve the .j and .sj files
via Lift with the right mime type, etc.)



 Cheers, Indrajit

 
 
   And I am given to understand spiders are nowadays smart to recognize
   dom events handlers (e.g., onclick) and decide what to do when it
   encounters them.
 
   Oh, and while at that, 'view source' a GWT based application and help
   youself have a perspective :)
 
   Cheers, Indrajit
 
   On Sep 12, 5:07 pm, marius d. marius.dan...@gmail.com wrote:
 
+1 Andrew.
 
Regarding the rule - absolutely no javascript in the markup doesn't
make a lot of sense. Some of the Lift's generated javascript for
 comet/
ajax calls is put inline at the end of the page. I see no practical
reason not to do that. On the other hand putting liftAjax.js on the
top of the page is not bad either. IN certain situations users may
need this loaded prior their own js code. Besides I really doubt that
putting it at the end of the page would really make any practical
difference.
 
Not putting lift's JS callas such as Ajax at onclick events like that
can become quite lucrative from framework perspective because:
 
1. Lift would have to queue all these events and add them to a JS
sequence and add this js to the served page.
2. that would create a dependency to JQuery events style that would
have to be changed when YUI is in place or potentially other
framework. If we'd still want this style but be JS library agnostic
we'd have to do our own DOM manipulation etc which just adds more
overhead without any practical gain.
 
Br's,
Marius
 
On Sep 11, 10:18 pm, Andrew Scherpbier and...@scherpbier.org
 wrote:
 
 Dustin Whitney wrote:Hey, I like Lift so in an effort to improve it
 I am submitting some criticism.
 Obtrusive javascript:
 when I create an ajaxButton I get this
 html:buttononclick=liftAjax.lift_ajaxHandler(quot;F1029758482780OTA=truequot;,
 null, null, null); return false;Press me/buttonThat onclick is not ok.
 It's bad for SEO and makes the page harder to read.  Ideally, no javascript
 should appear on the page whatsoever. (I presume here SEO == Search Engine
 Optimization.)
 If you are going to use AJAX in your website, you have to use
 Javascript, right?  If you don't want to use AJAX with lift, don't...  Just
 use standard forms and links.  (Also turn off client-side garbage collection
 and any comet stuff in Boot.scala...)
 So assuming you actually want an ajaxButton, the onclick needs to
 get in there somehow.  The only other way would be to have lift create some
 javascript that modifies the DOM to somehow add that onclick.  I think that
 would be much harder to read!
 For the SEO stuff, are you assuming deep traversal (clicking
 through forms) into your webapp by spiders?  I don't know of any spiders
 that do that very well.  Anyway, if that's what you want, then I wouldn't
 use AJAX for anything.
 A neat trick to let spiders get to all your public pages if your
 site has a complex form/ajax based navigation system is to use a site map
 and make sure all your main URLS are simple, non-form URLs.

[Lift] Re: Lift deal breakers

2009-09-14 Thread David Pollak
On Mon, Sep 14, 2009 at 12:51 AM, valotas valo...@gmail.com wrote:




 On Sep 14, 3:43 am, marius d. marius.dan...@gmail.com wrote:
  I kinda used the term js file a bit too loosely. It is true that each
  page would likely have different functions there and even the same
  page on subsequent load would have different content so the file can
  not really be cached.
 
  I'm thinking that instead of:
 
  button onclick=liftAjax.lift_ajaxHandler
  ('F1029758482780OTA=true',null, null, null); return false;Press me/
  button
 
  We could have:
 
  button onclick=liftAjax('F1029758482780OTA')Press me/button
 
  ...
 
  .. and at the end of the page:
 
  script type=text/javascript
 
  function liftAjax(id) {
 liftAjax.lift_ajaxHandler(id + '=true',null, null, null); return
  false;}
 
  ...
 
  /script


 With this approach you still have an onclick event binded to the dom
 element (in this case button) with html and this is bad practice for
 javascript development. Additionally you create another function
 called liftAjax at the window scope witch is again bad practice!

 What I described on my previous post is that good javascript
 development practice


Why?  It seems to me, and I'm open to some studies or other descriptions as
to why this is best practice, that designers are dealing with Lift templates
before the JavaScript is inserted, so they don't see the JavaScript and they
don't have to worry about it.  How the logic of the JavaScript gets attached
to the rendered page is immaterial except for (1) automated scanners of a
given page or (2) debugging the page.  In terms of the first point, yeah,
it's an issue.  In terms of the latter, I find it much easier to use Firebug
to attach to a script that I can see rather than some script that's attached
programmatically to the DOM element.

I'm open to understanding a different workflow.


 means that there should be nothing that has to do
 with javascript except script tags inside the html. Now If you can to
 get as less script tags as possible inside html is also better.


Unfortunately, if you've got a dynamically generated HTML page, you can't
have a statically generated Script page.   So, you either have (1) a page
that contains HTML with scripts at the bottom or (2) an HTML page that
references a dynamically generated JavaScript file.  The latter is a lose
because you've got 2 http requests rather than 1 and the complexity of
remembering what the JavaScript page looks like is non-trivial.



 
  Likely there will be more synthetic functions that would need to be
  generated depending on specific cases. This approach would result in a
  slightly larger markup but I'm not sure if the impact is negligible or
  not. In essence we are replacing a function call with another one more
  concise which helps just in having a more concise function calls in
  the markup.
 
  BUT most likely for functions like liftAjax above we should put them
  in liftAjax.js that lift generates and those would just be helper
  function. This means that the script block above will not be needed
  anymore. Thoughts?
 
  Thanks Xavi for the good points.
 
  Br's,
  Marius
 
  On Sep 13, 7:03 pm, Xavi Ramirez xavi@gmail.com wrote:
 
   If I understand everything correctly, the proposal is to dynamically
   create a js file for each page request to add event handlers?
 
   If this is true, then I'm against the proposal for the following two
 reasons:
 
   1. Every page will load slower
 
   Since the js file is dynamically create on each request, the js file
   will be un-cacheable.  This means the browser be will forced to make
   an addition HTTP request to the server to render each page.  This adds
   roughly 150ms to the page load time (50ms to 200ms for network lag,
   50ms for download, 10ms for js execution).

 This is partially true. If you have a page that can be cached except
 some javascript for example it is better to have the javascript as an
 external file. If not you could ad the dynamically created javascript
 inside the html body but it is still better to load it at the end of
 your html document.

 
   2. Each page will be more fragile
 
   Requiring the synthetic js file will add another point of failure.
   Even now-a-days with the ubiquity of broadband, connects still get
   lost and files still get corrupted.
 
   It's true that most modern web pages already depend a number of
   external JS and CSS files, but typically these files are static and
   easily cached.
 
   Just adding my 2 cents.
 
   -Xavi
 
   On Sun, Sep 13, 2009 at 5:41 PM, marius d. marius.dan...@gmail.com
 wrote:
 
I think so too. Does anyone have an opinion against this? I'll
probably have some time this week or next weekend to work on it.
 
Br's,
Marius
 
On Sep 13, 2:59 pm, Timothy Perrett timo...@getintheloop.eu wrote:
A synthetic file sounds good to me and would probably be preferable.
 
Cheers, Tim
 
On 13 Sep 2009, at 20:31, marius d. wrote:
 
 

[Lift] Re: Lift deal breakers

2009-09-14 Thread David Pollak
Nothing in Lift the way it exists today would preclude such a setup.  Just
as I was able to integrate with Cappuccino (which is all JS-generated view),
it's dead simple to integrate with any other non-markup framework.
The thing that triggered this thread was Lift's insertion of JavaScript into
attributes of tags.  I can see an alternative mechanism much like what we do
with Lift's comet:when attribute (which is used during the intermediate
mark-up but is no longer rendered out to the browser.  We could then render
clean HTML and attach events in JavaScript rendered at the bottom of the
page.

More generally, Lift's mechanism for JavaScript support is *not* required.
 You could build your own mechanism that would generate clean mark-up,
render JavaScript at the end of the page which would attach to DOM events.
 Everybody has access to Lift's GUID - Function binding.  You can use it
just like it's used in SHtml, but generate your own mark-up.

On Sun, Sep 13, 2009 at 6:41 PM, Josh Suereth joshua.suer...@gmail.comwrote:

 This is how we do JavaScript/ExtJS development at my work place, except
 with a twist.


 We actually have a javascript-only project for a our javascript library.
 We use the maven-javascript-tools plugins to create a javascript project
 that relies on others (in our case, things like Simile Timeline and
 ExtJS).   We then compile/minify the javascript into an 'artifact' that gets
 used by our main webapp, where the alchim yui-compressor takes all the
 CSS/Javascript and bundles as much of it as possible into a single huge JS
 file.

 The library project can make use of JSUnit tests (slow-to-run, recommend
 for integration tests only), and has its own stubbed out controllers and
 jetty for testing.

 It's a very interesting setup, but I'm very happy with it.  We have very
 modular JS code, and very very very very very very little JSP/HTML code (we
 didn't select lift at work).  If I were to start using Lift for my backend
 to ExtJS I would need support for a similar setup (i.e. expect little or no
 HTML generated outside of the Javascript).


 Also, the ability to cache dynamically created pages works great for our
 product in production, however, we're only dynamically creating a javasript
 file containing very static resources (externalized string library for use
 when rendering in javascript.  This ensures our Javascript and Java
 externalization works similarly.)  I highly recommend the approach if using
 something like ExtJS,  however for lift's templates I'd agree that a
 page-unique-id would be required for every synthetically created js file
 so that caching works appropriately.  You can also force the browser to
 check if something's changed.  We have a development hack that checks
 class-load time of the  synthetic-js-generator and ensures the cached copy
 is up-to-date from that time.   This means jetty-reloads will reload the
 class and ensure the next refresh pulls a new version.  It's a bit tricky to
 get set up at first, but worked great!

 Hopefully this input is helpful!

 - Josh


 On Sun, Sep 13, 2009 at 8:48 PM, Charles F. Munat c...@munat.com wrote:


 I'm afraid I have to disagree. As a website developer, I've been putting
 all my JS into an external file (per page when necessary) for many years
 without any problems. Every good JS programmer I know does the same. It
 is considered *more* not less robust to put the JS in an external file
 and attach event handlers to the DOM from there.

 Page loading is in the eye of the beholder. Moving the JS to external
 scripts and the script tags to the bottom of the page actually makes the
 page appear more quickly, hence load faster in the mind of the user.

 Fragility is a non-issue. If the JS is all in the external file and the
 file does not load, then the page loads without JS. Put the event
 handlers in the HTML and the external file to which they refer doesn't
 load, same problem (except now you get a raft of JS errors).

 With best practices, the JS file can be cacheable, albeit per-page.

 Ideally, here's what I'd like. I add Lift tags to my page for each JS
 file I want included with the page. In each tag I designate whether that
 file is cacheable or dynamic and whether it is site-wide or specific to
 that page.

 Lift then takes all the site-wide cacheable pages, in the order I
 specified them, and gzips them up into a single file. Then it inserts a
 script tag for that file at the bottom of the page.

 Similarly, it takes all the page-specific cacheable pages, adds Lift's
 own page specific stuff at the end (the event handlers of which we
 speak), gzips it, gives it a name unique to that page, and adds another
 script tag for that file.

 Finally, it gzips up all dynamically-generated JS and gives it a
 timestamp for a filename so it won't be cached.

 This way I get jQuery, Ext JS, etc. all downloaded and cached in one big
 gzipped file. I get all page-specific but unchanging JS in another
 gzipped file for each 

[Lift] JSON forms problem

2009-09-14 Thread glenn

This may be a question for the Lift Book forum, but has anyone gotten
the JSON forms example 8.13 in the Lift Book to work?  When I tried
it, the JsonHandler in class JSONForm never gets called when the
submit button is clicked.

Glenn
--~--~-~--~~~---~--~~
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: Why isn't this a trait in lift-json?

2009-09-14 Thread David Pollak
On Sun, Sep 13, 2009 at 3:31 PM, marius d. marius.dan...@gmail.com wrote:




 On Sep 13, 3:15 pm, Joni Freeman freeman.j...@gmail.com wrote:
  Hi,
 
  That annotation is used to configure the json path when extracting
  values. By default the extraction code assumes that case class
  parameter names match with json field names. For instance these match:
 
  case class Foo(bar: String, baz: Int)
  { bar: qwerty, baz: 10 }
 
  But sometimes json field names can contain characters which are not
  allowed in Scala identifiers. For example:
  { foo-bar: qwerty, baz: 10 }
 
  Now, to able to extract this we have to somehow tell the extractor the
  exact path explicitly. Currently @path annotation is used for that:
  case class Foo(@path(foo-bar) bar: String, baz: Int)
 
  I don't see how a trait can accomplish this, maybe I'm missing
  something?
 
  The reason why it is in Java is that Scala annotations are not
  accessible at  runtime.

 Right but I'd also suggest removing Java code from Lift stack. The
 above can be easily achieved by introducing a trait such as:

 case class Foo(bar: String with Nominator, baz: Int)


Is this even possible?  I think that it might be a problem to extend String,
which is a final class.



 Lift is a 100% Scala code with zero Java code. We also have strong
 opinions in the team that we should stay away from annotations.


Yes, this is absolutely correct.

The issue then gets to when do you have an exception to a rule?

I'm not sure this is the exception, but it's the closest thing I've seen.

Perhaps an alternative could be a companion object:

object Foo {
  val jsonFieldMapping: List[(String, String)] = ...
}

This is consistent with companion objects and implicits.

On the other hand, I lean (just a little) toward annotations in this case...
it's one of the few times I've seen annotations used in what I consider to
be a sane way.

I'm interested in hearing Marius' (and others') further thoughts as to
whether this should be the exception that proves the rule.

Thanks,

David


 one option would be something like this:

 Lift would have :

 trait Nominator{
  def name : String
 }

 In user's code:

 case class Foo(bar: String with MyNominator, baz: Int)

 trait MyNominator extends Nominator {
  def name = foo-bar
 }

 Yes it is more verbose then the annotation but IMHO it is more Scala-
 ish  Lift-ish.



 
  Cheers Joni
 
  On Sep 13, 11:03 pm, Timothy Perrett timo...@getintheloop.eu wrote:
 
   Just had a browse over the latest commit and found the following in
   path.java:
 
   @Retention(RetentionPolicy.RUNTIME)
   @Target(ElementType.TYPE)
   public @interface path {
   public String value();
 
   }
 
   Any reason were not using a trait etc to complete the same
   functionality?
 
   Cheers, Tim
 



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

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



[Lift] Re: Why isn't this a trait in lift-json?

2009-09-14 Thread David Pollak
On Sun, Sep 13, 2009 at 10:02 PM, Naftoli Gugenheim naftoli...@gmail.comwrote:


 Is there a list of rules for committers to stick to? Especially considering
 the review board system being put into place.


No... it's been word of mouth to date.  Maybe after we get user-level
documentation in order we'll start with committer rules.



 -
 Joni Freemanfreeman.j...@gmail.com wrote:


 Extending ClassfileAnnotation does not work at the moment. Excerpt
 from Programming Scala (http://programming-scala.labs.oreilly.com/
 ch13.html):

 Another child of scala.Annotation that is intended to be a parent of
 other annotations is the trait scala.ClassfileAnnotation. It is
 supposed to be used for annotations that should have runtime
 retention, i.e., the annotations should be visible in the class file
 so they are available at runtime. However, actually using it with the
 JDK version of Scala results in compiler errors Hence, if you
 want runtime visibility, you have to implement the annotation in
 Java.

 Cheers Joni

 On Sep 14, 4:18?am, Josh Suereth joshua.suer...@gmail.com wrote:
  Scala does support annotations, they're just anemic at this point.
 
  I hadn't tried, but does extending ClassfileAnnotation allow runtime
  visibility? ?That would give you a pure scala implementation. ?If not, I
  think we need to rally for StaticAnnotation/ClassfileAnnotation to be
 joined
  by their future brother RuntimeAnnotation.
 
  - Josh
 
  On Sun, Sep 13, 2009 at 6:31 PM, marius d. marius.dan...@gmail.com
 wrote:
 
   On Sep 13, 3:15 pm, Joni Freeman freeman.j...@gmail.com wrote:
Hi,
 
That annotation is used to configure the json path when extracting
values. By default the extraction code assumes that case class
parameter names match with json field names. For instance these
 match:
 
case class Foo(bar: String, baz: Int)
{ bar: qwerty, baz: 10 }
 
But sometimes json field names can contain characters which are not
allowed in Scala identifiers. For example:
{ foo-bar: qwerty, baz: 10 }
 
Now, to able to extract this we have to somehow tell the extractor
 the
exact path explicitly. Currently @path annotation is used for that:
case class Foo(@path(foo-bar) bar: String, baz: Int)
 
I don't see how a trait can accomplish this, maybe I'm missing
something?
 
The reason why it is in Java is that Scala annotations are not
accessible at ?runtime.
 
   Right but I'd also suggest removing Java code from Lift stack. The
   above can be easily achieved by introducing a trait such as:
 
   case class Foo(bar: String with Nominator, baz: Int)
 
   Lift is a 100% Scala code with zero Java code. We also have strong
   opinions in the team that we should stay away from annotations.
 
   one option would be something like this:
 
   Lift would have :
 
   trait Nominator{
   ?def name : String
   }
 
   In user's code:
 
   case class Foo(bar: String with MyNominator, baz: Int)
 
   trait MyNominator extends Nominator {
   ?def name = foo-bar
   }
 
   Yes it is more verbose then the annotation but IMHO it is more Scala-
   ish  Lift-ish.
 
Cheers Joni
 
On Sep 13, 11:03 pm, Timothy Perrett timo...@getintheloop.eu
 wrote:
 
 Just had a browse over the latest commit and found the following in
 path.java:
 
 @Retention(RetentionPolicy.RUNTIME)
 @Target(ElementType.TYPE)
 public @interface path {
 ? ? public String value();
 
 }
 
 Any reason were not using a trait etc to complete the same
 functionality?
 
 Cheers, Tim
 
 


 



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

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



[Lift] Re: Why isn't this a trait in lift-json?

2009-09-14 Thread Naftoli Gugenheim

Can someone detail the minus side of annotations? (Other than it's just not 
the Scala/Lift way. :) Preferably in terms of what goal it inhibits.)

Also keep in mind that the exception in terms of the code being in a Java 
source file is a temporary workaround that will be replaced when it's possible, 
so it's not a huge exception.

-
David Pollakfeeder.of.the.be...@gmail.com wrote:

On Sun, Sep 13, 2009 at 3:31 PM, marius d. marius.dan...@gmail.com wrote:




 On Sep 13, 3:15 pm, Joni Freeman freeman.j...@gmail.com wrote:
  Hi,
 
  That annotation is used to configure the json path when extracting
  values. By default the extraction code assumes that case class
  parameter names match with json field names. For instance these match:
 
  case class Foo(bar: String, baz: Int)
  { bar: qwerty, baz: 10 }
 
  But sometimes json field names can contain characters which are not
  allowed in Scala identifiers. For example:
  { foo-bar: qwerty, baz: 10 }
 
  Now, to able to extract this we have to somehow tell the extractor the
  exact path explicitly. Currently @path annotation is used for that:
  case class Foo(@path(foo-bar) bar: String, baz: Int)
 
  I don't see how a trait can accomplish this, maybe I'm missing
  something?
 
  The reason why it is in Java is that Scala annotations are not
  accessible at  runtime.

 Right but I'd also suggest removing Java code from Lift stack. The
 above can be easily achieved by introducing a trait such as:

 case class Foo(bar: String with Nominator, baz: Int)


Is this even possible?  I think that it might be a problem to extend String,
which is a final class.



 Lift is a 100% Scala code with zero Java code. We also have strong
 opinions in the team that we should stay away from annotations.


Yes, this is absolutely correct.

The issue then gets to when do you have an exception to a rule?

I'm not sure this is the exception, but it's the closest thing I've seen.

Perhaps an alternative could be a companion object:

object Foo {
  val jsonFieldMapping: List[(String, String)] = ...
}

This is consistent with companion objects and implicits.

On the other hand, I lean (just a little) toward annotations in this case...
it's one of the few times I've seen annotations used in what I consider to
be a sane way.

I'm interested in hearing Marius' (and others') further thoughts as to
whether this should be the exception that proves the rule.

Thanks,

David


 one option would be something like this:

 Lift would have :

 trait Nominator{
  def name : String
 }

 In user's code:

 case class Foo(bar: String with MyNominator, baz: Int)

 trait MyNominator extends Nominator {
  def name = foo-bar
 }

 Yes it is more verbose then the annotation but IMHO it is more Scala-
 ish  Lift-ish.



 
  Cheers Joni
 
  On Sep 13, 11:03 pm, Timothy Perrett timo...@getintheloop.eu wrote:
 
   Just had a browse over the latest commit and found the following in
   path.java:
 
   @Retention(RetentionPolicy.RUNTIME)
   @Target(ElementType.TYPE)
   public @interface path {
   public String value();
 
   }
 
   Any reason were not using a trait etc to complete the same
   functionality?
 
   Cheers, Tim
 



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



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



[Lift] ANNOUNCE: New functionality for Mapper logging with breaking changes

2009-09-14 Thread Derek Chen-Becker
Hi all,
I've made a change to the Mapper logging functionality. The
DB.addLogFunc method has changed to:

addLogFunc( f: (DBLog,Long) = Any)

where DBLog is a new trait (below) and the Long corresponds to the *total*
duration of a given DB execution method. DBLog is defined as:

trait DBLog {
  ... private stuff up here ...
  /** Return a list of all of the DBStatementEntry instances in the log
buffer */
  def statementEntries : List[DBStatementEntry] = ...

  /** Return a list of all of the DBMetaEntry instances in the log buffer */
  def metaEntries : List[DBMetaEntry] = ...

  /** Return all log buffer entries */
  def allEntries : List[DBLogEntry] = ...
}

and we have some new event class/traits:

trait DBLogEntry {
  def statement : String
  def duration : Long
}
object DBLogEntry {
  def unapply(obj : Any) = obj match {
case entry : DBLogEntry = Some(entry.statement,entry.duration)
case _ = None
  }
}
case class DBStatementEntry(statement : String, duration : Long) extends
DBLogEntry
case class DBMetaEntry(statement : String, duration : Long) extends
DBLogEntry

Statements are SQL statements, prepared or immediate, and meta entries
correspond to things like getMaxRows, getGeneratedKeys, etc. As you can see,
each individual statement records its own duration as well, so you can get
fine-grained detail on all activity. An example log function in Boot could
look like:

DB.addLogFunc {
  case (query, time) = {
Log.info(All queries took  + time + ms: )
query.allEntries.foreach({ case DBLogEntry(stmt, duration) =
Log.info(stmt +  took  + duration + ms)})
Log.info(End queries)
  }
}

And we get output like:

INFO - All queries took 17ms:
INFO - Exec update INSERT INTO users
(lastname,locale,password_pw,password_slt,validated,uniqueid,timezone,firstname,email,superuser,textarea)
VALUES
(C,en_US,GzwLqDpmJ6TrECg06bGKvOAQxyc=,1JTAWGSSYLJHXASO,1,DU0G0RT3IFOA0NHSY5QQQTX42BOIHDGI,US/Mountain,D,
d...@c.com,0,) : updated 1 rows took 9ms
INFO - Get generated keys : rs =
oracle.jdbc.driver.oraclereturnresult...@23f9e6e5 took 2ms
INFO - Closed Statement took 0ms
INFO - End queries

Note that this code does introduce a breaking change if you're already using
log functions, since the addLogFunc signature has changed.

--~--~-~--~~~---~--~~
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: Why isn't this a trait in lift-json?

2009-09-14 Thread David Pollak
On Mon, Sep 14, 2009 at 10:34 AM, Naftoli Gugenheim naftoli...@gmail.comwrote:


 Can someone detail the minus side of annotations? (Other than it's just
 not the Scala/Lift way. :) Preferably in terms of what goal it inhibits.)


Annotations inhibit the goal of simple, uniform code written in a single
language (the more languages, the more bugs and maintenance issues).


   - Annotations are a separate language within a language.  This means:
  - There is no IDE support unless the IDE tries to support the
  particular annotation
  - Refactoring tools may or may not work with a given annotation
  - It's something else for the developer to learn (the semantics of a
  given set of annotations)
   - Annotations of any complexity fail to capture every use case and have
   to be extended to support new logic... in a language that's different from
   the host language
   - Annotations (in Java, but not Python) are visually ugly
   - Annotations point up where the host language has failed.




 Also keep in mind that the exception in terms of the code being in a Java
 source file is a temporary workaround that will be replaced when it's
 possible, so it's not a huge exception.


This temporary issue has persisted for 3+ years.  I originally tried to do
mapper with annotations (taking a page from Java-land.)  Because I needed to
drop to Java to define runtime accessible annotations, I went in search of
another mechanism and found that by and large, Scala's syntax and rich
language features make annotations unnecessary.



 -
 David Pollakfeeder.of.the.be...@gmail.com wrote:

 On Sun, Sep 13, 2009 at 3:31 PM, marius d. marius.dan...@gmail.com
 wrote:

 
 
 
  On Sep 13, 3:15 pm, Joni Freeman freeman.j...@gmail.com wrote:
   Hi,
  
   That annotation is used to configure the json path when extracting
   values. By default the extraction code assumes that case class
   parameter names match with json field names. For instance these match:
  
   case class Foo(bar: String, baz: Int)
   { bar: qwerty, baz: 10 }
  
   But sometimes json field names can contain characters which are not
   allowed in Scala identifiers. For example:
   { foo-bar: qwerty, baz: 10 }
  
   Now, to able to extract this we have to somehow tell the extractor the
   exact path explicitly. Currently @path annotation is used for that:
   case class Foo(@path(foo-bar) bar: String, baz: Int)
  
   I don't see how a trait can accomplish this, maybe I'm missing
   something?
  
   The reason why it is in Java is that Scala annotations are not
   accessible at  runtime.
 
  Right but I'd also suggest removing Java code from Lift stack. The
  above can be easily achieved by introducing a trait such as:
 
  case class Foo(bar: String with Nominator, baz: Int)
 

 Is this even possible?  I think that it might be a problem to extend
 String,
 which is a final class.


 
  Lift is a 100% Scala code with zero Java code. We also have strong
  opinions in the team that we should stay away from annotations.
 

 Yes, this is absolutely correct.

 The issue then gets to when do you have an exception to a rule?

 I'm not sure this is the exception, but it's the closest thing I've seen.

 Perhaps an alternative could be a companion object:

 object Foo {
  val jsonFieldMapping: List[(String, String)] = ...
 }

 This is consistent with companion objects and implicits.

 On the other hand, I lean (just a little) toward annotations in this
 case...
 it's one of the few times I've seen annotations used in what I consider to
 be a sane way.

 I'm interested in hearing Marius' (and others') further thoughts as to
 whether this should be the exception that proves the rule.

 Thanks,

 David


  one option would be something like this:
 
  Lift would have :
 
  trait Nominator{
   def name : String
  }
 
  In user's code:
 
  case class Foo(bar: String with MyNominator, baz: Int)
 
  trait MyNominator extends Nominator {
   def name = foo-bar
  }
 
  Yes it is more verbose then the annotation but IMHO it is more Scala-
  ish  Lift-ish.
 
 
 
  
   Cheers Joni
  
   On Sep 13, 11:03 pm, Timothy Perrett timo...@getintheloop.eu wrote:
  
Just had a browse over the latest commit and found the following in
path.java:
  
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface path {
public String value();
  
}
  
Any reason were not using a trait etc to complete the same
functionality?
  
Cheers, Tim
  
 


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



 



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

--~--~-~--~~~---~--~~
You 

[Lift] Re: Using Ajax to send text to browser as it is generated.

2009-09-14 Thread David Pollak
I think you want Lift's comet support.  Take a look at the clock in examples
project.

On Sun, Sep 13, 2009 at 9:32 PM, jack jack.wid...@gmail.com wrote:


 I have some code that generates a list of urls but it takes awhile to
 generate all of them. I would like to send them to the browser as they
 are generated. How do I use Ajax to accomplish this.

 I can put the urls in a List as they are generated if that works. But
 how do I hook up the List to the Ajax code.  I do not understand the
 ajax examples in the book.

 Thanks.
 



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

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



[Lift] Re: Why isn't this a trait in lift-json?

2009-09-14 Thread Timothy Perrett

Whilst I cant speak for anyone else - looking at Java these days
generally makes me want to be sick and annotations are simply
convulsion inducing ;-)

There are some issues from a technical perspective with Scala
annotations (like deep nested annotations for JPA), but otherwise, in
terms of lift i think there are not really any good technical reasons
why it is we dont use java annotations - its mainly a general
dislike.

Cheers, Tim

On Sep 14, 6:34 pm, Naftoli Gugenheim naftoli...@gmail.com wrote:
 Can someone detail the minus side of annotations? (Other than it's just not 
 the Scala/Lift way. :) Preferably in terms of what goal it inhibits.)

 Also keep in mind that the exception in terms of the code being in a Java 
 source file is a temporary workaround that will be replaced when it's 
 possible, so it's not a huge exception.

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



[Lift] Re: Lift deal breakers

2009-09-14 Thread Timothy Perrett

Just wading into the fray here...

Looking at people who have responded to this thread, they are mainly
people i've not seen on the list before (sorry if your regulars
perhaps i should pay more attention!) and that indicates to me that
general users dont want *any* js in page (either in the head, the
footer, or attributes) and this should be the default, not the
exceptional case.

Personally, this stuff used to really bother me when doing front end
work. Luckily that is hardly ever now, but i see the point being made
and would like to add my vote to free-ing the markup of inline JS.

Thoughts?

Cheers, Tim

 More generally, Lift's mechanism for JavaScript support is *not* required.
  You could build your own mechanism that would generate clean mark-up,
 render JavaScript at the end of the page which would attach to DOM events.
  Everybody has access to Lift's GUID - Function binding.  You can use it
 just like it's used in SHtml, but generate your own mark-up.

--~--~-~--~~~---~--~~
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: Why isn't this a trait in lift-json?

2009-09-14 Thread Viktor Klang
For me, annotations in Scala are permissible when having to deal with Java
frameworks that need annotations to work.
(examples: JAX-RS, JPA et al)

On Mon, Sep 14, 2009 at 8:06 PM, Timothy Perrett timo...@getintheloop.euwrote:


 Whilst I cant speak for anyone else - looking at Java these days
 generally makes me want to be sick and annotations are simply
 convulsion inducing ;-)

 There are some issues from a technical perspective with Scala
 annotations (like deep nested annotations for JPA), but otherwise, in
 terms of lift i think there are not really any good technical reasons
 why it is we dont use java annotations - its mainly a general
 dislike.

 Cheers, Tim

 On Sep 14, 6:34 pm, Naftoli Gugenheim naftoli...@gmail.com wrote:
  Can someone detail the minus side of annotations? (Other than it's just
 not the Scala/Lift way. :) Preferably in terms of what goal it inhibits.)
 
  Also keep in mind that the exception in terms of the code being in a
 Java source file is a temporary workaround that will be replaced when it's
 possible, so it's not a huge exception.

 



-- 
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: Getting Maven Offline Mode Working

2009-09-14 Thread Peter Robinett

Great. I should have downloaded it again just now to see if it was up
to date, instead I just assumed it hadn't been updated. Thanks for
doing the installer, it's a great way for Mac people to get started
with Lift.

Peter

On Sep 14, 12:52 am, Timothy Perrett timo...@getintheloop.eu wrote:
 Peter,

 I built the installer - some time ago I already upgraded the installer  
 to the latest version of maven and removed java rebel as we are no  
 longer bundling it.

 Cheers, Tim

 Sent from my iPhone

 On 14 Sep 2009, at 06:39, Peter Robinett pe...@bubblefoundry.com  
 wrote:



  Ahh, thanks Josh. It turns out I had a third version of Maven at /
  Applications/liftweb-1.0/apache-maven, in addition to /user/share/
  java/
  apache-maven-2.0.9 and the 2.2.1 version I downloaded. Removing it
  from my PATH got me using the 2.2.1 version.

  Who's responsible for the OS X Lift installer? Can we update it to use
  the latest versions of Lift, Maven, and JavaRebel? How can I help?

  Peter

  On Sep 13, 6:21 pm, Josh Suereth joshua.suer...@gmail.com wrote:
  Check your PATH variable, probably pointing to the wrong maven  
  still.  You
  really need to get off of maven 2.0.9.   The offlline mode is broken.

  2.0.10 should be the minimum version you need to fix that issue.

  On Sun, Sep 13, 2009 at 8:33 PM, Peter Robinett  
  pe...@bubblefoundry.comwrote:

  Thanks, Kevin. Dropping in the latest version didn't seem to work  
  (mvn
  --version kept saying I still had 2.0.9) but switching to 1.1-M5  
  did.

  Peter

  On Sep 13, 4:00 pm, Kevin Wright kev.lee.wri...@googlemail.com
  wrote:
  Maven is essentially a java application, so you *should* just be  
  able to
  download and run.  I'm afraid I can't really give better advice  
  for OS-X
  though.
  One other idea is to work with 1.1-M5, which should let you go  
  offline on
  the older maven version - assuming you have no other snapshot
  dependencies.

  On Sun, Sep 13, 2009 at 10:51 PM, Peter Robinett 
  pe...@bubblefoundry.comwrote:

  Thanks. I have version 2.0.9, which was installed by the Lift OS X
  installer. What is the best way to upgrade to 2.2.1?

  Peter

  On Sep 13, 12:57 pm, Kevin Wright kev.lee.wri...@googlemail.com
  wrote:
  Try updating to the latest maven, older versions have known  
  issues
  with
  offline behaviour for snapshots.

  On Sun, Sep 13, 2009 at 8:55 PM, Peter Robinett 
  pe...@bubblefoundry.com
  wrote:

  Hi all,

  I'm having problems running mvn -o jetty:run with my version of
  Lift
  (1.1-SNAPSHOT) because Maven thinks that
  net.liftweb:lift-core:jar:1.1-
  SNAPSHOT is missing. How do I fix that? My pom.xml is here:
 http://gist.github.com/186293

  I've got an international plane flight in 24 hours, so I'd  
  love to
  have offline mode working for then. Thanks for the help!

  Peter
--~--~-~--~~~---~--~~
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: Best way to write a wizard

2009-09-14 Thread David Pollak
On Sun, Sep 13, 2009 at 10:52 AM, Josh Suereth joshua.suer...@gmail.comwrote:

 All,

 I write to you (unfortunately still) as a lift n00b.  I'm trying to modify
 a form such that it looks more wizard like.  i.e.  I want it to
 specifically state You've completed part 1, you're on step 2 of 5, etc.

 How should I accomplish this in view-first rendering?  Normal MVC, I'd make
 one controll that redirects you to the appropriate wizard screen depending
 on what steps have already been accomplished (i.e. the controller figures
 out which step you're on and sends you to the appropraite view.

 In Lift, I'm thinking I have a few options:

 1) Have my stateful snippet actually return the various pages in code.  I'm
 not happy with this, as my view would reside in the controller, but I could
 git'r'done this way.


Not really.  You can have the templates for each phase of the wizard be
separate files and use TemplateFinder.findAnyTemplate to load the template
for the step of the wizard that you're on.   This is akin to the
controller-first choosing a template.



 2) Attempt to learn the lift-wizard library (is this stable/released?)


No.  I need (and have not found) 2-3 uninterrupted days to get it done.
Maybe next week (this week is JVM summit).  While I think this is Lift's
future, having a simpler set of tools for people to use (like Naftoli's
bind-o-matic thing) is great.  Give people a choice and let them use what's
best for them.



 3) Spend more time trying to be inventive.


 Anyone have any thoughts?

 - Josh

 



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

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



[Lift] Re: how to send an attachment using Mailer?

2009-09-14 Thread David Pollak
On Sun, Sep 13, 2009 at 6:15 AM, george geo...@mattandgeorge.com wrote:


 update:

 ok, so it turns out that you can send pdfs as inline attachments using
 XHTMLPlusImages. (the byte array being empty was my fault).

 however, it would still be good to be able to add arbitrary
 attachments. a pdf isn't really an image.


 PlusImageHolder(name: String, mimeType: String, bytes: Array[Byte])

It's called PlusImageHolder, but it's really any old attachment.  You
specify the name, the mime type and the byte array and it gets included.




 



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

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



[Lift] Re: How do I hook up JS events to onsubmit on a lift-controlled form?

2009-09-14 Thread David Pollak
On Tue, Sep 8, 2009 at 7:02 PM, DMB combust...@gmail.com wrote:


 Hi, folks,

 I'm moving one of my old ruby based apps over to Scala/Lift to learn
 Lift better, and here's one thing I was not able to find how to do.

 Some forms in the old app have onsubmit event on the form tag which
 combines / pre-validates things in the form, puts the output into a
 hidden field and wipes some of the fields prior to submitting.

 I can't seem to find a way to hook up a JS event to a Lift form
 defined like so:

 lift:IndexView.show form=post


lift:IndexView.show form=post id=foobar ...

Then hook your onsubmit up to the form element with the id foobar.

Does that work?



 If I add onsubmit event to this tag, it simply gets ignored. How do I
 do this in Lift?

 Also, Ruby on Rails conveniently appends an integer value at the end
 of script and CSS urls, which comes in handy when you want to maximize
 caching but don't want to risk serving the old scripts and stylesheets
 to the users. Is there a corresponding mechanism for this in Lift?

 Thank you.

 



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

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



[Lift] Re: Why isn't this a trait in lift-json?

2009-09-14 Thread Timothy Perrett
Viktor you disappoint me! Was hoping you might chime in with some  
witty retort about java ;-) lol.

Your right though - sometimes there is just no other way if your inter- 
oping with some java framework that loves annotations.

Cheers, Tim

On 14 Sep 2009, at 19:22, Viktor Klang wrote:

 For me, annotations in Scala are permissible when having to deal  
 with Java frameworks that need annotations to work.
 (examples: JAX-RS, JPA et al)

 On Mon, Sep 14, 2009 at 8:06 PM, Timothy Perrett timo...@getintheloop.eu 
  wrote:

 Whilst I cant speak for anyone else - looking at Java these days
 generally makes me want to be sick and annotations are simply
 convulsion inducing ;-)

 There are some issues from a technical perspective with Scala
 annotations (like deep nested annotations for JPA), but otherwise, in
 terms of lift i think there are not really any good technical reasons
 why it is we dont use java annotations - its mainly a general
 dislike.

 Cheers, Tim

 On Sep 14, 6:34 pm, Naftoli Gugenheim naftoli...@gmail.com wrote:
  Can someone detail the minus side of annotations? (Other than  
 it's just not the Scala/Lift way. :) Preferably in terms of what  
 goal it inhibits.)
 
  Also keep in mind that the exception in terms of the code being  
 in a Java source file is a temporary workaround that will be  
 replaced when it's possible, so it's not a huge exception.





 -- 
 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: Why isn't this a trait in lift-json?

2009-09-14 Thread Indrajit Raychaudhuri

Absolutely, and just limit to that, no more.

/Indrajit

On Sep 14, 11:22 pm, Viktor Klang viktor.kl...@gmail.com wrote:
 For me, annotations in Scala are permissible when having to deal with Java
 frameworks that need annotations to work.
 (examples: JAX-RS, JPA et al)

 On Mon, Sep 14, 2009 at 8:06 PM, Timothy Perrett 
 timo...@getintheloop.euwrote:







  Whilst I cant speak for anyone else - looking at Java these days
  generally makes me want to be sick and annotations are simply
  convulsion inducing ;-)

  There are some issues from a technical perspective with Scala
  annotations (like deep nested annotations for JPA), but otherwise, in
  terms of lift i think there are not really any good technical reasons
  why it is we dont use java annotations - its mainly a general
  dislike.

  Cheers, Tim

  On Sep 14, 6:34 pm, Naftoli Gugenheim naftoli...@gmail.com wrote:
   Can someone detail the minus side of annotations? (Other than it's just
  not the Scala/Lift way. :) Preferably in terms of what goal it inhibits.)

   Also keep in mind that the exception in terms of the code being in a
  Java source file is a temporary workaround that will be replaced when it's
  possible, so it's not a huge exception.

 --
 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: Why isn't this a trait in lift-json?

2009-09-14 Thread Viktor Klang
On Mon, Sep 14, 2009 at 8:52 PM, Timothy Perrett timo...@getintheloop.euwrote:

 Viktor you disappoint me! Was hoping you might chime in with some witty
 retort about java ;-) lol.


Sorry mate, I'll have to buy you a beer at Devoxx! :D



 Your right though - sometimes there is just no other way if your
 inter-oping with some java framework that loves annotations.


Yup, the sad truth.


 Cheers, Tim

 On 14 Sep 2009, at 19:22, Viktor Klang wrote:

 For me, annotations in Scala are permissible when having to deal with Java
 frameworks that need annotations to work.
 (examples: JAX-RS, JPA et al)

 On Mon, Sep 14, 2009 at 8:06 PM, Timothy Perrett 
 timo...@getintheloop.euwrote:


 Whilst I cant speak for anyone else - looking at Java these days
 generally makes me want to be sick and annotations are simply
 convulsion inducing ;-)

 There are some issues from a technical perspective with Scala
 annotations (like deep nested annotations for JPA), but otherwise, in
 terms of lift i think there are not really any good technical reasons
 why it is we dont use java annotations - its mainly a general
 dislike.

 Cheers, Tim

 On Sep 14, 6:34 pm, Naftoli Gugenheim naftoli...@gmail.com wrote:
  Can someone detail the minus side of annotations? (Other than it's just
 not the Scala/Lift way. :) Preferably in terms of what goal it inhibits.)
 
  Also keep in mind that the exception in terms of the code being in a
 Java source file is a temporary workaround that will be replaced when it's
 possible, so it's not a huge exception.





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




 



-- 
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: Lift deal breakers

2009-09-14 Thread Viktor Klang
On Mon, Sep 14, 2009 at 8:20 PM, Timothy Perrett timo...@getintheloop.euwrote:


 Just wading into the fray here...

 Looking at people who have responded to this thread, they are mainly
 people i've not seen on the list before (sorry if your regulars
 perhaps i should pay more attention!) and that indicates to me that
 general users dont want *any* js in page (either in the head, the
 footer, or attributes) and this should be the default, not the
 exceptional case.

 Personally, this stuff used to really bother me when doing front end
 work. Luckily that is hardly ever now, but i see the point being made
 and would like to add my vote to free-ing the markup of inline JS.

 Thoughts?


I'd agree to this sentiment if it were not for DPPs excellent point that
we're talking about the markup Lift spits out, not the markup that lift
consumes.
I am too fond of graceful degradation, but publishing JS in a separate call
would be exotic to code at best.
The golden middle road perhaps is, to bake the JS into the bottom of the
page.

HOWEVER, it is important to know that direct JS callbacks (i.e.
onclick=foo()) outperforms _any_ other approach.




 Cheers, Tim

  More generally, Lift's mechanism for JavaScript support is *not*
 required.
   You could build your own mechanism that would generate clean mark-up,
  render JavaScript at the end of the page which would attach to DOM
 events.
   Everybody has access to Lift's GUID - Function binding.  You can use
 it
  just like it's used in SHtml, but generate your own mark-up.
 
 



-- 
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: Why isn't this a trait in lift-json?

2009-09-14 Thread Naftoli Gugenheim

Wow, isn't it amazing how passionate people could be about something without 
having a reason? ;)
Thanks for your answers, DPP!

-
Indrajit Raychaudhuriindraj...@gmail.com wrote:


Absolutely, and just limit to that, no more.

/Indrajit

On Sep 14, 11:22 pm, Viktor Klang viktor.kl...@gmail.com wrote:
 For me, annotations in Scala are permissible when having to deal with Java
 frameworks that need annotations to work.
 (examples: JAX-RS, JPA et al)

 On Mon, Sep 14, 2009 at 8:06 PM, Timothy Perrett 
 timo...@getintheloop.euwrote:







  Whilst I cant speak for anyone else - looking at Java these days
  generally makes me want to be sick and annotations are simply
  convulsion inducing ;-)

  There are some issues from a technical perspective with Scala
  annotations (like deep nested annotations for JPA), but otherwise, in
  terms of lift i think there are not really any good technical reasons
  why it is we dont use java annotations - its mainly a general
  dislike.

  Cheers, Tim

  On Sep 14, 6:34 pm, Naftoli Gugenheim naftoli...@gmail.com wrote:
   Can someone detail the minus side of annotations? (Other than it's just
  not the Scala/Lift way. :) Preferably in terms of what goal it inhibits.)

   Also keep in mind that the exception in terms of the code being in a
  Java source file is a temporary workaround that will be replaced when it's
  possible, so it's not a huge exception.

 --
 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: Why isn't this a trait in lift-json?

2009-09-14 Thread Viktor Klang
On Mon, Sep 14, 2009 at 9:00 PM, Naftoli Gugenheim naftoli...@gmail.comwrote:


 Wow, isn't it amazing how passionate people could be about something
 without having a reason? ;)


If you start me up if you start me up I'll never stop...


 Thanks for your answers, DPP!

 -
 Indrajit Raychaudhuriindraj...@gmail.com wrote:


 Absolutely, and just limit to that, no more.

 /Indrajit

 On Sep 14, 11:22 pm, Viktor Klang viktor.kl...@gmail.com wrote:
  For me, annotations in Scala are permissible when having to deal with
 Java
  frameworks that need annotations to work.
  (examples: JAX-RS, JPA et al)
 
  On Mon, Sep 14, 2009 at 8:06 PM, Timothy Perrett timo...@getintheloop.eu
 wrote:
 
 
 
 
 
 
 
   Whilst I cant speak for anyone else - looking at Java these days
   generally makes me want to be sick and annotations are simply
   convulsion inducing ;-)
 
   There are some issues from a technical perspective with Scala
   annotations (like deep nested annotations for JPA), but otherwise, in
   terms of lift i think there are not really any good technical reasons
   why it is we dont use java annotations - its mainly a general
   dislike.
 
   Cheers, Tim
 
   On Sep 14, 6:34 pm, Naftoli Gugenheim naftoli...@gmail.com wrote:
Can someone detail the minus side of annotations? (Other than it's
 just
   not the Scala/Lift way. :) Preferably in terms of what goal it
 inhibits.)
 
Also keep in mind that the exception in terms of the code being in
 a
   Java source file is a temporary workaround that will be replaced when
 it's
   possible, so it's not a huge exception.
 
  --
  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


 



-- 
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 stop validations if previous validator returns error.

2009-09-14 Thread David Pollak
I'll check code in after it passes the reviewboard process that let's you
mix in:
 trait StopValidationOnError[T] extends Function1[T, List[FieldError]]

to a validation function such that the validator will stop processing a
given field if a validator that has that trait mixed in returns a validation
error.



On Sun, Sep 6, 2009 at 3:02 PM, ishiijp yoshinori.is...@gmail.com wrote:


 I'm looking for a way to stop MappedField validations if prefvious
 validator returns error.

 For example:

 object Alphabets extends MappedString(this, 20) {
  override def validations =
valMinLen(1, Alphabets is required) _ ::
valRegex(Pattern.compile(^[a-zA-Z]+$, It's not alphabets!)
 _ ::
super.validations
 }

 if valMinLen returns error, I don't want to process valRegex.

 My solutions are
 (1) define custom validator which works as I want.
 (2) override MappedField#validate()

 If you have other ideas, please help me.

 Thanks in advance.

 



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

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



[Lift] Re: Lift deal breakers

2009-09-14 Thread Charles F. Munat

Done

David Pollak wrote:
 
 
 On Sat, Sep 12, 2009 at 11:48 AM, Charles F. Munat c...@munat.com 
 mailto:c...@munat.com wrote:
 
 
 I, too, would like to be able to move the liftAjax script call to the
 bottom of the page.
 
 
 Open a ticket and I'll see what I can do... it shouldn't be too hard
  
 
 
 Chas.
 
 Dustin Whitney wrote:
   Hey, I like Lift so in an effort to improve it I am submitting some
   criticism.
  
   Obtrusive javascript:
  
   when I create an ajaxButton I get this html:
  
   button
 onclick=liftAjax.lift_ajaxHandler(quot;F1029758482780OTA=truequot;,
 null, null, null); return false;Press me/button
  
   That onclick is not ok.  It's bad for SEO and makes the page
 harder to
   read.  Ideally, no javascript should appear on the page whatsoever.
  
   Client Side Load Time:
  
   I strive for that A in Y-Slow, so when I see
  
   script type=text/javascript src=/ajax_request/liftAjax.js
 view-source:http://localhost:8080/ajax_request/liftAjax.js/script
  
   at the top of the page, I feel a little uneasy, and there is
 nothing I
   can do (I think) to move it to the bottom of the page.
  
   -Dustin
  
   
 
 
 
 
 
 -- 
 Lift, the simply functional web framework http://liftweb.net
 Beginning Scala http://www.apress.com/book/view/1430219890
 Follow me: http://twitter.com/dpp
 Git some: http://github.com/dpp
 
  

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



[Lift] Re: Best way to write a wizard

2009-09-14 Thread Charles F. Munat

Gotta love a tool called bind-o-matic. Is it available from Ronco? 
Does it come with bonus laxatives? But wait, there's more! Ugh.

Chas.

David Pollak wrote:
 
 
 On Sun, Sep 13, 2009 at 10:52 AM, Josh Suereth joshua.suer...@gmail.com 
 mailto:joshua.suer...@gmail.com wrote:
 
 All,
 
 I write to you (unfortunately still) as a lift n00b.  I'm trying to
 modify a form such that it looks more wizard like.  i.e.  I want
 it to specifically state You've completed part 1, you're on step 2
 of 5, etc.
 
 How should I accomplish this in view-first rendering?  Normal MVC,
 I'd make one controll that redirects you to the appropriate wizard
 screen depending on what steps have already been accomplished (i.e.
 the controller figures out which step you're on and sends you to the
 appropraite view.
 
 In Lift, I'm thinking I have a few options:
 
 1) Have my stateful snippet actually return the various pages in
 code.  I'm not happy with this, as my view would reside in the
 controller, but I could git'r'done this way.
 
 
 Not really.  You can have the templates for each phase of the wizard be 
 separate files and use TemplateFinder.findAnyTemplate to load the 
 template for the step of the wizard that you're on.   This is akin to 
 the controller-first choosing a template.
  
 
 
 2) Attempt to learn the lift-wizard library (is this stable/released?)
 
 
 No.  I need (and have not found) 2-3 uninterrupted days to get it done.  
 Maybe next week (this week is JVM summit).  While I think this is Lift's 
 future, having a simpler set of tools for people to use (like Naftoli's 
 bind-o-matic thing) is great.  Give people a choice and let them use 
 what's best for them.
  
 
 
 3) Spend more time trying to be inventive.
 
 
 Anyone have any thoughts?
 
 - Josh
 
 
 
 
 
 -- 
 Lift, the simply functional web framework http://liftweb.net
 Beginning Scala http://www.apress.com/book/view/1430219890
 Follow me: http://twitter.com/dpp
 Git some: http://github.com/dpp
 
  

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



[Lift] Re: Master build failing...

2009-09-14 Thread Derek Chen-Becker
Out of curiosity, can Hudson be set to email the committers when the build
fails?

On Mon, Sep 14, 2009 at 2:23 AM, Timothy Perrett timo...@getintheloop.euwrote:


 Guys,

 Master build on hudson is now failing Naftoli, it looks like your
 commit has broken the build. Could you please take a look and correct
 it asap?

 We have a process by which you must complete a full local build of
 lift before committing anything to lift master; moreover, we now have
 a process by which you need another committer to complete a code
 review on your branch before merging to HEAD.

 [WARNING] /Users/timperrett/repositories/lift/lift-framework/lift-
 mapper/src/main/scala/net/liftweb/mapper/view/TableEditor.scala:179:
 error: value bind is not a member of scala.xml.NodeSeq
 [WARNING] xhtml.bind(header,
 [WARNING]   ^
 [WARNING] one error found

 Cheers, Tim
 


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



[Lift] JodaTime and JPA

2009-09-14 Thread Charles F. Munat

It occurs to me that I should probably share this. I've been using 
Jorge's wonderful Scala wrapper for JodaTime and I needed to persist 
DateTime and LocalDate. I found a Hibernate project that makes this 
possible. (Note that Jorge's wrapper is a work in progress and doesn't 
cover everything in JodaTime, but you can just use the JodaTime classes 
directly, which I did for DateTimeFormatter and DateTimeFormatterBuilder.)

In pom.xml:

dependency
   groupIdorg.scala-tools/groupId
   artifactIdtime/artifactId
   version2.7.5-0.2-SNAPSHOT/version
/dependency
dependency
   groupIdjoda-time/groupId
   artifactIdjoda-time/artifactId
   version1.6/version
/dependency
dependency
   groupIdjoda-time/groupId
   artifactIdjoda-time-hibernate/artifactId
   version1.1/version
/dependency

In the JPA entity classes:

@Type{val `type`=org.joda.time.contrib.hibernate.PersistentDateTime}
@Column{val name=created_at, val updatable = false}
var createdAt: DateTime = DateTime.now

Gets persisted as a timestamp without time zone in PostgreSQL.

@Type{val `type`=org.joda.time.contrib.hibernate.PersistentLocalDate}
@Column{val name = born_on}
var bornOn: LocalDate = new LocalDate()

Gets persisted as a date in PostgreSQL.

http://joda-time.sourceforge.net/
http://github.com/jorgeortiz85/scala-time
http://joda-time.sourceforge.net/contrib/hibernate/index.html

Chas.

--~--~-~--~~~---~--~~
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: Master build failing...

2009-09-14 Thread David Pollak
On Mon, Sep 14, 2009 at 12:36 PM, Derek Chen-Becker
dchenbec...@gmail.comwrote:

 Out of curiosity, can Hudson be set to email the committers when the build
 fails?


It emails me.  We could change that, but we'd also have to add the from
address to the closed committers group.




 On Mon, Sep 14, 2009 at 2:23 AM, Timothy Perrett 
 timo...@getintheloop.euwrote:


 Guys,

 Master build on hudson is now failing Naftoli, it looks like your
 commit has broken the build. Could you please take a look and correct
 it asap?

 We have a process by which you must complete a full local build of
 lift before committing anything to lift master; moreover, we now have
 a process by which you need another committer to complete a code
 review on your branch before merging to HEAD.

 [WARNING] /Users/timperrett/repositories/lift/lift-framework/lift-
 mapper/src/main/scala/net/liftweb/mapper/view/TableEditor.scala:179:
 error: value bind is not a member of scala.xml.NodeSeq
 [WARNING] xhtml.bind(header,
 [WARNING]   ^
 [WARNING] one error found

 Cheers, Tim



 



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

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



[Lift] Re: Ajax example from the book

2009-09-14 Thread Derek Chen-Becker
I think that he's referring to the SetHtml, which is actually a JsExp that
has to be returned from any Ajax functions (the javascript is returned to
the client and executed). In the case of the example code, it will set the
contents of the div with the id my-div to a single Text element of That's
it.

Derek

On Mon, Sep 14, 2009 at 7:52 AM, Daniel Nelson dpn53...@gmail.com wrote:


 If you're referring to the Exploring Lift book, have a look at Section
 3.11.1 Binding Values in Snippets where it explains bind. (I'm new
 to Lift myself and hopefully not leading you astray.)

 1. myFunc's html parameter is fed automatically by the HTML Lift
 Template.  In the follow example, everything between
 lift:SomeClass.myFunc and /lift:SomeClass.myFunc is passed to
 myFunc.

 lift:surround with=default at=content
h2Hello World/h2
lift:SomeClass.myFunc form=POST
p Some Text hello:description //p
hello:button /
/lift:SomeClass.myFunc
 /lift:surround


 2. hello is a prefix for referring to template elements by name. The
 HTML Lift template should have some like hello:button / which will
 get replaced by the evaluation after - within bind().

 3. I'm not sure what you mean How does the div work.


 On Sep 13, 10:24 pm, jack jack.wid...@gmail.com wrote:
  Could somebody please explain to me how this example from the book
  works.
 
   def myFunc(html:NodeSeq):NodeSeq  = {
  bind(hello,html,button -
   ajaxButton(Text(Press me),
  { () =
println(Got an Ajax call.)
   SetHtml(my-div, Text(That's it))
 })
 )
}
 
  In particular, what do I pass in as the html parameter?
  What is 'hello'?
  How does the div work?
 
  I don't understand 'bind'.

 


--~--~-~--~~~---~--~~
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: Ajax example from the book

2009-09-14 Thread Jack Widman
Thanks. Yes thats what I meant.

On Mon, Sep 14, 2009 at 3:42 PM, Derek Chen-Becker dchenbec...@gmail.comwrote:

 I think that he's referring to the SetHtml, which is actually a JsExp that
 has to be returned from any Ajax functions (the javascript is returned to
 the client and executed). In the case of the example code, it will set the
 contents of the div with the id my-div to a single Text element of That's
 it.

 Derek


 On Mon, Sep 14, 2009 at 7:52 AM, Daniel Nelson dpn53...@gmail.com wrote:


 If you're referring to the Exploring Lift book, have a look at Section
 3.11.1 Binding Values in Snippets where it explains bind. (I'm new
 to Lift myself and hopefully not leading you astray.)

 1. myFunc's html parameter is fed automatically by the HTML Lift
 Template.  In the follow example, everything between
 lift:SomeClass.myFunc and /lift:SomeClass.myFunc is passed to
 myFunc.

 lift:surround with=default at=content
h2Hello World/h2
lift:SomeClass.myFunc form=POST
p Some Text hello:description //p
hello:button /
/lift:SomeClass.myFunc
 /lift:surround


 2. hello is a prefix for referring to template elements by name. The
 HTML Lift template should have some like hello:button / which will
 get replaced by the evaluation after - within bind().

 3. I'm not sure what you mean How does the div work.


 On Sep 13, 10:24 pm, jack jack.wid...@gmail.com wrote:
  Could somebody please explain to me how this example from the book
  works.
 
   def myFunc(html:NodeSeq):NodeSeq  = {
  bind(hello,html,button -
   ajaxButton(Text(Press me),
  { () =
println(Got an Ajax call.)
   SetHtml(my-div, Text(That's it))
 })
 )
}
 
  In particular, what do I pass in as the html parameter?
  What is 'hello'?
  How does the div work?
 
  I don't understand 'bind'.




 


--~--~-~--~~~---~--~~
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: Ajax example from the book

2009-09-14 Thread Jack Widman
I was referring to that book. Is there another? :)
Thanks for your help Daniel.

On Mon, Sep 14, 2009 at 9:52 AM, Daniel Nelson dpn53...@gmail.com wrote:


 If you're referring to the Exploring Lift book, have a look at Section
 3.11.1 Binding Values in Snippets where it explains bind. (I'm new
 to Lift myself and hopefully not leading you astray.)

 1. myFunc's html parameter is fed automatically by the HTML Lift
 Template.  In the follow example, everything between
 lift:SomeClass.myFunc and /lift:SomeClass.myFunc is passed to
 myFunc.

 lift:surround with=default at=content
h2Hello World/h2
lift:SomeClass.myFunc form=POST
p Some Text hello:description //p
hello:button /
/lift:SomeClass.myFunc
 /lift:surround


 2. hello is a prefix for referring to template elements by name. The
 HTML Lift template should have some like hello:button / which will
 get replaced by the evaluation after - within bind().

 3. I'm not sure what you mean How does the div work.


 On Sep 13, 10:24 pm, jack jack.wid...@gmail.com wrote:
  Could somebody please explain to me how this example from the book
  works.
 
   def myFunc(html:NodeSeq):NodeSeq  = {
  bind(hello,html,button -
   ajaxButton(Text(Press me),
  { () =
println(Got an Ajax call.)
   SetHtml(my-div, Text(That's it))
 })
 )
}
 
  In particular, what do I pass in as the html parameter?
  What is 'hello'?
  How does the div work?
 
  I don't understand 'bind'.

 


--~--~-~--~~~---~--~~
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 cookies in an ajax response

2009-09-14 Thread David Pollak
Please open a ticket at http://github.com/dpp/liftweb/issues

On Sat, Sep 12, 2009 at 10:54 AM, harryh har...@gmail.com wrote:


 I have an SHtml.ajaxSelect that, when executed sets a cookie:

 S.addCookie(HTTPCookie(CITYID, city.id.toString))

 and then returns a JsCmds.RedirectTo(uri) command.  The cookie isn't
 actually being set (if I look at the live http headers the Set-Cookie
 line isn't sent down in the http response to the ajax call.

 It's not clear to me if this is correct behavior on lift's part, of if
 this is a bug.

 If it is correct behavior, is there a better way to do this sort of
 thing?

 -harryh
 



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

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



[Lift] Re: Lift deal breakers

2009-09-14 Thread Viktor Klang
On Mon, Sep 14, 2009 at 9:29 PM, Charles F. Munat c...@munat.com wrote:


 When you say that direct JS callbacks (i.e. onclick=foo())
 outperforms _any_ other approach what is the source for your assertion?
 And what do you mean by outperforms? What are the criteria? Are you
 talking about speed?


Yes, page load time speed. (since the callback is loaded in relativity to
its owner (no lookups needed etc).
I did a quick search but the source of my info was nowhere to be found.

I did a rather extensive research a year back or so, inline-callback vs.
event delegation vs. end-of-page initialization.

I guess all depends on what performance you're looking for and how JS heavy
your app is.
For me, with a _very_ high performance (speed) requirement, it's vital that
one doesn't do any un-cacheable, avoidable requests.

But as I said, perhaps a good trade-off is to put the JS init at the end of
the page.



 If so, what is the magnitude of the difference? Is it significant?

 Without this information it is difficult to guess which approach would
 be better. Is moving the attaching of event handlers to a separate JS
 file going to significantly slow down my page? Then maybe it's not worth
 it. But if the difference is negligible, then keeping concerns separate
 is worth it to me.

 It's dangerous to say that A outperforms B without understanding exactly
 what that means.

 For me, separation of concerns outperforms mixing concerns in terms of
 development ease, reuse, and graceful degradation. Some of this may not
 apply to automatically generated code, of course.

 Chas.

 Viktor Klang wrote:
 
 
  On Mon, Sep 14, 2009 at 8:20 PM, Timothy Perrett
  timo...@getintheloop.eu wrote:
 
 
  Just wading into the fray here...
 
  Looking at people who have responded to this thread, they are mainly
  people i've not seen on the list before (sorry if your regulars
  perhaps i should pay more attention!) and that indicates to me that
  general users dont want *any* js in page (either in the head, the
  footer, or attributes) and this should be the default, not the
  exceptional case.
 
  Personally, this stuff used to really bother me when doing front end
  work. Luckily that is hardly ever now, but i see the point being made
  and would like to add my vote to free-ing the markup of inline JS.
 
  Thoughts?
 
 
  I'd agree to this sentiment if it were not for DPPs excellent point that
  we're talking about the markup Lift spits out, not the markup that lift
  consumes.
  I am too fond of graceful degradation, but publishing JS in a separate
  call would be exotic to code at best.
  The golden middle road perhaps is, to bake the JS into the bottom of the
  page.
 
  HOWEVER, it is important to know that direct JS callbacks (i.e.
  onclick=foo()) outperforms _any_ other approach.
 
 
 
 
  Cheers, Tim
 
More generally, Lift's mechanism for JavaScript support is *not*
  required.
 You could build your own mechanism that would generate clean
  mark-up,
render JavaScript at the end of the page which would attach to
  DOM events.
 Everybody has access to Lift's GUID - Function binding.  You
  can use it
just like it's used in SHtml, but generate your own mark-up.
   
 
 
 
 
  --
  Viktor Klang
 
  Blog: klangism.blogspot.com http://klangism.blogspot.com
  Twttr: viktorklang
 
  Lift Committer - liftweb.com http://liftweb.com
  AKKA Committer - akkasource.org http://akkasource.org
  Cassidy - github.com/viktorklang/Cassidy.git
  http://github.com/viktorklang/Cassidy.git
  SoftPub founder: http://groups.google.com/group/softpub
 
  

 



-- 
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: JSON forms problem

2009-09-14 Thread glenn

Actually, the JsonHandler in the example gets called, but not the apply
(in:Any) method, as
that is never called in the book example. Also, the handler seems to
be called twice with every submit.
Why is that?

Glenn

On Sep 14, 8:08 am, glenn gl...@exmbly.com wrote:
 This may be a question for the Lift Book forum, but has anyone gotten
 the JSON forms example 8.13 in the Lift Book to work?  When I tried
 it, the JsonHandler in class JSONForm never gets called when the
 submit button is clicked.

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



[Lift] Re: Lift deal breakers

2009-09-14 Thread Charles F. Munat

My sites are low traffic mostly, so a fraction of a second isn't that 
important to me, but I can see how it might be to you. (Which is not to 
say that I don't try to minimize hits to the database, combine files, 
minify, etc., all of which are fractional-second improvements, usually.)

I don't use the Lift JSON stuff much, so it doesn't really affect me anyway.

If I find anything about actual speed differences, I'll let you know.

Chas.

Viktor Klang wrote:
 
 
 On Mon, Sep 14, 2009 at 9:29 PM, Charles F. Munat c...@munat.com 
 mailto:c...@munat.com wrote:
 
 
 When you say that direct JS callbacks (i.e. onclick=foo())
 outperforms _any_ other approach what is the source for your assertion?
 And what do you mean by outperforms? What are the criteria? Are you
 talking about speed?
 
 
 Yes, page load time speed. (since the callback is loaded in relativity 
 to its owner (no lookups needed etc).
 I did a quick search but the source of my info was nowhere to be found.
 
 I did a rather extensive research a year back or so, inline-callback vs. 
 event delegation vs. end-of-page initialization.
 
 I guess all depends on what performance you're looking for and how JS 
 heavy your app is.
 For me, with a _very_ high performance (speed) requirement, it's vital 
 that one doesn't do any un-cacheable, avoidable requests.
 
 But as I said, perhaps a good trade-off is to put the JS init at the end 
 of the page.
  
 
 
 If so, what is the magnitude of the difference? Is it significant?
 
 Without this information it is difficult to guess which approach would
 be better. Is moving the attaching of event handlers to a separate JS
 file going to significantly slow down my page? Then maybe it's not worth
 it. But if the difference is negligible, then keeping concerns separate
 is worth it to me.
 
 It's dangerous to say that A outperforms B without understanding exactly
 what that means.
 
 For me, separation of concerns outperforms mixing concerns in terms of
 development ease, reuse, and graceful degradation. Some of this may not
 apply to automatically generated code, of course.
 
 Chas.
 
 Viktor Klang wrote:
  
  
   On Mon, Sep 14, 2009 at 8:20 PM, Timothy Perrett
   timo...@getintheloop.eu wrote:
  
  
   Just wading into the fray here...
  
   Looking at people who have responded to this thread, they are
 mainly
   people i've not seen on the list before (sorry if your regulars
   perhaps i should pay more attention!) and that indicates to
 me that
   general users dont want *any* js in page (either in the head, the
   footer, or attributes) and this should be the default, not the
   exceptional case.
  
   Personally, this stuff used to really bother me when doing
 front end
   work. Luckily that is hardly ever now, but i see the point
 being made
   and would like to add my vote to free-ing the markup of
 inline JS.
  
   Thoughts?
  
  
   I'd agree to this sentiment if it were not for DPPs excellent
 point that
   we're talking about the markup Lift spits out, not the markup
 that lift
   consumes.
   I am too fond of graceful degradation, but publishing JS in a
 separate
   call would be exotic to code at best.
   The golden middle road perhaps is, to bake the JS into the bottom
 of the
   page.
  
   HOWEVER, it is important to know that direct JS callbacks (i.e.
   onclick=foo()) outperforms _any_ other approach.
  
  
  
  
   Cheers, Tim
  
 More generally, Lift's mechanism for JavaScript support is
 *not*
   required.
  You could build your own mechanism that would generate clean
   mark-up,
 render JavaScript at the end of the page which would attach to
   DOM events.
  Everybody has access to Lift's GUID - Function binding.
  You
   can use it
 just like it's used in SHtml, but generate your own mark-up.

  
  
  
  
   --
   Viktor Klang
  
   Blog: klangism.blogspot.com http://klangism.blogspot.com
 http://klangism.blogspot.com
   Twttr: viktorklang
  
   Lift Committer - liftweb.com http://liftweb.com
 http://liftweb.com
   AKKA Committer - akkasource.org http://akkasource.org
 http://akkasource.org
   Cassidy - github.com/viktorklang/Cassidy.git
 http://github.com/viktorklang/Cassidy.git
   http://github.com/viktorklang/Cassidy.git
   SoftPub founder: http://groups.google.com/group/softpub
  
   
 
 
 
 
 
 -- 
 Viktor Klang
 
 Blog: klangism.blogspot.com http://klangism.blogspot.com
 Twttr: viktorklang
 
 Lift Committer - liftweb.com http://liftweb.com
 AKKA Committer - akkasource.org 

[Lift] Re: Nested binding

2009-09-14 Thread Heiko Seeberger
Jose,
Please use - instead of --
The latter is deprecated and seems to do weird things ;-)

Cheers,

Heiko

2009/9/14 José María josemariar...@gmail.com


 That's what I need Heiko!!

 But I've another problem, the following code:

 def estante1 (xhtml : NodeSeq ) : NodeSeq =  this.estante(xhtml,
 Peluches, List(180L,34L,55L) )

 def estante (xhtml: NodeSeq, nombre: String, listaProductos : List
 [Long]) : NodeSeq = {
bind(estante, xhtml,
 nombre -- nombre,
 productos -- listaProductos.flatMap( id =
  Producto.find(id) match {
  case Full(producto) = bind(p,
 chooseTemplate(producto,datos,xhtml),
  nombre --
 producto.nombre)

  case _ = NodeSeq.Empty
  }))
  }

 Applied to:

 lift:estantes.estante1
div class=Estante
h3estante:nombre//h3
ul
estante:productos
producto:datos
p:nombre/
/producto:datos
/estante:productos
/ul
/div
 /lift:estantes.estante1

 Generates this xhtml:


 div class=Estante
 h3Peluches/h3
 ul
   List(
, Peluche de la E. Coli (Escherichi Coli),
,
, Peluche del Resfriado común (Rhinovirus),
,
, Peluche de la Sífilis (Treponema pallidum),
   )
 /ul
 /div

 Looks like a serialization of the NodeSeq, as if it doesn't concat the
 nodes.

 Cheers




 On Sep 14, 12:48 pm, Heiko Seeberger heiko.seeber...@googlemail.com
 wrote:
  Jose,
  please take it from here:
 http://wiki.github.com/dpp/liftweb/how-to-binding-view-content-to-code
 
  Cheers,
 
  Heiko
 
  2009/9/14 José María josemariar...@gmail.com
 
 
 
 
 
   Hi,
 
   I want to render the content of some tables one after another:
 
   table 1
data
   table 2
data
   table 3
data
 
   I want to separate the XHTML from the code, so I'm trying to use
   binding. My problem is that each table is rendered with the same XHTML
   template, as every row.
 
   If I use bind to bind the tables:
 
   lift:mysnippet.tables
   
   /lift:mysnippet.tables
 
   What can I do to bind the rows inside this snippet so I can render
   them? This is what I tried/want/expect:
 
   lift:mysnippet.tables
table:name/
   table:rows?
 row:name??
   /table:rows ?
   /lift:mysnippet.tables
 
   Best regards.
 
  --
  Heiko Seeberger
 
  My job: weiglewilczek.com
  My blog: heikoseeberger.name
  Follow me: twitter.com/hseeberger
  OSGi on Scala: scalamodules.org
  Lift, the simply functional web framework: liftweb.net
 



-- 
Heiko Seeberger

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

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to 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] Sermo, persistent comet chat example

2009-09-14 Thread Bjarte Stien Karlsen

Hello lifted,

Today i created Sermo [1] as the title says a persistent comet based
chat example.

I copied code from demo.liftweb.net/chat and modified to support
 - user's firstname + lastname is the username in the chat
 - messages are persisted in the message table and loaded when the
chat server starts up.
 - chat is added as a page that requires user login

I plan to use this example as a demo in a upcomming talk about lift.
The reason I wanted a example that is a little bit more complex then
the 50 line comet example is to show some more of lifts features.

Comments and suggestions are very welcome.

[1] http://www.github.com/bjartek/Sermo

-- 
Bjarte Stien Karlsen
Ronatoppen 6a, 4638 Kristiansand
95219547
MSN: m...@ibjarte.com

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



[Lift] Mapper: Why is every SQL query sent twice? (second time with NULL parameters)

2009-09-14 Thread tiro

Dear all,

on every findAll request, lift seems to send the query twice (tested
1.0 and 1.0.2, working from the PocketChangeApp example on h2database,
and using
 DB.addLogFunc((query, time) =
  Log.info(query + : + time + ms)))

for logging

1. e.g. right after login; this must be framework code (ProtoUser):

INFO - prep91: SELECT users.firstname, users.lastname, users.email,
users.locale, users.timezone, users.password_pw, use
rs.password_slt, users.superuser, users.validated, users.uniqueid,
users.id FROM users  WHERE email = ?  {1: 't...@rombe
rg.be'};:14ms
INFO - prep91: SELECT users.firstname, users.lastname, users.email,
users.locale, users.timezone, users.password_pw, use
rs.password_slt, users.superuser, users.validated, users.uniqueid,
users.id FROM users  WHERE email = ?  {1: NULL};:65ms

same on practically all other statements

2nd example:

INFO - prep110: SELECT  DISTINCT resourcestopics.resourcetype,
resourcestopics.resourceid, resourcestopics.topicid FROM
resourcestopics   WHERE resourcetype = ?  AND resourceid = ?   {1: 2,
2: 3};:0ms
INFO - prep110: SELECT  DISTINCT resourcestopics.resourcetype,
resourcestopics.resourceid, resourcestopics.topicid FROM
resourcestopics   WHERE resourcetype = ?  AND resourceid = ?   {1:
NULL, 2: NULL};:27ms
INFO - Service request (POST) /editProject.html took 748 Milliseconds

my code: findAll(By(ResourcesTopics.resourceType, resourceType), By
(ResourcesTopics.resourceId, resourceId))


Is this desired behavior? Am only I seeing this? It also seems that
the useless query takes much more time than the real query..

Tried to compare with one of the most recent milestone (1.1-M5) but
this one only throws exceptions on me, starting from boot, so I
suppose there have been too many changes I am not aware of.


Thanks,

Tim

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



[Lift] Re: Sermo, persistent comet chat example

2009-09-14 Thread David Pollak
On Mon, Sep 14, 2009 at 1:18 PM, Bjarte Stien Karlsen 
bjarte.stien.karl...@gmail.com wrote:


 Hello lifted,

 Today i created Sermo [1] as the title says a persistent comet based
 chat example.

 I copied code from demo.liftweb.net/chat and modified to support
  - user's firstname + lastname is the username in the chat
  - messages are persisted in the message table and loaded when the
 chat server starts up.
  - chat is added as a page that requires user login

 I plan to use this example as a demo in a upcomming talk about lift.
 The reason I wanted a example that is a little bit more complex then
 the 50 line comet example is to show some more of lifts features.

 Comments and suggestions are very welcome.


I had the honor to show Lift off to Phillip Wadler last year.  I did the
chat example and he asked How would you persist the chats?  The code I
came up with was surprisingly similar to your code.

The only suggestion that I would have is to PreCache the Message.user fields
to get better start-up performance.



 [1] http://www.github.com/bjartek/Sermo

 --
 Bjarte Stien Karlsen
 Ronatoppen 6a, 4638 Kristiansand
 95219547
 MSN: m...@ibjarte.com

 



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

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



[Lift] Re: Sermo, persistent comet chat example

2009-09-14 Thread Bjarte Stien Karlsen

Hello David,

Thanks for your comments.

So you mean that instead of using m.id.obj then I should fetch all
users in a map and lookup in that instead?

mvh
Bjarte

On Mon, Sep 14, 2009 at 10:39 PM, David Pollak
feeder.of.the.be...@gmail.com wrote:


 On Mon, Sep 14, 2009 at 1:18 PM, Bjarte Stien Karlsen
 bjarte.stien.karl...@gmail.com wrote:

 Hello lifted,

 Today i created Sermo [1] as the title says a persistent comet based
 chat example.

 I copied code from demo.liftweb.net/chat and modified to support
  - user's firstname + lastname is the username in the chat
  - messages are persisted in the message table and loaded when the
 chat server starts up.
  - chat is added as a page that requires user login

 I plan to use this example as a demo in a upcomming talk about lift.
 The reason I wanted a example that is a little bit more complex then
 the 50 line comet example is to show some more of lifts features.

 Comments and suggestions are very welcome.

 I had the honor to show Lift off to Phillip Wadler last year.  I did the
 chat example and he asked How would you persist the chats?  The code I
 came up with was surprisingly similar to your code.
 The only suggestion that I would have is to PreCache the Message.user fields
 to get better start-up performance.


 [1] http://www.github.com/bjartek/Sermo

 --
 Bjarte Stien Karlsen
 Ronatoppen 6a, 4638 Kristiansand
 95219547
 MSN: m...@ibjarte.com





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

 




-- 
Bjarte Stien Karlsen
Ronatoppen 6a, 4638 Kristiansand
95219547
MSN: m...@ibjarte.com

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



[Lift] Re: Ajax example from the book

2009-09-14 Thread Randinn

Not at the moment but it does have a group

http://groups.google.com/group/the-lift-book

On Sep 15, 5:45 am, Jack Widman jack.wid...@gmail.com wrote:
 I was referring to that book. Is there another? :)
 Thanks for your help Daniel.

 On Mon, Sep 14, 2009 at 9:52 AM, Daniel Nelson dpn53...@gmail.com wrote:

  If you're referring to the Exploring Lift book, have a look at Section
  3.11.1 Binding Values in Snippets where it explains bind. (I'm new
  to Lift myself and hopefully not leading you astray.)

  1. myFunc's html parameter is fed automatically by the HTML Lift
  Template.  In the follow example, everything between
  lift:SomeClass.myFunc and /lift:SomeClass.myFunc is passed to
  myFunc.

  lift:surround with=default at=content
         h2Hello World/h2
         lift:SomeClass.myFunc form=POST
                 p Some Text hello:description //p
                 hello:button /
         /lift:SomeClass.myFunc
  /lift:surround

  2. hello is a prefix for referring to template elements by name. The
  HTML Lift template should have some like hello:button / which will
  get replaced by the evaluation after - within bind().

  3. I'm not sure what you mean How does the div work.

  On Sep 13, 10:24 pm, jack jack.wid...@gmail.com wrote:
   Could somebody please explain to me how this example from the book
   works.

    def myFunc(html:NodeSeq):NodeSeq  = {
           bind(hello,html,button -
            ajaxButton(Text(Press me),
                       { () =
                         println(Got an Ajax call.)
                        SetHtml(my-div, Text(That's it))
                      })
          )
     }

   In particular, what do I pass in as the html parameter?
   What is 'hello'?
   How does the div work?

   I don't understand 'bind'.
--~--~-~--~~~---~--~~
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: Sermo, persistent comet chat example

2009-09-14 Thread David Pollak
On Mon, Sep 14, 2009 at 2:17 PM, Bjarte Stien Karlsen 
bjarte.stien.karl...@gmail.com wrote:


 Hello David,

 Thanks for your comments.

 So you mean that instead of using m.id.obj then I should fetch all
 users in a map and lookup in that instead?


import mapper._

  private var chats: List[Message] =
Message.findAll(PreCache(Message.user)).reverse

This will pre-cache the user object in each Message instance.



 mvh
 Bjarte

 On Mon, Sep 14, 2009 at 10:39 PM, David Pollak
 feeder.of.the.be...@gmail.com wrote:
 
 
  On Mon, Sep 14, 2009 at 1:18 PM, Bjarte Stien Karlsen
  bjarte.stien.karl...@gmail.com wrote:
 
  Hello lifted,
 
  Today i created Sermo [1] as the title says a persistent comet based
  chat example.
 
  I copied code from demo.liftweb.net/chat and modified to support
   - user's firstname + lastname is the username in the chat
   - messages are persisted in the message table and loaded when the
  chat server starts up.
   - chat is added as a page that requires user login
 
  I plan to use this example as a demo in a upcomming talk about lift.
  The reason I wanted a example that is a little bit more complex then
  the 50 line comet example is to show some more of lifts features.
 
  Comments and suggestions are very welcome.
 
  I had the honor to show Lift off to Phillip Wadler last year.  I did the
  chat example and he asked How would you persist the chats?  The code I
  came up with was surprisingly similar to your code.
  The only suggestion that I would have is to PreCache the Message.user
 fields
  to get better start-up performance.
 
 
  [1] http://www.github.com/bjartek/Sermo
 
  --
  Bjarte Stien Karlsen
  Ronatoppen 6a, 4638 Kristiansand
  95219547
  MSN: m...@ibjarte.com
 
 
 
 
 
  --
  Lift, the simply functional web framework http://liftweb.net
  Beginning Scala http://www.apress.com/book/view/1430219890
  Follow me: http://twitter.com/dpp
  Git some: http://github.com/dpp
 
  
 



 --
 Bjarte Stien Karlsen
 Ronatoppen 6a, 4638 Kristiansand
 95219547
 MSN: m...@ibjarte.com

 



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

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



[Lift] Re: Bug in HasManyThough causing unexpected deletions?

2009-09-14 Thread harryh

I'm still seeing this on M5.  My diagnosis of the prolem in my 2nd e-
mail is incorrect, but there is definitely a problem here.

-harryh

On Aug 28, 1:39 pm, harryh har...@gmail.com wrote:
 Tips are on TipLists based on TipListBinds.
 Tips are also hooked to a Venue:

 class Tip extends LongKeyedMapper[Tip] with IdPK {
   // other unrelated stuff stuff
   object venueid extends MappedLongForeignKey(this, Venue)
   object lists extendsHasManyThrough(this, TipList, TipListBind,
 TipListBind.tipid, TipListBind.listid)

 }

 In an ajax request I am setting the venueid on a collection of Tips to
 Empty.  This is, for somewhat confusing reasons, causing the Tip to be
 removed from the lists it is on (the TipListBindings are being
 deleted).  I am fairly certain this is happening because ofHasManyThrough.

 INFO - com.mysql.jdbc.preparedstatem...@2b48c3: UPDATE tips SET
 venueid = ** NOT SPECIFIED ** WHERE id = ** NOT SPECIFIED **:2ms
 INFO - com.mysql.jdbc.preparedstatem...@69827c: SELECT  DISTINCT
 tipxlist.listid, tipxlist.id, tipxlist.tipid FROM tipxlist   WHERE
 tipid = 21128 :1ms
 INFO - com.mysql.jdbc.preparedstatem...@69827c: SELECT  DISTINCT
 tipxlist.listid, tipxlist.id, tipxlist.tipid FROM tipxlist   WHERE
 tipid = ** NOT SPECIFIED ** :22ms
 INFO - com.mysql.jdbc.preparedstatem...@ca8d17: DELETE FROM tipxlist
 WHERE id = ** NOT SPECIFIED **:1ms

 Currently thinking through what's going on inHasManyThrough::afterUpdate

 -harryh
--~--~-~--~~~---~--~~
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: Sermo, persistent comet chat example

2009-09-14 Thread Bjarte Stien Karlsen

Thanks,

I googled a little bit and found this sollution myself as well :)

Will push it to github any minute now.

mvh
Bjarte


On Mon, Sep 14, 2009 at 11:42 PM, David Pollak
feeder.of.the.be...@gmail.com wrote:


 On Mon, Sep 14, 2009 at 2:17 PM, Bjarte Stien Karlsen
 bjarte.stien.karl...@gmail.com wrote:

 Hello David,

 Thanks for your comments.

 So you mean that instead of using m.id.obj then I should fetch all
 users in a map and lookup in that instead?

 import mapper._
   private var chats: List[Message] =
 Message.findAll(PreCache(Message.user)).reverse
 This will pre-cache the user object in each Message instance.


 mvh
 Bjarte

 On Mon, Sep 14, 2009 at 10:39 PM, David Pollak
 feeder.of.the.be...@gmail.com wrote:
 
 
  On Mon, Sep 14, 2009 at 1:18 PM, Bjarte Stien Karlsen
  bjarte.stien.karl...@gmail.com wrote:
 
  Hello lifted,
 
  Today i created Sermo [1] as the title says a persistent comet based
  chat example.
 
  I copied code from demo.liftweb.net/chat and modified to support
   - user's firstname + lastname is the username in the chat
   - messages are persisted in the message table and loaded when the
  chat server starts up.
   - chat is added as a page that requires user login
 
  I plan to use this example as a demo in a upcomming talk about lift.
  The reason I wanted a example that is a little bit more complex then
  the 50 line comet example is to show some more of lifts features.
 
  Comments and suggestions are very welcome.
 
  I had the honor to show Lift off to Phillip Wadler last year.  I did the
  chat example and he asked How would you persist the chats?  The code I
  came up with was surprisingly similar to your code.
  The only suggestion that I would have is to PreCache the Message.user
  fields
  to get better start-up performance.
 
 
  [1] http://www.github.com/bjartek/Sermo
 
  --
  Bjarte Stien Karlsen
  Ronatoppen 6a, 4638 Kristiansand
  95219547
  MSN: m...@ibjarte.com
 
 
 
 
 
  --
  Lift, the simply functional web framework http://liftweb.net
  Beginning Scala http://www.apress.com/book/view/1430219890
  Follow me: http://twitter.com/dpp
  Git some: http://github.com/dpp
 
  
 



 --
 Bjarte Stien Karlsen
 Ronatoppen 6a, 4638 Kristiansand
 95219547
 MSN: m...@ibjarte.com





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

 




-- 
Bjarte Stien Karlsen
Ronatoppen 6a, 4638 Kristiansand
95219547
MSN: m...@ibjarte.com

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



[Lift] MINOR BREAKING CHANGE IN mapper.view.ModelView

2009-09-14 Thread Naftoli Gugenheim

If you use ModelView in a ModelSnippet, read the following:
I added an inner class to mapper.view.ModelSnippet called ModelView, which 
extends mapper.view.ModelView but allows you to leave out the snippet parameter.
However if you were using these new classes you may have to make a small 
change. If you use ModelView inside ModelSnippet, just leave out this from 
the constructor.
You may also be able to change ModelView to view.ModelView.
The Wiki article may not yet reflect this.

--~--~-~--~~~---~--~~
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: JodaTime and JPA

2009-09-14 Thread Derek Chen-Becker
Quite nice. Hibernate is really flexible with user-defined types. I wish
that JPA had a general mechanism for it...

Derek

On Mon, Sep 14, 2009 at 1:39 PM, Charles F. Munat c...@munat.com wrote:


 It occurs to me that I should probably share this. I've been using
 Jorge's wonderful Scala wrapper for JodaTime and I needed to persist
 DateTime and LocalDate. I found a Hibernate project that makes this
 possible. (Note that Jorge's wrapper is a work in progress and doesn't
 cover everything in JodaTime, but you can just use the JodaTime classes
 directly, which I did for DateTimeFormatter and DateTimeFormatterBuilder.)

 In pom.xml:

 dependency
   groupIdorg.scala-tools/groupId
   artifactIdtime/artifactId
   version2.7.5-0.2-SNAPSHOT/version
 /dependency
 dependency
   groupIdjoda-time/groupId
   artifactIdjoda-time/artifactId
   version1.6/version
 /dependency
 dependency
   groupIdjoda-time/groupId
   artifactIdjoda-time-hibernate/artifactId
   version1.1/version
 /dependency

 In the JPA entity classes:

 @Type{val `type`=org.joda.time.contrib.hibernate.PersistentDateTime}
 @Column{val name=created_at, val updatable = false}
 var createdAt: DateTime = DateTime.now

 Gets persisted as a timestamp without time zone in PostgreSQL.

 @Type{val `type`=org.joda.time.contrib.hibernate.PersistentLocalDate}
 @Column{val name = born_on}
 var bornOn: LocalDate = new LocalDate()

 Gets persisted as a date in PostgreSQL.

 http://joda-time.sourceforge.net/
 http://github.com/jorgeortiz85/scala-time
 http://joda-time.sourceforge.net/contrib/hibernate/index.html

 Chas.

 


--~--~-~--~~~---~--~~
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: Best way to write a wizard

2009-09-14 Thread David Pollak
On Mon, Sep 14, 2009 at 1:12 PM, Josh Suereth joshua.suer...@gmail.comwrote:



 On Mon, Sep 14, 2009 at 2:31 PM, David Pollak 
 feeder.of.the.be...@gmail.com wrote:



 On Sun, Sep 13, 2009 at 10:52 AM, Josh Suereth 
 joshua.suer...@gmail.comwrote:

 All,

 I write to you (unfortunately still) as a lift n00b.  I'm trying to
 modify a form such that it looks more wizard like.  i.e.  I want it to
 specifically state You've completed part 1, you're on step 2 of 5, etc.

 How should I accomplish this in view-first rendering?  Normal MVC, I'd
 make one controll that redirects you to the appropriate wizard screen
 depending on what steps have already been accomplished (i.e. the controller
 figures out which step you're on and sends you to the appropraite view.

 In Lift, I'm thinking I have a few options:

 1) Have my stateful snippet actually return the various pages in code.
 I'm not happy with this, as my view would reside in the controller, but I
 could git'r'done this way.


 Not really.  You can have the templates for each phase of the wizard be
 separate files and use TemplateFinder.findAnyTemplate to load the template
 for the step of the wizard that you're on.   This is akin to the
 controller-first choosing a template.



 That's a lot better than I was thinking.  Are there any samples that use
 this?


http://github.com/dpp/liftweb/commit/8aab3c61e9b10399afcb4d04f3e23b0750b0e00d



 



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

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



[Lift] Re: Mapper: Why is every SQL query sent twice? (second time with NULL parameters)

2009-09-14 Thread David Pollak
On Mon, Sep 14, 2009 at 3:56 PM, Derek Chen-Becker dchenbec...@gmail.comwrote:

 With my own project using the new logging code that I just committed, I
 don't see dup queries. This is against 1.1-SNAPSHOT, so I don't know if
 there's a bug in 1.0, but I would think that if things were really happening
 twice then inserts and updates would be broken.


The SQL is not being sent twice.  There are two different points (when the
Statement is created and after the Statement is executed) that the same
query is logged.



 Derek


 On Mon, Sep 14, 2009 at 2:30 PM, tiro tim.romb...@googlemail.com wrote:


 Dear all,

 on every findAll request, lift seems to send the query twice (tested
 1.0 and 1.0.2, working from the PocketChangeApp example on h2database,
 and using
  DB.addLogFunc((query, time) =
  Log.info(query + : + time + ms)))

 for logging

 1. e.g. right after login; this must be framework code (ProtoUser):

 INFO - prep91: SELECT users.firstname, users.lastname, users.email,
 users.locale, users.timezone, users.password_pw, use
 rs.password_slt, users.superuser, users.validated, users.uniqueid,
 users.id FROM users  WHERE email = ?  {1: 't...@rombe
 rg.be'};:14ms
 INFO - prep91: SELECT users.firstname, users.lastname, users.email,
 users.locale, users.timezone, users.password_pw, use
 rs.password_slt, users.superuser, users.validated, users.uniqueid,
 users.id FROM users  WHERE email = ?  {1: NULL};:65ms

 same on practically all other statements

 2nd example:

 INFO - prep110: SELECT  DISTINCT resourcestopics.resourcetype,
 resourcestopics.resourceid, resourcestopics.topicid FROM
 resourcestopics   WHERE resourcetype = ?  AND resourceid = ?   {1: 2,
 2: 3};:0ms
 INFO - prep110: SELECT  DISTINCT resourcestopics.resourcetype,
 resourcestopics.resourceid, resourcestopics.topicid FROM
 resourcestopics   WHERE resourcetype = ?  AND resourceid = ?   {1:
 NULL, 2: NULL};:27ms
 INFO - Service request (POST) /editProject.html took 748 Milliseconds

 my code: findAll(By(ResourcesTopics.resourceType, resourceType), By
 (ResourcesTopics.resourceId, resourceId))


 Is this desired behavior? Am only I seeing this? It also seems that
 the useless query takes much more time than the real query..

 Tried to compare with one of the most recent milestone (1.1-M5) but
 this one only throws exceptions on me, starting from boot, so I
 suppose there have been too many changes I am not aware of.


 Thanks,

 Tim




 



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

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



[Lift] Re: email encoding problem

2009-09-14 Thread David Pollak
On Sat, Sep 12, 2009 at 9:54 AM, night_stalker usur...@gmail.com wrote:


 Thank you all for your replies.

 I just modified  net/liftweb/util/Mailer.scala,
 replaced all  text/html  with  text/html;charset=UTF-8 , then
 problem solved.


I'll check this in



 the result mail's Content-Type part becomes:

  Content-Type: text/plain; charset=UTF-8
  Content-Transfer-Encoding: quoted-printable

 and 你好 is shown correctly.
 



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

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



[Lift] The bridge of sorrows

2009-09-14 Thread David Pollak
What is your name?

What is your quest?

What is your favorite color?

How do you do this in Lift?  http://demo.liftweb.net/simple_wizard

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

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



[Lift] Re: Subquerys Mapper?

2009-09-14 Thread David Pollak
Sorry, Lift's mapper doesn't let you do this. :-(

On Fri, Sep 4, 2009 at 9:01 AM, José María josemariar...@gmail.com wrote:


 Hi,

 Is it possible to do subqueries with Mapper?

 If I have something like:

 Product.findAll(...)

 How can I use it as subquery for another query? What I'm trying to do
 is:

 Select *  from Table order by random() limit 6

 But this doesn't works in modern SQL implementations (Oracle, PG 8.4)
 so what I need to do is:

 Select * from (select * from Table) order by random limit 6

 Cheers.
 



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

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



[Lift] Re: The bridge of sorrows

2009-09-14 Thread Charles F. Munat

You, Sir Lancelot on the quest I seek the Holy Grail may cross the 
bridge of sorrows...

David Pollak wrote:
 What is your name?
 
 What is your quest?
 
 What is your favorite color?
 
 How do you do this in Lift?  http://demo.liftweb.net/simple_wizard
 
 -- 
 Lift, the simply functional web framework http://liftweb.net
 Beginning Scala http://www.apress.com/book/view/1430219890
 Follow me: http://twitter.com/dpp
 Git some: http://github.com/dpp
 
  

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



[Lift] trouble with comet Clock example

2009-09-14 Thread jack

I compiled the comet Clock app and used the following markup

lift:surround with=default at=content
  lift:comet type=Clock name=Other
clk:timeMissing Clock/clk:time
  /lift:comet
/lift:surround

I also used the standard default.html

When I ran it, I got the error

XML parsing failed: syntax error (Line: 13, Character: 4)

Error:undeclared XML namespace prefix used in attribute name
Specification:http://www.w3.org/TR/xml-names11/#nsc-NSDeclared
 10:   body
 11:
 12:   !--FIXME - comet type: Full(Clock) name: Full(Other) Not Found
--
 13: clk:timeMissing Clock/clk:time
 14:
 15:
 16:   script type=text/javascript

Any ideas?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---