[Lift] Re: Whitespace removal from XML

2009-11-09 Thread Bryan Germann

Also see trimProper in
http://lampsvn.epfl.ch/trac/scala/browser/scala/tags/R_2_7_7_final/src/library/scala/xml/Utility.scala?view=markup

--Bryan

On Mon, Nov 9, 2009 at 5:47 PM, harryh har...@gmail.com wrote:

 Answering my own question, I wrote this.  I think it should do what I
 want:

 def compactXml(node: Node): Node = node match {
  case Elem(p, l, a, s, children @ _*) = Elem(p, l, a, s, children.map
 (compactXml(_)) :_*)
  case Text(data) = Text(data.trim)
  case x = x
 }

 -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] Scala Lift Off East

2009-11-01 Thread Bryan

I'm waiting for a ride to Union Station, so I thought I'd use this  
time to discuss some of the questions and concerns I heard about lift  
at the recent Scala Lift Off East.

Personally, I did not attend any of the lift sessions, so I'm  
definitely leaving a lot out.  I like lift and its community, so I  
want to make sure these points get mentioned.

1.  There were a handful of lift sessions called, but no active  
committers at the unconference to go into depth about a given topic.   
That could be why most of the sessions were about using lift in  
particular environments, such as clustered and under GAE.

2.  With the above said, much praise did go out to the lift community  
for their responsiveness to develop feature requests and fix bugs.

3.  There was interest -- myself included -- to learn more about Record.

4.  I heard a few discussions concerning the use of Sessions.  They  
wanted to know how this impacted scalability.

5.  Just an observation:  I was surprised to learn that many people at  
the conference had never used maven before.

6. Users discussed that lift was very fast to develop in.  One group  
there mentioned that they used lift to replace an existing PHP app.   
Another user held a session on how his company used lift to create its  
website in under 90 days. -- I hope I got that right.

--Bryan

Sent from my iPhone

--~--~-~--~~~---~--~~
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: Don't shoot the non-XML messenger ...

2009-10-13 Thread Bryan

Hi Aule,

 I am still looking to see if I over-looked somewhere on the web where
 there is a 1.0.2 Boot.scala

   1) showing unambiguously how to flip the default Content-Type
   2) and having, in fact, the intended effect

  as I now know from a few trials over a few hours that this is not as
 simple as some web posts present.

I have not had a need for this, so I had to search some web posts to
find the answer.  Quckly, I found the following snippet:

LiftRules.determineContentType = {
  case _ = text/curl
}

I have not verified this, so please let us know if it does not help.

 Were it trivial, I had not mocked a framework, and you, Mr. Pollock,
 had not raged.

From my readings, Mr. Pollak has yet to show any rage.

--Bryan

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



[Lift] Binding - keepAttrs?

2009-09-17 Thread Bryan

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

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

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

Renders as

input value= type=text name=F812119230404JZF /

But should be

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

Thanks,
Bryan

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



[Lift] Re: customizing my SiteMap

2009-06-28 Thread Bryan

Hi David,

I created a custom snippet, MyMenu, to do this:
http://paste.pocoo.org/show/EVKLV81FdRuz257apvS7/.  See its select
method.  I just happened to rewrite the code this morning and haven't
gotten around to testing it, so I hope it still works.

Usage:
div id=menu
  ul
lift:MyMenu.select active:class=active default=home localize=true
  limenu:bind name=photos //li
  limenu:bind name=links //li
  limenu:bind name=contact a:id=contact //li
/lift:MyMenu.select
  /ul
/div

This assumes that home, photos, links, and contact are defined as Loc
names in your SiteMap.

Let me know if you have any questions.

Regards,
Bryan Germann

On Sun, Jun 28, 2009 at 2:47 PM, David Personsdhwpers...@gmail.com wrote:

 Hello guys,

 For a project, we use a pre-defined html / css template. This template
 displays the menu as follows:

 div id=menu

        ul

                li class=current_page_itema href=#home/a/li

                lia href=#photos/a/li

                lia href=#about/a/li

                lia href=#links/a/li

                lia href=#contact/a/li

        /ul

 /div

 How can I retrieve this 'current page item' and generate the html
 shown above? Can somebody try to give a code example?

 regards,
 David Persons

 


--~--~-~--~~~---~--~~
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: customizing my SiteMap

2009-06-28 Thread Bryan

Oops.  I forgot to add home into the menu.

Usage:
div id=menu
  ul
lift:MyMenu.select active:class=current_page_item
default=home localize=true
  limenu:bind name=home //li
  limenu:bind name=about //li
  limenu:bind name=photos //li
  limenu:bind name=links //li
  limenu:bind name=contact a:id=contact //li
/lift:MyMenu.select
  /ul
/div

On Jun 28, 8:08 pm, Bryan germ...@gmail.com wrote:
 Hi David,

 I created a custom snippet, MyMenu, to do 
 this:http://paste.pocoo.org/show/EVKLV81FdRuz257apvS7/.  See its select
 method.  I just happened to rewrite the code this morning and haven't
 gotten around to testing it, so I hope it still works.

 Usage:
 div id=menu
   ul
     lift:MyMenu.select active:class=active default=home localize=true
       limenu:bind name=photos //li
       limenu:bind name=links //li
       limenu:bind name=contact a:id=contact //li
     /lift:MyMenu.select
   /ul
 /div

 This assumes that home, photos, links, and contact are defined as Loc
 names in your SiteMap.

 Let me know if you have any questions.

 Regards,
 Bryan Germann

 On Sun, Jun 28, 2009 at 2:47 PM, David Personsdhwpers...@gmail.com wrote:

  Hello guys,

  For a project, we use a pre-defined html / css template. This template
  displays the menu as follows:

  div id=menu

         ul

                 li class=current_page_itema href=#home/a/li

                 lia href=#photos/a/li

                 lia href=#about/a/li

                 lia href=#links/a/li

                 lia href=#contact/a/li

         /ul

  /div

  How can I retrieve this 'current page item' and generate the html
  shown above? Can somebody try to give a code example?

  regards,
  David Persons
--~--~-~--~~~---~--~~
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] Is Hudson Stuck? 6/24

2009-06-24 Thread Bryan

Is this the correct URL to check on the status of the Hudson build?
If so, is it stuck?

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



[Lift] Re: Is Hudson Stuck? 6/24

2009-06-24 Thread Bryan

I'm using http://hudson.scala-tools.org/job/Lift/.

On Jun 24, 9:08 pm, Bryan germ...@gmail.com wrote:
 Is this the correct URL to check on the status of the Hudson build?
 If so, is it stuck?

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



[Lift] Re: JPA and auto generation of id

2009-06-24 Thread Bryan

Try upgrading your hibernate version from 3.3.1.ga to 3.3.2.GA.

Derek, can you look into upgrading the archetype to this release as
well?  I recall 3.3.1.ga having some packaging issues.

--Bryan

On Wed, Jun 24, 2009 at 6:29 PM, David Personsdhwpers...@gmail.com wrote:

 Thanks for all the answers guys.

 I managed to fix the id problem, I needed the Hibernate specific class
 GenericGenerator to fix it, which of cource is less pretty then using
 only JPA. Someone has an example of how to make it work with MySql and
 only JPA annotations? Current version:

 @Entity
 class Scene {
 �...@id
 �...@genericgenerator{val name=hibernate-increment, val
 strategy=increment}
 �...@generatedvalue{val strategy = GenerationType.SEQUENCE, val
 generator = hibernate-increment}
  var id : Long = _

 �...@column{val unique = true, val nullable = false}
  var ordering : Int = _

 �...@column{val unique = true, val nullable = false}
  var name : String = 

 �...@manytoone{val optional = false}
  var storyBoard : StoryBoard = _
 }

 However, now I get an org.hibernate.PropertyValueException: not-null
 property references a null or transient value:
 model.Scene.storyBoard :-s I tried a lot of things already, the
 corresponding StoryBoard is saved and not null, so I guess it has to
 be transient. Merging the StoryBoard however still gives the same
 error..

 I tried to get JPA and Lift working together in the same way as in the
 JPADemo example.. Is it the use of MySql which prevents the example
 from working for me?

 regards,
 David

 On 23 jun, 00:54, Derek Chen-Becker dchenbec...@gmail.com wrote:
 Also, what does the schema for the entity's table look like?

 On Mon, Jun 22, 2009 at 4:54 PM, Derek Chen-Becker 
 dchenbec...@gmail.comwrote:

  Mind posting the snippet of code where you're saving the instance? A merge
  should interpret a null ID as a fresh instance, and a persist should just
  save it.

  Derek

  On Mon, Jun 22, 2009 at 1:50 PM, David Persons dhwpers...@gmail.comwrote:

  I am using MySql (5). After setting the hibernate.dialect to
  org.hibernate.dialect.MySQLDialect in my persistence.xml file, I get a
  org.hibernate.AssertionFailure: null id :-s

  cheers

  On 22 jun, 19:18, Derek Chen-Becker dchenbec...@gmail.com wrote:
   That's not accurate, at least with Hibernate. By putting the annotations
  on
   vars, the compiler ends up putting them on the internal fields, which
  then
   forces Hibernate into a field-based persistence model and not a
   getter/setter based one. The SQLGrammarException is most likely what the
   other people have said. If you're in Oracle or PostgreSQL, for instance,
  you
   need a sequence set up for the auto identity model. What database are
  you
   using?

   Derek

   On Mon, Jun 22, 2009 at 8:54 AM, Eric Bowman ebow...@boboco.ie wrote:

David Persons wrote:
 Hello guys,

 I get a org.hibernate.exception.SQLGrammarException: could not get
  or
 update next value error everytime I try to save the following
  Entity:

 @Entity
 class Scene {
   @Id
   @GeneratedValue(){val strategy = GenerationType.AUTO}
   var id : Long = _

   @Column{val unique = true, val nullable = false}
   var ordering : Int = _

   @Column{val unique = true, val nullable = false}
   var name : String = 

   @ManyToOne{val optional = false}
   var storyBoard : StoryBoard = _
 }

You almost certainly need some scala.reflect.BeanProperty annotations
  on
your fields.

cheers,
Eric

--
Eric Bowman
Boboco Ltd
ebow...@boboco.ie
   http://www.boboco.ie/ebowman/pubkey.pgp
+35318394189/+353872801532
 http://www.boboco.ie/ebowman/pubkey.pgp%0A+35318394189/+353872801532

 


--~--~-~--~~~---~--~~
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 Jquery autocomplete *** API CHANGE CANDIDATE ***

2009-06-15 Thread Bryan.

Hi Marius,

I just updated to the tip and got a build failure:

[WARNING] /home/bryan/public-repos/git/liftweb/sites/example/src/main/
scala/net/liftweb/example/snippet/Ajax.scala:65: error: value
autocomplete is not a member of object net.liftweb.http.jquery.JqSHtml
[WARNING]  auto - JqSHtml.autocomplete(, buildQuery _, _
= ()))

--Bryan

On Jun 15, 2:16 pm, marius d. marius.dan...@gmail.com wrote:
 Folks,

 I just made the autocomplete a Lift widget so it does not exist
 anymore in JqShtml object. Here is an example on how to use it:

 - For Ajax autocomplete
     AutoComplete(, (current, limit) = {
       println(current =  + current)
       (1 to limit).map(v = Value_ + v)
     }, s = println(submit  + s))

 - For pre-provided options list
    AutoComplete.autocompleteObj(/*same params as bfore*/)

 This may break your app but I think it is very easy to update it.

 I also fixed some bugs:
 1. It didn;t work if the container cookies were turned off
 2. hovering on the options list did not work on Ubuntu FF3 at least
 due to a capitalizated LI equality test.

 If you encounter any problems, please let me know.

 Br's,
 Marius

 On Jun 8, 12:34 pm, Kevin Wright kev.lee.wri...@googlemail.com
 wrote:

  +1

  As an evolving framework, it definitely makes more sense to favour
  consistency over backward compatibility at this stage

  On Mon, Jun 8, 2009 at 9:00 AM, marius d. marius.dan...@gmail.com wrote:

   Other folks, please speak up ! :) ... I will soon migrate this into a
   Lift widget.

   Br's,
   Marius

   On Jun 6, 4:53 pm, David Pollak feeder.of.the.be...@gmail.com wrote:
I think I'm using in one place in one project so my api breakage factor
   is
low.  I'm okay with moving it unless someone else is going to feel real
pain.

On Jun 6, 2009 12:24 AM, Marius marius.dan...@gmail.com wrote:

Is there a reason why the JQuery autocomplete is not a Lift widget but
instead it lives in http/jquery package? .. I remember a long time ago
me putting it in the jquery package to separate SHtml stuff that is
dependent on JQuery to the others.

Thoughts?

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



[Lift] Re: How to remove leading text in Msgs.error

2009-06-05 Thread Bryan.

+1 on removing the default text.

--Bryan

On Jun 5, 6:46 am, marius d. marius.dan...@gmail.com wrote:
 The reason for that is that if the node text is empty (and yes we
 explicitly trim it) we render the default text. To be honest I'm not a
 fan of this approach either. I think it should be ok to just not
 render a default text. Does anyone have any objections? If not I could
 change this real quick, if yes let's talk about it.

 Br's,
 Marius

 On Jun 5, 12:48 pm, Jeppe Nejsum Madsen je...@ingolfs.dk wrote:

  Hi,

  I'm trying to remove the Notice, Error lead in text that is
  displayed when using the Msgs snippet, like this:

   lift:snippet type=msgs
            lift:notice_msg class=success/lift:notice_msg
            lift:error_msg class=error/lift:error_msg
            lift:warning_msg class=notice/lift:warning_msg
   /lift:snippet

  Looking at the code, it seems the default text is used if the specified
  text is empty, so I tried putting a nbsp; in there but this also seems
  to be swallowed.

  Is there anyway to do this (besides changing the default property
  values)??

  /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: Future of the Lift wiki

2009-06-02 Thread Bryan.

I too am willing to help.

I really like the format of the django documentation:
http://docs.djangoproject.com/en/dev/.  Any other recommendations out
there?

Thanks,
Bryan

On Jun 2, 6:57 am, Kevin Wright kev.lee.wri...@googlemail.com wrote:
 Mark me down :)

 On Tue, Jun 2, 2009 at 9:36 AM, marius d. marius.dan...@gmail.com wrote:

  I believe Debbie was asking the community for a few folks willing to
  garden the wiki. Anyone interested?

  Br's,
  Marius

  On Jun 2, 11:07 am, Timothy Perrett timo...@getintheloop.eu wrote:
   Guys,

   I know you chaps are quite new on this lift, so just to add a bit of
   background - we've been here many, many times before with various
   people pledging to fix and cleanup the wiki (myself included!)

   After much discussion we decided that what was needed were gardeners -
   not perhaps to write the articles themselves (as they may not be able
   to if its about complex lift internals), but rather, to hassle the
   commit team into churning out the required information that the
   gardeners can distill onto the wiki. This involves going through the
   current wiki and removing the old / irrelevant stuff.

   Cheers, Tim

   On Jun 2, 3:36 am, g-man gregor...@gmail.com wrote:

Having gone through Rails, the Google App Engine with Django, and
web2py over the last four years, I have seen it all as far as learning
new frameworks goes, and I have posted a few ideas on that subject
both here and on the book group.

For those of us spoiled by the wealth of learning material on Rails,
and to a lesser degree Django and web2py, all I can say is: 'Lift is a
new framework, and a sophisticated one at that, which uses a new
language derived from a convoluted one, and is at a relatively early
stage of development, so therefore the designers are forging ahead to
completion of the foundation, and thus there are few who can devote
the time to creating the documentation we newcomers need.'

My post on the book group defined the three classes of useful
documents to be the Guidebook, the Encyclopedia, and the Cookbook. My
role for the wiki is to hold Cookbook recipes which answer the most
common 'how to' questions we encounter when building a website.

In my personal learning quest, I am extending the 'ToDo' app by adding
pieces of functionality, like many-to-many tagging, date manipulation,
deletion, an admin interface, etc.

As I come across solutions or questions, I post those on the group in
order to help others and to get improvements and refinements from the
members.

David is right... Lift and Scala together are taking web applications
to a whole new level of performance, so naturally it will take a
little time to make things happen.

By the way, today my copies of David's and Martin's Scala books
arrived, and I urge all to purchase them yourselves!

On Jun 1, 3:35 pm, Charles F. Munat c...@munat.com wrote:

 Hi, Xavi,

 One of my tasks is to come up with a good organization for the wiki
  and
 a site map, as well as a list of things we'd like to add to it.
 Unfortunately, with the coming Scala/Liftoff and OSB conferences,
  I've
 been swamped with other things. But I am working on it, albeit
  slowly.
 If you have any specific recommendations, please post them.

 Thanks!

 Chas.

 Xavi Ramirez wrote:
  Hello,

  I'm a bit confused about the future of the lift wiki.  What's the
  end
  goal?  In an ideal world is it supposed to be the main repository
  of
  lift knowledge, or just another documentation source?

  I personally feel that having one repository of knowledge is much
  more
  noob friendly.  Currently new members have to navigate through
  started
  guides, books, e-mail threads, scala docs, and personal blogs to
  find
  relative information.  Though the get started guided and book
  provide
  a good introduction, it's hard to progress from novice to
  intermediate
  with these fragmented resources.

  Thanks,
  Xavi
--~--~-~--~~~---~--~~
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] Showing a Box or Redirecting?

2009-05-30 Thread Bryan

If Foo has 5 methods that I need to show in a Snippet (scattered
throughout the template), what's a good way to S.error(inactive);
S.redirectTo(/) whenever Box[Foo] cannot be opened because it is not
Full, without having to write a bunch of boiler plate code for each of
the show methods I have defined below.

class SomeSnippet {
  val foo: Box[Foo] = tryo(session1.get(S.param(id).getOrElse()))

  def showA(xhtml: NodeSeq): NodeSeq = ...
  def showB(xhtml: NodeSeq): NodeSeq = ...
  def showC(xhtml: NodeSeq): NodeSeq = ...
  def showD(xhtml: NodeSeq): NodeSeq = ...
  def showE(xhtml: NodeSeq): NodeSeq = ...
}

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



[Lift] Re: Where is scalajpa.jar?

2009-05-30 Thread Bryan.

http://scala-tools.org/repo-snapshots/org/scala-tools/scalajpa/

--Bryan

On May 30, 8:37 pm, c...@munat.com wrote:
 Missing:
 --
 1) org.scala-libs:scalajpa:jar:1.1-SNAPSHOT

   Try downloading the file manually from the project website.

   Then, install it using the command:
       mvn install:install-file -DgroupId=org.scala-libs
 -DartifactId=scalajpa -Dversion=1.1-SNAPSHOT -Dpackaging=jar
 -Dfile=/path/to/file

   Alternatively, if you host your own repository you can deploy the file
 there:
       mvn deploy:deploy-file -DgroupId=org.scala-libs
 -DartifactId=scalajpa -Dversion=1.1-SNAPSHOT -Dpackaging=jar
 -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]

   Path to dependency:
         1) com.munat.totc:totc-app:war:1.0-SNAPSHOT
         2) org.scala-libs:scalajpa:jar:1.1-SNAPSHOT

 --
 1 required artifact is missing.

 (Yes, I did blow away .m2.)

 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: Showing a Box or Redirecting?

2009-05-30 Thread Bryan.

I guess I should just have def showFoo(xhtml: NodeSeq) and use bind to
render A, B, C, D, and E.

--Bryan

On May 30, 9:12 pm, Bryan germ...@gmail.com wrote:
 If Foo has 5 methods that I need to show in a Snippet (scattered
 throughout the template), what's a good way to S.error(inactive);
 S.redirectTo(/) whenever Box[Foo] cannot be opened because it is not
 Full, without having to write a bunch of boiler plate code for each of
 the show methods I have defined below.

 class SomeSnippet {
   val foo: Box[Foo] = tryo(session1.get(S.param(id).getOrElse()))

   def showA(xhtml: NodeSeq): NodeSeq = ...
   def showB(xhtml: NodeSeq): NodeSeq = ...
   def showC(xhtml: NodeSeq): NodeSeq = ...
   def showD(xhtml: NodeSeq): NodeSeq = ...
   def showE(xhtml: NodeSeq): NodeSeq = ...

 }

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



[Lift] Re: Giving an Actor access to S

2009-05-26 Thread Bryan.

Thanks.

--Bryan

On May 26, 11:33 am, David Pollak feeder.of.the.be...@gmail.com
wrote:
 As long as you have access to the LiftSession, you can initialize S and use
 it correctly:

 case MyMessage =
 S.initIfUninitted(theSession) {
 ... code to execute in the actor scope

 }

 Thanks,

 David



 On Mon, May 25, 2009 at 11:39 AM, Bryan germ...@gmail.com wrote:

  How can I give an Actor access to S?  I need this for adding results
  to a SessionVar of a HashMap.

  If I call show() directly, then I see localhost logged.  If I call
  show() from within an actor, then it logs nowhere_123.com:
  listener ! 'show.

  val listener: Actor = actor {
   loop {
     react {
       case 'show = show()
     }
   }
  }

  def show() {
   Log.info(show's host name:  + S.hostName)
  }

 --
 Lift, the simply functional web frameworkhttp://liftweb.net
 Beginning Scalahttp://www.apress.com/book/view/1430219890
 Follow me:http://twitter.com/dpp
 Git some:http://github.com/dpp
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Giving an Actor access to S

2009-05-25 Thread Bryan

How can I give an Actor access to S?  I need this for adding results
to a SessionVar of a HashMap.

If I call show() directly, then I see localhost logged.  If I call
show() from within an actor, then it logs nowhere_123.com:
listener ! 'show.

val listener: Actor = actor {
  loop {
react {
  case 'show = show()
}
  }
}

def show() {
  Log.info(show's host name:  + S.hostName)
}
--~--~-~--~~~---~--~~
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: Strange Comet Behavior

2009-05-12 Thread Bryan.

Wow, this is great stuff!  setupComet was a very thoughtful addition.
Thanks, David.

Regards,
Bryan

On May 12, 6:13 pm, David Pollak feeder.of.the.be...@gmail.com
wrote:
 Bryan,

 I've reworked your example... and based on my re-work, I added a method to
 LiftSession that allows you to send messages to a CometActor referenced
 later on.

 I hope you like it.

 Thanks,

 David



 On Mon, May 11, 2009 at 7:08 PM, Bryan. germ...@gmail.com wrote:

  Yes, the alerts were there just to illustrate that I am trying to push
  some JavaScript objects over the wire.  In my project code I also have
  additional methods that will be called on these objects (i.e. sorting,
  pagination, etc...) that make it faster for the client end if I just
  use these objects instead of traversing the HTML; it also makes it
  easier for me to implement and is independent of any changes made to
  the markup.

  If the example I provided is some one-off implementation, then let me
  know and I will start looking into some comet alternatives or try to
  come up with some hack.  Is there a way to currently check if the
  page is ready for the partialUpdate?  If so, then I can just add some
  guard to the cases in my partial function passed to lowPriority.

  Thanks,
  Bryan

  On May 11, 6:31 pm, David Pollak feeder.of.the.be...@gmail.com
  wrote:
   On Mon, May 11, 2009 at 3:08 PM, Bryan. germ...@gmail.com wrote:

Hi David,

Is it possible that the partialUpdate is being called before the page
is ready?

   Yes.

   Doing alerts in partial updates is not optimal.  I'd suggest doing all
  the
   drawing via HTML.  You can do a partial update in a way that it will
  modify
   the HTML.

   When a CometActor is rendered on a new page, its render method is called
  if
   there have been partial updates to the component since the component was
   last rendered.

 It works fine if I put Thread.sleep(1000) after the case
Results.

Thanks,
Bryan

On May 11, 5:21 pm, David Pollak feeder.of.the.be...@gmail.com
wrote:
 Try putting the this.start at the end of the Actor body... I think
  the
 start method is being called prematurely.

 On Mon, May 11, 2009 at 1:14 PM, Bryan. germ...@gmail.com wrote:

  I posted this message through the Google Groups interface and was
  forced to upload tohttp://
  groups.google.com/group/liftweb/files?hl=en.
  Sorry about the confusion.

  --Bryan

  On May 11, 4:01 pm, David Pollak feeder.of.the.be...@gmail.com
  wrote:
   You didn't include the code... :-(

   On Mon, May 11, 2009 at 12:18 PM, Bryan germ...@gmail.com
  wrote:

This could be a result of my strange usage of comet actors, but
  I'm
getting incosistent comet behavior.  When run in windows +
  jetty I
have no problems.  In linux + jetty, subsequent requests fail.
 I'll
explain.

I have attached comet-test.tar.gz to the files page as an
  example.
When you enter in a search term and click on submit it should
  popup
up
2 JS alert messages.  This seems to work everytime upon first
request
(when you restart jetty).  On all susequent tries of the Jetty
instance, the comet requests fail when you click back to the
  home
page
and search again.  I've tried clearing my browser cache,
  cookies,
and
even trying on a remote windows browser with no luck.  If I add
Thread.sleep(1000) to the comet actor's localSetup, then
  everything
appears to work OK.

Please see the sample code and let me know if I'm doing
  something
wrong.

Thanks,
Bryan

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

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

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

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

  comet-test.tgz
 6KViewDownload

--~--~-~--~~~---~--~~
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] Strange Comet Behavior

2009-05-11 Thread Bryan

This could be a result of my strange usage of comet actors, but I'm
getting incosistent comet behavior.  When run in windows + jetty I
have no problems.  In linux + jetty, subsequent requests fail.  I'll
explain.

I have attached comet-test.tar.gz to the files page as an example.
When you enter in a search term and click on submit it should popup up
2 JS alert messages.  This seems to work everytime upon first request
(when you restart jetty).  On all susequent tries of the Jetty
instance, the comet requests fail when you click back to the home page
and search again.  I've tried clearing my browser cache, cookies, and
even trying on a remote windows browser with no luck.  If I add
Thread.sleep(1000) to the comet actor's localSetup, then everything
appears to work OK.

Please see the sample code and let me know if I'm doing something
wrong.

Thanks,
Bryan

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



[Lift] Re: Strange Comet Behavior

2009-05-11 Thread Bryan.

I posted this message through the Google Groups interface and was
forced to upload to http://groups.google.com/group/liftweb/files?hl=en.
Sorry about the confusion.

--Bryan

On May 11, 4:01 pm, David Pollak feeder.of.the.be...@gmail.com
wrote:
 You didn't include the code... :-(



 On Mon, May 11, 2009 at 12:18 PM, Bryan germ...@gmail.com wrote:

  This could be a result of my strange usage of comet actors, but I'm
  getting incosistent comet behavior.  When run in windows + jetty I
  have no problems.  In linux + jetty, subsequent requests fail.  I'll
  explain.

  I have attached comet-test.tar.gz to the files page as an example.
  When you enter in a search term and click on submit it should popup up
  2 JS alert messages.  This seems to work everytime upon first request
  (when you restart jetty).  On all susequent tries of the Jetty
  instance, the comet requests fail when you click back to the home page
  and search again.  I've tried clearing my browser cache, cookies, and
  even trying on a remote windows browser with no luck.  If I add
  Thread.sleep(1000) to the comet actor's localSetup, then everything
  appears to work OK.

  Please see the sample code and let me know if I'm doing something
  wrong.

  Thanks,
  Bryan

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

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



[Lift] Re: Strange Comet Behavior

2009-05-11 Thread Bryan.

Yes, the alerts were there just to illustrate that I am trying to push
some JavaScript objects over the wire.  In my project code I also have
additional methods that will be called on these objects (i.e. sorting,
pagination, etc...) that make it faster for the client end if I just
use these objects instead of traversing the HTML; it also makes it
easier for me to implement and is independent of any changes made to
the markup.

If the example I provided is some one-off implementation, then let me
know and I will start looking into some comet alternatives or try to
come up with some hack.  Is there a way to currently check if the
page is ready for the partialUpdate?  If so, then I can just add some
guard to the cases in my partial function passed to lowPriority.

Thanks,
Bryan

On May 11, 6:31 pm, David Pollak feeder.of.the.be...@gmail.com
wrote:
 On Mon, May 11, 2009 at 3:08 PM, Bryan. germ...@gmail.com wrote:

  Hi David,

  Is it possible that the partialUpdate is being called before the page
  is ready?

 Yes.

 Doing alerts in partial updates is not optimal.  I'd suggest doing all the
 drawing via HTML.  You can do a partial update in a way that it will modify
 the HTML.

 When a CometActor is rendered on a new page, its render method is called if
 there have been partial updates to the component since the component was
 last rendered.



   It works fine if I put Thread.sleep(1000) after the case
  Results.

  Thanks,
  Bryan

  On May 11, 5:21 pm, David Pollak feeder.of.the.be...@gmail.com
  wrote:
   Try putting the this.start at the end of the Actor body... I think the
   start method is being called prematurely.

   On Mon, May 11, 2009 at 1:14 PM, Bryan. germ...@gmail.com wrote:

I posted this message through the Google Groups interface and was
forced to upload tohttp://groups.google.com/group/liftweb/files?hl=en.
Sorry about the confusion.

--Bryan

On May 11, 4:01 pm, David Pollak feeder.of.the.be...@gmail.com
wrote:
 You didn't include the code... :-(

 On Mon, May 11, 2009 at 12:18 PM, Bryan germ...@gmail.com wrote:

  This could be a result of my strange usage of comet actors, but I'm
  getting incosistent comet behavior.  When run in windows + jetty I
  have no problems.  In linux + jetty, subsequent requests fail.
   I'll
  explain.

  I have attached comet-test.tar.gz to the files page as an example.
  When you enter in a search term and click on submit it should popup
  up
  2 JS alert messages.  This seems to work everytime upon first
  request
  (when you restart jetty).  On all susequent tries of the Jetty
  instance, the comet requests fail when you click back to the home
  page
  and search again.  I've tried clearing my browser cache, cookies,
  and
  even trying on a remote windows browser with no luck.  If I add
  Thread.sleep(1000) to the comet actor's localSetup, then everything
  appears to work OK.

  Please see the sample code and let me know if I'm doing something
  wrong.

  Thanks,
  Bryan

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

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

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

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



[Lift] Re: Tail merge?

2009-05-10 Thread Bryan.

A nice use for this tail merge would be for the Google Analytics
tracking code, especially the ecommerce tracking code.

Here's something to keep an eye on as well:  http://blog.digg.com/?p=621
-- still very new and in development.

--Bryan

On May 10, 9:57 am, David Pollak feeder.of.the.be...@gmail.com
wrote:
 On Sun, May 10, 2009 at 6:55 AM, marius d. marius.dan...@gmail.com wrote:

  People can choose to smash multiple js/css files into a single one,
  in fact it is a common practice. However for scripts that can be
  deferred putting them at the bottom of the page can improve rendering.

 Okay.. so we're not actually putting the scripts on the page, we're just
 putting them right about the /body tag?





  Br's,
  Marius

  On May 10, 4:42 pm, David Pollak feeder.of.the.be...@gmail.com
  wrote:
   On Fri, May 8, 2009 at 5:26 PM, Timothy Perrett timo...@getintheloop.eu
  wrote:

Sounds like this could be a neat addition. Looking forward to see what
  you
come up with :-)

   I'm not 100% keen on it.  Loading a ton of stuff into the HTML page
  (rather
   than having stuff cached by the browser) makes for larger page sizes.
   I'd
   much rather see a tool that would analyze the scripts and css that was
   included across lots of pages and recommending to the developer to make
  10
   CSS files or 20 script files into 1.  But that's just me.

Cheers, Tim

On 08/05/2009 20:19, marius d. marius.dan...@gmail.com wrote:

 A lift:tail built in snippet might me a good addition. I could
 probably allocate some time to noodle on it.

 Br's,
 Marius

 On May 8, 5:05 pm, KWright kev.lee.wri...@googlemail.com wrote:
 It's becoming an established best practice that scripts should be
  put
 at the END of a page, where possible, in order to speed up download
 times

 Good article here:http://developer.yahoo.com/performance/rules.html

 It would be nice if Lift could help encourage and support this by
 allowing a tail (or Lift:tail?) element that could be merged in
 the same fashion as the head element, perhaps also removing
 duplicates, etc.

 This element would then disappear and expose only its content when
  the
 page is ultimately sent to the browser.

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

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

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



[Lift] Re: How to handle refresh with S.redirectTo with state?

2009-05-05 Thread Bryan.

Thanks for the reply, Marius.

I just saw your reply and am not sure I fully grasp how this is safe.
What if request A comes in and sets com.bryan.myproject.locationQuery
and starts working on processing the rest of the request.  In the
meantime, request B comes in and sets
com.bryan.myproject.locationQuery.  Now request A finishes processing
the request, upon which it has to read in
com.bryan.myproject.locationQuery.  Wouldn't request A now be reading
in com.bryan.myproject.locationQuery set by request B?

Or have I mistaken how objects work and how requests are handled in
lift?

Thanks,
Bryan

On May 4, 2:24 am, marius d. marius.dan...@gmail.com wrote:
 Not at all. They are safe.

 On May 3, 9:49 pm, Bryan. germ...@gmail.com wrote:

  Would that mean that the state of the RequestVar could accidentally be
  shared with multiple requests?

  On May 3, 1:51 pm, marius d. marius.dan...@gmail.com wrote:

   Hmmm ... the code seems to be fine (as far as I can tell from the code
   snippet)

   Can you perhaps declare your RequestVars outside of Cars scope?

   just

   object locationQuery extends RequestVar[Box[LocationQuery]](Empty)

   class Cars {
     ...

   }

   .. personally I would avoid using open_! unless I'm really sure that
   the Box is not Empty.

   Br's,
   Marius

   On May 3, 7:08 pm, Bryan. germ...@gmail.com wrote:

I believe I am doing #1 now with no luck.  Let me know if this is
correct:

class Cars {
  // ...
  object locationQuery extends RequestVar[Box[LocationQuery]](Empty)

  def search(xhtml: NodeSeq): NodeSeq = {
    def processSearch() = {
      // ...
      val lq = new LocationQuery(validPickupDate.open_!,
validDropoffDate.open_!, city, city)
      S.redirectTo(/select, () = { locationQuery(Full(lq));
requestReference(Full(requestRef)) })
    }

    // binds are here
  }

  def selectedLocation(xhtml: NodeSeq): NodeSeq = {
    if (locationQuery.isDefined) {
      val selectedCity = locationQuery.open_!.pickupLocation
      Text(selectedCity.name + ,  + selectedCity.region)
    } else {
      Text()
    }
  }

  // ...

}

Thanks,
Bryan

On May 3, 11:46 am, marius d. marius.dan...@gmail.com wrote:

 Oh.. 1  2 are unrelated ... just slightly different approaches.

 On May 3, 6:45 pm, marius d. marius.dan...@gmail.com wrote:

  Well instead of open_1 use openOr so that you wont get exceptions 
  when
  the Box is Empty. Also if you want when you to the redirect you 
  could
  propagate those RequestsVars as well so that your browser re-send
  them. Now sure if this is what you'd want but should help avoiding
  Empty request vars. But what I'd do is:

  1. Since you are doing redirect with state in the function passed to
  S.redirectTo you can set relevant values to your RequestVar's .. 
  hence
  when your page is rendered your request vars have the old values
  potentially.
  2. Use a StatefulSnippet and call redirectTo from the 
  StatefulSnippet
  not S. Hence you can save state inside your snippet and when 
  redirect
  happens, the same snippet instance would be used.

  Br's,
  Marius

  On May 3, 6:08 pm, Bryan germ...@gmail.com wrote:

   I have a snippet that calls S.redirectTo with state.  In this same
   snippet class I have a few functions to show the values of the
   processed RequestVar's.  This works fine until I refresh the page,
   because in these functions I call .open_! on some now Empty
   RequestVar's.  It is simple enough to show Text() when the box 
   is
   not Full, but now I have a problem with the page not showing 
   useful
   data.

   What are some suggestions for handling this?  Should I just add 
   code
   to each of my many snippet functions to redirect to / when the
   RequestVar's are empty?

   Thanks,
   Bryan

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



[Lift] button binder

2009-05-04 Thread Bryan

How can I create a widget to render a customized button.  This is
probably trivial, but I failed on my first attempt.

object MyButton {
  def red(value: String, func: () = Unit, attrs: (String, String)*):
Elem =
fmapFunc(NFuncHolder(func))(funcName =
  button name={funcName} type=submit class=mybutton... a few
images will go here ... /button)

and in my snippet

bind(f, xhtml, ...
  submit - MyButton.red(Search, processSearch))

Thanks,
Bryan

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



[Lift] Re: Sample applications are somewhat slow - is Lift slow ?

2009-05-03 Thread Bryan.

Hi Daniel,

You can pass the following to mvn:  -Drun.mode=production.

--Bryan

On May 3, 9:18 am, Daniel Guryca dun...@gmail.com wrote:
 Hi David,

 Thank you for your reply.

 How and where can I set production vs development mode in lift ?

 Thank you again.
 Daniel

 On Sun, May 3, 2009 at 3:12 PM, David Pollak
 feeder.of.the.be...@gmail.comwrote:

  Are you running Lift in production or development mode?
  I typically see 300 pages/second to 800 pages/second when I do benchmarks
  on dual core opteron machines.

  I'll look into this, but you should be seeing north of 300 pages per second
  with simple pages in Lift.

  On Sat, May 2, 2009 at 1:32 PM, Dunsun dun...@gmail.com wrote:

  Hi,

  I'm very new to lift and scala.

  I have made some Grails intranet applications but sadly Grails or
  better say GSP rendering part which is completely written in Groovy is
  a very slow beast (even in comparison with Rails or Django).

  For my future big project (heavy loaded site) I need something much
  faster.

  So I have made some quick and dirty Lift benchmarks using ApacheBench
  + Tomcat, GlassFish (from netbeans) and even Jetty.
  My machine - AMD X2 @ 2500Mhz, 4 GB RAM

  LIFT BASIC SAMPLE:
  ab -c 10 -n 3000
 http://localhost:8080/liftbasic-1.0-SNAPSHOT/user_mgt/login
  50 req/s

  LIFT BLANK SAMPLE:
  ab -c 10 -n 3000http://localhost:8080/liftblank-1.0/
  120 req/s

  Obtained numbers were similar for all 3 servers.

  Using Stripes and rendering similar simple pages I'm getting much much
  higher scores (600 req/s).
  Using Grails I'm getting little worse results but I would say it is
  same league.
  I would expect much better performance from Lift which is written in
  scala.

  Why am I getting these low numbers ?
  Am I doing something wrong ?
  Any suggestion is very welcome.

  regards
  Daniel

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

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



[Lift] Re: Lift documentation -- Attention newcomers (and everyone else)!

2009-05-03 Thread Bryan.

I'd like to help with the wiki as well.  Let me know if there is
anything in particular that you would like me to do.

--Bryan

On May 3, 9:46 am, David Pollak feeder.of.the.be...@gmail.com wrote:
 On Sun, May 3, 2009 at 6:33 AM, Axel Rose axel.roesl...@googlemail.comwrote:





  Hello Charles,

  I know I'm a bit late for your request to consolidate the lift wiki.

  Anyway:
  It's really puzzling to me to get the version numbers right, when creating
  a new
  archetype with maven.

  The Maven mini guide athttp://wiki.liftweb.net/index.php/Maven_Mini_Guide
  is not so helpful.

  Perhaps it would be good to color the version numbers and clearly state
  what
  will be downloaded from maven and what to do if I wanted to use snapshots.
  Does pom.xml need to be changed?

  A howto for Google App Engine usage is missing. Here I'd need to use
  snapshots.

  Also:
  Make it easier for guests to put suggestions into the wiki. I'm too
  lazy to register.

 We've done just the opposite.  You can only get an account if you make a
 request (Derek and I create the accounts).  We've had far too much
 wiki vandalism and are clamping down by making sure everybody who has
 write-access to the wiki is willing to ask for an account.



  Regards,
  Axel.

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

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



[Lift] Re: How to handle refresh with S.redirectTo with state?

2009-05-03 Thread Bryan.

I believe I am doing #1 now with no luck.  Let me know if this is
correct:

class Cars {
  // ...
  object locationQuery extends RequestVar[Box[LocationQuery]](Empty)

  def search(xhtml: NodeSeq): NodeSeq = {
def processSearch() = {
  // ...
  val lq = new LocationQuery(validPickupDate.open_!,
validDropoffDate.open_!, city, city)
  S.redirectTo(/select, () = { locationQuery(Full(lq));
requestReference(Full(requestRef)) })
}

// binds are here
  }

  def selectedLocation(xhtml: NodeSeq): NodeSeq = {
if (locationQuery.isDefined) {
  val selectedCity = locationQuery.open_!.pickupLocation
  Text(selectedCity.name + ,  + selectedCity.region)
} else {
  Text()
}
  }

  // ...
}

Thanks,
Bryan

On May 3, 11:46 am, marius d. marius.dan...@gmail.com wrote:
 Oh.. 1  2 are unrelated ... just slightly different approaches.

 On May 3, 6:45 pm, marius d. marius.dan...@gmail.com wrote:

  Well instead of open_1 use openOr so that you wont get exceptions when
  the Box is Empty. Also if you want when you to the redirect you could
  propagate those RequestsVars as well so that your browser re-send
  them. Now sure if this is what you'd want but should help avoiding
  Empty request vars. But what I'd do is:

  1. Since you are doing redirect with state in the function passed to
  S.redirectTo you can set relevant values to your RequestVar's .. hence
  when your page is rendered your request vars have the old values
  potentially.
  2. Use a StatefulSnippet and call redirectTo from the StatefulSnippet
  not S. Hence you can save state inside your snippet and when redirect
  happens, the same snippet instance would be used.

  Br's,
  Marius

  On May 3, 6:08 pm, Bryan germ...@gmail.com wrote:

   I have a snippet that calls S.redirectTo with state.  In this same
   snippet class I have a few functions to show the values of the
   processed RequestVar's.  This works fine until I refresh the page,
   because in these functions I call .open_! on some now Empty
   RequestVar's.  It is simple enough to show Text() when the box is
   not Full, but now I have a problem with the page not showing useful
   data.

   What are some suggestions for handling this?  Should I just add code
   to each of my many snippet functions to redirect to / when the
   RequestVar's are empty?

   Thanks,
   Bryan

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



[Lift] Re: How to handle refresh with S.redirectTo with state?

2009-05-03 Thread Bryan.

Would that mean that the state of the RequestVar could accidentally be
shared with multiple requests?

On May 3, 1:51 pm, marius d. marius.dan...@gmail.com wrote:
 Hmmm ... the code seems to be fine (as far as I can tell from the code
 snippet)

 Can you perhaps declare your RequestVars outside of Cars scope?

 just

 object locationQuery extends RequestVar[Box[LocationQuery]](Empty)

 class Cars {
   ...

 }

 .. personally I would avoid using open_! unless I'm really sure that
 the Box is not Empty.

 Br's,
 Marius

 On May 3, 7:08 pm, Bryan. germ...@gmail.com wrote:

  I believe I am doing #1 now with no luck.  Let me know if this is
  correct:

  class Cars {
    // ...
    object locationQuery extends RequestVar[Box[LocationQuery]](Empty)

    def search(xhtml: NodeSeq): NodeSeq = {
      def processSearch() = {
        // ...
        val lq = new LocationQuery(validPickupDate.open_!,
  validDropoffDate.open_!, city, city)
        S.redirectTo(/select, () = { locationQuery(Full(lq));
  requestReference(Full(requestRef)) })
      }

      // binds are here
    }

    def selectedLocation(xhtml: NodeSeq): NodeSeq = {
      if (locationQuery.isDefined) {
        val selectedCity = locationQuery.open_!.pickupLocation
        Text(selectedCity.name + ,  + selectedCity.region)
      } else {
        Text()
      }
    }

    // ...

  }

  Thanks,
  Bryan

  On May 3, 11:46 am, marius d. marius.dan...@gmail.com wrote:

   Oh.. 1  2 are unrelated ... just slightly different approaches.

   On May 3, 6:45 pm, marius d. marius.dan...@gmail.com wrote:

Well instead of open_1 use openOr so that you wont get exceptions when
the Box is Empty. Also if you want when you to the redirect you could
propagate those RequestsVars as well so that your browser re-send
them. Now sure if this is what you'd want but should help avoiding
Empty request vars. But what I'd do is:

1. Since you are doing redirect with state in the function passed to
S.redirectTo you can set relevant values to your RequestVar's .. hence
when your page is rendered your request vars have the old values
potentially.
2. Use a StatefulSnippet and call redirectTo from the StatefulSnippet
not S. Hence you can save state inside your snippet and when redirect
happens, the same snippet instance would be used.

Br's,
Marius

On May 3, 6:08 pm, Bryan germ...@gmail.com wrote:

 I have a snippet that calls S.redirectTo with state.  In this same
 snippet class I have a few functions to show the values of the
 processed RequestVar's.  This works fine until I refresh the page,
 because in these functions I call .open_! on some now Empty
 RequestVar's.  It is simple enough to show Text() when the box is
 not Full, but now I have a problem with the page not showing useful
 data.

 What are some suggestions for handling this?  Should I just add code
 to each of my many snippet functions to redirect to / when the
 RequestVar's are empty?

 Thanks,
 Bryan

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



[Lift] Re: scalar queries in Lift/JPA

2009-04-24 Thread Bryan.

I've never tried this on a scalar query, but a constructor expression
example should be something like this:

select new com.chas.values.AnswerCount(t.answer, count(distinct
answer)) from ...

class AnswerCount(answer: String, count: Long) {
  private def nullToOption[T](v: T) = v match { case null = None case
_ = Some(v) }

  def getAnswer = nullToOption(answer)
  def getCount = nullToOption(count)
}

object AnswerCount {
  def unapply(ac: AnswerCount): Option[(Option[String], Option[Long])]
= {
Some(ac.getAnswer, ac.getCount)
  }
}

Sources:  
http://edocs.bea.com/kodo/docs41/full/html/ejb3_langref.html#ejb3_langref_constructor

On Apr 23, 4:11 pm, Derek Chen-Becker dchenbec...@gmail.com wrote:
 Oliver, I've never done anything like that in JPA or Hibernate. Is that
 actually possible? Can you create a class instance within a query?

 Derek

 On Thu, Apr 23, 2009 at 2:47 PM, Charles F. Munat c...@munat.com wrote:



  I'm not really sure how I would go about this, but I'll think about it
  when I have time to get back to that code.

  Thanks, Oliver.

  Chas.

  Oliver Lambert wrote:
   Is there anything to stop you defining an class/entity {answer: String,
   countAnswer: Int} and to directly create it from JPA (of course, it's
   read only).

   On Wed, Apr 22, 2009 at 9:36 AM, Charles F. Munat c...@munat.com
   mailto:c...@munat.com wrote:

       I was thinking tuples, but that didn't work. I'll try your
  suggestion.
       BTW, for anyone reading along, I forgot the group by clause in the
  query
       below.

       Chas.

       Derek Chen-Becker wrote:
         I think that the type would be Array[Any] and you'll get one
       String and
         Int for each row.

         Derek

         On Tue, Apr 21, 2009 at 3:37 PM, Charles F. Munat c...@munat.com
       mailto:c...@munat.com
         mailto:c...@munat.com mailto:c...@munat.com wrote:

             Anyone have a quick example of how to run a scalar query in
       JPA? I can't
             find anything in the JPA demo.

             I have this query:

             select t.answer, count(distinct answer) from Vote t where
       t.poll = :poll
             order by t.answer

             but how do I call it? I normally do:

             Model.createNamedQuery[...](findVoteCountAnswersByPoll,
       poll -
             poll).findAll

             But what is the type? And how do I get the results back out?

             I know I did this once before somewhere, but I can't remember
       where and
             I can't find it.

             Thanks!

             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: Need for lightweight JPA archetype

2009-04-13 Thread Bryan.

Great!  I can't wait to check these out.

Thanks,
Bryan

On Apr 13, 6:32 pm, Timothy Perrett timo...@getintheloop.eu wrote:
 Awesome work Derek!

 On 13/04/2009 23:24, Derek Chen-Becker dchenbec...@gmail.com wrote:



  OK, I just checked in two more archetypes for JPA:

  lift-archetype-jpa-blank - same as the basic one, but with only the bare
  minimum set of files for a JPA project with separate Persistence and Web
  modules
  lift-archetype-jpa-blank-single - same as blank, but set up to all be in a
  single project instead of using modules.

  Derek

  On Sun, Apr 5, 2009 at 10:23 AM, Derek Chen-Becker dchenbec...@gmail.com
  wrote:
  Ah, I forgot to check in the BookOps.add.doAdd method whether or not the
  author was set. There should be a check there with an error that would
  prevent a book from not having an author. Even better, I should update the
  Book entity object to put a not-null constraint on the author property. 
  I'll
  get this fixed in the archetype and in the demo site.

  Derek

  On Sat, Apr 4, 2009 at 5:04 PM, bradford fingerm...@gmail.com wrote:

  I pasted it here:  http://pastebin.com/m1da32b3

  Thanks,
  Bradford

  On Apr 4, 5:25 pm, Derek Chen-Becker dchenbec...@gmail.com wrote:
   If you have a second, could you send the stack trace for the NPE? 
   That's
   definitely not something that should be happening.

   Derek

   On Sat, Apr 4, 2009 at 2:34 PM, bradford fingerm...@gmail.com wrote:

Yeah, just NetBeans.  It probably makes sense, but everything in
NetBeans was fine after I did mvn compile; mvn install.  Running the
app works too.  I did happen to get a NullPointerException when I
would add a book with no author.  And then again when I would click 
on
Book list.  Just an FYI.

Thanks a lot for the demo and your help.

Thanks,
Bradford

On Apr 4, 3:26 pm, Derek Chen-Becker dchenbec...@gmail.com wrote:
 Hmmm. Does maven complain if you try to compile, or is it just
  NetBeans?

 Derek

 On Sat, Apr 4, 2009 at 9:31 AM, bradford fingerm...@gmail.com
  wrote:

  Hi,

  I think I would like to use JPA for my project.  This 
  archetype
 would
  be nice.  Just a second ago I ran mvn archtype:generate on 
  lift-
  archetype-jpa-basic.  NetBeans is complaining on 'import
  javax.persistence._' not being found in jpatest-spa's
  Author.scala.
  It also complains on 'import org.scala_libs.jpa._' in
  jpatest-web's
  Model.scala.

  Thanks,
  Bradford

  On Apr 3, 4:45 am, Charles F. Munat c...@munat.com wrote:
   No, I meant there were a few candidates for a first commit,
 not that
   someone else should do it. I have my fingers in a bunch of
 things at
the
   moment...

   At the moment, however, I have to pay the bills. But I'll
 keep
tinkering.

   Chas.

   Timothy Perrett wrote:
Probally between yourself and Derek in all honesty - I
 simply dont
have the time right now and my lift time and what I do
 with it
has
other investments right now...

Derek might well be swamped with the book at the 
moment...
 so
perhaps
there are not so many candidates as you think :-)

Crack on is what I say - make a branch, knock yourself 
out
 and then
post to the list before merging to master

Cheers, Tim

On Apr 2, 7:17 pm, Charles F. Munat c...@munat.com
 wrote:
Yup. But there seem to be a few candidates...

Timothy Perrett wrote:
Are you eyeing up for your first commit Chas? ;-)
The src of the JPA archetype is here:

  http://github.com/dpp/liftweb/tree/4a5d4530b407782a2f0e0e99b277432dbb.
..
Cheers, Tim
On Apr 2, 6:02 pm, Charles F. Munat 
c...@munat.com
 wrote:
Where is the code for these archetypes and how
  tricky is it to
  create them?
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] JPA Run Modes

2009-04-13 Thread Bryan

Is it possible to use mvn -Drun.mode with JPA in lift?  For example,
mvn -Drun.mode=production would use persistence-prod.xml.  This will
allow me to keep my test data separate from my development data.

Thanks,
Bryan

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



[Lift] Conversation Context

2009-01-22 Thread Bryan

Does lift offer conversation contexts?  If so, could someone provide
me with an example.

I am not sure if conversation context is the proper term, but I am
using this term as it is used by JBoss Seam.  A partial description
would be an approach that allows state to be scoped to a unit of work
and automatically handles memory cleanup when a conversation is no
longer in use.  This would allow users to work in multiple tabs.
Keeping the back button working during this process would be a *huge*
plus.

Thanks,
Bryan

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



[Lift] Re: Conversation Context

2009-01-22 Thread Bryan

That type of Wizard would be nice, though I am not a big fan of XML.
Thank you for your willingness to come up with a solution, but I don't
have a specific need for it right now.  There is a project I may be
working on in the future that is similar to the hotel website featured
in that document I linked to.  I just wanted to see what is possible
to do with lift right now.

Regards,
Bryan

On Jan 22, 1:40 pm, David Pollak feeder.of.the.be...@gmail.com
wrote:
 Bryan,

 There's no much in Lift to support what you're looking to do.

 For 1.1, there will be something like SmartMode Wizard 
 (seehttps://www.lostlake.org/wizard.wmv)

 If you can tell us something about your application, requirements, use
 cases, whatever, we'll work to tailor a solution for you.

 Thanks,

 David



 On Thu, Jan 22, 2009 at 10:31 AM, Bryan germ...@gmail.com wrote:

  Hi Marius,

  I would like the conversations contained within each tab.  If I were
  to use just a Session variable then the user's state/data would
  collide and therefore cause unexpected behavior.

  This link does a better job of describing how conversations solve this
  problem:
 http://www.informit.com/content/images/9780131347960/samplechapter/01...
  .

  Thanks,
  Bryan

  On Jan 22, 12:29 pm, Marius marius.dan...@gmail.com wrote:
   The conversation context could be kept in a SessionVar. When your
   context terminates (say user clicked a button). You can attach a
   cleanUp function to the SessionVar (see registerCleanupFunc) so when
   your context terminates you can just call remove() on your SessionVar

   Would that help or I'm just misunderstanding your case?

   Br's,
   Marius

   On Jan 22, 6:24 pm, Bryan germ...@gmail.com wrote:

Does lift offer conversation contexts?  If so, could someone provide
me with an example.

I am not sure if conversation context is the proper term, but I am
using this term as it is used by JBoss Seam.  A partial description
would be an approach that allows state to be scoped to a unit of work
and automatically handles memory cleanup when a conversation is no
longer in use.  This would allow users to work in multiple tabs.
Keeping the back button working during this process would be a *huge*
plus.

Thanks,
Bryan

 --
 Lift, the simply functional web frameworkhttp://liftweb.net
 Collaborative Task Managementhttp://much4.us
 Follow me:http://twitter.com/dpp
 Git some:http://github.com/dpp

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



[Lift] Re: Image Submit Buttons fail to Submit (in IE)

2008-09-26 Thread Bryan

It would be nice to have some control over this.  I work on a site
where we forward users to the iPhone version of the site when they
access / and their user agent matches the iPhone (or iPod Touch) user
agent.  But, we also provide them with a link to view the full version
of the site.

This is just something to consider.  We handle the full version switch
through some additional paths we have setup, but I've seen cookie-
based implementations of this as well.

--Bryan

On Sep 26, 7:40 am, Marius [EMAIL PROTECTED] wrote:
 Very true Viktor.

 Some mobile terminals like some of Nokia S40 series have both service
 browsers and web browsers (for some awkward reason). Service browsers
 even if they are capable of WAP or internet connectivity their support
 of XHTML is very limited. There is an XHTML-MP standard out there.

 Br's,
 Marius

 On Sep 26, 2:24 pm, Viktor Klang [EMAIL PROTECTED] wrote:

  On Fri, Sep 26, 2008 at 12:15 PM, Charles F. Munat [EMAIL PROTECTED] 
  wrote:

   Ah, I forgot that you were talking server-side. Hmm. I'll have to think
   about this.

   For mobile browsers, are you talking ones that use WML? (Does anyone
   still use that?) For something like that, I think you could use the
   Accept HTTP header. User Agent is going to be very tricky.

  Perhaps you want to have a more light-weighted page for mobile consumers?

   But for something like this, shouldn't you send a default button
   (assuming JS is off), and then a JS script that does the object
   detection client-side and replaces the button with an image button? I'm
   not clear -- why do you want to do the detection server-side?

   Chas.

   Marius wrote:
Charles ... this is not only about JS level. One may simply click a
link or submit a simple form (with NO JS involved) and lift should
probably be aware of browser type it can correct some browser specific
idiosyncrasies in the resulting markup. Certain applications may need
for instance to detect if a mobile browser is used instead of a PC
browser.

I don't think there is some other option then user-agent. But user-
agent can be used today in lift but I agree that a higher abstraction
is needed.

P.S.
At JS level, yeah object detection sounds really good.

Br's,
Marius

On Sep 26, 12:25 pm, Charles F. Munat [EMAIL PROTECTED] wrote:
Browser detection is a really bad idea, and I would recommend avoiding
it at all costs. A much better solution is object detection.

Here's one pretty good description about why this is so:

   http://developer.apple.com/internet/webcontent/objectdetection.html

Here's another:

   http://www.quirksmode.org/js/support.html

And one more (for the unconvinced :-)

   http://www.evotech.net/blog/2007/07/browser-detection-versus-object-d.
   ..

Chas.

Tim Perrett wrote:
Am I being dumb here - could we not just run some checks on the user-
agent header and respond appropriately?
It would be very cool if SHtml was browser aware.
Cheers
Tim

  --
  Viktor Klang
  Senior Systems Analyst

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



[Lift] Comet and Flot

2008-09-20 Thread Bryan

I am interested in adding some (almost) real-time charts to a project
of mine.  I have a couple of questions, though.

1) Is there documentation on lift's server and client implementation
of comet available online?
2) Are there any reasons why dojo's comet client wasn't considered?
3) I see that there is a flot widget that will be integrated into lift
soon.  What benefits do these widgets offer over a normal JavaScript
implementation?
4) I have an immutable Map of data that I need to push to the JQuery
chart.  Where should I begin?  Do I send this in JSON format?

A lot of questions, I know!

p.s. I am loving lift so far.  Great work.  The CometActor tutorial
was very useful as well.

Thanks,
Bryan

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