Re: [Lift] Re: serving images from a directory

2010-02-27 Thread Jack Widman
Thanks Marius.

On Sat, Feb 27, 2010 at 4:07 AM, Marius marius.dan...@gmail.com wrote:

 If you want Lift to serve images you should put them in /resources/
 toserve folder and reference them as /classpath/{image file}

 If you want to put images say in /img folder at the same level with /
 WEB-INF for example, you just reference tham /img/{image file} ...
 these will not be served by Lift but by web container.

 There is no need for SiteMap when serving other resources.



 On Feb 27, 10:53 am, jack jack.wid...@gmail.com wrote:
  I would like to access an image on the client via a URL. How do I
  generate that URL. Currently, I'm getting the error
 
  The requested page was not defined in your SiteMap, so access was
  blocked.
 
  I understand what this error means for html pages. How does it work
  for images?
 
  Thanks.

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



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



Re: [Lift] Re: simple database question

2009-11-26 Thread Jack Widman
excellent. Thanks. Just what I needed.

On Thu, Nov 26, 2009 at 2:34 PM, harryh har...@gmail.com wrote:

 Here is what you need for a minimal Person table that contains two
 columns: an id for the primary key, and name which is a string:

 package com.jacksdomain.model

 import net.liftweb.mapper._

 class Person extends LongKeyedMapper[Person] with IdPK {
  def getSingleton = Person

  object name extends MappedString(this, 100)
 }

 object Person extends Person with LongKeyedMetaMapper[Person] {
  override def dbTableName = person
 }

 You can then do things like this:

 val person = Person.find(1)   // retrieve the person with id = 1 from
 the database
 val person = Person.find(By(Person.name, Jack)) // retrieve the
 person with name = Jack from the database
 val people = Person.findAll() // retrieve all people form the database
 val people = Person.findAll(By_(Person.id, 10)) // retrieve all the
 people with id  10

 etc.

 -harryh

 On Nov 26, 1:39 pm, jack jack.wid...@gmail.com wrote:
  wow. thats impressive. But for this, what does the Person class have
  to look like? Suppose I have the table but I don't have the Person
  class written. What does it need to look like?
 
  On Nov 26, 1:32 pm, harryh har...@gmail.com wrote:
 
   val people = Person.findAll()
 
   On Nov 26, 1:22 pm, jack jack.wid...@gmail.com wrote:
 
I have my database configured properly in Boot.scala and in my
pom.xml. Suppose I have a table name person with a field called name.
What is the simple code to return all rows of this table using
 Mapper.
I want to understand the essence of how lift ties tables to objects
with a simple example.

 --

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





-- 
Jack Widman

co-founder / cto,  Authoritude, Inc.

203-641-9355

--

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




Re: [Lift] InputStream to String

2009-11-21 Thread Jack Widman
I kind of like it. Says exactly what it does :)

On Sat, Nov 21, 2009 at 9:56 AM, David Pollak feeder.of.the.be...@gmail.com
 wrote:

 Helpers.readWholeThing(reader): String

 Yes... this method name is ripe for bettering.


 On Sat, Nov 21, 2009 at 6:47 AM, jack jack.wid...@gmail.com wrote:

 I have seen this problem around and it seems basic but I haven't found
 a solution. I need to turn an InputStream into a String. There seems
 to be a bug in the Source class that fails for large files so I don't
 want to use that (though it is an elegant approach).

 The following doesn't work because reader.readLine returns Unit and
 not null, as in Java.

  val reader = new BufferedReader(new InputStreamReader(is))
  var responseBody = 

  var line = reader.readLine()

  while(line != null){
responseBody  += line
line = reader.readLine()
  }

 return responseBody

 What to do?

 --

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





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

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




-- 
Jack Widman

co-founder / cto,  Authoritude, Inc.

203-641-9355

--

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




Re: [Lift] Re: InputStream to String

2009-11-21 Thread Jack Widman
How about

pleaseGoOutAndConvertThisInputStreamToAStringAndReturnIt

And then after returns the String you can call a function called

thankYou

On Sat, Nov 21, 2009 at 10:40 AM, Timothy Perrett
timo...@getintheloop.euwrote:

 HAHAHA. That is an awesome method name if ever i did see one. Little
 confused why readWholeInputStream was somehow not the obvious
 choice ;-)

 Cheers, Tim

 On Nov 21, 4:37 pm, Jack Widman jack.wid...@gmail.com wrote:
  I kind of like it. Says exactly what it does :)
 
  On Sat, Nov 21, 2009 at 9:56 AM, David Pollak 
 feeder.of.the.be...@gmail.com
 
 
 
 
 
   wrote:
   Helpers.readWholeThing(reader): String
 
   Yes... this method name is ripe for bettering.
 
   On Sat, Nov 21, 2009 at 6:47 AM, jack jack.wid...@gmail.com wrote:
 
   I have seen this problem around and it seems basic but I haven't found
   a solution. I need to turn an InputStream into a String. There seems
   to be a bug in the Source class that fails for large files so I don't
   want to use that (though it is an elegant approach).
 
   The following doesn't work because reader.readLine returns Unit and
   not null, as in Java.
 
val reader = new BufferedReader(new InputStreamReader(is))
var responseBody = 
 
var line = reader.readLine()
 
while(line != null){
  responseBody  += line
  line = reader.readLine()
}
 
   return responseBody
 
   What to do?
 
   --
 
   You received this message because you are subscribed to the Google
 Groups
   Lift group.
   To post to this group, send email to lift...@googlegroups.com.
   To unsubscribe from this group, send email to
   liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com
 liftweb%2bunsubscr...@googlegroups.comliftweb%252bunsubscr...@googlegroups.com
   .
   For more options, visit this group at
  http://groups.google.com/group/liftweb?hl=.
 
   --
   Lift, the simply functional web frameworkhttp://liftweb.net
   Beginning Scalahttp://www.apress.com/book/view/1430219890
   Follow me:http://twitter.com/dpp
   Surf the harmonics
 
   --
   You received this message because you are subscribed to the Google
 Groups
   Lift group.
   To post to this group, send email to lift...@googlegroups.com.
   To unsubscribe from this group, send email to
   liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com
 liftweb%2bunsubscr...@googlegroups.comliftweb%252bunsubscr...@googlegroups.com
   .
   For more options, visit this group at
  http://groups.google.com/group/liftweb?hl=.
 
  --
  Jack Widman
 
  co-founder / cto,  Authoritude, Inc.
 
  203-641-9355

 --

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





-- 
Jack Widman

co-founder / cto,  Authoritude, Inc.

203-641-9355

--

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




Re: [Lift] Re: Menu generated from database?

2009-11-19 Thread Jack Widman
This is one of thing that is so amazing about the lift community David. You
apologize for not getting to something today. [?]

On Thu, Nov 19, 2009 at 12:56 PM, David Pollak 
feeder.of.the.be...@gmail.com wrote:

 Philip  list,

 I've had it on my to-do list to write up an example... and haven't...
 but...

 In your Loc, you can override def supplimentalKidMenuItems and dynamically
 generate kid menu items.

 I'll try to get to an example but not today... sorry :-(

 Thanks,

 David


 On Thu, Nov 19, 2009 at 12:35 AM, philip philip14...@gmail.com wrote:


 Hi David,

 Since I am programming a CMS for my client, I need my lift menu to
 come from the database.

 LiftRules.setSiteMap(SiteMap(MenuInfo.menu :_*))

  def menu: List[Menu] =
  {
Log.info(Menu called)
 ...

 It seems my menu function only gets called once, on subsquent calls I
 do not get any log message.

 Maybe I have to subclass SiteMap?

 Can you point me in the right direction?

 Thanks, Philip



 On 10月21日, 下午11時20分, David Pollak feeder.of.the.be...@gmail.com
 wrote:
  I owe the list example code to do this... maybe tomorrow.
 
  On Wed, Oct 21, 2009 at 6:26 AM, philip philip14...@gmail.com wrote:
 
   Hi,
 
   How can I get a Liftweb menu to be generated from database content?
 
   Alternatively, can the menu come from a XML datasource? could I load/
   serialize from that?
   Could it change dynamically at any time?
 
   Thanks, Philip
 
  --
  Lift, the simply functional web frameworkhttp://liftweb.net
  Beginning Scalahttp://www.apress.com/book/view/1430219890
  Follow me:http://twitter.com/dpp
  Surf the harmonics

 --

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





 --
 Lift, the simply functional web framework http://liftweb.net
 Beginning Scala http://www.apress.com/book/view/1430219890

 Follow me: http://twitter.com/dpp
 Surf the harmonics

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




-- 
Jack Widman

co-founder / cto,  Authoritude, Inc.

203-641-9355

--

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


330.gif

Re: [Lift] Re: Call it Lift 2.0

2009-11-17 Thread Jack Widman
 good feedback
 from you), the Scala 2.8 port, and the flood of newbies on the list.  So,
 yeah, I don't spend 2+ hours a day debating... I make shorter fuse
 decisions.

 But, the it's DPP's ball and he'll do with it what he wants kind of
 feedback bugs me at a very, very core level.


  -
  Jonathan Fergusonj...@spiralarm.com wrote:
 
  I was thinking about this earlier, if there is to be a 2.0 I would hope
  there was a chance to remove deprecated code.
 

 Which particular deprecated code are you thinking.


  Also consider making breaking
  changes @dpp hasn't been in favour of making to date.
 

 Which changes are you thinking about?


  Not to annoy him. As
  1.X to 2.X is a big enough change that people who don't want to move can
  stay with a stable 1.X and those of us who are running HEAD/TRUNK
 whatever
  these new fangled git kids call it nowadays can keep racing along.
 

 I'm not sure we have the resources to support a 1.X and a 2.X and a 2.7.x
 and a 2.8.x branch.  If there are any folks who want to step up and
 maintain
 a branch (or if there's money to hire someone), it's something worth a
 discussion, but I don't think there's anyone I know of who could maintain a
 1.X branch if we're going to get radical with a 2.X.  I think it's one
 branch.


 
  Jono.
 
  2009/11/17 Heiko Seeberger heiko.seeber...@googlemail.com
 
   2009/11/17 David Pollak feeder.of.the.be...@gmail.com
  
   The current Lift is not a major change to Lift 1.0, it's a minor
   progression and a lot of tuning of the developer experience.
  
  
   There are breaking changes to the API which in the version policy
  suggested
   by me (the OSGi way) means increasing the major version number. OK, of
   course we need not stick to this particular version policy, but it
 would
  be
   beneficial to have one. What about: Increasing the minor version number
   (e.g. 1.0 - 1.1) means breaking changes to the API. Increasing the
 micro
   version number (e.g. 1.1.0 - 1.1.1) means *no* breaking changes to the
  API.
  
   Heiko
  
  
   My job: weiglewilczek.com
   My blog: heikoseeberger.name
   Follow me: twitter.com/hseeberger
   OSGi on Scala: scalamodules.org
   Lift, the simply functional web framework: liftweb.net
  
   --
   You received this message because you are subscribed to the Google
 Groups
   Lift group.
   To post to this group, send email to lift...@googlegroups.com.
   To unsubscribe from this group, send email to
   liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com
 liftweb%2bunsubscr...@googlegroups.comliftweb%252bunsubscr...@googlegroups.com
 
  liftweb%2bunsubscr...@googlegroups.comliftweb%252bunsubscr...@googlegroups.com
 liftweb%252bunsubscr...@googlegroups.comliftweb%25252bunsubscr...@googlegroups.com
 
  
   .
   For more options, visit this group at
   http://groups.google.com/group/liftweb?hl=.
  
 
  --
 
  You received this message because you are subscribed to the Google Groups
  Lift group.
  To post to this group, send email to lift...@googlegroups.com.
  To unsubscribe from this group, send email to
  liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com
 liftweb%2bunsubscr...@googlegroups.comliftweb%252bunsubscr...@googlegroups.com
 
  .
  For more options, visit this group at
  http://groups.google.com/group/liftweb?hl=.
 
 
  --
 
  You received this message because you are subscribed to the Google Groups
  Lift group.
  To post to this group, send email to lift...@googlegroups.com.
  To unsubscribe from this group, send email to
  liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com
 liftweb%2bunsubscr...@googlegroups.comliftweb%252bunsubscr...@googlegroups.com
 
  .
  For more options, visit this group at
  http://groups.google.com/group/liftweb?hl=.
 
 
 


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

 --

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


 --

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





-- 
Jack Widman

co-founder / cto,  Authoritude, Inc.

203-641-9355

--

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

Re: [Lift] Re: How do I properly read a value from a cookie?

2009-11-16 Thread Jack Widman
A refuting piece of evidence from the guy who created nulls. How cool is
that?!  :)

On Tue, Nov 17, 2009 at 1:20 AM, David Pollak feeder.of.the.be...@gmail.com
 wrote:



 On Mon, Nov 16, 2009 at 9:01 PM, DMB combust...@gmail.com wrote:

  that it's not null--which is a source of many bugs

 After a bold statement like this, one can't help but wonder how
 programmers manage to ship software in all the other languages. :-)
 Come to think of it, after working on a couple of pretty large ASP.NET
 projects (~50 devs), I haven't once seen a bug which was caused by the
 semantics of retrieving the cookie or URL parameter values. I'm not
 saying the Box thing doesn't have its uses, I'm just saying that in
 this particular case it's a pain in the ass and overkill.


 Before judging, spend a month or two writing idomatic Scala code rather
 than fighting with it.

 In your example, I reduced the lines of code, made your code more logical
 and reduced the McCabe complexity (see
 http://en.wikipedia.org/wiki/Cyclomatic_complexity).  The higher the
 McCabe complexity, the more defects there are in software.

 So, even in a trivial 20 line program, using the Scala idioms shortens code
 and generally makes code easier to read and easier to maintain.

 And we're not the only ones who think null is a problem... the guy that
 invented null thinks it's a huge problem:
 http://qconlondon.com/london-2009/presentation/Null+References:+The+Billion+Dollar+Mistake




 On Nov 16, 2:40 pm, Naftoli Gugenheim naftoli...@gmail.com wrote:
  As others may have said, the difference between a Box and a value that
 may be null is that both may or may not contain what you want it to have;
 but in one case the compiler lets you assume that it does--that it's not
 null--which is a source of many bugs.
  Programming presents a tension between type safety and conciseness, and
 Scala does an amazing job of being extremely type safe and extremely
 concise. But type safety comes first.
 
  -
 
  DMBcombust...@gmail.com wrote:
 
  I guess that could work, but why go to such lengths where there are
  much more straightforward solutions available? What do for
  comprehensions buy you in this case? I mean, 99% of the time, when I
  want to check for a cookie, I don't need the cookie itself or any of
  its properties. I need its value, or null if there's no cookie. Why
  not do something a-la RoR:
 
  S.cookieValue(cookieName)
 
  or a-la ASP.NET:
 
  val c = S.cookie(cookieName)
  if(c != null) {
 val v = c.value
 
  }
 
  Or, indeed, both?
 
  On Nov 16, 1:22 am, Sergey Andreev andser...@gmail.com wrote:
 
   Hi,
 
   For-comprehensions could help you out:
 
   for{
 cookie - S.findCookie(cookieName)
 value - cookie} doSomethingWithValue
 
   Regards
 
   On Mon, Nov 16, 2009 at 12:07 PM, DMB combust...@gmail.com wrote:
 
When I call findCookie it returns a Box. Then, the value on the
 cookie
itself is also a box. Hence a ruby one-liner turns into something
like:
 
val cookie = S.findCookie(cookieName)
if(cookie.isDefined) {
val cookieVal = cookie.open_!.value.openOr(null)
// Do something with the cookie value
}
 
This is very ugly, so I'm guessing I'm doing something wrong, but
 try
as I might, I could not find any examples that would look even
 vaguely
right to me.
 
Why can't findCookie return a simple, unboxed HTTPCookie object or
null if cookie is not found?
Why does the value inside a cookie need to also be Box'ed?
 
For the sake of comparison, here's how you do the same thing in RoR:
v = cookies[cookieName]
// Do something with the cookie
 
or ASP.NET:
var c = Request.Cookies[CookieName]
if(c != null) {
  var v = c.Value
  // Do something with the cookie
}
 
I fail to see why Lift should be more complicated.
 
This is with Lift 1.1 M7

 --

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





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

 --
 You received this message because you are subscribed to the Google Groups
 Lift group.

 To post to this group, send email to lift...@googlegroups.com.
 To unsubscribe from this group, send email to
 liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/liftweb?hl=.




-- 
Jack Widman

co-founder / cto,  Authoritude, Inc.

203-641-9355

--

You received this message because you are subscribed to the Google Groups

[Lift] Re: CometListener

2009-11-13 Thread Jack Widman
sure. Thanks Ross. I will send it tonight. Also what is the difference
between the CometListener and the CometListenee?

On Fri, Nov 13, 2009 at 11:14 AM, Ross Mellgren dri...@gmail.com wrote:

 Could you send over your pom.xml if you're using Maven? It sounds like
 maybe your build path is not correct.

 -Ross


 On Nov 13, 2009, at 12:09 AM, Jack Widman wrote:

 David,

 I'm using lift 1.1 and scala 2.5 now and the compiler says it cant find
 CometListener when I import net.liftweb.http._

 Jack

 On Fri, Nov 13, 2009 at 12:01 AM, David Pollak 
 feeder.of.the.be...@gmail.com wrote:



 On Thu, Nov 12, 2009 at 8:54 PM, Jack Widman jack.wid...@gmail.comwrote:

 C:\work\widman\src\main\scala\com\widman\comet\PackComet.scala:20: error:
 type CometListener is not a member of package net.liftweb.http

 I got this compile error.

 I must be missing something obvious.


 It's part of Lift 1.1, not Lift 1.0




  On Thu, Nov 12, 2009 at 11:42 PM, Ross Mellgren dri...@gmail.comwrote:


 It is in net.liftweb.http.


 http://www.scala-tools.org/mvnsites-snapshots/liftweb/lift-webkit/scaladocs/net/liftweb/http/CometListener.html


 By the way, the link you gave only indicates it's in either
 net.liftweb.http, net.liftweb.util, net.liftweb or model (or a couple
 other packages, since scala implicitly imports superpackages).

 -Ross

 On Nov 12, 2009, at 11:38 PM, jack wrote:

 
  I also tried net.liftweb.http
 
  On Nov 12, 11:35 pm, jack jack.wid...@gmail.com wrote:
  I am trying to use CometListener. According tohttp://bit.ly/1Wnxt4,
  it is in the package net.liftweb._ but compiler says it can't be
  found. Is this the wrong package?
  






 --
 Jack Widman

 co-founder / cto,  Authoritude, Inc.

 203-641-9355






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





 --
 Jack Widman

 co-founder / cto,  Authoritude, Inc.

 203-641-9355




 



-- 
Jack Widman

co-founder / cto,  Authoritude, Inc.

203-641-9355

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

2009-11-13 Thread Jack Widman
Here is my pom.xml

On Fri, Nov 13, 2009 at 12:09 PM, Jack Widman jack.wid...@gmail.com wrote:

 sure. Thanks Ross. I will send it tonight. Also what is the difference
 between the CometListener and the CometListenee?


 On Fri, Nov 13, 2009 at 11:14 AM, Ross Mellgren dri...@gmail.com wrote:

 Could you send over your pom.xml if you're using Maven? It sounds like
 maybe your build path is not correct.

 -Ross


 On Nov 13, 2009, at 12:09 AM, Jack Widman wrote:

 David,

 I'm using lift 1.1 and scala 2.5 now and the compiler says it cant find
 CometListener when I import net.liftweb.http._

 Jack

 On Fri, Nov 13, 2009 at 12:01 AM, David Pollak 
 feeder.of.the.be...@gmail.com wrote:



 On Thu, Nov 12, 2009 at 8:54 PM, Jack Widman jack.wid...@gmail.comwrote:

 C:\work\widman\src\main\scala\com\widman\comet\PackComet.scala:20:
 error: type CometListener is not a member of package net.liftweb.http

 I got this compile error.

 I must be missing something obvious.


 It's part of Lift 1.1, not Lift 1.0




  On Thu, Nov 12, 2009 at 11:42 PM, Ross Mellgren dri...@gmail.comwrote:


 It is in net.liftweb.http.


 http://www.scala-tools.org/mvnsites-snapshots/liftweb/lift-webkit/scaladocs/net/liftweb/http/CometListener.html


 By the way, the link you gave only indicates it's in either
 net.liftweb.http, net.liftweb.util, net.liftweb or model (or a couple
 other packages, since scala implicitly imports superpackages).

 -Ross

 On Nov 12, 2009, at 11:38 PM, jack wrote:

 
  I also tried net.liftweb.http
 
  On Nov 12, 11:35 pm, jack jack.wid...@gmail.com wrote:
  I am trying to use CometListener. According tohttp://bit.ly/1Wnxt4,
  it is in the package net.liftweb._ but compiler says it can't be
  found. Is this the wrong package?
  






 --
 Jack Widman

 co-founder / cto,  Authoritude, Inc.

 203-641-9355






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





 --
 Jack Widman

 co-founder / cto,  Authoritude, Inc.

 203-641-9355




 



 --
 Jack Widman

 co-founder / cto,  Authoritude, Inc.

 203-641-9355




-- 
Jack Widman

co-founder / cto,  Authoritude, Inc.

203-641-9355

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


project xmlns=http://maven.apache.org/POM/4.0.0; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation=http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd;
  modelVersion4.0.0/modelVersion
  groupIdcom.widman/groupId
  artifactIdwidman/artifactId
  version1.1-M6/version
  packagingwar/packaging
  namewidman/name
  inceptionYear2007/inceptionYear
  properties
scala.version2.7.5/scala.version
  /properties

  repositories
repository
  idscala-tools.org/id
  nameScala-Tools Maven2 Repository/name
  urlhttp://scala-tools.org/repo-releases/url
/repository
  /repositories

  pluginRepositories
pluginRepository
  idscala-tools.org/id
  nameScala-Tools Maven2 Repository/name
  urlhttp://scala-tools.org/repo-releases/url
/pluginRepository
  /pluginRepositories

  dependencies
dependency
   groupIdnet.liftweb/groupId
   artifactIdlift-textile/artifactId
   version1.1-M6/version
/dependency
dependency
  groupIdorg.scala-lang/groupId
  artifactIdscala-library/artifactId
  version${scala.version}/version
/dependency
dependency
  groupIdnet.liftweb/groupId
  artifactIdlift-util/artifactId
  version1.0/version
/dependency
dependency
  groupIdnet.liftweb/groupId
  artifactIdlift-webkit/artifactId
  version1.0/version
/dependency
dependency
  groupIdnet.liftweb/groupId
  artifactIdlift-mapper/artifactId
  version1.0/version
/dependency
dependency
  groupIdjavax.servlet/groupId
  artifactIdservlet-api/artifactId
  version2.5/version
  scopeprovided/scope
/dependency
dependency
  groupIdjunit/groupId
  artifactIdjunit/artifactId
  version4.5/version
  scopetest/scope
/dependency
dependency
  groupIdorg.mortbay.jetty/groupId
  artifactIdjetty/artifactId
  version[6.1.6,)/version
  scopetest/scope
/dependency
!-- for LiftConsole --
dependency
  groupIdorg.scala-lang/groupId
  artifactIdscala-compiler/artifactId
  version${scala.version}/version
  scopetest/scope
/dependency
   !-- dependency
  groupIdorg.apache.httpcomponents/groupId
  artifactIdhttpcore/artifactId
  version4.0.1/version
  scopecompile

[Lift] Re: CometListener

2009-11-13 Thread Jack Widman
Thanks Ross.

On Fri, Nov 13, 2009 at 11:55 PM, Ross Mellgren dri...@gmail.com wrote:

 Your pom specifies lift 1.0, not 1.1 for the majority of lift modules. You
 are using 1.1-M6 for lift-textile. In addition, you don't have the snapshots
 repository configured.

 To fix this, first add the snapshot repository to repositories:

 repository
   idscala-tools.org.snapshots/id
   nameScala-Tools Maven2 Repository for Snapshots/name
   urlhttp://scala-tools.org/repo-snapshots/url
   snapshots/
 /repository

 Then switch *all* your lift-* dependencies to 1.1-SNAPSHOT and your scala
 version to 2.7.7. I use a property for the lift version to use, myself, like
 this:

 properties
 scala.version2.7.7/scala.version
 lift.version1.1-SNAPSHOT/lift.version
 /properties

 ...

 dependency
 groupIdnet.liftweb/gropuId
 artifactIdlift-util/artifactId
 version${lift.version}/version}
 /dependency

 (and so on, for each lift-* dependency)

 I'm not sure what would happen exactly if you have mixed versions of the
 lift modules, but It Can't Be Good.

 Hope that helps,
 -Ross

 On Nov 13, 2009, at 10:17 PM, Jack Widman wrote:

 Here is my pom.xml

 On Fri, Nov 13, 2009 at 12:09 PM, Jack Widman jack.wid...@gmail.comwrote:

 sure. Thanks Ross. I will send it tonight. Also what is the difference
 between the CometListener and the CometListenee?


 On Fri, Nov 13, 2009 at 11:14 AM, Ross Mellgren dri...@gmail.com wrote:

 Could you send over your pom.xml if you're using Maven? It sounds like
 maybe your build path is not correct.

 -Ross


 On Nov 13, 2009, at 12:09 AM, Jack Widman wrote:

 David,

 I'm using lift 1.1 and scala 2.5 now and the compiler says it cant find
 CometListener when I import net.liftweb.http._

 Jack

 On Fri, Nov 13, 2009 at 12:01 AM, David Pollak 
 feeder.of.the.be...@gmail.com wrote:



 On Thu, Nov 12, 2009 at 8:54 PM, Jack Widman jack.wid...@gmail.comwrote:

 C:\work\widman\src\main\scala\com\widman\comet\PackComet.scala:20:
 error: type CometListener is not a member of package net.liftweb.http

 I got this compile error.

 I must be missing something obvious.


 It's part of Lift 1.1, not Lift 1.0




  On Thu, Nov 12, 2009 at 11:42 PM, Ross Mellgren dri...@gmail.comwrote:


 It is in net.liftweb.http.


 http://www.scala-tools.org/mvnsites-snapshots/liftweb/lift-webkit/scaladocs/net/liftweb/http/CometListener.html


 By the way, the link you gave only indicates it's in either
 net.liftweb.http, net.liftweb.util, net.liftweb or model (or a couple
 other packages, since scala implicitly imports superpackages).

 -Ross

 On Nov 12, 2009, at 11:38 PM, jack wrote:

 
  I also tried net.liftweb.http
 
  On Nov 12, 11:35 pm, jack jack.wid...@gmail.com wrote:
  I am trying to use CometListener. According tohttp://bit.ly/1Wnxt4
 ,
  it is in the package net.liftweb._ but compiler says it can't be
  found. Is this the wrong package?
  






 --
 Jack Widman

 co-founder / cto,  Authoritude, Inc.

 203-641-9355






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





 --
 Jack Widman

 co-founder / cto,  Authoritude, Inc.

 203-641-9355








 --
 Jack Widman

 co-founder / cto,  Authoritude, Inc.

 203-641-9355




 --
 Jack Widman

 co-founder / cto,  Authoritude, Inc.

 203-641-9355


 pom.xml



 



-- 
Jack Widman

co-founder / cto,  Authoritude, Inc.

203-641-9355

--~--~-~--~~~---~--~~
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: CometActor and render

2009-11-12 Thread Jack Widman
I did and its actually in the code I attached. In one place I use Dispatch
and in another place I use httpclient directly. I intend to use Dispatch for
everything.

On Thu, Nov 12, 2009 at 4:05 PM, Randinn rand...@gmail.com wrote:


 I'm not trying to change the subject but I was wondering if you looked
 at Databinder Dispatch http://databinder.net/dispatch/About for your
 url calls?

 On Nov 12, 3:26 pm, Jack Widman jack.wid...@gmail.com wrote:
  David,
 
  I have attached my code. It runs but does not behave as I intended it to.
  The code does a web search on the term scala and displays a list of
 URLs
  of the results. Next to each URL it says Page Length : -1. A process is
  running in the background which takes each URL, goes out and gets the
 page
  and takes the length of the page. The length of that page is then
 supposed
  to immediately appear on the page next to that URL. I put the lengths on
 a
  queue, as they come in, and I have the Comet page poll the queue and
 display
  the results. It would probably be better to have the results send a
 message
  to the Comet class so the page is only re-rendered when there is a change
  but for now I am polling.
 
  I can see the lengths coming in and being put on the queue, but the Comet
  page is not getting them till they are all retrieved. (This takes way too
  long and nothing changes on the screen till its too late). I need them to
  appear as they come in. Occasionally I can see a length being retrieved
 and
  the Comet page finds it but even then it is not displayed until all the
  lengths are in.   I know this is not very clear but I think it will be
 clear
  from the code.
 
  I also know there are a lot of places in the code which can be improved
 and
  I welcome all of your input but what I would love is to have these
 numbers
  appear on the page as they they are retrieved. I have been stumped by
 this
  for a while and I suspect that somebody who knows Lift well might see the
  problem right away.
 
  The class that retrieves the page lengths is called Calculator and the
 queue
  is called SourceQueue. The classes are pretty small so hopefully it will
 be
  clear what is going on. I want you to know I think it is incredible how
  responsive you and the group are and I look forward to using Lift in the
  future.
 
  Thanks so much.
 
  Jack
 
  On Tue, Nov 10, 2009 at 1:27 AM, David Pollak 
 feeder.of.the.be...@gmail.com
 
   wrote:
 
   On Mon, Nov 9, 2009 at 10:10 PM, Jack Widman jack.wid...@gmail.com
 wrote:
 
   The only difference between your working code and mine is that mine
 has a
   process in the background that is always running and puts Foo objects
 on a
   queue whenever they are ready. Where can I start this long running
 process
   so that it doesn't interfere with the lowPriority method that takes
 things
   off the queue and rerenders the page. I tried starting the process in
 its
   own Actor that I start in localSetup but it seems somehow to be
 blocking the
   lowPriority method from doing its thing.
 
   I have no idea what this means... sorry.
 
   Please post actual runnable code and we can help you debug.
 
   On Sun, Nov 8, 2009 at 11:35 PM, David Pollak 
   feeder.of.the.be...@gmail.com wrote:
 
   Jack,
 
   I reproduced your code and it seems to work fine.  I've enclosed a
   working copy.
 
   Some comments about your code:
 
  - The foos variable and the foo variable may be getting confused
 in
  the code... the render method may be rendering the same thing
 based on the
  unchanging foos variable.
  - Doing null testing is a sign that you have logic errors in your
  code.  I strongly recommend using either Box or Option for
 everything that
  can logically not contain a value/reference.  If you're bridging
 out to Java
  code and are expecting null from the Java code, write a small
 bridge that
  will wrapper the Java return values in Box/Option.
  - You have a case class (Tick) that contains no parameters.
  Please
  use a case object instead.
  - Your Tick look is a spin loop.  You fire a Tick message as part
 of
  processing the Tick message.  I would suggest that if you're
 polling, that
  you have a reasonable poll interval, otherwise you'll starve your
 CPU.
  Further, having reRender on each loop through means that you're
 forcing a
  lot of bytes over the wire rather than only doing a reRender on
 changed
  values.
 
   Thanks,
 
   David
 
   On Sun, Nov 8, 2009 at 3:47 PM, Jack Widman jack.wid...@gmail.com
 wrote:
 
   Sorry. Here it is:   As I said, I know that when render is called,
   foo.getValue has the right value. But it does not show on the
 screen, unless
   I refresh the browser.
 
   package com.foo.comet
 
   import net.liftweb._
   import http._
   import js._
   import JsCmds._
   import net.liftweb.util._
   import net.liftweb.http._
   import _root_.scala.xml._
   import scala.actors._
   import com.authoritude.snippet

[Lift] Re: CometActor and render

2009-11-12 Thread Jack Widman
Will do. One more small question How do I send a message to the Comet Actor
from another class? Can the CometActor be an object instead of a class? In
the code

X ! messageToCometActor,   what is X? I don't have a variable that holds the
instance of the CometActor.

On Thu, Nov 12, 2009 at 5:12 PM, David Pollak feeder.of.the.be...@gmail.com
 wrote:

 Jack,

 The issues you're seeing are not Lift related.  You are not using Actors
 correctly.  Please see Philipp Haller's preso on Actors:
 http://lamp.epfl.ch/~phaller/doc/ScalaActors.pdfhttp://lamp.epfl.ch/%7Ephaller/doc/ScalaActors.pdf

 Please also look at the Actor chapters in Beginning Scala or Programming in
 Scala.

 Thanks,

 David


 On Wed, Nov 11, 2009 at 8:26 PM, Jack Widman jack.wid...@gmail.comwrote:

 David,

 I have attached my code. It runs but does not behave as I intended it to.
 The code does a web search on the term scala and displays a list of URLs
 of the results. Next to each URL it says Page Length : -1. A process is
 running in the background which takes each URL, goes out and gets the page
 and takes the length of the page. The length of that page is then supposed
 to immediately appear on the page next to that URL. I put the lengths on a
 queue, as they come in, and I have the Comet page poll the queue and display
 the results. It would probably be better to have the results send a message
 to the Comet class so the page is only re-rendered when there is a change
 but for now I am polling.

 I can see the lengths coming in and being put on the queue, but the Comet
 page is not getting them till they are all retrieved. (This takes way too
 long and nothing changes on the screen till its too late). I need them to
 appear as they come in. Occasionally I can see a length being retrieved and
 the Comet page finds it but even then it is not displayed until all the
 lengths are in.   I know this is not very clear but I think it will be clear
 from the code.

 I also know there are a lot of places in the code which can be improved
 and I welcome all of your input but what I would love is to have these
 numbers appear on the page as they they are retrieved. I have been stumped
 by this for a while and I suspect that somebody who knows Lift well might
 see the problem right away.

 The class that retrieves the page lengths is called Calculator and the
 queue is called SourceQueue. The classes are pretty small so hopefully it
 will be clear what is going on. I want you to know I think it is incredible
 how responsive you and the group are and I look forward to using Lift in the
 future.

 Thanks so much.

 Jack


 On Tue, Nov 10, 2009 at 1:27 AM, David Pollak 
 feeder.of.the.be...@gmail.com wrote:



 On Mon, Nov 9, 2009 at 10:10 PM, Jack Widman jack.wid...@gmail.comwrote:

 The only difference between your working code and mine is that mine has
 a process in the background that is always running and puts Foo objects on 
 a
 queue whenever they are ready. Where can I start this long running process
 so that it doesn't interfere with the lowPriority method that takes things
 off the queue and rerenders the page. I tried starting the process in its
 own Actor that I start in localSetup but it seems somehow to be blocking 
 the
 lowPriority method from doing its thing.


 I have no idea what this means... sorry.

 Please post actual runnable code and we can help you debug.



 On Sun, Nov 8, 2009 at 11:35 PM, David Pollak 
 feeder.of.the.be...@gmail.com wrote:

 Jack,

 I reproduced your code and it seems to work fine.  I've enclosed a
 working copy.

 Some comments about your code:

- The foos variable and the foo variable may be getting confused in
the code... the render method may be rendering the same thing based on 
 the
unchanging foos variable.
- Doing null testing is a sign that you have logic errors in your
code.  I strongly recommend using either Box or Option for everything 
 that
can logically not contain a value/reference.  If you're bridging out 
 to Java
code and are expecting null from the Java code, write a small bridge 
 that
will wrapper the Java return values in Box/Option.
- You have a case class (Tick) that contains no parameters.  Please
use a case object instead.
- Your Tick look is a spin loop.  You fire a Tick message as part
of processing the Tick message.  I would suggest that if you're 
 polling,
that you have a reasonable poll interval, otherwise you'll starve your 
 CPU.
Further, having reRender on each loop through means that you're 
 forcing a
lot of bytes over the wire rather than only doing a reRender on changed
values.

 Thanks,

 David

 On Sun, Nov 8, 2009 at 3:47 PM, Jack Widman jack.wid...@gmail.comwrote:

 Sorry. Here it is:   As I said, I know that when render is called,
 foo.getValue has the right value. But it does not show on the screen, 
 unless
 I refresh the browser.

 package com.foo.comet

 import net.liftweb._
 import http

[Lift] Re: CometActor and render

2009-11-12 Thread Jack Widman
Thanks.

On Thu, Nov 12, 2009 at 5:32 PM, David Pollak feeder.of.the.be...@gmail.com
 wrote:



 On Thu, Nov 12, 2009 at 2:16 PM, Jack Widman jack.wid...@gmail.comwrote:

 Will do. One more small question How do I send a message to the Comet
 Actor from another class? Can the CometActor be an object instead of a
 class? In the code


 Lift instantiates a new CometActor each time it needs one.  If you have a
 singleton CometActor, you'd be sharing state across all sessions and that
 would be impossible to manage.



 X ! messageToCometActor,   what is X? I don't have a variable that holds
 the instance of the CometActor.


 If the CometActor is a listener to another service, you can register the
 instance of the CometActor as a listener during localSetup and unregister
 during localShutdown.

 See that Chat example in lift-examples/example




 On Thu, Nov 12, 2009 at 5:12 PM, David Pollak 
 feeder.of.the.be...@gmail.com wrote:

 Jack,

 The issues you're seeing are not Lift related.  You are not using Actors
 correctly.  Please see Philipp Haller's preso on Actors:
 http://lamp.epfl.ch/~phaller/doc/ScalaActors.pdfhttp://lamp.epfl.ch/%7Ephaller/doc/ScalaActors.pdf

 Please also look at the Actor chapters in Beginning Scala or Programming
 in Scala.

 Thanks,

 David


 On Wed, Nov 11, 2009 at 8:26 PM, Jack Widman jack.wid...@gmail.comwrote:

 David,

 I have attached my code. It runs but does not behave as I intended it
 to. The code does a web search on the term scala and displays a list of
 URLs of the results. Next to each URL it says Page Length : -1. A process
 is running in the background which takes each URL, goes out and gets the
 page and takes the length of the page. The length of that page is then
 supposed to immediately appear on the page next to that URL. I put the
 lengths on a queue, as they come in, and I have the Comet page poll the
 queue and display the results. It would probably be better to have the
 results send a message to the Comet class so the page is only re-rendered
 when there is a change but for now I am polling.

 I can see the lengths coming in and being put on the queue, but the
 Comet page is not getting them till they are all retrieved. (This takes way
 too long and nothing changes on the screen till its too late). I need them
 to appear as they come in. Occasionally I can see a length being retrieved
 and the Comet page finds it but even then it is not displayed until all the
 lengths are in.   I know this is not very clear but I think it will be 
 clear
 from the code.

 I also know there are a lot of places in the code which can be improved
 and I welcome all of your input but what I would love is to have these
 numbers appear on the page as they they are retrieved. I have been stumped
 by this for a while and I suspect that somebody who knows Lift well might
 see the problem right away.

 The class that retrieves the page lengths is called Calculator and the
 queue is called SourceQueue. The classes are pretty small so hopefully it
 will be clear what is going on. I want you to know I think it is incredible
 how responsive you and the group are and I look forward to using Lift in 
 the
 future.

 Thanks so much.

 Jack


 On Tue, Nov 10, 2009 at 1:27 AM, David Pollak 
 feeder.of.the.be...@gmail.com wrote:



 On Mon, Nov 9, 2009 at 10:10 PM, Jack Widman jack.wid...@gmail.comwrote:

 The only difference between your working code and mine is that mine
 has a process in the background that is always running and puts Foo 
 objects
 on a queue whenever they are ready. Where can I start this long running
 process so that it doesn't interfere with the lowPriority method that 
 takes
 things off the queue and rerenders the page. I tried starting the 
 process in
 its own Actor that I start in localSetup but it seems somehow to be 
 blocking
 the lowPriority method from doing its thing.


 I have no idea what this means... sorry.

 Please post actual runnable code and we can help you debug.



 On Sun, Nov 8, 2009 at 11:35 PM, David Pollak 
 feeder.of.the.be...@gmail.com wrote:

 Jack,

 I reproduced your code and it seems to work fine.  I've enclosed a
 working copy.

 Some comments about your code:

- The foos variable and the foo variable may be getting confused
in the code... the render method may be rendering the same thing 
 based on
the unchanging foos variable.
- Doing null testing is a sign that you have logic errors in your
code.  I strongly recommend using either Box or Option for 
 everything that
can logically not contain a value/reference.  If you're bridging out 
 to Java
code and are expecting null from the Java code, write a small bridge 
 that
will wrapper the Java return values in Box/Option.
- You have a case class (Tick) that contains no parameters.
Please use a case object instead.
- Your Tick look is a spin loop.  You fire a Tick message as part
of processing the Tick message.  I would suggest

[Lift] Re: CometActor and render

2009-11-12 Thread Jack Widman
got it. I was mixing metaphors.

On Thu, Nov 12, 2009 at 5:41 PM, David Pollak feeder.of.the.be...@gmail.com
 wrote:



 On Thu, Nov 12, 2009 at 2:25 PM, Jack Widman jack.wid...@gmail.comwrote:

 Is it that I am putting things on a Queue from within an the Calculator
 Actor and having the CometActor retrieve them from the Queue? Is that the
 problem?  I will read up on actors but it would help if you could tell me
 (if only briefly) what you saw about my actor code that is wrong.


 The act method in an actor sets up the receive/react loop.  It is not a
 background thread in and of itself.  Actors are not background threads
 they are things that process messages sent to them with the ! method.  You
 set up the message handling in the receive/react loop.

 Further, mixing method calls and Actor message handling is wicked dangerous
 (especially without synchronized blocks).  Choose either a traditional
 threading model or an Actor-based model, but not both.


  Thanks.



 On Thu, Nov 12, 2009 at 5:12 PM, David Pollak 
 feeder.of.the.be...@gmail.com wrote:

 Jack,

 The issues you're seeing are not Lift related.  You are not using Actors
 correctly.  Please see Philipp Haller's preso on Actors:
 http://lamp.epfl.ch/~phaller/doc/ScalaActors.pdfhttp://lamp.epfl.ch/%7Ephaller/doc/ScalaActors.pdf

 Please also look at the Actor chapters in Beginning Scala or Programming
 in Scala.

 Thanks,

 David


 On Wed, Nov 11, 2009 at 8:26 PM, Jack Widman jack.wid...@gmail.comwrote:

 David,

 I have attached my code. It runs but does not behave as I intended it
 to. The code does a web search on the term scala and displays a list of
 URLs of the results. Next to each URL it says Page Length : -1. A process
 is running in the background which takes each URL, goes out and gets the
 page and takes the length of the page. The length of that page is then
 supposed to immediately appear on the page next to that URL. I put the
 lengths on a queue, as they come in, and I have the Comet page poll the
 queue and display the results. It would probably be better to have the
 results send a message to the Comet class so the page is only re-rendered
 when there is a change but for now I am polling.

 I can see the lengths coming in and being put on the queue, but the
 Comet page is not getting them till they are all retrieved. (This takes way
 too long and nothing changes on the screen till its too late). I need them
 to appear as they come in. Occasionally I can see a length being retrieved
 and the Comet page finds it but even then it is not displayed until all the
 lengths are in.   I know this is not very clear but I think it will be 
 clear
 from the code.

 I also know there are a lot of places in the code which can be improved
 and I welcome all of your input but what I would love is to have these
 numbers appear on the page as they they are retrieved. I have been stumped
 by this for a while and I suspect that somebody who knows Lift well might
 see the problem right away.

 The class that retrieves the page lengths is called Calculator and the
 queue is called SourceQueue. The classes are pretty small so hopefully it
 will be clear what is going on. I want you to know I think it is incredible
 how responsive you and the group are and I look forward to using Lift in 
 the
 future.

 Thanks so much.

 Jack


 On Tue, Nov 10, 2009 at 1:27 AM, David Pollak 
 feeder.of.the.be...@gmail.com wrote:



 On Mon, Nov 9, 2009 at 10:10 PM, Jack Widman jack.wid...@gmail.comwrote:

 The only difference between your working code and mine is that mine
 has a process in the background that is always running and puts Foo 
 objects
 on a queue whenever they are ready. Where can I start this long running
 process so that it doesn't interfere with the lowPriority method that 
 takes
 things off the queue and rerenders the page. I tried starting the 
 process in
 its own Actor that I start in localSetup but it seems somehow to be 
 blocking
 the lowPriority method from doing its thing.


 I have no idea what this means... sorry.

 Please post actual runnable code and we can help you debug.



 On Sun, Nov 8, 2009 at 11:35 PM, David Pollak 
 feeder.of.the.be...@gmail.com wrote:

 Jack,

 I reproduced your code and it seems to work fine.  I've enclosed a
 working copy.

 Some comments about your code:

- The foos variable and the foo variable may be getting confused
in the code... the render method may be rendering the same thing 
 based on
the unchanging foos variable.
- Doing null testing is a sign that you have logic errors in your
code.  I strongly recommend using either Box or Option for 
 everything that
can logically not contain a value/reference.  If you're bridging out 
 to Java
code and are expecting null from the Java code, write a small bridge 
 that
will wrapper the Java return values in Box/Option.
- You have a case class (Tick) that contains no parameters.
Please use a case object instead

[Lift] Re: CometListener

2009-11-12 Thread Jack Widman
C:\work\widman\src\main\scala\com\widman\comet\PackComet.scala:20: error:
type CometListener is not a member of package net.liftweb.http

I got this compile error.

I must be missing something obvious.

On Thu, Nov 12, 2009 at 11:42 PM, Ross Mellgren dri...@gmail.com wrote:


 It is in net.liftweb.http.


 http://www.scala-tools.org/mvnsites-snapshots/liftweb/lift-webkit/scaladocs/net/liftweb/http/CometListener.html


 By the way, the link you gave only indicates it's in either
 net.liftweb.http, net.liftweb.util, net.liftweb or model (or a couple
 other packages, since scala implicitly imports superpackages).

 -Ross

 On Nov 12, 2009, at 11:38 PM, jack wrote:

 
  I also tried net.liftweb.http
 
  On Nov 12, 11:35 pm, jack jack.wid...@gmail.com wrote:
  I am trying to use CometListener. According tohttp://bit.ly/1Wnxt4,
  it is in the package net.liftweb._ but compiler says it can't be
  found. Is this the wrong package?
  


 



-- 
Jack Widman

co-founder / cto,  Authoritude, Inc.

203-641-9355

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

2009-11-12 Thread Jack Widman
David,

I'm using lift 1.1 and scala 2.5 now and the compiler says it cant find
CometListener when I import net.liftweb.http._

Jack

On Fri, Nov 13, 2009 at 12:01 AM, David Pollak 
feeder.of.the.be...@gmail.com wrote:



 On Thu, Nov 12, 2009 at 8:54 PM, Jack Widman jack.wid...@gmail.comwrote:

 C:\work\widman\src\main\scala\com\widman\comet\PackComet.scala:20: error:
 type CometListener is not a member of package net.liftweb.http

 I got this compile error.

 I must be missing something obvious.


 It's part of Lift 1.1, not Lift 1.0




  On Thu, Nov 12, 2009 at 11:42 PM, Ross Mellgren dri...@gmail.comwrote:


 It is in net.liftweb.http.


 http://www.scala-tools.org/mvnsites-snapshots/liftweb/lift-webkit/scaladocs/net/liftweb/http/CometListener.html


 By the way, the link you gave only indicates it's in either
 net.liftweb.http, net.liftweb.util, net.liftweb or model (or a couple
 other packages, since scala implicitly imports superpackages).

 -Ross

 On Nov 12, 2009, at 11:38 PM, jack wrote:

 
  I also tried net.liftweb.http
 
  On Nov 12, 11:35 pm, jack jack.wid...@gmail.com wrote:
  I am trying to use CometListener. According tohttp://bit.ly/1Wnxt4,
  it is in the package net.liftweb._ but compiler says it can't be
  found. Is this the wrong package?
  






 --
 Jack Widman

 co-founder / cto,  Authoritude, Inc.

 203-641-9355






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

 



-- 
Jack Widman

co-founder / cto,  Authoritude, Inc.

203-641-9355

--~--~-~--~~~---~--~~
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: CometActor and render

2009-11-10 Thread Jack Widman
Sorry. Just reread my past post and it is indeed unclear. I will post
running code tonight. I very much appreciate your help.

On Tue, Nov 10, 2009 at 1:27 AM, David Pollak feeder.of.the.be...@gmail.com
 wrote:



 On Mon, Nov 9, 2009 at 10:10 PM, Jack Widman jack.wid...@gmail.comwrote:

 The only difference between your working code and mine is that mine has a
 process in the background that is always running and puts Foo objects on a
 queue whenever they are ready. Where can I start this long running process
 so that it doesn't interfere with the lowPriority method that takes things
 off the queue and rerenders the page. I tried starting the process in its
 own Actor that I start in localSetup but it seems somehow to be blocking the
 lowPriority method from doing its thing.


 I have no idea what this means... sorry.

 Please post actual runnable code and we can help you debug.



 On Sun, Nov 8, 2009 at 11:35 PM, David Pollak 
 feeder.of.the.be...@gmail.com wrote:

 Jack,

 I reproduced your code and it seems to work fine.  I've enclosed a
 working copy.

 Some comments about your code:

- The foos variable and the foo variable may be getting confused in
the code... the render method may be rendering the same thing based on 
 the
unchanging foos variable.
- Doing null testing is a sign that you have logic errors in your
code.  I strongly recommend using either Box or Option for everything 
 that
can logically not contain a value/reference.  If you're bridging out to 
 Java
code and are expecting null from the Java code, write a small bridge that
will wrapper the Java return values in Box/Option.
- You have a case class (Tick) that contains no parameters.  Please
use a case object instead.
- Your Tick look is a spin loop.  You fire a Tick message as part of
processing the Tick message.  I would suggest that if you're polling, 
 that
you have a reasonable poll interval, otherwise you'll starve your CPU.
Further, having reRender on each loop through means that you're forcing a
lot of bytes over the wire rather than only doing a reRender on changed
values.

 Thanks,

 David

 On Sun, Nov 8, 2009 at 3:47 PM, Jack Widman jack.wid...@gmail.comwrote:

 Sorry. Here it is:   As I said, I know that when render is called,
 foo.getValue has the right value. But it does not show on the screen, 
 unless
 I refresh the browser.

 package com.foo.comet

 import net.liftweb._
 import http._
 import js._
 import JsCmds._
 import net.liftweb.util._
 import net.liftweb.http._
 import _root_.scala.xml._
 import scala.actors._
 import com.authoritude.snippet._
 import scala.collection.mutable.Queue
 import net.liftweb.http.SessionVar


 class MyComet extends CometActor {

   override def defaultPrefix = Full(auth)

   private var foos = FooManager.getFoos

   def createDisplay(foos:List[Foo]):NodeSeq = {
 span id=gotable
 {
   for {foo - foos} yield trtd{foo.getValue}/td/tr
 }

 /table/span
   }

   def render = { bind(foo - createDisplay(foos)) }

   override def localSetup = {
 super.localSetup
 this ! Tick
   }

   var foo:Foo = null
   override def lowPriority = {
 case Tick = {
   foo=FooQueue.getLatest
   if (foo!=null  foo.getValue  -1) {
 blogs = FooManager.process(foo, foos)
   } else if (foo!=null){
 foos = foos.remove((f:Foo)=(f.id==foo.id))
   }
   reRender(false)
   this ! Tick
 }
   }
 }

 case class Tick



 On Sun, Nov 8, 2009 at 5:31 AM, Timothy Perrett 
 timo...@getintheloop.eu wrote:


 Without posting your code it's going to be tough to help you.

 Cheers, Tim

 Sent from my iPhone

 On 8 Nov 2009, at 08:14, jack jack.wid...@gmail.com wrote:

 
  By the way, I know that when render is called, all the variables have
  the right values. I just don't see it on the screen unless I refresh
  it.
 
  On Nov 8, 3:12 am, jack jack.wid...@gmail.com wrote:
  I have a CometActor. render is called when it is supposed to be but
 I
  don't see the changes. If I refresh the page at anytime, I do see
 the
  changes. Any idea what might cause this?
  
 





 --
 Jack Widman

 co-founder / cto,  Authoritude, Inc.

 203-641-9355






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






 --
 Jack Widman

 co-founder / cto,  Authoritude, Inc.

 203-641-9355





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

 



-- 
Jack Widman

co-founder / cto,  Authoritude, Inc.

203-641-9355

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

[Lift] Re: CometActor and render

2009-11-09 Thread Jack Widman
The only difference between your working code and mine is that mine has a
process in the background that is always running and puts Foo objects on a
queue whenever they are ready. Where can I start this long running process
so that it doesn't interfere with the lowPriority method that takes things
off the queue and rerenders the page. I tried starting the process in its
own Actor that I start in localSetup but it seems somehow to be blocking the
lowPriority method from doing its thing.

On Sun, Nov 8, 2009 at 11:35 PM, David Pollak feeder.of.the.be...@gmail.com
 wrote:

 Jack,

 I reproduced your code and it seems to work fine.  I've enclosed a working
 copy.

 Some comments about your code:

- The foos variable and the foo variable may be getting confused in the
code... the render method may be rendering the same thing based on the
unchanging foos variable.
- Doing null testing is a sign that you have logic errors in your
code.  I strongly recommend using either Box or Option for everything that
can logically not contain a value/reference.  If you're bridging out to 
 Java
code and are expecting null from the Java code, write a small bridge that
will wrapper the Java return values in Box/Option.
- You have a case class (Tick) that contains no parameters.  Please use
a case object instead.
- Your Tick look is a spin loop.  You fire a Tick message as part of
processing the Tick message.  I would suggest that if you're polling, that
you have a reasonable poll interval, otherwise you'll starve your CPU.
Further, having reRender on each loop through means that you're forcing a
lot of bytes over the wire rather than only doing a reRender on changed
values.

 Thanks,

 David

 On Sun, Nov 8, 2009 at 3:47 PM, Jack Widman jack.wid...@gmail.com wrote:

 Sorry. Here it is:   As I said, I know that when render is called,
 foo.getValue has the right value. But it does not show on the screen, unless
 I refresh the browser.

 package com.foo.comet

 import net.liftweb._
 import http._
 import js._
 import JsCmds._
 import net.liftweb.util._
 import net.liftweb.http._
 import _root_.scala.xml._
 import scala.actors._
 import com.authoritude.snippet._
 import scala.collection.mutable.Queue
 import net.liftweb.http.SessionVar


 class MyComet extends CometActor {

   override def defaultPrefix = Full(auth)

   private var foos = FooManager.getFoos

   def createDisplay(foos:List[Foo]):NodeSeq = {
 span id=gotable
 {
   for {foo - foos} yield trtd{foo.getValue}/td/tr
 }

 /table/span
   }

   def render = { bind(foo - createDisplay(foos)) }

   override def localSetup = {
 super.localSetup
 this ! Tick
   }

   var foo:Foo = null
   override def lowPriority = {
 case Tick = {
   foo=FooQueue.getLatest
   if (foo!=null  foo.getValue  -1) {
 blogs = FooManager.process(foo, foos)
   } else if (foo!=null){
 foos = foos.remove((f:Foo)=(f.id==foo.id))
   }
   reRender(false)
   this ! Tick
 }
   }
 }

 case class Tick



 On Sun, Nov 8, 2009 at 5:31 AM, Timothy Perrett 
 timo...@getintheloop.euwrote:


 Without posting your code it's going to be tough to help you.

 Cheers, Tim

 Sent from my iPhone

 On 8 Nov 2009, at 08:14, jack jack.wid...@gmail.com wrote:

 
  By the way, I know that when render is called, all the variables have
  the right values. I just don't see it on the screen unless I refresh
  it.
 
  On Nov 8, 3:12 am, jack jack.wid...@gmail.com wrote:
  I have a CometActor. render is called when it is supposed to be but I
  don't see the changes. If I refresh the page at anytime, I do see the
  changes. Any idea what might cause this?
  
 





 --
 Jack Widman

 co-founder / cto,  Authoritude, Inc.

 203-641-9355






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


 



-- 
Jack Widman

co-founder / cto,  Authoritude, Inc.

203-641-9355

--~--~-~--~~~---~--~~
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: CometActor and render

2009-11-08 Thread Jack Widman
Sorry. Here it is:   As I said, I know that when render is called,
foo.getValue has the right value. But it does not show on the screen, unless
I refresh the browser.

package com.foo.comet

import net.liftweb._
import http._
import js._
import JsCmds._
import net.liftweb.util._
import net.liftweb.http._
import _root_.scala.xml._
import scala.actors._
import com.authoritude.snippet._
import scala.collection.mutable.Queue
import net.liftweb.http.SessionVar


class MyComet extends CometActor {

  override def defaultPrefix = Full(auth)

  private var foos = FooManager.getFoos

  def createDisplay(foos:List[Foo]):NodeSeq = {
span id=gotable
{
  for {foo - foos} yield trtd{foo.getValue}/td/tr
}

/table/span
  }

  def render = { bind(foo - createDisplay(foos)) }

  override def localSetup = {
super.localSetup
this ! Tick
  }

  var foo:Foo = null
  override def lowPriority = {
case Tick = {
  foo=FooQueue.getLatest
  if (foo!=null  foo.getValue  -1) {
blogs = FooManager.process(foo, foos)
  } else if (foo!=null){
foos = foos.remove((f:Foo)=(f.id==foo.id))
  }
  reRender(false)
  this ! Tick
}
  }
}

case class Tick


On Sun, Nov 8, 2009 at 5:31 AM, Timothy Perrett timo...@getintheloop.euwrote:


 Without posting your code it's going to be tough to help you.

 Cheers, Tim

 Sent from my iPhone

 On 8 Nov 2009, at 08:14, jack jack.wid...@gmail.com wrote:

 
  By the way, I know that when render is called, all the variables have
  the right values. I just don't see it on the screen unless I refresh
  it.
 
  On Nov 8, 3:12 am, jack jack.wid...@gmail.com wrote:
  I have a CometActor. render is called when it is supposed to be but I
  don't see the changes. If I refresh the page at anytime, I do see the
  changes. Any idea what might cause this?
  
 

 



-- 
Jack Widman

co-founder / cto,  Authoritude, Inc.

203-641-9355

--~--~-~--~~~---~--~~
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: CometActor and render

2009-11-08 Thread Jack Widman
Thanks David. This is a big help. Can you tell me exactly how lowPriority,
mediumPriorty and highPriority work? When are they called?

On Sun, Nov 8, 2009 at 11:35 PM, David Pollak feeder.of.the.be...@gmail.com
 wrote:

 Jack,

 I reproduced your code and it seems to work fine.  I've enclosed a working
 copy.

 Some comments about your code:

- The foos variable and the foo variable may be getting confused in the
code... the render method may be rendering the same thing based on the
unchanging foos variable.
- Doing null testing is a sign that you have logic errors in your
code.  I strongly recommend using either Box or Option for everything that
can logically not contain a value/reference.  If you're bridging out to 
 Java
code and are expecting null from the Java code, write a small bridge that
will wrapper the Java return values in Box/Option.
- You have a case class (Tick) that contains no parameters.  Please use
a case object instead.
- Your Tick look is a spin loop.  You fire a Tick message as part of
processing the Tick message.  I would suggest that if you're polling, that
you have a reasonable poll interval, otherwise you'll starve your CPU.
Further, having reRender on each loop through means that you're forcing a
lot of bytes over the wire rather than only doing a reRender on changed
values.

 Thanks,

 David

 On Sun, Nov 8, 2009 at 3:47 PM, Jack Widman jack.wid...@gmail.com wrote:

 Sorry. Here it is:   As I said, I know that when render is called,
 foo.getValue has the right value. But it does not show on the screen, unless
 I refresh the browser.

 package com.foo.comet

 import net.liftweb._
 import http._
 import js._
 import JsCmds._
 import net.liftweb.util._
 import net.liftweb.http._
 import _root_.scala.xml._
 import scala.actors._
 import com.authoritude.snippet._
 import scala.collection.mutable.Queue
 import net.liftweb.http.SessionVar


 class MyComet extends CometActor {

   override def defaultPrefix = Full(auth)

   private var foos = FooManager.getFoos

   def createDisplay(foos:List[Foo]):NodeSeq = {
 span id=gotable
 {
   for {foo - foos} yield trtd{foo.getValue}/td/tr
 }

 /table/span
   }

   def render = { bind(foo - createDisplay(foos)) }

   override def localSetup = {
 super.localSetup
 this ! Tick
   }

   var foo:Foo = null
   override def lowPriority = {
 case Tick = {
   foo=FooQueue.getLatest
   if (foo!=null  foo.getValue  -1) {
 blogs = FooManager.process(foo, foos)
   } else if (foo!=null){
 foos = foos.remove((f:Foo)=(f.id==foo.id))
   }
   reRender(false)
   this ! Tick
 }
   }
 }

 case class Tick



 On Sun, Nov 8, 2009 at 5:31 AM, Timothy Perrett 
 timo...@getintheloop.euwrote:


 Without posting your code it's going to be tough to help you.

 Cheers, Tim

 Sent from my iPhone

 On 8 Nov 2009, at 08:14, jack jack.wid...@gmail.com wrote:

 
  By the way, I know that when render is called, all the variables have
  the right values. I just don't see it on the screen unless I refresh
  it.
 
  On Nov 8, 3:12 am, jack jack.wid...@gmail.com wrote:
  I have a CometActor. render is called when it is supposed to be but I
  don't see the changes. If I refresh the page at anytime, I do see the
  changes. Any idea what might cause this?
  
 





 --
 Jack Widman

 co-founder / cto,  Authoritude, Inc.

 203-641-9355






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


 



-- 
Jack Widman

co-founder / cto,  Authoritude, Inc.

203-641-9355

--~--~-~--~~~---~--~~
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: using Dispatch library for Http

2009-11-05 Thread Jack Widman
Thanks Ross, I'll try it.

On Thu, Nov 5, 2009 at 11:51 PM, Ross Mellgren dri...@gmail.com wrote:


 Many exceptions do not have a message, e.g. NullPointerException
 (unless thrown by hand).

 Maybe:

 try {
 ...
 } catch {
 case ex: Exception if ex.getMessage == null = Message:  +
 ex.toString
 case ex: Exception = Message:  + ex.getMessage
 }

 -Ross

 On Nov 5, 2009, at 11:45 PM, jack wrote:

 
  I'm using the Dispatch Databinder library for Http.  http://bit.ly/NPWcW
 
  My code is this simple method.
 
  def testCheckPage(url:String):String = {
 try {
   var http = new Http
   var request = new Request
  (url)
   val req_with_agent = request : Map(User-Agent - Mozilla/
  5.0)
   val responseBody = Http (req_with_agent as_str)
   responseBody.length.toString
 } catch {
case ex: Exception = {
 Message:  + ex.getMessage
}
 }
   }
 
  For some urls, e.g., http://bae.cf.huffingtonpost.com/ , an exception
  is thrown but the exception message is null. Any ideas?
  


 



-- 
Jack Widman

co-founder / cto,  Authoritude, Inc.

203-641-9355

--~--~-~--~~~---~--~~
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: using Dispatch library for Http

2009-11-05 Thread Jack Widman
Tried and I see now that the exception is java.nio.BufferUnderflowException
Any idea what might be causing this?

On Thu, Nov 5, 2009 at 11:51 PM, Ross Mellgren dri...@gmail.com wrote:


 Many exceptions do not have a message, e.g. NullPointerException
 (unless thrown by hand).

 Maybe:

 try {
 ...
 } catch {
 case ex: Exception if ex.getMessage == null = Message:  +
 ex.toString
  case ex: Exception = Message:  + ex.getMessage
 }

 -Ross

 On Nov 5, 2009, at 11:45 PM, jack wrote:

 
  I'm using the Dispatch Databinder library for Http.  http://bit.ly/NPWcW
 
  My code is this simple method.
 
  def testCheckPage(url:String):String = {
 try {
   var http = new Http
   var request = new Request
  (url)
   val req_with_agent = request : Map(User-Agent - Mozilla/
  5.0)
   val responseBody = Http (req_with_agent as_str)
   responseBody.length.toString
 } catch {
case ex: Exception = {
 Message:  + ex.getMessage
}
 }
   }
 
  For some urls, e.g., http://bae.cf.huffingtonpost.com/ , an exception
  is thrown but the exception message is null. Any ideas?
  


 



-- 
Jack Widman

co-founder / cto,  Authoritude, Inc.

203-641-9355

--~--~-~--~~~---~--~~
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: regular expression

2009-11-02 Thread Jack Widman
Thanks Derek. Will do.

On Mon, Nov 2, 2009 at 3:45 PM, Derek Chen-Becker dchenbec...@gmail.comwrote:

 From the Scaladoc for scala.util.matching.Regex:

 You can use special pattern syntax construct (?idmsux-idmsux) to switch
 various regex compilation options like CASE_INSENSITIVE or UNICODE_CASE.
 See java.util.regex.Pattern javadoc for details.

 Probably better to ask Scala questions on the Scala list(s).


 On Mon, Nov 2, 2009 at 10:28 AM, jack jack.wid...@gmail.com wrote:


 I am using the findAllIn function for regular expressions. How do I
 make it ignore case? I know its simple but I can't find it.



 



-- 
Jack Widman

co-founder / cto,  Authoritude, Inc.

203-641-9355

--~--~-~--~~~---~--~~
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: global exception page

2009-10-28 Thread Jack Widman
Yes. Thanks alot Tim.

On Wed, Oct 28, 2009 at 9:32 AM, Timothy Perrett timo...@getintheloop.euwrote:


 Jack,

 LiftRules.exceptionHandler.prepend {
   case (Props.RunModes.Production, r, e) = {
 Log.error(IMPORTANT IMPORTANT IMPORTANT: Unhandeled error
 occoured!!,e)
 // your LiftResponse here
RedirectResponse(/error)
   }
 }

 Does that clear it up for you...?

 Cheers, Tim

 On 28 Oct 2009, at 13:17, jack wrote:

 
  I would like to have one error page that appears when any exception
  occurs. How would I do that?
  
 


 



-- 
Jack Widman

co-founder / cto,  Authoritude, Inc.

203-641-9355

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

2009-10-25 Thread Jack Widman
Thanks Tim. And next time I will search more before asking.

On Sun, Oct 25, 2009 at 2:26 PM, Timothy Perrett timo...@getintheloop.euwrote:


 Jack,

 This question has been asked quite a number of times recently on list.

 Change:

 version1.0/version

 on the liftweb dependencies in your pom.xml to be:

 version1.1-SNAPSHOT/version

 That will give you the latest HEAD build. If you want a known point in
 time, use M6:

 version1.1-M6/version

 Cheers, Tim

 On Oct 25, 6:00 pm, jack jack.wid...@gmail.com wrote:
  I have been using lift 1.0. What is the best way to upgrade to 1.1?
 



-- 
Jack Widman

co-founder / cto,  Authoritude, Inc.

203-641-9355

--~--~-~--~~~---~--~~
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: html not being evalutated

2009-10-21 Thread Jack Widman
Oops. I just noticed I made source.body a String and not a NodeSeq.
Sometimes source.body is text with html tags in it. Like -

Hey dude, bwhat/b are you doing?
I guess I should make it a NodeSeq. Sorry about that.
Jack

On Wed, Oct 21, 2009 at 9:33 AM, David Pollak feeder.of.the.be...@gmail.com
 wrote:



 On Wed, Oct 21, 2009 at 6:32 AM, jack jack.wid...@gmail.com wrote:


 Let's say source.body is ahref=google.comSearch/a.  If I put
 source.body in a span like this -

 span{source.body}/span

 source.body will be converted to text and the actual link tags will be
 displayed. What is the right way to do this?


 How was source.body generated?


 On Oct 21, 9:06 am, David Pollak feeder.of.the.be...@gmail.com
 wrote:
  On Tue, Oct 20, 2009 at 10:16 PM, jack jack.wid...@gmail.com wrote:
 
   OK, I see why this is happening. the {exp} in the NodeSeq convert exp
   to a String. So I did by creating a string and then converting it to a
   NodeSeq at the end. Is there a way to do this without using and
   intermediary string?
 
  I don't know what a source is, but you really, really have to be careful
  about promoting a String to a NodeSeq.  If the String has user-generated
  content in it, then you've got a cross-site scripting vulnerability
 waiting
  to happen.  For user-generated content, I suggest using Textile parser
 built
  into Lift.
 
  In any case, if you don't have a NodeSeq in your data structure, you'll
 have
  to parse it into XML before displaying it.
 
 
 
 
 
   On Oct 21, 1:03 am, jack jack.wid...@gmail.com wrote:
I have the following method display. source.body has html tags in it
but the actual tags are showing instead of being evaluated. e.g. I'm
seeing things like 'bHey There/b' instead of 'Hey There' in
 bold.
This method is in a CometActor and is running when the page is
rendered. Am I missing something obvious?
 
 def display(sources:List[Source]):NodeSeq = {
 
span id=jooptable
{
   for {source - sources} yield trtd{source.body}/td/tr
}
 
/table
/span
  }
 
  --
  Lift, the simply functional web frameworkhttp://liftweb.net
  Beginning Scalahttp://www.apress.com/book/view/1430219890
  Follow me:http://twitter.com/dpp
  Surf the harmonics




 --
 Lift, the simply functional web framework http://liftweb.net
 Beginning Scala http://www.apress.com/book/view/1430219890

 Follow me: http://twitter.com/dpp
 Surf the harmonics

 



-- 
Jack

--~--~-~--~~~---~--~~
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: Newbie post: Where are the basics and best practices?

2009-10-21 Thread Jack Widman
Just wanted to say that I have never seen a community like this. Its
fantastic!

On Wed, Oct 21, 2009 at 11:05 PM, David Pollak 
feeder.of.the.be...@gmail.com wrote:



 On Wed, Oct 21, 2009 at 4:15 PM, Strom strommo...@gmail.com wrote:


 Hello everyone,
 I am pretty much brand new to lift and scala, and I come from a non-
 framework jsp/java servlet/hibernate background. I've been reading
 this board, Beginning Scala, The lift book, and googling how to use
 the lift framework, but I can't seem to find some basic info.


 That's why we're here.  Ask away!


 Please
 help me out. I know these are very basic questions, and posting on the
 group was a last resort after coming up empty on searches. I want to
 start off with best practices since I'm beginning from scratch.


 Doing some searching is great, but asking on list is heartily encouraged.



 1. Directory structure - where is everything?
 Looking at the PocketChange example and making a basic lift 1.0
 project via netbeans, I know that the DB schema go under model, the
 snippets in snippet, the templates in the corresponding webapp/
 templates-hidden directory, and the web pages in the webapp
 directory.

 What I don't know is where /classpath or lift:CSS.blueprint are
 actually going. Is classpath still going to src/main/resources/
 toserve, or is that old info? Looking at the default.html template,
 there's no jquery.js or CSS files in a toserve directory; in fact
 there is no toserve directory period, so I made my own. Also I see
 lift:CSS.blueprint, and I have no idea where that's going. I don't
 see any CSS class with blueprint method, but the syntax looks clean
 and I'd like to add my own custom stylesheet in the same fashion.


 The /classpath stuff is served out of the Lift JAR file rather than out of
 a directory.  If you want to have your own CSS, just put it in
 /src/webapp/css/xxx.css and then refer to /css/xxx.css in your web page.



 2. Dynamically generated HTML - what's the best practice, and how to
 do it?


 Snippets are the way that Lift does dynamic HTML.  It's not a templating
 system, but a binding between your XHTML file and methods on classes that
 substitute the dynamically generated HTML.


 I would like to know what the lift equivalent is for the following:

 a href=%=request.getContextPath()%/home/index.jspIndex/a


 In the case of Lift, you don't have to do this.  a
 href=/home/indexindex/a will automatically be rewritten for the correct
 context path. No work on your part.


 That's the way I was taught to link web pages together because it
 avoids hardcoding the page location, but the main point is the stuff
 inside %=...%. It looks like the lift uses {...}, but this example
 from the lift book causes an IllegalArgumentException (bad XML
 according to the msgs I've found on this board):
 link type=text/css rel=stylesheet href=
 {LiftRules.resourceServerPath + /css/style.css } /


 If you're writing Scala, then you can do substitutions like the one above,
 but Lift's views are not like JSP templates.  In the above case, you can
 simply say:
 link type=text/css rel=stylesheet href=/css/style.css/

 And it will be automatically updated based on the context path.


 How do I go about making this work, and in what scenarios should I be
 using this {...} approach vs snippets?

 Note: An earlier example in the lift book used href=/classpath/css/
 style.css, but later on said that the 1st method is better. The basic
 lift archetype references /classpath everywhere as well, so I don't
 know what to believe.

 I guess those are the glaring questions I have right now. In addition,
 what are some common search terms I could use to find this sort of
 basic info on the board, or where can I find best practices info and
 more examples of working sites? I'd rather see what documentation/
 tutorials already exists for beginners before I send more messages for
 the board, but my main issue is knowing whether or not I'm getting the
 right information; most every lift example document/wiki/tutorial I've
 seen is outdated code or incomplete. I'm looking for more code
 examples that comply with lift's current evolution. The lift book is
 helpful, but I also feel a little left out when I read it because I
 get the feeling the book assumes the reader knows certain lift and
 scala basics that are obvious to more seasoned users, but not to...me.

 Thank you so much for your help!


 Sure thing.

 Welcome to the community.

 Thanks,

 David





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


 



-- 
Jack

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

[Lift] Re: does this look ok?

2009-10-18 Thread Jack Widman
yes. I think I found the problem elsewhere in the logic. thanks.

On Sun, Oct 18, 2009 at 11:07 PM, Naftoli Gugenheim naftoli...@gmail.comwrote:

 I think so... Does it compile?


 On Sun, Oct 18, 2009 at 7:13 PM, jack jack.wid...@gmail.com wrote:


 Does this code look ok?


  def createDisplay(blogs:List[Blog]):NodeSeq = {

span id=scoretable
{
  for {blog - blogs} yield trtda href={blog.url}{blog.url}/
 a/tdtd {blog.title}/td/tr
 }
/table/span
  }

  def render  = { bind(joop - createDisplay(blogs)) }



 



-- 
Jack

--~--~-~--~~~---~--~~
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 quality of the Lift list [was: Don't shoot the non-XML messenger ...]

2009-10-14 Thread Jack Widman
The necessity of this kind of action (the banning) is absolutely no sign of
anything having been done wrong. There will ALWAYS be people like that.

On Wed, Oct 14, 2009 at 3:31 PM, koveen liep...@xs4all.nl wrote:


 I think that when someone enters a group, expecting to be shot,
 it is a very kind act only to ban him.

 Ko

 On Oct 14, 7:49 pm, David Pollak feeder.of.the.be...@gmail.com
 wrote:
  Folks,
 
  It is not lightly that I ban someone from the group... this is only the
  second time I've banned a substantive poster.  I'm going to discuss some
 of
  the process and then touch on some of the substance of the questions that
  the poster was getting at.
 
  The Lift community, reflected on this list, is an inquisitive, friendly
  place where people who have a passion for building great web apps
 converge
  and contribute to making Lift a really great open source framework.
  Newbies
  are the lifeblood of the group because they come with fresh perspectives
 and
  new ways of looking at things.  Questions from newbies help us refine and
  enhance Lift and the associated documentation.  Folks who are building
  production apps on Lift receive the fastest turn-around because these
 folks
  are betting their careers and their enterprises (even enterprises of one)
 on
  Lift and they deserve the best support in the industry for taking this
 risk.
 
  A big part of why this community is successful (in terms of size, quality
 of
  discussion, and quality of results) is because we keep the quality of
  discussion high.  How do we do this?  The folks who have been on the list
  generally keep the level of discussion to the Lift ideals.  We reward
  newbies with quick answers and encourage friendly discourse.  We are
  generally slower to respond to those that are less reflective of the list
  ideals.  I warn folks who are pushing boundaries (usually privately, but
  every once in a while publicly) and where the line is.
 
  In this case, nothing worked.  The poster was neither asking questions,
  giving usable feedback, or being polite in his engagement with the folks
 on
  the list.  I received a substantial number of private communications
 about
  this poster (which is pretty rare), and I took action.
 
  In terms of the substance, let me address to threat issue first.  I
  threatened to ban the poster from the list.  Perhaps DHH or Martin would
 not
  make such a threat.  I am very sure that the quality of discussion on the
  Lift list is higher than that on the Rails list (one of the reasons I
  started Lift was to be part of a nicer community.)  One cost of having a
  nicer place is excluding those who do not fit.  The second threat I
 made
  was to relay a tongue-in-cheek private communication I received about the
  poster to the list (after receiving the okay from the guy that made the
  communication to me.)  This threat was obvious, using video game rating
  language http://www.esrb.org/ratings/ratings_guide.jsp, Comic
 mischief
  and Cartoon violence.  It was something that even a 6 year old can
  distinguish from reality.  Put another way, the poster was talking about
  Kafkaesque experiences with using Lift and I responded with
  Jonesian
 http://www.youtube.com/watch?v=CrupqdGvsocfeature=PlayListp=62FED00..
 .language.
 
  In terms of the broader issue of Lift's HTML templating system being
 XHTML
  only, yes, that's true.  Lift treats HTML templates as XML.  Lift's
  templating system is not a String templating system but an XML templating
  system.  This satisfies the needs to render content to HTML browsers.  If
  there are needs for generating other kinds of content, Lift is not as
 good,
  but in many cases there are better libraries for doing so.  Lift makes it
  very simple to integrate other rendering/templating engines into Lift,
  usually with a single line of code the dispatches the HTTP request to an
  alternate provider of a LiftResponse.  If the poster had simply said, I
  want to template non-HTML output, can you show me how? he would have
 gotten
  a nice example (and I might have even rolled it into demo.liftweb.net or
  maybe Tim might have blogged about it.
 
  Keeping things in XML has a number of advantages and a few disadvantages.
  First, the disadvantages: (1) you can't template non-XHTML responses and
 (2)
  everything must be well formed XML.  The advantages are (1) security (2)
  performance (it's easier to cache XML and the cost of mutating XML trees
 is
  O(log N)), (3) there is better separation of logic from the view (perhaps
  Terrance Parr's String Template library achieves this level of
 separation),
  and (4) the ability to mutate the resulting page (rewrite tags, move
 stuff
  to head/tail, consolidate scripts) is more performant and less
 error-prone
  than doing the same with a String-based representation.
 
  I will address Bill's security question.  For String-based rendering
 systems
  that emit HTML, the developer is the one who must make a decision at 

[Lift] Re: The quality of the Lift list [was: Don't shoot the non-XML messenger ...]

2009-10-14 Thread Jack Widman
Not to harp on it  but:

*When some sycophants of
Seaside got, nasty, I did not walk away from Seaside, warts and all.
*
suggests this person has had this problem elsewhere.


On Wed, Oct 14, 2009 at 3:37 PM, Jack Widman jack.wid...@gmail.com wrote:

 The necessity of this kind of action (the banning) is absolutely no sign of
 anything having been done wrong. There will ALWAYS be people like that.


 On Wed, Oct 14, 2009 at 3:31 PM, koveen liep...@xs4all.nl wrote:


 I think that when someone enters a group, expecting to be shot,
 it is a very kind act only to ban him.

 Ko

 On Oct 14, 7:49 pm, David Pollak feeder.of.the.be...@gmail.com
 wrote:
  Folks,
 
  It is not lightly that I ban someone from the group... this is only the
  second time I've banned a substantive poster.  I'm going to discuss some
 of
  the process and then touch on some of the substance of the questions
 that
  the poster was getting at.
 
  The Lift community, reflected on this list, is an inquisitive, friendly
  place where people who have a passion for building great web apps
 converge
  and contribute to making Lift a really great open source framework.
  Newbies
  are the lifeblood of the group because they come with fresh perspectives
 and
  new ways of looking at things.  Questions from newbies help us refine
 and
  enhance Lift and the associated documentation.  Folks who are building
  production apps on Lift receive the fastest turn-around because these
 folks
  are betting their careers and their enterprises (even enterprises of
 one) on
  Lift and they deserve the best support in the industry for taking this
 risk.
 
  A big part of why this community is successful (in terms of size,
 quality of
  discussion, and quality of results) is because we keep the quality of
  discussion high.  How do we do this?  The folks who have been on the
 list
  generally keep the level of discussion to the Lift ideals.  We reward
  newbies with quick answers and encourage friendly discourse.  We are
  generally slower to respond to those that are less reflective of the
 list
  ideals.  I warn folks who are pushing boundaries (usually privately, but
  every once in a while publicly) and where the line is.
 
  In this case, nothing worked.  The poster was neither asking questions,
  giving usable feedback, or being polite in his engagement with the folks
 on
  the list.  I received a substantial number of private communications
 about
  this poster (which is pretty rare), and I took action.
 
  In terms of the substance, let me address to threat issue first.  I
  threatened to ban the poster from the list.  Perhaps DHH or Martin would
 not
  make such a threat.  I am very sure that the quality of discussion on
 the
  Lift list is higher than that on the Rails list (one of the reasons I
  started Lift was to be part of a nicer community.)  One cost of having a
  nicer place is excluding those who do not fit.  The second threat I
 made
  was to relay a tongue-in-cheek private communication I received about
 the
  poster to the list (after receiving the okay from the guy that made the
  communication to me.)  This threat was obvious, using video game
 rating
  language http://www.esrb.org/ratings/ratings_guide.jsp, Comic
 mischief
  and Cartoon violence.  It was something that even a 6 year old can
  distinguish from reality.  Put another way, the poster was talking about
  Kafkaesque experiences with using Lift and I responded with
  Jonesian
 http://www.youtube.com/watch?v=CrupqdGvsocfeature=PlayListp=62FED00..
 .language.
 
  In terms of the broader issue of Lift's HTML templating system being
 XHTML
  only, yes, that's true.  Lift treats HTML templates as XML.  Lift's
  templating system is not a String templating system but an XML
 templating
  system.  This satisfies the needs to render content to HTML browsers.
  If
  there are needs for generating other kinds of content, Lift is not as
 good,
  but in many cases there are better libraries for doing so.  Lift makes
 it
  very simple to integrate other rendering/templating engines into Lift,
  usually with a single line of code the dispatches the HTTP request to an
  alternate provider of a LiftResponse.  If the poster had simply said, I
  want to template non-HTML output, can you show me how? he would have
 gotten
  a nice example (and I might have even rolled it into demo.liftweb.netor
  maybe Tim might have blogged about it.
 
  Keeping things in XML has a number of advantages and a few
 disadvantages.
  First, the disadvantages: (1) you can't template non-XHTML responses and
 (2)
  everything must be well formed XML.  The advantages are (1) security (2)
  performance (it's easier to cache XML and the cost of mutating XML trees
 is
  O(log N)), (3) there is better separation of logic from the view
 (perhaps
  Terrance Parr's String Template library achieves this level of
 separation),
  and (4) the ability to mutate the resulting page (rewrite tags, move
 stuff
  to head/tail

[Lift] Re: The quality of the Lift list [was: Don't shoot the non-XML messenger ...]

2009-10-14 Thread Jack Widman
fyi

http://developers.curl.com/people/rshiplett

On Wed, Oct 14, 2009 at 3:40 PM, Jack Widman jack.wid...@gmail.com wrote:

 Not to harp on it  but:

 *When some sycophants of
 Seaside got, nasty, I did not walk away from Seaside, warts and all.
 *
 suggests this person has had this problem elsewhere.



 On Wed, Oct 14, 2009 at 3:37 PM, Jack Widman jack.wid...@gmail.comwrote:

 The necessity of this kind of action (the banning) is absolutely no sign
 of anything having been done wrong. There will ALWAYS be people like that.


 On Wed, Oct 14, 2009 at 3:31 PM, koveen liep...@xs4all.nl wrote:


 I think that when someone enters a group, expecting to be shot,
 it is a very kind act only to ban him.

 Ko

 On Oct 14, 7:49 pm, David Pollak feeder.of.the.be...@gmail.com
 wrote:
  Folks,
 
  It is not lightly that I ban someone from the group... this is only the
  second time I've banned a substantive poster.  I'm going to discuss
 some of
  the process and then touch on some of the substance of the questions
 that
  the poster was getting at.
 
  The Lift community, reflected on this list, is an inquisitive, friendly
  place where people who have a passion for building great web apps
 converge
  and contribute to making Lift a really great open source framework.
  Newbies
  are the lifeblood of the group because they come with fresh
 perspectives and
  new ways of looking at things.  Questions from newbies help us refine
 and
  enhance Lift and the associated documentation.  Folks who are building
  production apps on Lift receive the fastest turn-around because these
 folks
  are betting their careers and their enterprises (even enterprises of
 one) on
  Lift and they deserve the best support in the industry for taking this
 risk.
 
  A big part of why this community is successful (in terms of size,
 quality of
  discussion, and quality of results) is because we keep the quality of
  discussion high.  How do we do this?  The folks who have been on the
 list
  generally keep the level of discussion to the Lift ideals.  We reward
  newbies with quick answers and encourage friendly discourse.  We are
  generally slower to respond to those that are less reflective of the
 list
  ideals.  I warn folks who are pushing boundaries (usually privately,
 but
  every once in a while publicly) and where the line is.
 
  In this case, nothing worked.  The poster was neither asking questions,
  giving usable feedback, or being polite in his engagement with the
 folks on
  the list.  I received a substantial number of private communications
 about
  this poster (which is pretty rare), and I took action.
 
  In terms of the substance, let me address to threat issue first.  I
  threatened to ban the poster from the list.  Perhaps DHH or Martin
 would not
  make such a threat.  I am very sure that the quality of discussion on
 the
  Lift list is higher than that on the Rails list (one of the reasons I
  started Lift was to be part of a nicer community.)  One cost of having
 a
  nicer place is excluding those who do not fit.  The second threat I
 made
  was to relay a tongue-in-cheek private communication I received about
 the
  poster to the list (after receiving the okay from the guy that made the
  communication to me.)  This threat was obvious, using video game
 rating
  language http://www.esrb.org/ratings/ratings_guide.jsp, Comic
 mischief
  and Cartoon violence.  It was something that even a 6 year old can
  distinguish from reality.  Put another way, the poster was talking
 about
  Kafkaesque experiences with using Lift and I responded with
  Jonesian
 http://www.youtube.com/watch?v=CrupqdGvsocfeature=PlayListp=62FED00..
 .language.
 
  In terms of the broader issue of Lift's HTML templating system being
 XHTML
  only, yes, that's true.  Lift treats HTML templates as XML.  Lift's
  templating system is not a String templating system but an XML
 templating
  system.  This satisfies the needs to render content to HTML browsers.
  If
  there are needs for generating other kinds of content, Lift is not as
 good,
  but in many cases there are better libraries for doing so.  Lift makes
 it
  very simple to integrate other rendering/templating engines into Lift,
  usually with a single line of code the dispatches the HTTP request to
 an
  alternate provider of a LiftResponse.  If the poster had simply said,
 I
  want to template non-HTML output, can you show me how? he would have
 gotten
  a nice example (and I might have even rolled it into demo.liftweb.netor
  maybe Tim might have blogged about it.
 
  Keeping things in XML has a number of advantages and a few
 disadvantages.
  First, the disadvantages: (1) you can't template non-XHTML responses
 and (2)
  everything must be well formed XML.  The advantages are (1) security
 (2)
  performance (it's easier to cache XML and the cost of mutating XML
 trees is
  O(log N)), (3) there is better separation of logic from the view
 (perhaps
  Terrance Parr's String Template library

[Lift] Re: Naming CometActors

2009-10-07 Thread Jack Widman
The naming each CometActor with a different name is working quite nicely.

On Wed, Oct 7, 2009 at 5:51 PM, David Pollak
feeder.of.the.be...@gmail.comwrote:



 On Wed, Oct 7, 2009 at 2:39 PM, Derek Chen-Becker 
 dchenbec...@gmail.comwrote:

 It's been a while since I looked at this, but IIRC, the name for
 CometActor is there so that you can distinguish multiple actors on the same
 page. I don't think that you share a CometActor between multiple requests. I
 think that each request gets a new CometActor that's in place as long as the
 page is active.


 Multiple requests share the same CometActor given type/name.  The
 CometActor lives until the session ends or until it times out based on its
 lifespan.



 Derek


 On Tue, Oct 6, 2009 at 1:28 PM, Jack Widman jack.wid...@gmail.comwrote:


 So if give a  CometActor a static name, say Other, then every request
 will get the same running instance of the CometActor. But if I name it
 dynamically, say with a random string, each request will get its own
 instance of the CometActor. Right?
 --
 Jack








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


 



-- 
Jack

--~--~-~--~~~---~--~~
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: execute code when browser is closed

2009-10-06 Thread Jack Widman
I didn't mean to sound like I am justifying the way I am doing. I definitely
do not have a good feel for lift yet and  it feels hackey to me too. Part of
it is I'm rushing to get a demo done at the same time I am learning lift.
Thanks for your help.

On Tue, Oct 6, 2009 at 2:04 AM, Timothy Perrett timo...@getintheloop.euwrote:

 Hey jack,

 As I said before, I think the design you have is wrong if your needing to
 code in a hacky way such as this. The way you articulate the justification
 for using shutdown almost certianly clarifies an incorrect design.

 Personally I think you could use Ajax for this an have a much simpler
 design of system... I would tend to recomend using comet when you have some
 server side state that changes and needs update client side continually.
 Kinda feel it's hammer to crack a nut here, but perhaps that's just me.

 Hope you get it sorted :-)

 Cheers, Tim

 Sent from my iPhone

 On 6 Oct 2009, at 05:25, Jack Widman jack.wid...@gmail.com wrote:

 So I am using a snippet like this
  def go:NodeSeq = {
 var term:String = S.param(term).openOr()
 lift:surround with=default at=content
 lift:comet type=JoopComet name={term}
 auth:joop/auth:joop
 /lift:comet
 /lift:surround
   }

 And the term is indeed different each time. But I am still getting the same
 results from two different browsers with different terms.

 On Tue, Oct 6, 2009 at 12:18 AM, Naftoli Gugenheim naftoli...@gmail.com
 naftoli...@gmail.com wrote:


 You are correct that Comet is a way to update information after the page
 is loaded. I think there's a simpler way using ajax, but I haven't explored
 those areas of Lift yet. But meanwhile you need to have the xml specifying
 the comet actor be dynamic. So you need to have that xml be generated by a
 snippet. A snippet is an XML to XML function.


 -
 jack jack.wid...@gmail.comjack.wid...@gmail.com wrote:


 Let me start again. Maybe I am misunderstanding when Comet should be
 used. In my application, people search for web pages. I do a lot of
 processing for each resulting page. First I just display the links and
 then as the processing is finished, the links on the page are
 automatically modified with the data I just found for each link. This
 is all working fine.

 But, the session is being shared among all users so if I make one
 search in one browser, and then make another search from another
 browser, I get the results from the first browser.

 David suggested I name each CometActor differently. That is not
 working, though maybe I am not doing it right.

 On Oct 6, 12:01 am, Naftoli Gugenheim naftoli...@gmail.com wrote:
  What do you mean?
 
  -
 
  jackjack.wid...@gmail.com wrote:
 
  i guess you meant put the snippet right in the CometActor. Ok. Now I'm
  getting it.
 
  On Oct 5, 11:46 pm, Jack Widman jack.wid...@gmail.com wrote:
 
 
 
   Sorry if this is a dumb question but in lift:comet type=Search
   name={searchString}/, what is searchString? This is in an html file.
 I am
   obviously missing something.
 
   On Mon, Oct 5, 2009 at 2:40 PM, David Pollak
feeder.of.the.be...@gmail.comfeeder.of.the.be...@gmail.comwrote:
 
On Mon, Oct 5, 2009 at 10:27 AM, Jack Widman jack.wid...@gmail.com
 wrote:
 
Understood. My intention is to send a ShutDown message to the
 CometActor
when somebody closes the browser. I need this so that when they
 visit the
page in a browser again, the CometActor is 'reset'.
 
First, there's no way to determine if the browser window is closed.
 
Second, *DO NOT* send a ShutDown message to the CometActor.  This is
 an
internal Lift piece of housekeeping.  If you do this, you will break
 stuff.
 Don't do it.  (There is a reason the message is not private, but it
 should
not be used for this purpose.)
 
CometActors can be named:
 
lift:comet type=Search name={searchString}/
 
You can then have a separate CometActor for each searchString.
  Voila...
you get what you want.  Now, how do you make then CometActor go away
 when
it's not being used anymore?
 
In your CometActor:
 override def lifespan: Box[TimeSpan] = Full(3 minutes)
 
That means if a CometActor does not appear on a page for 3 minutes,
 it's
removed from the session.  If the named CometActor is requested
 again, a new
one will be created.
 
On Mon, Oct 5, 2009 at 1:18 PM, marius d. marius.dan...@gmail.com
 wrote:
 
HTTP session termination does not equate with browser-close event.
 
Br's,
Marius
 
On Oct 5, 3:22 pm, Jack Widman jack.wid...@gmail.com wrote:
 Yes, thats what I meant. Thanks
 
 On Mon, Oct 5, 2009 at 4:10 AM, Timothy Perrett
timo...@getintheloop.euwrote:
 
  But you can do it on session termination (which is what you
 probably
  want):
 
   http://scala-tools.org/mvnsites-snapshots/liftweb/lift-webkit/scalado.
 http://scala-tools.org/mvnsites-snapshots

[Lift] Re: Help!

2009-10-06 Thread Jack Widman
Thanks David. The command I was trying to remember was deploy-war but I kept
using run-war. The names are not quite precise. run-war should be called
build-and-run-war, and deploy-war is really run-with-war. If those names
were not so horribly long, that is.

On Tue, Oct 6, 2009 at 3:05 AM, David Bernard david.bernard...@gmail.comwrote:


 To create a war :
 mvn package

 To deploy (outline), (war are bundles that need a WebApp server to run
 (eg : jetty, tomcat, glassfish, jboss,...):
 # install jetty on your server (not maven)
 ## start jetty
 ## try http://jetty.host:jetty.port/  (eg: http://127.0.0.1:8080/)
 ## stop
 # put your .war into the jetty/webapp dir
 ## start jetty
 ## try http://jetty.host:jetty.port/mywebapp (mywebapp is the basename
 of your .war, if you don't want context (mywebapp prefix, named your
 war ROOT.war)
 # optional tweak the jetty configuration (read the jetty doc)

 FYI : Tim Perret is working on solution to create standalone jar with
 jetty embedded (search in the mailing-list)

 If you don't use Comet, you could try the winstone-maven-plugin to
 create a runnable jar

 /davidB

 On Tue, Oct 6, 2009 at 05:31, jack jack.wid...@gmail.com wrote:
 
  never mind.
  deploy-war, not run-war
  (been working too hard)
 
  On Oct 5, 11:09 pm, Jack Widman jack.wid...@gmail.com wrote:
  I meant to say jetty:run-war
 
  On Mon, Oct 5, 2009 at 10:52 PM, jack jack.wid...@gmail.com wrote:
 
   Is mvn jetty:run supposed to creat the war file? I want to upload a
   war file and just run it, not create another one. How do I do that?
 
  --
  Jack
  
 

 



-- 
Jack

--~--~-~--~~~---~--~~
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] Naming CometActors

2009-10-06 Thread Jack Widman
So if give a  CometActor a static name, say Other, then every request will
get the same running instance of the CometActor. But if I name it
dynamically, say with a random string, each request will get its own
instance of the CometActor. Right?
-- 
Jack

--~--~-~--~~~---~--~~
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: maven and jetty

2009-10-06 Thread Jack Widman
I thought run uses classes and run-war uses the war. no?

On Tue, Oct 6, 2009 at 4:54 PM, MarkChance mark.cha...@gmail.com wrote:


 I use mvn -Djetty.port=8090 jetty:run
 It builds the war and then runs jetty.  If you leave it running and re-
 build the war, say in your IDE, the Jetty generally restarts
 automatically.

 HTH, Mark

 On Oct 5, 8:44 pm, Jack Widman jack.wid...@gmail.com wrote:
  Well it seems that mvn run-war is creating the war and overriding the one
 I
  just uploaded. How do I just run with a given war and not create the war.
 

 



-- 
Jack

--~--~-~--~~~---~--~~
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: maven and jetty

2009-10-06 Thread Jack Widman
I am picking up a very subtle insinuation that that question was too easy
for this forum. I agree whole heartedly. Won't do it again. My next question
is - Is P=NP?  No wait, thats not appropriate.

On Tue, Oct 6, 2009 at 5:07 PM, Timothy Perrett timo...@getintheloop.euwrote:

 Correct. :run uses the stuff under src/main/webapp vs :run-war that uses
 what is bundled in the war (surprise surprise!)

 This should all be explained in the maven-jetty-plugin docs as this is not
 something lift specific by any means.

 Cheers, Tim

 Sent from my iPhone

 On 6 Oct 2009, at 21:57, Jack Widman jack.wid...@gmail.com wrote:

 I thought run uses classes and run-war uses the war. no?

 On Tue, Oct 6, 2009 at 4:54 PM, MarkChance  mark.cha...@gmail.com
 mark.cha...@gmail.com wrote:


 I use mvn -Djetty.port=8090 jetty:run
 It builds the war and then runs jetty.  If you leave it running and re-
 build the war, say in your IDE, the Jetty generally restarts
 automatically.

 HTH, Mark

 On Oct 5, 8:44 pm, Jack Widman jack.wid...@gmail.com wrote:
  Well it seems that mvn run-war is creating the war and overriding the
 one I
  just uploaded. How do I just run with a given war and not create the
 war.
 





 --
 Jack



 



-- 
Jack

--~--~-~--~~~---~--~~
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: ShutDown and CometActor

2009-10-05 Thread Jack Widman
Actually, this is working nicely now. Thanks.

On Mon, Oct 5, 2009 at 11:46 AM, David Pollak feeder.of.the.be...@gmail.com
 wrote:

 When you send the shutdown message, oddly enough, the CometActor shuts
 down.
 You don't have to do this (in fact, don't do it).  Lift will shut the
 CometActor down automatically.


 On Sun, Oct 4, 2009 at 7:32 PM, jack jack.wid...@gmail.com wrote:


 I am sending a ShutDown message to my CometActor to end the session.
 WHen I then go back to  the CometActor, it is not working properly the
 way it did the first time. Is there anything I have to do after
 shutting down the session, or should it just work when I load the
 CometActor again?




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

 



-- 
Jack

--~--~-~--~~~---~--~~
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 share request scope data among snippets in Lift

2009-10-05 Thread Jack Widman
Why don't we make Esperanto the official Lift language?

On Mon, Oct 5, 2009 at 11:52 AM, marius d. marius.dan...@gmail.com wrote:




 On Oct 5, 6:15 pm, David Pollak feeder.of.the.be...@gmail.com wrote:
  On Sun, Oct 4, 2009 at 2:41 AM, ishiijp yoshinori.is...@gmail.com
 wrote:
 
   Thank you for your example, David.
   It will work in my purpose.
 
  Cool.
 
 
 
   It seems that my poor English and less information let some people
   confused.
 
  I appreciate that you have put in the work to translate your thoughts to
  English.  I apologize that I only speak English, but would love to speak
  Japanese, German, Russian, and a few other languages.

 oh you gotta learn Romanian :)

 
   I need just a request scope data.
   It means I want to share information between snippets across a
   request.
   (Is the expression request scope not good for in this case...?)
 
  request scope is exactly the right phrase.
 
 
 
 
 
   Thank all responsed my post,
   and your suggestions are informative.
   I think very nice community is here.
 
   On 9月26日, 午後10:33, David Pollak feeder.of.the.be...@gmail.com wrote:
To share information between snippets during a request, use a
 RequestVar:
object MyInfo extends RequestVar(calculate_value)
 
so
 
object MyInfo extends RequestVar[Box[Invoice]](Empty)
 
in one snippet, you may calculate the Invoice and put it in the
 MyInfo:
 
MyInfo.set(Full(invoice))
 
In another snippet, you can extract:
 
for {
  invoice - MyInfo.is
  } yield ...
 
Note that the calculate_value is a call-by-name parameter, so it
 will
   be
invoked each time the RequestVar is uninitialized.  You can place
 lazy
calculation logic in here.
 
On Sat, Sep 26, 2009 at 12:14 AM, ishiijp yoshinori.is...@gmail.com
 
   wrote:
 
 Hi.
 
 If my lift application have some data that cost to create, and I
 want
 to share it among snippets, how to do in Lift?
 
 if such data are shared inside one snippet, I may use lazy val.
 But I have no nice idea to share it among different snippts.
 
 Thanks much.
 
--
Lift, the simply functional web frameworkhttp://liftweb.net
Beginning Scalahttp://www.apress.com/book/view/1430219890
Follow me:http://twitter.com/dpp
Surf the harmonics
 
  --
  Lift, the simply functional web frameworkhttp://liftweb.net
  Beginning Scalahttp://www.apress.com/book/view/1430219890
  Follow me:http://twitter.com/dpp
  Surf the harmonics
 



-- 
Jack

--~--~-~--~~~---~--~~
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: execute code when browser is closed

2009-10-05 Thread Jack Widman
Understood. My intention is to send a ShutDown message to the CometActor
when somebody closes the browser. I need this so that when they visit the
page in a browser again, the CometActor is 'reset'.

On Mon, Oct 5, 2009 at 1:18 PM, marius d. marius.dan...@gmail.com wrote:


 HTTP session termination does not equate with browser-close event.

 Br's,
 Marius

 On Oct 5, 3:22 pm, Jack Widman jack.wid...@gmail.com wrote:
  Yes, thats what I meant. Thanks
 
  On Mon, Oct 5, 2009 at 4:10 AM, Timothy Perrett timo...@getintheloop.eu
 wrote:
 
 
 
 
 
   But you can do it on session termination (which is what you probably
   want):
 
  http://scala-tools.org/mvnsites-snapshots/liftweb/lift-webkit/scalado.
 ..
 
   Checkout the method:
 
   registerCleanupFunc
 
   Cheers, Tim
 
   On Oct 5, 8:54 am, Viktor Klang viktor.kl...@gmail.com wrote:
On Mon, Oct 5, 2009 at 6:50 AM, jack jack.wid...@gmail.com wrote:
 
 I would like to call a function when the browser is closed. How do
 I
 do this?
 
You cannot reliably do this.
 
--
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
 
  --
  Jack
 



-- 
Jack

--~--~-~--~~~---~--~~
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: execute code when browser is closed

2009-10-05 Thread Jack Widman
Interesting. I will try that. And I won't send any more ShutDownMessages :)
Though I should add that each CometActor is doing a lot of processing. So I
it would be good if I could shut one down somehow when the user searches on
a new term. Timeout won't work because there is no way to know how long it
will take.

Maybe I could just kill all the actors directly that are doing the
processing.

On Mon, Oct 5, 2009 at 2:40 PM, David Pollak
feeder.of.the.be...@gmail.comwrote:



 On Mon, Oct 5, 2009 at 10:27 AM, Jack Widman jack.wid...@gmail.comwrote:

 Understood. My intention is to send a ShutDown message to the CometActor
 when somebody closes the browser. I need this so that when they visit the
 page in a browser again, the CometActor is 'reset'.


 First, there's no way to determine if the browser window is closed.

 Second, *DO NOT* send a ShutDown message to the CometActor.  This is an
 internal Lift piece of housekeeping.  If you do this, you will break stuff.
  Don't do it.  (There is a reason the message is not private, but it should
 not be used for this purpose.)

 CometActors can be named:

 lift:comet type=Search name={searchString}/

 You can then have a separate CometActor for each searchString.  Voila...
 you get what you want.  Now, how do you make then CometActor go away when
 it's not being used anymore?

 In your CometActor:
  override def lifespan: Box[TimeSpan] = Full(3 minutes)

 That means if a CometActor does not appear on a page for 3 minutes, it's
 removed from the session.  If the named CometActor is requested again, a new
 one will be created.




 On Mon, Oct 5, 2009 at 1:18 PM, marius d. marius.dan...@gmail.comwrote:


 HTTP session termination does not equate with browser-close event.

 Br's,
 Marius

 On Oct 5, 3:22 pm, Jack Widman jack.wid...@gmail.com wrote:
  Yes, thats what I meant. Thanks
 
  On Mon, Oct 5, 2009 at 4:10 AM, Timothy Perrett
 timo...@getintheloop.euwrote:
 
 
 
 
 
   But you can do it on session termination (which is what you probably
   want):
 
  
 http://scala-tools.org/mvnsites-snapshots/liftweb/lift-webkit/scalado...
 
   Checkout the method:
 
   registerCleanupFunc
 
   Cheers, Tim
 
   On Oct 5, 8:54 am, Viktor Klang viktor.kl...@gmail.com wrote:
On Mon, Oct 5, 2009 at 6:50 AM, jack jack.wid...@gmail.com
 wrote:
 
 I would like to call a function when the browser is closed. How
 do I
 do this?
 
You cannot reliably do this.
 
--
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
 
  --
  Jack




 --
 Jack





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


 



-- 
Jack

--~--~-~--~~~---~--~~
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: execute code when browser is closed

2009-10-05 Thread Jack Widman
In my app, when the user is done searching on one keyword, they click a link
which takes them back to the main search page. Thats the time when I wanted
the CometActor to stop. Otherwise there will be too many threads floating
around and performance will suffer.

On Mon, Oct 5, 2009 at 2:50 PM, David Pollak
feeder.of.the.be...@gmail.comwrote:



 On Mon, Oct 5, 2009 at 11:45 AM, Jack Widman jack.wid...@gmail.comwrote:

 Interesting. I will try that. And I won't send any more ShutDownMessages
 :)
 Though I should add that each CometActor is doing a lot of processing. So
 I it would be good if I could shut one down somehow when the user searches
 on a new term. Timeout won't work because there is no way to know how long
 it will take.

 Maybe I could just kill all the actors directly that are doing the
 processing.


 That's going to be even worse.  You'll kill something out from under
 Lift... it's going to cause a huge pile of pain.

 You can remove an Actor from the session and that will cause ShutDown to be
 sent to it, but depending on how the Actor was written it's not going to
 stop processing its mailbox.

 Bottom line... there's no way to tell if a user is not looking at a page
 with an Actor anymore.  The best way to deal with that is timing the Actor
 out.  It's going to take time (your timeout period), but it's the best way
 to do it.



 On Mon, Oct 5, 2009 at 2:40 PM, David Pollak 
 feeder.of.the.be...@gmail.com wrote:



 On Mon, Oct 5, 2009 at 10:27 AM, Jack Widman jack.wid...@gmail.comwrote:

 Understood. My intention is to send a ShutDown message to the CometActor
 when somebody closes the browser. I need this so that when they visit the
 page in a browser again, the CometActor is 'reset'.


 First, there's no way to determine if the browser window is closed.

 Second, *DO NOT* send a ShutDown message to the CometActor.  This is an
 internal Lift piece of housekeeping.  If you do this, you will break stuff.
  Don't do it.  (There is a reason the message is not private, but it should
 not be used for this purpose.)

 CometActors can be named:

 lift:comet type=Search name={searchString}/

 You can then have a separate CometActor for each searchString.  Voila...
 you get what you want.  Now, how do you make then CometActor go away when
 it's not being used anymore?

 In your CometActor:
  override def lifespan: Box[TimeSpan] = Full(3 minutes)

 That means if a CometActor does not appear on a page for 3 minutes, it's
 removed from the session.  If the named CometActor is requested again, a new
 one will be created.




 On Mon, Oct 5, 2009 at 1:18 PM, marius d. marius.dan...@gmail.comwrote:


 HTTP session termination does not equate with browser-close event.

 Br's,
 Marius

 On Oct 5, 3:22 pm, Jack Widman jack.wid...@gmail.com wrote:
  Yes, thats what I meant. Thanks
 
  On Mon, Oct 5, 2009 at 4:10 AM, Timothy Perrett
 timo...@getintheloop.euwrote:
 
 
 
 
 
   But you can do it on session termination (which is what you
 probably
   want):
 
  
 http://scala-tools.org/mvnsites-snapshots/liftweb/lift-webkit/scalado.
 ..
 
   Checkout the method:
 
   registerCleanupFunc
 
   Cheers, Tim
 
   On Oct 5, 8:54 am, Viktor Klang viktor.kl...@gmail.com wrote:
On Mon, Oct 5, 2009 at 6:50 AM, jack jack.wid...@gmail.com
 wrote:
 
 I would like to call a function when the browser is closed. How
 do I
 do this?
 
You cannot reliably do this.
 
--
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
 
  --
  Jack




 --
 Jack





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






 --
 Jack





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

 



-- 
Jack

--~--~-~--~~~---~--~~
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: execute code when browser is closed

2009-10-05 Thread Jack Widman
Because when the users searches on a new keyword, the actors that were
processing the results for the last keyword are still processing (some of
them). But I can just send each of those a message to stop processing,  no?
No problem with that, right?

On Mon, Oct 5, 2009 at 3:02 PM, David Pollak
feeder.of.the.be...@gmail.comwrote:



 On Mon, Oct 5, 2009 at 11:53 AM, Jack Widman jack.wid...@gmail.comwrote:

 In my app, when the user is done searching on one keyword, they click a
 link which takes them back to the main search page. Thats the time when I
 wanted the CometActor to stop. Otherwise there will be too many threads
 floating around and performance will suffer.


 Why?  Actors do not consume threads, they consume memory unless they are
 actively processing a message.




 On Mon, Oct 5, 2009 at 2:50 PM, David Pollak 
 feeder.of.the.be...@gmail.com wrote:



 On Mon, Oct 5, 2009 at 11:45 AM, Jack Widman jack.wid...@gmail.comwrote:

 Interesting. I will try that. And I won't send any more ShutDownMessages
 :)
 Though I should add that each CometActor is doing a lot of processing.
 So I it would be good if I could shut one down somehow when the user
 searches on a new term. Timeout won't work because there is no way to know
 how long it will take.

 Maybe I could just kill all the actors directly that are doing the
 processing.


 That's going to be even worse.  You'll kill something out from under
 Lift... it's going to cause a huge pile of pain.

 You can remove an Actor from the session and that will cause ShutDown to
 be sent to it, but depending on how the Actor was written it's not going to
 stop processing its mailbox.

 Bottom line... there's no way to tell if a user is not looking at a page
 with an Actor anymore.  The best way to deal with that is timing the Actor
 out.  It's going to take time (your timeout period), but it's the best way
 to do it.



 On Mon, Oct 5, 2009 at 2:40 PM, David Pollak 
 feeder.of.the.be...@gmail.com wrote:



 On Mon, Oct 5, 2009 at 10:27 AM, Jack Widman jack.wid...@gmail.comwrote:

 Understood. My intention is to send a ShutDown message to the
 CometActor when somebody closes the browser. I need this so that when 
 they
 visit the page in a browser again, the CometActor is 'reset'.


 First, there's no way to determine if the browser window is closed.

 Second, *DO NOT* send a ShutDown message to the CometActor.  This is an
 internal Lift piece of housekeeping.  If you do this, you will break 
 stuff.
  Don't do it.  (There is a reason the message is not private, but it 
 should
 not be used for this purpose.)

 CometActors can be named:

 lift:comet type=Search name={searchString}/

 You can then have a separate CometActor for each searchString.
  Voila... you get what you want.  Now, how do you make then CometActor go
 away when it's not being used anymore?

 In your CometActor:
  override def lifespan: Box[TimeSpan] = Full(3 minutes)

 That means if a CometActor does not appear on a page for 3 minutes,
 it's removed from the session.  If the named CometActor is requested 
 again,
 a new one will be created.




 On Mon, Oct 5, 2009 at 1:18 PM, marius d. marius.dan...@gmail.comwrote:


 HTTP session termination does not equate with browser-close event.

 Br's,
 Marius

 On Oct 5, 3:22 pm, Jack Widman jack.wid...@gmail.com wrote:
  Yes, thats what I meant. Thanks
 
  On Mon, Oct 5, 2009 at 4:10 AM, Timothy Perrett
 timo...@getintheloop.euwrote:
 
 
 
 
 
   But you can do it on session termination (which is what you
 probably
   want):
 
  
 http://scala-tools.org/mvnsites-snapshots/liftweb/lift-webkit/scalado.
 ..
 
   Checkout the method:
 
   registerCleanupFunc
 
   Cheers, Tim
 
   On Oct 5, 8:54 am, Viktor Klang viktor.kl...@gmail.com wrote:
On Mon, Oct 5, 2009 at 6:50 AM, jack jack.wid...@gmail.com
 wrote:
 
 I would like to call a function when the browser is closed.
 How do I
 do this?
 
You cannot reliably do this.
 
--
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
 
  --
  Jack




 --
 Jack





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






 --
 Jack





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





 --
 Jack





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

 



-- 
Jack

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group

[Lift] Re: execute code when browser is closed

2009-10-05 Thread Jack Widman
Good. Only thing is that if their job was to start an actor to go out and
search some pages, say, then 'stop your job' means '   'call your 'exit'
method, no?Not trying to be a wise guy. I actually have a number of VCs
lined up to look at my app. Overall I am very glad to be using Lift. On the
Comet alone it save me a LOT of time.
Of course, I  have a lot to learn.

On Mon, Oct 5, 2009 at 3:08 PM, David Pollak
feeder.of.the.be...@gmail.comwrote:



 On Mon, Oct 5, 2009 at 12:06 PM, Jack Widman jack.wid...@gmail.comwrote:

 Because when the users searches on a new keyword, the actors that were
 processing the results for the last keyword are still processing (some of
 them). But I can just send each of those a message to stop processing,  no?
 No problem with that, right?


 Sure... send them a message that says tell all your jobs to stop.  This
 has nothing to do with the CometActor lifecycle.  It is all your application
 level stuff.




 On Mon, Oct 5, 2009 at 3:02 PM, David Pollak 
 feeder.of.the.be...@gmail.com wrote:



 On Mon, Oct 5, 2009 at 11:53 AM, Jack Widman jack.wid...@gmail.comwrote:

 In my app, when the user is done searching on one keyword, they click a
 link which takes them back to the main search page. Thats the time when I
 wanted the CometActor to stop. Otherwise there will be too many threads
 floating around and performance will suffer.


 Why?  Actors do not consume threads, they consume memory unless they are
 actively processing a message.




 On Mon, Oct 5, 2009 at 2:50 PM, David Pollak 
 feeder.of.the.be...@gmail.com wrote:



 On Mon, Oct 5, 2009 at 11:45 AM, Jack Widman jack.wid...@gmail.comwrote:

 Interesting. I will try that. And I won't send any more
 ShutDownMessages :)
 Though I should add that each CometActor is doing a lot of processing.
 So I it would be good if I could shut one down somehow when the user
 searches on a new term. Timeout won't work because there is no way to 
 know
 how long it will take.

 Maybe I could just kill all the actors directly that are doing the
 processing.


 That's going to be even worse.  You'll kill something out from under
 Lift... it's going to cause a huge pile of pain.

 You can remove an Actor from the session and that will cause ShutDown
 to be sent to it, but depending on how the Actor was written it's not 
 going
 to stop processing its mailbox.

 Bottom line... there's no way to tell if a user is not looking at a
 page with an Actor anymore.  The best way to deal with that is timing the
 Actor out.  It's going to take time (your timeout period), but it's the 
 best
 way to do it.



 On Mon, Oct 5, 2009 at 2:40 PM, David Pollak 
 feeder.of.the.be...@gmail.com wrote:



 On Mon, Oct 5, 2009 at 10:27 AM, Jack Widman 
 jack.wid...@gmail.comwrote:

 Understood. My intention is to send a ShutDown message to the
 CometActor when somebody closes the browser. I need this so that when 
 they
 visit the page in a browser again, the CometActor is 'reset'.


 First, there's no way to determine if the browser window is closed.

 Second, *DO NOT* send a ShutDown message to the CometActor.  This is
 an internal Lift piece of housekeeping.  If you do this, you will break
 stuff.  Don't do it.  (There is a reason the message is not private, 
 but it
 should not be used for this purpose.)

 CometActors can be named:

 lift:comet type=Search name={searchString}/

 You can then have a separate CometActor for each searchString.
  Voila... you get what you want.  Now, how do you make then CometActor 
 go
 away when it's not being used anymore?

 In your CometActor:
  override def lifespan: Box[TimeSpan] = Full(3 minutes)

 That means if a CometActor does not appear on a page for 3 minutes,
 it's removed from the session.  If the named CometActor is requested 
 again,
 a new one will be created.




 On Mon, Oct 5, 2009 at 1:18 PM, marius d. 
 marius.dan...@gmail.comwrote:


 HTTP session termination does not equate with browser-close event.

 Br's,
 Marius

 On Oct 5, 3:22 pm, Jack Widman jack.wid...@gmail.com wrote:
  Yes, thats what I meant. Thanks
 
  On Mon, Oct 5, 2009 at 4:10 AM, Timothy Perrett
 timo...@getintheloop.euwrote:
 
 
 
 
 
   But you can do it on session termination (which is what you
 probably
   want):
 
  
 http://scala-tools.org/mvnsites-snapshots/liftweb/lift-webkit/scalado.
 ..
 
   Checkout the method:
 
   registerCleanupFunc
 
   Cheers, Tim
 
   On Oct 5, 8:54 am, Viktor Klang viktor.kl...@gmail.com
 wrote:
On Mon, Oct 5, 2009 at 6:50 AM, jack jack.wid...@gmail.com
 wrote:
 
 I would like to call a function when the browser is closed.
 How do I
 do this?
 
You cannot reliably do this.
 
--
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
 
  --
  Jack




 --
 Jack





 --
 Lift, the simply

[Lift] Re: How to share request scope data among snippets in Lift

2009-10-05 Thread Jack Widman
Well it is high enough level! [?]

On Mon, Oct 5, 2009 at 3:49 PM, Viktor Klang viktor.kl...@gmail.com wrote:



 On Mon, Oct 5, 2009 at 6:02 PM, Jack Widman jack.wid...@gmail.com wrote:

 Why don't we make Esperanto the official Lift language?


 I'd say make Scala the official language ;)



 On Mon, Oct 5, 2009 at 11:52 AM, marius d. marius.dan...@gmail.comwrote:




 On Oct 5, 6:15 pm, David Pollak feeder.of.the.be...@gmail.com wrote:
  On Sun, Oct 4, 2009 at 2:41 AM, ishiijp yoshinori.is...@gmail.com
 wrote:
 
   Thank you for your example, David.
   It will work in my purpose.
 
  Cool.
 
 
 
   It seems that my poor English and less information let some people
   confused.
 
  I appreciate that you have put in the work to translate your thoughts
 to
  English.  I apologize that I only speak English, but would love to
 speak
  Japanese, German, Russian, and a few other languages.

 oh you gotta learn Romanian :)

 
   I need just a request scope data.
   It means I want to share information between snippets across a
   request.
   (Is the expression request scope not good for in this case...?)
 
  request scope is exactly the right phrase.
 
 
 
 
 
   Thank all responsed my post,
   and your suggestions are informative.
   I think very nice community is here.
 
   On 9月26日, 午後10:33, David Pollak feeder.of.the.be...@gmail.com
 wrote:
To share information between snippets during a request, use a
 RequestVar:
object MyInfo extends RequestVar(calculate_value)
 
so
 
object MyInfo extends RequestVar[Box[Invoice]](Empty)
 
in one snippet, you may calculate the Invoice and put it in the
 MyInfo:
 
MyInfo.set(Full(invoice))
 
In another snippet, you can extract:
 
for {
  invoice - MyInfo.is
  } yield ...
 
Note that the calculate_value is a call-by-name parameter, so it
 will
   be
invoked each time the RequestVar is uninitialized.  You can place
 lazy
calculation logic in here.
 
On Sat, Sep 26, 2009 at 12:14 AM, ishiijp 
 yoshinori.is...@gmail.com
   wrote:
 
 Hi.
 
 If my lift application have some data that cost to create, and I
 want
 to share it among snippets, how to do in Lift?
 
 if such data are shared inside one snippet, I may use lazy val.
 But I have no nice idea to share it among different snippts.
 
 Thanks much.
 
--
Lift, the simply functional web frameworkhttp://liftweb.net
Beginning Scalahttp://www.apress.com/book/view/1430219890
Follow me:http://twitter.com/dpp
Surf the harmonics
 
  --
  Lift, the simply functional web frameworkhttp://liftweb.net
  Beginning Scalahttp://www.apress.com/book/view/1430219890
  Follow me:http://twitter.com/dpp
  Surf the harmonics




 --
 Jack






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


 



-- 
Jack

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

inline: 330.gif

[Lift] Re: How to share request scope data among snippets in Lift

2009-10-05 Thread Jack Widman
I'm not sure English is Turing Complete. Also not sure how prominent it will
be in 50 years ... :)

On Mon, Oct 5, 2009 at 5:51 PM, David Pollak
feeder.of.the.be...@gmail.comwrote:



 On Mon, Oct 5, 2009 at 9:35 AM, Timothy Perrett 
 timo...@getintheloop.euwrote:


 Call me old fashioned, but good ol' English seems to be quite
 prevalent these days ;-)


 Is this the Queen's English? ;-)



 On 5 Oct 2009, at 17:02, Jack Widman wrote:

  Why don't we make Esperanto the official Lift language?






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

 



-- 
Jack

--~--~-~--~~~---~--~~
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: maven and jetty

2009-10-05 Thread Jack Widman
Well it seems that mvn run-war is creating the war and overriding the one I
just uploaded. How do I just run with a given war and not create the war.

On Mon, Oct 5, 2009 at 10:37 PM, Ryan Stradling ryanstradl...@gmail.comwrote:


 Have you verified another server is not running on that port?

 Have you tried http://url:80/name of app   Just to see if that works

 Sent from my iPhone

 On Oct 5, 2009, at 10:12 PM, jack jack.wid...@gmail.com wrote:

 
  I have been working locally for a long time and I seem to have
  forgotten how to deploy and run a war on Jetty!
 
  I am ftping the war to my server and putting it in the target
  directory.
 
  I then run mvn jetty:run-war -Djetty.port=80 and I keep getting the
  default app.
 
  What am I doing wrong?
  

 



-- 
Jack

--~--~-~--~~~---~--~~
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: Help!

2009-10-05 Thread Jack Widman
I meant to say jetty:run-war

On Mon, Oct 5, 2009 at 10:52 PM, jack jack.wid...@gmail.com wrote:


 Is mvn jetty:run supposed to creat the war file? I want to upload a
 war file and just run it, not create another one. How do I do that?
 



-- 
Jack

--~--~-~--~~~---~--~~
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: execute code when browser is closed

2009-10-05 Thread Jack Widman
Sorry if this is a dumb question but in lift:comet type=Search
name={searchString}/, what is searchString? This is in an html file. I am
obviously missing something.

On Mon, Oct 5, 2009 at 2:40 PM, David Pollak
feeder.of.the.be...@gmail.comwrote:



 On Mon, Oct 5, 2009 at 10:27 AM, Jack Widman jack.wid...@gmail.comwrote:

 Understood. My intention is to send a ShutDown message to the CometActor
 when somebody closes the browser. I need this so that when they visit the
 page in a browser again, the CometActor is 'reset'.


 First, there's no way to determine if the browser window is closed.

 Second, *DO NOT* send a ShutDown message to the CometActor.  This is an
 internal Lift piece of housekeeping.  If you do this, you will break stuff.
  Don't do it.  (There is a reason the message is not private, but it should
 not be used for this purpose.)

 CometActors can be named:

 lift:comet type=Search name={searchString}/

 You can then have a separate CometActor for each searchString.  Voila...
 you get what you want.  Now, how do you make then CometActor go away when
 it's not being used anymore?

 In your CometActor:
  override def lifespan: Box[TimeSpan] = Full(3 minutes)

 That means if a CometActor does not appear on a page for 3 minutes, it's
 removed from the session.  If the named CometActor is requested again, a new
 one will be created.




 On Mon, Oct 5, 2009 at 1:18 PM, marius d. marius.dan...@gmail.comwrote:


 HTTP session termination does not equate with browser-close event.

 Br's,
 Marius

 On Oct 5, 3:22 pm, Jack Widman jack.wid...@gmail.com wrote:
  Yes, thats what I meant. Thanks
 
  On Mon, Oct 5, 2009 at 4:10 AM, Timothy Perrett
 timo...@getintheloop.euwrote:
 
 
 
 
 
   But you can do it on session termination (which is what you probably
   want):
 
  
 http://scala-tools.org/mvnsites-snapshots/liftweb/lift-webkit/scalado...
 
   Checkout the method:
 
   registerCleanupFunc
 
   Cheers, Tim
 
   On Oct 5, 8:54 am, Viktor Klang viktor.kl...@gmail.com wrote:
On Mon, Oct 5, 2009 at 6:50 AM, jack jack.wid...@gmail.com
 wrote:
 
 I would like to call a function when the browser is closed. How
 do I
 do this?
 
You cannot reliably do this.
 
--
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
 
  --
  Jack




 --
 Jack





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


 



-- 
Jack

--~--~-~--~~~---~--~~
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: execute code when browser is closed

2009-10-05 Thread Jack Widman
So I am using a snippet like this
 def go:NodeSeq = {
var term:String = S.param(term).openOr()
lift:surround with=default at=content
lift:comet type=JoopComet name={term}
auth:joop/auth:joop
/lift:comet
/lift:surround
  }

And the term is indeed different each time. But I am still getting the same
results from two different browsers with different terms.

On Tue, Oct 6, 2009 at 12:18 AM, Naftoli Gugenheim naftoli...@gmail.comwrote:


 You are correct that Comet is a way to update information after the page is
 loaded. I think there's a simpler way using ajax, but I haven't explored
 those areas of Lift yet. But meanwhile you need to have the xml specifying
 the comet actor be dynamic. So you need to have that xml be generated by a
 snippet. A snippet is an XML to XML function.


 -
 jackjack.wid...@gmail.com wrote:


 Let me start again. Maybe I am misunderstanding when Comet should be
 used. In my application, people search for web pages. I do a lot of
 processing for each resulting page. First I just display the links and
 then as the processing is finished, the links on the page are
 automatically modified with the data I just found for each link. This
 is all working fine.

 But, the session is being shared among all users so if I make one
 search in one browser, and then make another search from another
 browser, I get the results from the first browser.

 David suggested I name each CometActor differently. That is not
 working, though maybe I am not doing it right.

 On Oct 6, 12:01 am, Naftoli Gugenheim naftoli...@gmail.com wrote:
  What do you mean?
 
  -
 
  jackjack.wid...@gmail.com wrote:
 
  i guess you meant put the snippet right in the CometActor. Ok. Now I'm
  getting it.
 
  On Oct 5, 11:46 pm, Jack Widman jack.wid...@gmail.com wrote:
 
 
 
   Sorry if this is a dumb question but in lift:comet type=Search
   name={searchString}/, what is searchString? This is in an html file. I
 am
   obviously missing something.
 
   On Mon, Oct 5, 2009 at 2:40 PM, David Pollak
   feeder.of.the.be...@gmail.comwrote:
 
On Mon, Oct 5, 2009 at 10:27 AM, Jack Widman jack.wid...@gmail.com
 wrote:
 
Understood. My intention is to send a ShutDown message to the
 CometActor
when somebody closes the browser. I need this so that when they
 visit the
page in a browser again, the CometActor is 'reset'.
 
First, there's no way to determine if the browser window is closed.
 
Second, *DO NOT* send a ShutDown message to the CometActor.  This is
 an
internal Lift piece of housekeeping.  If you do this, you will break
 stuff.
 Don't do it.  (There is a reason the message is not private, but it
 should
not be used for this purpose.)
 
CometActors can be named:
 
lift:comet type=Search name={searchString}/
 
You can then have a separate CometActor for each searchString.
  Voila...
you get what you want.  Now, how do you make then CometActor go away
 when
it's not being used anymore?
 
In your CometActor:
 override def lifespan: Box[TimeSpan] = Full(3 minutes)
 
That means if a CometActor does not appear on a page for 3 minutes,
 it's
removed from the session.  If the named CometActor is requested
 again, a new
one will be created.
 
On Mon, Oct 5, 2009 at 1:18 PM, marius d. marius.dan...@gmail.com
 wrote:
 
HTTP session termination does not equate with browser-close event.
 
Br's,
Marius
 
On Oct 5, 3:22 pm, Jack Widman jack.wid...@gmail.com wrote:
 Yes, thats what I meant. Thanks
 
 On Mon, Oct 5, 2009 at 4:10 AM, Timothy Perrett
timo...@getintheloop.euwrote:
 
  But you can do it on session termination (which is what you
 probably
  want):
 
   
 http://scala-tools.org/mvnsites-snapshots/liftweb/lift-webkit/scalado...
 
  Checkout the method:
 
  registerCleanupFunc
 
  Cheers, Tim
 
  On Oct 5, 8:54 am, Viktor Klang viktor.kl...@gmail.com
 wrote:
   On Mon, Oct 5, 2009 at 6:50 AM, jack jack.wid...@gmail.com
wrote:
 
I would like to call a function when the browser is closed.
 How
do I
do this?
 
   You cannot reliably do this.
 
   --
   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
 
 --
 Jack
 
--
Jack
 
--
Lift, the simply functional web frameworkhttp://liftweb.net
Beginning Scalahttp://www.apress.com/book/view/1430219890
Follow me:http://twitter.com/dpp
Surf the harmonics
 
   --
   Jack


 



-- 
Jack

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

[Lift] Re: a very simple question

2009-10-04 Thread Jack Widman
Well my app is a search application. You search for certain web pages and I
do some processing after the results are displayed. Thats why I am using
Comet. Certain information is added to each result link.
I want the user to be able to either hit the back button or click on alink
that goes to the search page again. When they enter a search term and click
submit, I want to load the CometActor class again.

Do you think sending a ShutDown message will accomplish this?
After the session is killed, how do I get the CometActor to automatically
load again. Do I send the message and then redirect to the page?

I am just not comfortable yet with the mechanics of how Lift handles comet.
Thanks in advance.

Jack


On Sun, Oct 4, 2009 at 6:50 PM, Timothy Perrett timo...@getintheloop.euwrote:


 If memory serves, the comet actor lives on in the session scope until
 its either sent the ShutDown message explicitly, or it times out (you
 can set the timeout).

 Does that help?

 Cheers, Tim

 On 4 Oct 2009, at 23:17, jack wrote:

 
  I put the line
 
  println(dude)
 
  in a Comet class write under the class declaration.
 
  i.e.
 
  class JoopComet extends CometActor with CometListenee {
 
  println(INSIDE COMET CLASS)
 
 
  When the class runs and all the activity is complete, I hit the back
  button and that loads the JoopComet class again.
 
  But I do not see dude printed.
 
  Why not?
  
 


 



-- 
Jack

--~--~-~--~~~---~--~~
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: CometActor timeout problem

2009-10-01 Thread Jack Widman
Thanks Atsuhiko very much. I really appreciate your effort and this helps
alot.
Jack

On Thu, Oct 1, 2009 at 4:11 AM, Atsuhiko Yamanaka 
atsuhiko.yaman...@gmail.com wrote:

 Hi,

 On Thu, Oct 1, 2009 at 1:11 PM, Jack Widman jack.wid...@gmail.com wrote:
  David,
  I have attached a (non) working example. It compiles and runs and does a
  part of what I want it to do but not completely. It first displays a
 couple
  of links and the link body for both links is just 0. It then spawns a
 couple
  of threads each of which generates a random number and then   puts two
 Page
  objects on a PageQueue. The comet page is supposed to reRender the screen
  whenever a new page object is added to the Queue. Before it does this it
  calls a method called insertRandomNumber which changes the zero to some
  random value.
  There is not much code and i think its pretty self-explanatory. The html
  page is test.html.
  I really do appreciate your help and understand if you can't go through
 the
  whole thing.

 Frankly to say, I could not understand the internal logic, and it
 seems it has be broken,
 but attached modified src.zip will work as the demonstration of
 CometActor at least.
  * JoopComet implements CometListenee
  * TSGetterLauncer has been rewritten, and will start TSGetters in
 every 3 seconds.
The previous version has really short life.
  * TSCatcher implements ListenerManager.
  * url links on the web page will be updated in every 3 seconds.


 Sincerely,
 --
 Atsuhiko Yamanaka
 JCraft,Inc.
 1-14-20 HONCHO AOBA-KU,
 SENDAI, MIYAGI 980-0014 Japan.
 Tel +81-22-723-2150
+1-415-578-3454
 Skype callto://jcraft/

 


--~--~-~--~~~---~--~~
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: CometActor timeout problem

2009-10-01 Thread Jack Widman
Atsuhiko,
How would I make one small change? I would like each link to refresh only
once and I would like that to happen as soon as the TSCatcher objects catch
a package. Thanks in advance.

Jack

On Thu, Oct 1, 2009 at 4:11 AM, Atsuhiko Yamanaka 
atsuhiko.yaman...@gmail.com wrote:

 Hi,

 On Thu, Oct 1, 2009 at 1:11 PM, Jack Widman jack.wid...@gmail.com wrote:
  David,
  I have attached a (non) working example. It compiles and runs and does a
  part of what I want it to do but not completely. It first displays a
 couple
  of links and the link body for both links is just 0. It then spawns a
 couple
  of threads each of which generates a random number and then   puts two
 Page
  objects on a PageQueue. The comet page is supposed to reRender the screen
  whenever a new page object is added to the Queue. Before it does this it
  calls a method called insertRandomNumber which changes the zero to some
  random value.
  There is not much code and i think its pretty self-explanatory. The html
  page is test.html.
  I really do appreciate your help and understand if you can't go through
 the
  whole thing.

 Frankly to say, I could not understand the internal logic, and it
 seems it has be broken,
 but attached modified src.zip will work as the demonstration of
 CometActor at least.
  * JoopComet implements CometListenee
  * TSGetterLauncer has been rewritten, and will start TSGetters in
 every 3 seconds.
The previous version has really short life.
  * TSCatcher implements ListenerManager.
  * url links on the web page will be updated in every 3 seconds.


 Sincerely,
 --
 Atsuhiko Yamanaka
 JCraft,Inc.
 1-14-20 HONCHO AOBA-KU,
 SENDAI, MIYAGI 980-0014 Japan.
 Tel +81-22-723-2150
+1-415-578-3454
 Skype callto://jcraft/

 


--~--~-~--~~~---~--~~
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: CometActor timeout problem

2009-10-01 Thread Jack Widman
Thanks so much Atsuhiko. You are very kind.

On Thu, Oct 1, 2009 at 11:01 AM, Atsuhiko Yamanaka 
atsuhiko.yaman...@gmail.com wrote:

 Hi,

 On Thu, Oct 1, 2009 at 9:42 PM, Jack Widman jack.wid...@gmail.com wrote:
  Atsuhiko,
  How would I make one small change? I would like each link to refresh only
  once and I would like that to happen as soon as the TSCatcher objects
 catch
  a package. Thanks in advance.

 How about the attached src.zip?
 It will refresh each links only once.
 A package will be sent from JoopComet#localSetup and
 that method will be invoked only once during the life of JoopComet.
 This means that even if you leave test.html page and re-vist there,
 that method will not be invoked again.


 Sincerely,
 --
 Atsuhiko Yamanaka
 JCraft,Inc.
 1-14-20 HONCHO AOBA-KU,
 SENDAI, MIYAGI 980-0014 Japan.
 Tel +81-22-723-2150
+1-415-578-3454
 Skype callto://jcraft

 


--~--~-~--~~~---~--~~
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: CometActor timeout problem

2009-09-18 Thread Jack Widman
Yes, the page never gets rendered. I am actually using Actors. I will post a
code example tonight. Thanks for your response.

On Fri, Sep 18, 2009 at 12:09 PM, marius d. marius.dan...@gmail.com wrote:




 On Sep 17, 11:09 pm, jack jack.wid...@gmail.com wrote:
  I have a CometActor which displays a list of urls and at the same time
  launches a bunch of threads each of which gets information about the
  urls and then puts messages about that information in a Queue. On each
  new tick, the CometActor checks the queue and updates its urls.
 
  The problem is that I am launching the threads from the CometActor and
  the page is never coming back. It times out.

 So the page never gets rendered? I would recommend using actors and
 not really threads but even with threads it shouldn't impact you. But
 it also depends on what your code does. Can you post a minimalistic
 example?

 
  Is there some general principle about launching threads from a
  CometActor that might explain this behavior?
 


--~--~-~--~~~---~--~~
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: trouble with comet Clock example

2009-09-15 Thread Jack Widman
The package is correct. Here is the error
XML parsing failed: syntax error (Line: 13, Character: 4)

Reparse document as HTML
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(com.authoritude.snippet.Clock) name:
Full(Other) Not Found --
 13: clk:timeMissing Clock/clk:time
 14:
 15:
 16:   script type=text/javascript
I tried it both with the full class name and just Clock. I get the same
error in both cases.
Its seems to be saying clk is an undeclared namespace?


On Tue, Sep 15, 2009 at 4:46 AM, Timothy Perrett timo...@getintheloop.euwrote:


 Its telling you that the class Clock could not be found - if i were
 you, check the package definitions on the clock class to make sure its
 in the right namespace.

 Cheers, Tim

 On Sep 15, 3:38 am, jack jack.wid...@gmail.com wrote:
  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
-~--~~~~--~~--~--~---



[Lift] Re: trouble with comet Clock example

2009-09-15 Thread Jack Widman
Here is the complete code for my Clock example
*class*

import scala.xml._
import net.liftweb.http.S
import net.liftweb.http.CometActor
import net.liftweb.http.SessionVar
import net.liftweb.util._
import _root_.scala.xml._
import _root_.net.liftweb.util.Helpers._
import scala.actors._




class Clock extends CometActor {
  override def defaultPrefix = Full(clk)

  def render = bind(time - timeSpan)

  def timeSpan = (span id=time{timeNow}/span)

  ActorPing.schedule(this, Tick, 1L)

  override def lowPriority :
  PartialFunction[Any, Unit] = {
case Tick = {
  partialUpdate(SetHtml(time,
Text(timeNow.toString)))
  ActorPing.schedule(this,Tick, 1L)
}
  }
}

case object Tick

*markup - (I have also tried it with just *type=Clock since the package is
in my Boot class)

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


On Tue, Sep 15, 2009 at 8:25 AM, Jack Widman jack.wid...@gmail.com wrote:

 The package is correct. Here is the error
 XML parsing failed: syntax error (Line: 13, Character: 4)

 Reparse document as HTML
 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(com.authoritude.snippet.Clock) name:
 Full(Other) Not Found --
  13: clk:timeMissing Clock/clk:time
  14:
  15:
  16:   script type=text/javascript
 I tried it both with the full class name and just Clock. I get the same
 error in both cases.
 Its seems to be saying clk is an undeclared namespace?


 On Tue, Sep 15, 2009 at 4:46 AM, Timothy Perrett 
 timo...@getintheloop.euwrote:


 Its telling you that the class Clock could not be found - if i were
 you, check the package definitions on the clock class to make sure its
 in the right namespace.

 Cheers, Tim

 On Sep 15, 3:38 am, jack jack.wid...@gmail.com wrote:
  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
-~--~~~~--~~--~--~---



[Lift] Re: trouble with comet Clock example

2009-09-15 Thread Jack Widman
And here is the error again:
Error!
XML parsing failed

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

Reparse document as HTML
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(com.authoritude.snippet.Clock) name:
Full(Other) Not Found --
 13: clk:timeMissing Clock/clk:time
 14:
 15:
 16:   script type=text/javascript

On Tue, Sep 15, 2009 at 8:32 AM, Jack Widman jack.wid...@gmail.com wrote:

 Here is the complete code for my Clock example
 *class*

 import scala.xml._
 import net.liftweb.http.S
 import net.liftweb.http.CometActor
 import net.liftweb.http.SessionVar
 import net.liftweb.util._
 import _root_.scala.xml._
 import _root_.net.liftweb.util.Helpers._
 import scala.actors._




 class Clock extends CometActor {
   override def defaultPrefix = Full(clk)

   def render = bind(time - timeSpan)

   def timeSpan = (span id=time{timeNow}/span)

   ActorPing.schedule(this, Tick, 1L)

   override def lowPriority :
   PartialFunction[Any, Unit] = {
 case Tick = {
   partialUpdate(SetHtml(time,
 Text(timeNow.toString)))
   ActorPing.schedule(this,Tick, 1L)
 }
   }
 }

 case object Tick

 *markup - (I have also tried it with just *type=Clock since the package
 is in my Boot class)

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


 On Tue, Sep 15, 2009 at 8:25 AM, Jack Widman jack.wid...@gmail.comwrote:

 The package is correct. Here is the error
 XML parsing failed: syntax error (Line: 13, Character: 4)

 Reparse document as HTML
 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(com.authoritude.snippet.Clock) name:
 Full(Other) Not Found --
  13: clk:timeMissing Clock/clk:time
  14:
  15:
  16:   script type=text/javascript
 I tried it both with the full class name and just Clock. I get the same
 error in both cases.
 Its seems to be saying clk is an undeclared namespace?


 On Tue, Sep 15, 2009 at 4:46 AM, Timothy Perrett timo...@getintheloop.eu
  wrote:


 Its telling you that the class Clock could not be found - if i were
 you, check the package definitions on the clock class to make sure its
 in the right namespace.

 Cheers, Tim

 On Sep 15, 3:38 am, jack jack.wid...@gmail.com wrote:
  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
-~--~~~~--~~--~--~---



[Lift] Re: trouble with comet Clock example

2009-09-15 Thread Jack Widman
Yikes. Feeling stupid.

On Tue, Sep 15, 2009 at 9:02 AM, Tim Nelson tnell...@gmail.com wrote:

 Comet classes are supposed to go in the comet folder. It looks like you
 have it in your snippet folder. Did you try putting the clock class in the
 comet folder?


 On Tue, Sep 15, 2009 at 7:34 AM, Jack Widman jack.wid...@gmail.comwrote:

 And here is the error again:
 Error!
 XML parsing failed

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

 Reparse document as HTML
 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(com.authoritude.snippet.Clock) name:
 Full(Other) Not Found --
  13: clk:timeMissing Clock/clk:time
  14:
  15:
  16:   script type=text/javascript

 On Tue, Sep 15, 2009 at 8:32 AM, Jack Widman jack.wid...@gmail.comwrote:

 Here is the complete code for my Clock example
 *class*

 import scala.xml._
 import net.liftweb.http.S
 import net.liftweb.http.CometActor
 import net.liftweb.http.SessionVar
 import net.liftweb.util._
 import _root_.scala.xml._
 import _root_.net.liftweb.util.Helpers._
 import scala.actors._




 class Clock extends CometActor {
   override def defaultPrefix = Full(clk)

   def render = bind(time - timeSpan)

   def timeSpan = (span id=time{timeNow}/span)

   ActorPing.schedule(this, Tick, 1L)

   override def lowPriority :
   PartialFunction[Any, Unit] = {
 case Tick = {
   partialUpdate(SetHtml(time,
 Text(timeNow.toString)))
   ActorPing.schedule(this,Tick, 1L)
 }
   }
 }

 case object Tick

 *markup - (I have also tried it with just *type=Clock since the
 package is in my Boot class)

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


 On Tue, Sep 15, 2009 at 8:25 AM, Jack Widman jack.wid...@gmail.comwrote:

 The package is correct. Here is the error
 XML parsing failed: syntax error (Line: 13, Character: 4)

 Reparse document as HTML
 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(com.authoritude.snippet.Clock) name:
 Full(Other) Not Found --
  13: clk:timeMissing Clock/clk:time
  14:
  15:
  16:   script type=text/javascript
 I tried it both with the full class name and just Clock. I get the same
 error in both cases.
 Its seems to be saying clk is an undeclared namespace?


 On Tue, Sep 15, 2009 at 4:46 AM, Timothy Perrett
 timo...@getintheloop.eu wrote:


 Its telling you that the class Clock could not be found - if i were
 you, check the package definitions on the clock class to make sure its
 in the right namespace.

 Cheers, Tim

 On Sep 15, 3:38 am, jack jack.wid...@gmail.com wrote:
  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
-~--~~~~--~~--~--~---



[Lift] Re: trouble with comet Clock example

2009-09-15 Thread Jack Widman
I did not try it without the package statement. The class is located in the
snippet folder. It was just pointed out to me that it must be in the comet
folder.

On Tue, Sep 15, 2009 at 10:15 AM, Naftoli Gugenheim naftoli...@gmail.comwrote:


 Did you leave out the package statement? Where is the .class file
 outputted?
 I think the browser is complaining that the error message xml has an
 unbound prefix.


 -
 Jack Widmanjack.wid...@gmail.com wrote:

 And here is the error again:
 Error!
 XML parsing failed

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

 Reparse document as HTML
 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(com.authoritude.snippet.Clock) name:
 Full(Other) Not Found --
  13: clk:timeMissing Clock/clk:time
  14:
  15:
  16:   script type=text/javascript

 On Tue, Sep 15, 2009 at 8:32 AM, Jack Widman jack.wid...@gmail.com
 wrote:

  Here is the complete code for my Clock example
  *class*
 
  import scala.xml._
  import net.liftweb.http.S
  import net.liftweb.http.CometActor
  import net.liftweb.http.SessionVar
  import net.liftweb.util._
  import _root_.scala.xml._
  import _root_.net.liftweb.util.Helpers._
  import scala.actors._
 
 
 
 
  class Clock extends CometActor {
override def defaultPrefix = Full(clk)
 
def render = bind(time - timeSpan)
 
def timeSpan = (span id=time{timeNow}/span)
 
ActorPing.schedule(this, Tick, 1L)
 
override def lowPriority :
PartialFunction[Any, Unit] = {
  case Tick = {
partialUpdate(SetHtml(time,
  Text(timeNow.toString)))
ActorPing.schedule(this,Tick, 1L)
  }
}
  }
 
  case object Tick
 
  *markup - (I have also tried it with just *type=Clock since the package
  is in my Boot class)
 
  lift:surround with=default at=content
lift:comet type=com.authoritude.snippet.Clock name=Other
  clk:timeMissing Clock/clk:time
/lift:comet
  /lift:surround
 
 
  On Tue, Sep 15, 2009 at 8:25 AM, Jack Widman jack.wid...@gmail.com
 wrote:
 
  The package is correct. Here is the error
  XML parsing failed: syntax error (Line: 13, Character: 4)
 
  Reparse document as HTML
  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(com.authoritude.snippet.Clock) name:
  Full(Other) Not Found --
   13: clk:timeMissing Clock/clk:time
   14:
   15:
   16:   script type=text/javascript
  I tried it both with the full class name and just Clock. I get the same
  error in both cases.
  Its seems to be saying clk is an undeclared namespace?
 
 
  On Tue, Sep 15, 2009 at 4:46 AM, Timothy Perrett
 timo...@getintheloop.eu
   wrote:
 
 
  Its telling you that the class Clock could not be found - if i were
  you, check the package definitions on the clock class to make sure its
  in the right namespace.
 
  Cheers, Tim
 
  On Sep 15, 3:38 am, jack jack.wid...@gmail.com wrote:
   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
-~--~~~~--~~--~--~---



[Lift] Re: trouble with comet Clock example

2009-09-15 Thread Jack Widman
I double checked it. The full package was there, I just failed to include it
in the email.

On Tue, Sep 15, 2009 at 11:12 AM, Naftoli Gugenheim naftoli...@gmail.comwrote:


 I asked because the package statement didn't seem to get pasted into your
 email with the rest of your code, and I've had times that I tracked down
 errors to an incorrect package statement. In Java, if a package statement
 doesn't correspond to a file's containing folder it's an error, but in Scala
 it just compiles into a different package/output folder.

 -
 Jack Widmanjack.wid...@gmail.com wrote:

 I did not try it without the package statement. The class is located in the
 snippet folder. It was just pointed out to me that it must be in the comet
 folder.

 On Tue, Sep 15, 2009 at 10:15 AM, Naftoli Gugenheim naftoli...@gmail.com
 wrote:

 
  Did you leave out the package statement? Where is the .class file
  outputted?
  I think the browser is complaining that the error message xml has an
  unbound prefix.
 
 
  -
  Jack Widmanjack.wid...@gmail.com wrote:
 
  And here is the error again:
  Error!
  XML parsing failed
 
  XML parsing failed: syntax error (Line: 13, Character: 4)
 
  Reparse document as HTML
  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(com.authoritude.snippet.Clock) name:
  Full(Other) Not Found --
   13: clk:timeMissing Clock/clk:time
   14:
   15:
   16:   script type=text/javascript
 
  On Tue, Sep 15, 2009 at 8:32 AM, Jack Widman jack.wid...@gmail.com
  wrote:
 
   Here is the complete code for my Clock example
   *class*
  
   import scala.xml._
   import net.liftweb.http.S
   import net.liftweb.http.CometActor
   import net.liftweb.http.SessionVar
   import net.liftweb.util._
   import _root_.scala.xml._
   import _root_.net.liftweb.util.Helpers._
   import scala.actors._
  
  
  
  
   class Clock extends CometActor {
 override def defaultPrefix = Full(clk)
  
 def render = bind(time - timeSpan)
  
 def timeSpan = (span id=time{timeNow}/span)
  
 ActorPing.schedule(this, Tick, 1L)
  
 override def lowPriority :
 PartialFunction[Any, Unit] = {
   case Tick = {
 partialUpdate(SetHtml(time,
   Text(timeNow.toString)))
 ActorPing.schedule(this,Tick, 1L)
   }
 }
   }
  
   case object Tick
  
   *markup - (I have also tried it with just *type=Clock since the
 package
   is in my Boot class)
  
   lift:surround with=default at=content
 lift:comet type=com.authoritude.snippet.Clock name=Other
   clk:timeMissing Clock/clk:time
 /lift:comet
   /lift:surround
  
  
   On Tue, Sep 15, 2009 at 8:25 AM, Jack Widman jack.wid...@gmail.com
  wrote:
  
   The package is correct. Here is the error
   XML parsing failed: syntax error (Line: 13, Character: 4)
  
   Reparse document as HTML
   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(com.authoritude.snippet.Clock)
 name:
   Full(Other) Not Found --
13: clk:timeMissing Clock/clk:time
14:
15:
16:   script type=text/javascript
   I tried it both with the full class name and just Clock. I get the
 same
   error in both cases.
   Its seems to be saying clk is an undeclared namespace?
  
  
   On Tue, Sep 15, 2009 at 4:46 AM, Timothy Perrett
  timo...@getintheloop.eu
wrote:
  
  
   Its telling you that the class Clock could not be found - if i were
   you, check the package definitions on the clock class to make sure
 its
   in the right namespace.
  
   Cheers, Tim
  
   On Sep 15, 3:38 am, jack jack.wid...@gmail.com wrote:
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

[Lift] Re: trouble with comet Clock example

2009-09-15 Thread Jack Widman
Ok Great. I will try this first thing when I get home tonight.

On Tue, Sep 15, 2009 at 11:05 AM, David Pollak 
feeder.of.the.be...@gmail.com wrote:



 On Tue, Sep 15, 2009 at 7:18 AM, Jack Widman jack.wid...@gmail.comwrote:

 I did not try it without the package statement. The class is located in
 the snippet folder. It was just pointed out to me that it must be in the
 comet folder.


 Actually, it doesn't matter what folder it's in, but the package my be
 specified correctly or Lift won't know how to find the code.

 In your code above, there is no package declaration, so the code is not
 going to have any package.

 Please take the package line from your snippet file, copy it into your
 Clock file and change snippet to comet and it should work.




 On Tue, Sep 15, 2009 at 10:15 AM, Naftoli Gugenheim naftoli...@gmail.com
  wrote:


 Did you leave out the package statement? Where is the .class file
 outputted?
 I think the browser is complaining that the error message xml has an
 unbound prefix.


 -
 Jack Widmanjack.wid...@gmail.com wrote:

 And here is the error again:
 Error!
 XML parsing failed

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

 Reparse document as HTML
 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(com.authoritude.snippet.Clock) name:
 Full(Other) Not Found --
  13: clk:timeMissing Clock/clk:time
  14:
  15:
  16:   script type=text/javascript

 On Tue, Sep 15, 2009 at 8:32 AM, Jack Widman jack.wid...@gmail.com
 wrote:

  Here is the complete code for my Clock example
  *class*
 
  import scala.xml._
  import net.liftweb.http.S
  import net.liftweb.http.CometActor
  import net.liftweb.http.SessionVar
  import net.liftweb.util._
  import _root_.scala.xml._
  import _root_.net.liftweb.util.Helpers._
  import scala.actors._
 
 
 
 
  class Clock extends CometActor {
override def defaultPrefix = Full(clk)
 
def render = bind(time - timeSpan)
 
def timeSpan = (span id=time{timeNow}/span)
 
ActorPing.schedule(this, Tick, 1L)
 
override def lowPriority :
PartialFunction[Any, Unit] = {
  case Tick = {
partialUpdate(SetHtml(time,
  Text(timeNow.toString)))
ActorPing.schedule(this,Tick, 1L)
  }
}
  }
 
  case object Tick
 
  *markup - (I have also tried it with just *type=Clock since the
 package
  is in my Boot class)
 
  lift:surround with=default at=content
lift:comet type=com.authoritude.snippet.Clock name=Other
  clk:timeMissing Clock/clk:time
/lift:comet
  /lift:surround
 
 
  On Tue, Sep 15, 2009 at 8:25 AM, Jack Widman jack.wid...@gmail.com
 wrote:
 
  The package is correct. Here is the error
  XML parsing failed: syntax error (Line: 13, Character: 4)
 
  Reparse document as HTML
  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(com.authoritude.snippet.Clock)
 name:
  Full(Other) Not Found --
   13: clk:timeMissing Clock/clk:time
   14:
   15:
   16:   script type=text/javascript
  I tried it both with the full class name and just Clock. I get the
 same
  error in both cases.
  Its seems to be saying clk is an undeclared namespace?
 
 
  On Tue, Sep 15, 2009 at 4:46 AM, Timothy Perrett
 timo...@getintheloop.eu
   wrote:
 
 
  Its telling you that the class Clock could not be found - if i were
  you, check the package definitions on the clock class to make sure
 its
  in the right namespace.
 
  Cheers, Tim
 
  On Sep 15, 3:38 am, jack jack.wid...@gmail.com wrote:
   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?
  
 
 
 










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

[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: what the difference between :: and :::

2009-09-09 Thread Jack Widman
:: is cons. It adds an element to a list. ::: concatentates two lists.

On Wed, Sep 9, 2009 at 11:15 PM, surfman chinasmile...@gmail.com wrote:


 I am confused by :: and :::,it seems they are doing concatenation job.
 but what they differ from each other? Thanks.

 


--~--~-~--~~~---~--~~
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 user-agent header with Databinder

2009-09-08 Thread Jack Widman
Right. I will try to keep to the topic :)
I actually found him and he quickly answered me.

On Tue, Sep 8, 2009 at 12:24 PM, David Pollak feeder.of.the.be...@gmail.com
 wrote:

 Jack,
 I'm not sure where N8han (the author of Databinder) hangs out, but it's not
 on the Lift list.  :-(

 Sorry.

 David


 On Tue, Sep 8, 2009 at 8:58 AM, jack jack.wid...@gmail.com wrote:


 Please forgive me for including so much code but I have an important
 demo fast approaching and I'm kind of in a bind. I am using
 Databinders Dispatch http library which is a wrapper around Javas
 HttpClient library. I have included the Http class below. Does anyone
 see how to set the user-agent header. Once again I apologize and would
 be much obliged for any help.

 import collection.Map
 import collection.immutable.{Map = IMap}
 import util.DynamicVariable
 import java.io.
 {InputStream,OutputStream,BufferedInputStream,BufferedOutputStream}
 import java.net.URI
 import java.util.zip.GZIPInputStream

 import org.apache.http._
 import org.apache.http.client._
 import org.apache.http.impl.client.{DefaultHttpClient,
 BasicCredentialsProvider}
 import org.apache.http.client.methods._
 import org.apache.http.client.entity.UrlEncodedFormEntity
 import org.apache.http.client.utils.URLEncodedUtils

 import org.apache.http.entity.StringEntity
 import org.apache.http.message.BasicNameValuePair
 import org.apache.http.protocol.HTTP.UTF_8
 import org.apache.http.params.{HttpProtocolParams, BasicHttpParams}
 import org.apache.http.util.EntityUtils
 import org.apache.http.auth.{AuthScope, UsernamePasswordCredentials,
 Credentials}

 case class StatusCode(code: Int, contents:String)
  extends Exception(Exceptional resoponse code:  + code + \n +
 contents)

 /** Http access point. Standard instances to be used by a single
 thread. */
 class Http {
  val credentials = new DynamicVariable[Option[(AuthScope,
 Credentials)]](None)
  val client = new ConfiguredHttpClient

  def credentialsProvider = new BasicCredentialsProvider {
override def getCredentials(scope: AuthScope) = null
  }

 /**  /** Info Logger for this instance, default returns Connfiggy if
 on classpath else console logger. */
  lazy val log: Logger = try {
new Logger {
  val delegate = net.lag.logging.Logger.get
  def info(msg: String, items: Any*) { delegate.info(msg, items:
 _*) }
}
  } catch {
case e: NoClassDefFoundError = new Logger {
  def info(msg: String, items: Any*) {
println(INF: [console logger] dispatch:  + msg.format(items:
 _*))
  }
}
  }
  **/
  /** Execute method for the given host, with logging. */
  def execute(host: HttpHost, req: HttpUriRequest) = {
//log.info(%s %s%s, req.getMethod, host, req.getURI)
client.execute(host, req)
  }
  /** Execute for given optional parametrs, with logging. Creates
 local scope for credentials. */
  val execute: (Option[HttpHost], Option[Credentials], HttpUriRequest)
 = HttpResponse = {
case (Some(host), Some(creds), req) =
  client.credentials.withValue(Some((new AuthScope
 (host.getHostName, host.getPort), creds)))(execute(host, req))
case (None, Some(creds), _) = error(Credentials specified
 without explicit host)
case (Some(host), _, req) = execute(host, req)
case (_, _, req) =
  //log.info(%s %s, req.getMethod, req.getURI)
  client.execute(req)
  }
  /** Execute full request-response handler. */
  def x[T](hand: Handler[T]): T = x(hand.request)(hand.block)
  /** Execute request and handle response codes, response, and entity
 in block */
  def x [T](req: Request)(block: Handler.F[T]) = {
val res = execute(req.host, req.creds, req.req)
val ent = res.getEntity match {
  case null = None
  case ent = Some(ent)
}
try { block(res.getStatusLine.getStatusCode, res, ent) }
finally { ent foreach (_.consumeContent) }
  }
  /** Apply Response Handler if reponse code returns true from chk. */
  def when[T](chk: Int = Boolean)(hand: Handler[T]) = x(hand.request)
 {
case (code, res, ent) if chk(code) = hand.block(code, res, ent)
case (code, _, Some(ent)) = throw StatusCode(code,
 EntityUtils.toString(ent, UTF_8))
case (code, _, _) = throw StatusCode(code, [no entity])
  }
  /** Apply a custom block in addition to predefined response Handler.
 */
  def also[A,B](hand: Handler[B])(block: Handler.F[A]) =
x(hand.request) { (code, res, ent) = ( hand.block(code, res,
 ent), block(code, res, ent) ) }

  /** Apply handler block when response code is 200 - 204 */
  def apply[T](hand: Handler[T]) = (this when {code = (200 to 204)
 contains code})(hand)
 }

 /** Nil request, useful to kick off a descriptors that don't have a
 factory. */
 object /\ extends Request(None, None, Nil)

 /* Factory for requests from a host */
 object :/ {
  def apply(hostname: String, port: Int): Request =
new Request(Some(new HttpHost(hostname, port)), None, Nil)

  def apply(hostname: String): Request = new Request(Some(new HttpHost
 

[Lift] Re: setting user-agent header with Databinder

2009-09-08 Thread Jack Widman
Sorry.  should have thought to tell everyone. I have been coding all day
with tunnel vision!
The : method adds a Map[String, String] of headers to the request object:
http://databinder.net/sxr/dispatch-http/0.5.2/main/Http.scala.html#10878

For user agent it would be something like
val req_with_agent = req : Map(User-Agent - my user agent value)

On Tue, Sep 8, 2009 at 5:17 PM, Randinn rand...@gmail.com wrote:


 What was the answer now that you have attained it?

 On Sep 9, 3:02 am, Jack Widman jack.wid...@gmail.com wrote:
  You are right. I will fine tune my determine which is a good question to
 ask
  mechanism :)
 
  On Tue, Sep 8, 2009 at 12:54 PM, Timothy Perrett timo...@getintheloop.eu
 wrote:
 
 
 
   IMHO, you'd probably get better traction with such questions in a
   wider audience on the main scala-user list over at EPFL...
 
   Cheers, Tim
 
   On 8 Sep 2009, at 17:26, Jack Widman wrote:
 
Right. I will try to keep to the topic :)
 
I actually found him and he quickly answered me.
 
On Tue, Sep 8, 2009 at 12:24 PM, David Pollak 
   feeder.of.the.be...@gmail.com
 wrote:
Jack,
 
I'm not sure where N8han (the author of Databinder) hangs out, but
it's not on the Lift list.  :-(
 
Sorry.
 
David
 
On Tue, Sep 8, 2009 at 8:58 AM, jack jack.wid...@gmail.com wrote:
 
Please forgive me for including so much code but I have an important
demo fast approaching and I'm kind of in a bind. I am using
Databinders Dispatch http library which is a wrapper around Javas
HttpClient library. I have included the Http class below. Does anyone
see how to set the user-agent header. Once again I apologize and
 would
be much obliged for any help.
 
import collection.Map
import collection.immutable.{Map = IMap}
import util.DynamicVariable
import java.io.
{InputStream,OutputStream,BufferedInputStream,BufferedOutputStream}
import java.net.URI
import java.util.zip.GZIPInputStream
 
import org.apache.http._
import org.apache.http.client._
import org.apache.http.impl.client.{DefaultHttpClient,
BasicCredentialsProvider}
import org.apache.http.client.methods._
import org.apache.http.client.entity.UrlEncodedFormEntity
import org.apache.http.client.utils.URLEncodedUtils
 
import org.apache.http.entity.StringEntity
import org.apache.http.message.BasicNameValuePair
import org.apache.http.protocol.HTTP.UTF_8
import org.apache.http.params.{HttpProtocolParams, BasicHttpParams}
import org.apache.http.util.EntityUtils
import org.apache.http.auth.{AuthScope, UsernamePasswordCredentials,
Credentials}
 
case class StatusCode(code: Int, contents:String)
 extends Exception(Exceptional resoponse code:  + code + \n +
contents)
 
/** Http access point. Standard instances to be used by a single
thread. */
class Http {
 val credentials = new DynamicVariable[Option[(AuthScope,
Credentials)]](None)
 val client = new ConfiguredHttpClient
 
 def credentialsProvider = new BasicCredentialsProvider {
   override def getCredentials(scope: AuthScope) = null
 }
 
/**  /** Info Logger for this instance, default returns Connfiggy if
on classpath else console logger. */
 lazy val log: Logger = try {
   new Logger {
 val delegate = net.lag.logging.Logger.get
 def info(msg: String, items: Any*) { delegate.info(msg, items:
_*) }
   }
 } catch {
   case e: NoClassDefFoundError = new Logger {
 def info(msg: String, items: Any*) {
   println(INF: [console logger] dispatch:  + msg.format(items:
_*))
 }
   }
 }
 **/
 /** Execute method for the given host, with logging. */
 def execute(host: HttpHost, req: HttpUriRequest) = {
   //log.info(%s %s%s, req.getMethod, host, req.getURI)
   client.execute(host, req)
 }
 /** Execute for given optional parametrs, with logging. Creates
local scope for credentials. */
 val execute: (Option[HttpHost], Option[Credentials], HttpUriRequest)
= HttpResponse = {
   case (Some(host), Some(creds), req) =
 client.credentials.withValue(Some((new AuthScope
(host.getHostName, host.getPort), creds)))(execute(host, req))
   case (None, Some(creds), _) = error(Credentials specified
without explicit host)
   case (Some(host), _, req) = execute(host, req)
   case (_, _, req) =
 //log.info(%s %s, req.getMethod, req.getURI)
 client.execute(req)
 }
 /** Execute full request-response handler. */
 def x[T](hand: Handler[T]): T = x(hand.request)(hand.block)
 /** Execute request and handle response codes, response, and entity
in block */
 def x [T](req: Request)(block: Handler.F[T]) = {
   val res = execute(req.host, req.creds, req.req)
   val ent = res.getEntity match {
 case null = None
 case ent = Some(ent)
   }
   try { block

[Lift] Re: setting user-agent header

2009-09-08 Thread Jack Widman
Cool. Thanks. The useful things about Lift seem to never end.

On Tue, Sep 8, 2009 at 6:51 PM, Derek Chen-Becker dchenbec...@gmail.comwrote:

 S.setHeader can be used in Lift to set a response header.

 Derek


 On Tue, Sep 8, 2009 at 9:02 AM, jack jack.wid...@gmail.com wrote:


 Has anyone used dispatch from databinder.net?  Its an http library in
 Scala.
 I do not know how to set the User-Agent header.



 


--~--~-~--~~~---~--~~
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: putting data in a session

2009-09-06 Thread Jack Widman
Thanks Indrajit for the quick response!

On Sun, Sep 6, 2009 at 4:22 PM, Indrajit Raychaudhuri
indraj...@gmail.comwrote:


 object FooVar extends SessionVar[Box[String]](Empty)

 // to set
 FooVar.set(Full(fooValToSet))

 // to retreive
 val foo = FooVar.is.openOr(Not found)

 Cheers, Indrajit

 On Sep 7, 12:36 am, jack jack.wid...@gmail.com wrote:
  How do I put something in the session from one page and take it out
  from another page?
 


--~--~-~--~~~---~--~~
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: putting data in a session

2009-09-06 Thread Jack Widman
I'm sorry for such an elementary question, but what is Empty here?

On Sun, Sep 6, 2009 at 4:22 PM, Indrajit Raychaudhuri
indraj...@gmail.comwrote:


 object FooVar extends SessionVar[Box[String]](Empty)

 // to set
 FooVar.set(Full(fooValToSet))

 // to retreive
 val foo = FooVar.is.openOr(Not found)

 Cheers, Indrajit

 On Sep 7, 12:36 am, jack jack.wid...@gmail.com wrote:
  How do I put something in the session from one page and take it out
  from another page?
 


--~--~-~--~~~---~--~~
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: putting data in a session

2009-09-06 Thread Jack Widman
I'm sorry. You probably meant 'None'

On Sun, Sep 6, 2009 at 5:05 PM, Jack Widman jack.wid...@gmail.com wrote:

 I'm sorry for such an elementary question, but what is Empty here?

 On Sun, Sep 6, 2009 at 4:22 PM, Indrajit Raychaudhuri indraj...@gmail.com
  wrote:


 object FooVar extends SessionVar[Box[String]](Empty)

 // to set
 FooVar.set(Full(fooValToSet))

 // to retreive
 val foo = FooVar.is.openOr(Not found)

 Cheers, Indrajit

 On Sep 7, 12:36 am, jack jack.wid...@gmail.com wrote:
  How do I put something in the session from one page and take it out
  from another page?
 



--~--~-~--~~~---~--~~
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] stopping an Actor

2009-09-01 Thread Jack Widman
How does an Actor stop itself from running. That is to say, stop its act
method as soon as possible?

--~--~-~--~~~---~--~~
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: has anyone seen this exception?

2009-08-28 Thread Jack Widman
I'm able to get the page with wget, no problem. My application is making
many hits to other sites. Maybe that has something to do with it. Also I am
using Jetty in embedded mode. Is there a difference in performance and
throughput with Jetty embedded vs non embedded?

On Fri, Aug 28, 2009 at 12:20 AM, Ross Mellgren dri...@gmail.com wrote:

 That error sounds like it's probably that the remote server is
 disconnecting prematurely, or is not handling Transfer-Encoding: Chunked as
 HttpURLConnection expects.
 Have you tried getting whatever URL it's trying with wget or curl?

 -Ross

 On Aug 27, 2009, at 7:28 PM, Jack Widman wrote:

 Here is the code I am using. The exception is happening at line 12, the
 line that goes  line =
 br.readLine()
  The exception is happening alot. Any ideas?

 package com.authoritude.snippet

 import java.io.{InputStreamReader, BufferedInputStream, BufferedReader,
 OutputStreamWriter, InputStream}

 object StreamUtil {
   def streamToString(stream: InputStream): String = {
 val buf = new StringBuilder
 val br = new BufferedReader(new InputStreamReader(stream))
 var line: String = null
 var eof = false
 while (! eof) {
   line = br.readLine()
   if (line == null) eof = true else
 buf.append(line).append(\n)
 }
 buf.toString
   }
 }


 On Thu, Aug 27, 2009 at 5:49 PM, David Pollak 
 feeder.of.the.be...@gmail.com wrote:

 This happens sometimes when the client disconnects before the
 communications with the server is complete.  I see them from time to time
 and they indicate to me that the Internet is a random place.

 On Thu, Aug 27, 2009 at 12:06 PM, jack jack.wid...@gmail.com wrote:


 Has anyone seen this error? I get it while transforming a Stream into
 a String. The stream is from an http request I just made.

 Message: java.io.IOException: Premature EOF
sun.net.www.http.ChunkedInputStream.readAheadBlocking
 (ChunkedInputStream.java:556)
sun.net.www.http.ChunkedInputStream.readAhead
 (ChunkedInputStream.java:
 600)
sun.net.www.http.ChunkedInputStream.read
 (ChunkedInputStream.java:687)
java.io.FilterInputStream.read(FilterInputStream.java:133)
sun.net.www.protocol.http.HttpURLConnection$HttpInputStream.read
 (HttpURLConnection.java:2419)
sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:282)
sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:324)
sun.nio.cs.StreamDecoder.read(StreamDecoder.java:176)
java.io.InputStreamReader.read(InputStreamReader.java:184)
java.io.BufferedReader.fill(BufferedReader.java:153)
java.io.BufferedReader.readLine(BufferedReader.java:316)
java.io.BufferedReader.readLine(BufferedReader.java:379)
com.abc.snippet.StreamUtil$.streamToString(StreamUtil.scala:12)





 --
 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: has anyone seen this exception?

2009-08-27 Thread Jack Widman
Here is the code I am using. The exception is happening at line 12, the line
that goes  line = br.readLine()
 The exception is happening alot. Any ideas?

package com.authoritude.snippet

import java.io.{InputStreamReader, BufferedInputStream, BufferedReader,
OutputStreamWriter, InputStream}

object StreamUtil {
  def streamToString(stream: InputStream): String = {
val buf = new StringBuilder
val br = new BufferedReader(new InputStreamReader(stream))
var line: String = null
var eof = false
while (! eof) {
  line = br.readLine()
  if (line == null) eof = true else
buf.append(line).append(\n)
}
buf.toString
  }
}


On Thu, Aug 27, 2009 at 5:49 PM, David Pollak feeder.of.the.be...@gmail.com
 wrote:

 This happens sometimes when the client disconnects before the
 communications with the server is complete.  I see them from time to time
 and they indicate to me that the Internet is a random place.

 On Thu, Aug 27, 2009 at 12:06 PM, jack jack.wid...@gmail.com wrote:


 Has anyone seen this error? I get it while transforming a Stream into
 a String. The stream is from an http request I just made.

 Message: java.io.IOException: Premature EOF
sun.net.www.http.ChunkedInputStream.readAheadBlocking
 (ChunkedInputStream.java:556)

  sun.net.www.http.ChunkedInputStream.readAhead(ChunkedInputStream.java:
 600)

  sun.net.www.http.ChunkedInputStream.read(ChunkedInputStream.java:687)
java.io.FilterInputStream.read(FilterInputStream.java:133)
sun.net.www.protocol.http.HttpURLConnection$HttpInputStream.read
 (HttpURLConnection.java:2419)
sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:282)
sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:324)
sun.nio.cs.StreamDecoder.read(StreamDecoder.java:176)
java.io.InputStreamReader.read(InputStreamReader.java:184)
java.io.BufferedReader.fill(BufferedReader.java:153)
java.io.BufferedReader.readLine(BufferedReader.java:316)
java.io.BufferedReader.readLine(BufferedReader.java:379)
com.abc.snippet.StreamUtil$.streamToString(StreamUtil.scala:12)





 --
 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: has anyone seen this exception?

2009-08-27 Thread Jack Widman
Great. Thanks David. I'll try that.

On Fri, Aug 28, 2009 at 12:27 AM, David Pollak 
feeder.of.the.be...@gmail.com wrote:

 I'd suggest that you use
 import net.liftweb.util.Helpers._

 def streamToString(stream: InputStream) = new
 String(readWholeStream(stream), UTF-8)

 See if that makes things better.


 On Thu, Aug 27, 2009 at 4:28 PM, Jack Widman jack.wid...@gmail.comwrote:

 Here is the code I am using. The exception is happening at line 12, the
 line that goes  line =
 br.readLine()
  The exception is happening alot. Any ideas?

 package com.authoritude.snippet

 import java.io.{InputStreamReader, BufferedInputStream, BufferedReader,
 OutputStreamWriter, InputStream}

 object StreamUtil {
   def streamToString(stream: InputStream): String = {
 val buf = new StringBuilder
 val br = new BufferedReader(new InputStreamReader(stream))
 var line: String = null
 var eof = false
 while (! eof) {
   line = br.readLine()
   if (line == null) eof = true else
 buf.append(line).append(\n)
 }
 buf.toString
   }
 }


 On Thu, Aug 27, 2009 at 5:49 PM, David Pollak 
 feeder.of.the.be...@gmail.com wrote:

 This happens sometimes when the client disconnects before the
 communications with the server is complete.  I see them from time to time
 and they indicate to me that the Internet is a random place.

 On Thu, Aug 27, 2009 at 12:06 PM, jack jack.wid...@gmail.com wrote:


 Has anyone seen this error? I get it while transforming a Stream into
 a String. The stream is from an http request I just made.

 Message: java.io.IOException: Premature EOF
sun.net.www.http.ChunkedInputStream.readAheadBlocking
 (ChunkedInputStream.java:556)

  sun.net.www.http.ChunkedInputStream.readAhead(ChunkedInputStream.java:
 600)

  sun.net.www.http.ChunkedInputStream.read(ChunkedInputStream.java:687)
java.io.FilterInputStream.read(FilterInputStream.java:133)
sun.net.www.protocol.http.HttpURLConnection$HttpInputStream.read
 (HttpURLConnection.java:2419)
sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:282)
sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:324)
sun.nio.cs.StreamDecoder.read(StreamDecoder.java:176)
java.io.InputStreamReader.read(InputStreamReader.java:184)
java.io.BufferedReader.fill(BufferedReader.java:153)
java.io.BufferedReader.readLine(BufferedReader.java:316)
java.io.BufferedReader.readLine(BufferedReader.java:379)
com.abc.snippet.StreamUtil$.streamToString(StreamUtil.scala:12)





 --
 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 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: Regarding my question about not showing the password in the querystring.

2009-08-26 Thread Jack Widman
Thanks Jeppe. I wasn't realizing that since it has to be done on the server,
there's a chicken and egg problem with respect to getting it there
encrypted.  I just wasn't thinking.
I will use a post.

On Wed, Aug 26, 2009 at 6:45 AM, Jeppe Nejsum Madsen je...@ingolfs.dkwrote:


 jack jack.wid...@gmail.com writes:

  Of course I could use a POST instead of a GET but my question was
  really about how to process a form value in a snippet, before the form
  is submitted. This way I can encrypt the password before it is sent in
  the body of the post, over the wire.

 Snippets are server side code. If you need to encrypt the password
 before it is sent, you need to do it in the browser (ie
 Javascript). Lift doesn't really do this (but can make a snippet that
 generates the javascript for you)

 If you are concerned about sending clear text over the wire, I strongly
 suggest you use https instead of trying to roll your own encryption in
 javascript :-)

 /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: simple Ajax form

2009-08-24 Thread Jack Widman
Excellent. Thanks David.

On Mon, Aug 24, 2009 at 8:08 PM, David Pollak feeder.of.the.be...@gmail.com
 wrote:



 On Sun, Aug 23, 2009 at 10:40 PM, jack jack.wid...@gmail.com wrote:


 I am trying to make a simple ajax form. The code is below. The
 Javascript error I am getting when I hit the send button is:

 uncaught exception ReferenceError: F777221462447MPT is not defined

 Am I missing something?

 lift:surround with=default at=content
h1Hello FormAjax/h1
lift:HelloFormAjax.show
Hello hello:who/br/
label for=whoFieldWho :/labelhello:whoField/
hello:submit/
/lift:HelloFormAjax.show
 /lift:surround

 create src/main/scala/sandbox/lift/hellodarwin/snippet/HelloFormAjax
 package sandbox.lift.hellodarwin.snippet

 import scala.xml.NodeSeq
 import net.liftweb.http.S._
 import net.liftweb.http.SHtml._
 import net.liftweb.util.Helpers._
 import net.liftweb.http.js.{JsCmd, JsCmds}

 class HelloFormAjax {
  def whoNode(str: String) = span id=who{str}/span

  def updateWho(str: String): JsCmd = {
println(updateWho on  + str)
JsCmds.Run($('#who').text('+str+'))


 This will fail if str contains any non-printables or '.  Please use:

 str.encJs

 To encode a Scala String into a JavaScript friendly String.

 But better, you could use:

 SetHtml(who, scala.xml.Text(str))



  }






  def show(xhtml: NodeSeq): NodeSeq = {
bind(hello, xhtml,
whoField - text(world, null) % (size - 10) % (id -
  whoField),
submit - button type=button{?(Send)}/button %
 (onclick - ajaxCall(JsRaw($('#whoField').attr('value')), s =
 updateWho(s))),



 ajaxCall returns a tuple of (String, JsExp).  I'm not sure why the compiler
 is letting that get converted into the second half of a pair for
 UnparsedAttribute purposes... but... in order to use it, you must do:
 ajaxCall(JsRaw($('#whoField').attr('value')), s =updateWho(s))._2

 But... it'd be better to ValById:

 ajaxCall(ValById(whoField), , s =updateWho(s))._2

 I've added a few helpers to ajaxButton, so you can do:

 submit - ajaxButton(Text(?(Send)), ValById(whoField), s =
 updateWho(s))



who - whoNode(world)
)
  }
 }





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

2009-08-23 Thread Jack Widman
Thanks Derek for the quick and helpful response. I am going to go with
Lift.

On Sun, Aug 23, 2009 at 12:49 PM, Derek Williams de...@nebvin.ca wrote:

 On Sun, Aug 23, 2009 at 8:45 AM, jack jack.wid...@gmail.com wrote:

 I really do want to use Lift instead of Rails. Could somebody please
 convince me? :)


 I used to struggle with Rails (and to a lesser extent Merb) because it was
 difficult to do things that weren't the Rails Way. Lift does have a
 recommended way of doing things as well but I haven't yet run into issues
 where I had to fight the framework in order to do things my way. This aspect
 along with the performance and ease of use makes it my preferred framework
 by far.

 If you are not doing the coding yourself, finding a programmer might be an
 issue as experienced Scala developers (not to mention Lift developers) are
 probably much harder to find then Ruby and Rails developers.

 As far as existing libraries, being able to use any Java library is a big
 plus. It can sometimes be hard to find a good (or maintained) ruby library
 in order to use an existing binary (C/C++) library.

 The only thing at the moment that I would like to be better is Text
 Editor/IDE support. I don't find this to be too bad of a problem though as I
 spent all of my Ruby development struggling with the same things. I ended up
 using Vim for ruby development, and have now turned to Emacs for Scala
 development. For learning Scala I used Eclipse as it did a good job of
 giving me documentation for Classes/Methods. After a couple of months of
 coding I only have to reference the scaladocs once in a while as I find the
 language to be very natural. But these are issues that you will run into
 with Ruby development too, as getting good IDE support for a dynamic
 language can be even more difficult.

 I'd recommend Lift for your project, especially considering you want to use
 plenty of Ajax/Comet. I never even considered using Comet in a web project
 of mine until I started using Lift. The only case where I might recommend
 Rails is if you are not a decent coder yourself and you aren't able to find
 a good Lift developer to work with.

 Hope this helps

 --
 Derek Williams

 


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

2009-08-23 Thread Jack Widman
Thanks Marius. I agree its a no brainer. Just wanted some independent
confirmation!.

On Sun, Aug 23, 2009 at 1:08 PM, marius d. marius.dan...@gmail.com wrote:


 Looks like you don't need to be convinced :) ... Scala with its
 features + Java compatibility + Lift's rich set of features  +
 performance of Scala  Lift makes it a no brainer. Enumerating all the
 pros of Scala and Lift would just take way to long.


 The list of Scala books and the Lift book are enlisted here
 http://www.scala-lang.org/node/959

 Br's,
 Marius

 On Aug 23, 5:45 pm, jack jack.wid...@gmail.com wrote:
  I am doing a startup company that involves both a lot of processing on
  the backend (in the code) and a decent amount of comet/ajax in the
  frontend.It is very important that the code quickly  on the server.  I
  have seen the light with respect to Scala and Lift looks terrific. My
  only concern is how new it is and the availability of resources
  (programmers, books etc).
 
  I really do want to use Lift instead of Rails. Could somebody please
  convince me? :)
 


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