[Lift] Re: really basic lift question

2009-04-29 Thread David Pollak
On Wed, Apr 29, 2009 at 6:56 PM, Meredith Gregory
wrote:

> Charles, et al,
>
> i'm trying to do something dead simple and it is exposing all kinds of
> ignorance on my part regarding lift. (Yay! i get to learn new stuff -- which
> would be great if i weren't under a terrible time crunch.)
>
> Now, all i want to do is create a form with
>
>- 3 text boxes
>- 1 submit button
>- and an area for rendering a chart that results from a computation on
>the values of the text boxes
>
> Here's the minor complication. The submit is going to kick off a process
> that may be quite long running. So, i'll render immediately what's possible
> with the existing data and then when the long-running computation gets back
> to me i'll refresh the feedback. i thought this would be a poster-child app
> for the comet support. But, i'm realizing i don't really understand how
>
>- bind
>- text
>- submit
>- ...
>
> work and i find it difficult to navigate to their defns. For example,
> suppose i want the submit button to be greyed-out and inactive unless the 3
> text boxes have validated input in them. What is the simplest pair of a
> snippet and controller that will do that?


In terms of disabling the submit button until the input is valid, that's all
client-side JavaScript and no server-side Scala code. :-(  This part of the
page is static in that no matter the server state, the client code will be
rendered in the same way.  There is no snippet or controller or anything
else that changes the state of the submit button.

In terms of what happens when you want to submit, see the code at:
http://demo.liftweb.net/json

This is what you want to do... when the submit button is pressed (after the
client-side script has enabled it), you want to grab the values of a couple
of form elements and pass them as parameters in a JSON call.  On the server
side, you use pattern matching to extract the parameters and perform the
action.

See if you can make this non-comet code work first.  Once you get that
working, we can hook in the push of results back to the browser.  Also, I'd
encourage you to copy the code from the Json.scala and json.html files in
sites/example as a basis for your code.

Thanks,

David


>
>
> Best wishes,
>
> --greg
>
> --
> L.G. Meredith
> Managing Partner
> Biosimilarity LLC
> 1219 NW 83rd St
> Seattle, WA 98117
>
> +1 206.650.3740
>
> http://biosimilarity.blogspot.com
>
> >
>


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

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



[Lift] Re: Form Question

2009-04-29 Thread David Pollak
def create(action: String, target: String: body: NodeSeq) =
{
  body
}



On Wed, Apr 29, 2009 at 7:38 PM, sailormoo...@gmail.com <
sailormoo...@gmail.com> wrote:

>
> Hello:
>
>  It's me again. I would like to ask how to generate the following
> form tag with attribute.
> 
>
>  This form needs the following feature:
>  1. specifying the action link, with an parameter and #game_top
>  2. the target isn't the same window, it's another window
>  3. with an Javascript onSubmit to it
>
> Thanks for the help.
>
> >
>


-- 
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] Form Question

2009-04-29 Thread sailormoo...@gmail.com

Hello:

  It's me again. I would like to ask how to generate the following
form tag with attribute.


 This form needs the following feature:
 1. specifying the action link, with an parameter and #game_top
 2. the target isn't the same window, it's another window
 3. with an Javascript onSubmit to it

Thanks for the help.

--~--~-~--~~~---~--~~
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] really basic lift question

2009-04-29 Thread Meredith Gregory
Charles, et al,

i'm trying to do something dead simple and it is exposing all kinds of
ignorance on my part regarding lift. (Yay! i get to learn new stuff -- which
would be great if i weren't under a terrible time crunch.)

Now, all i want to do is create a form with

   - 3 text boxes
   - 1 submit button
   - and an area for rendering a chart that results from a computation on
   the values of the text boxes

Here's the minor complication. The submit is going to kick off a process
that may be quite long running. So, i'll render immediately what's possible
with the existing data and then when the long-running computation gets back
to me i'll refresh the feedback. i thought this would be a poster-child app
for the comet support. But, i'm realizing i don't really understand how

   - bind
   - text
   - submit
   - ...

work and i find it difficult to navigate to their defns. For example,
suppose i want the submit button to be greyed-out and inactive unless the 3
text boxes have validated input in them. What is the simplest pair of a
snippet and controller that will do that?

Best wishes,

--greg

-- 
L.G. Meredith
Managing Partner
Biosimilarity LLC
1219 NW 83rd St
Seattle, WA 98117

+1 206.650.3740

http://biosimilarity.blogspot.com

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



[Lift] comet sample app rendering problem

2009-04-29 Thread Meredith Gregory
Lifted,

i'm trying a minor variation on DPP's comet screencast and am running into a
weird rendering problem. The component associated with the "comet-managed
state" never renders. The relevant methods are listed below. Any help would
be greatly appreciated.

Best wishes,

--greg

// View

R-E-P-L



// CometListenee
case class Messages( ms : List[DataSamplePattern] )

class REPLForm extends CometActor with CometListenee {
...
  override def highPriority = {
case Messages( what ) => {
  _theDataSampleToRender =
Some( what ).asInstanceOf[Option[DataSample]]
  reRender( true )
}
  }

  def registerWith = TemperatureTSCometRenderer

  def render = {

  
   {
 ajaxText(
   "Now",
   s => { TemperatureTSCometRenderer ! InitialTime( s ); Noop}
 )
   }
  
  
  {
ajaxText(
  "Now",
  s => { TemperatureTSCometRenderer ! FinalTime( s ); Noop}
)
  }
  

  }

// Wire this up to Lift's support for Comet updates.
object TemperatureTSCometRenderer
 extends Actor
 with ListenerManager
 with TempDataServiceCnxn[TemperatureDataService.type]
 with TemperatureDataSource
{
  var _theUpdate : Option[DataSample] = None
  override def highPriority = {
case Connect( tds ) => {
  println( "received connect" );
  setTemperatureDataService(
Some( tds ).asInstanceOf[Option[TemperatureDataService.type]]
)
}
case DataSample( initTime, finalTime, tics, values ) => {
  println( "received data" );
  println( "update cache, render data" );
  updateCache( DataSample( initTime, finalTime, tics, values )
  )
  _theUpdate =
Some( DataSample( initTime, finalTime, tics, values ) )
  updateListeners()
}
case InitialTime( s ) => {
  println( "initial time request" );
}
case dsp : DataSamplePattern => {
  println( "check cache for data" );
  println( "if empty render null points and request data from service"
);
  println( "else if meets rules render" );
  println( "else recalc, render and request any additional data" );

  getMatchingSamples( dsp ) match {
case Nil => {
  println( "cache miss" )
  getTemperatureDataService match {
case Some( tds ) =>
  tds ! RequestTemperatureData( dsp, this )
case None =>
  throw new Exception( "disconnected from data service" )
  }
  dsp match {
case DataSamplePattern(
  Some( initTime ),
  Some( finalTime ),
  Some( tics ),
  _
) => {
  println(
DataSample(
  initTime, finalTime, tics, None
).toString
  )
}
case _ => throw new Exception( "not implemented" )
  }
}
case sample :: samples => {
  println( "cache hit" )
  sample
}
  }
}
  }

  def createUpdate = _theUpdate

  // start the actor
  start()

  // connect to the TemperatureDataService
  this ! Connect( TemperatureDataService )
 }

-- 
L.G. Meredith
Managing Partner
Biosimilarity LLC
1219 NW 83rd St
Seattle, WA 98117

+1 206.650.3740

http://biosimilarity.blogspot.com

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



[Lift] CometListener and CometActor

2009-04-29 Thread Meredith Gregory
David, et al,

i wanted to attempt to recapitulate some version of the screencast for the
comet stuff. Where does CometListener live?

Best wishes,

--greg

[INFO] Compiling 2 source files to
/Users/lgm/work/src/projex/biosimilarity/chart/target/classes
[WARNING]
/Users/lgm/work/src/projex/biosimilarity/chart/src/main/scala/com/biosimilarity/weather/snippet/REPLForm.scala:25:
error: not found: type CometListener
[WARNING] class REPLForm extends CometActor with CometListener {
[WARNING]^
[WARNING]
/Users/lgm/work/src/projex/biosimilarity/chart/src/main/scala/com/biosimilarity/weather/snippet/REPLForm.scala:122:
error: REPLForm.this.? of type Any does not take parameters
[WARNING] { {?("Go")} %
[WARNING]  ^
[WARNING]
/Users/lgm/work/src/projex/biosimilarity/chart/src/main/scala/com/biosimilarity/weather/snippet/REPLForm.scala:102:
error: type mismatch;
[WARNING]  found   : net.liftweb.http.RenderOut
[WARNING]  required: scala.xml.NodeSeq
[WARNING]   def show(xhtml: NodeSeq): NodeSeq = { render }
[WARNING] ^
[WARNING]
/Users/lgm/work/src/projex/biosimilarity/chart/src/main/scala/com/biosimilarity/weather/snippet/REPLForm.scala:105:
error: not found: value Messages
[WARNING] case Messages( what ) => {
[WARNING]  ^
[WARNING]
/Users/lgm/work/src/projex/biosimilarity/chart/src/main/scala/com/biosimilarity/weather/snippet/REPLForm.scala:107:
error: not found: value what
[WARNING] Some( what ).asInstanceOf[Option[DataSample]]
[WARNING]   ^
[WARNING] 5 errors found
[INFO]

[ERROR] BUILD FAILURE
[INFO]

[INFO] command line returned non-zero value:1
[INFO]

[INFO] For more information, run Maven with the -e switch
[INFO]

[INFO] Total time: 8 seconds
[INFO] Finished at: Wed Apr 29 14:12:10 PDT 2009
[INFO] Final Memory: 13M/25M
[INFO]

bash-3.2$

-- 
L.G. Meredith
Managing Partner
Biosimilarity LLC
1219 NW 83rd St
Seattle, WA 98117

+1 206.650.3740

http://biosimilarity.blogspot.com

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



[Lift] Re: Move common dependencies into parent POM?

2009-04-29 Thread Daniel Mueller

Not a complete solution (as that would indeed require additional
parents): The parent pom already has a dependencyManagement section,
which can indicate which exact version of a dependency should be used
in a child. Currently it's only used for the scala-lib and for the
servlet api. See [1] for more information and an explanation. Could be
used for more. To see a full fledged use case, check the ActiveMQ
parent pom[2].

There seems to be also the new possibility of importing dependencies
from one module into another [3], which would pretty much solve the
exact at hand. But it has been only introduced in 2.0.9, and it might
have some negative impact on the maven experience for users (Basically
there would be an additional 2.0.9 tag in pom to indicate that maven 2.0.9+ is required.
Discussed in the pom reference at [4]).

Cheers,
Daniel

[1] 
http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Dependency_Management
[2] http://svn.apache.org/repos/asf/activemq/tags/activemq-5.0.0/pom.xml
[3] 
http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Importing_Dependencies
[4] http://maven.apache.org/pom.html (search for prerequisites,
there's no decent anchor...)

On Apr 29, 7:51 pm, David Pollak 
wrote:
> On Wed, Apr 29, 2009 at 2:20 AM, Heiko Seeberger <
>
> heiko.seeber...@googlemail.com> wrote:
> > Hi,
> > For my work on OSGi-fying Lift I took a closer look at the POMs. I noticed,
> > that dependencies are duplicated across the modules, e.g. lift-util and
> > lift-webkit both declare almost the same dependencies.
>
> > What's the reason for that? Wouldn't it be better to move the common
> > dependencies into the parent POM / multiple parent POMs?
>
> Sure... if you can make that happen, wicked cool.
>
> Note that some Lift modules (e.g., lift-textile) should not depend on
> anything other than the base Scala distribution.
>
>
>
> > Heiko
> > --
> >www.heikoseeberger.name
> > OSGi on Scala:www.scalamodules.org
> > Lift, the simply functional web framework:http://liftweb.net
>
> --
> Lift, the simply functional web frameworkhttp://liftweb.net
> Beginning Scalahttp://www.apress.com/book/view/1430219890
> Follow me:http://twitter.com/dpp
> Git some:http://github.com/dpp

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



[Lift] Re: namespace problem again

2009-04-29 Thread David Pollak
On Wed, Apr 29, 2009 at 11:35 AM, Meredith Gregory  wrote:

> Lifted,
>
> Sorry for the sound and fury. i found the soln again: the following call
> had gotten mangled in boot
>
> LiftRules.addToPackages("com.biosimilarity.weather")
>
> That's a nasty one to get wrong. No help from the compiler. Error message
> completely misleading.


The "default" way to do snippets is naming by convention.  In your terminal
window, there should have been an error indicating that the snippet was not
invoked.

You can also register snippets:

In Boot.scala:

LiftRules.snippetDispatch.append {
  case "MySnippet" => MySnippet
}

object MySnippet extends DispatchSnippet {
  val dispatch = {
case "foo" => doFoo _
  }

   def doFoo(in: NodeSeq): NodeSeq = bind()
}




>
> Best wishes,
>
> --greg
>
>
> On Wed, Apr 29, 2009 at 11:27 AM, Meredith Gregory <
> lgreg.mered...@gmail.com> wrote:
>
>> Lifted,
>>
>> It appears that the interface for binding a namespace is side-effecting.
>> That's fine. But, i can't seem to understand the semantics. For example,
>>
>>- if one puts a call to bind at the beginning of a block for a method
>>that handles a post, and yet returns a different nodeseq, the desired 
>> effect
>>is not present.
>>- If one nests the bind call inside the construction of a nodeseq, the
>>effect is not present.
>>- On the other hand, if one puts a call to bind on a completely
>>different form, the desired effect is present in the post handler.
>>
>> i find that a little confusing. Is there a clean, simple model that will
>> help me understand how to use bind?
>>
>> Best wishes,
>>
>> --greg
>>
>>
>> On Wed, Apr 29, 2009 at 11:17 AM, Meredith Gregory <
>> lgreg.mered...@gmail.com> wrote:
>>
>>> David,
>>>
>>> Thanks for the suggestion, but no joy. The error is the same. BTW, the
>>> only difference i could spot between your proposal and mine was changing the
>>> "-->" to "->".
>>>
>>> Best wishes,
>>>
>>> --greg
>>>
>>> XML Parsing Error: prefix not bound to a namespace
>>> Location: http://localhost:8080/AJAXREPLForm
>>> Line Number 78, Column 58:Initial time
>>> :
>>> -^
>>>
>>> On Wed, Apr 29, 2009 at 11:00 AM, David Pollak <
>>> feeder.of.the.be...@gmail.com> wrote:
>>>
 Try:

   def show(xhtml: NodeSeq): NodeSeq = {
 {
   bind( "hello", xhtml,
"initialTimeField" -> text("Nil", (updateInitialTime _)) %
 ("size" -> "60") % ("id" -> "initialTimeField"),
"finalTimeField" -> text("Nil", (updateFinalTime _)) % ("size" ->
 "60") % ("id" -> "finalTimeField"),
"submit" -> {?("Go")} % ("onclick"
 -> ajaxCall(JsRaw("$('#initialTimeField').attr('value')"), s =>
 updateInitialTime(s)))
)
 }
   
   {whatNode(evalStr())}
 
   }
 }


 On Wed, Apr 29, 2009 at 10:51 AM, Meredith Gregory <
 lgreg.mered...@gmail.com> wrote:

> Lifted,
>
> i'm getting the following error. i've run into this before and resolved
> it, but i can't for the life of me remember what i did. All my other lift
> sites are constructed pretty much isomorphic to this one. Any help would 
> be
> greatly appreciated.
>
> Best wishes,
>
> --greg
>
> XML Parsing Error: prefix not bound to a namespace
> Location: http://localhost:8080/AJAXREPLForm
> Line Number 78, Column 58:Initial
> time :
> -^
>
> 
> R-E-P-L
> 
> Initial time
> :
> Final time
> :
> 
> Result: 
> 
> 
>
> class REPLForm {
>  // ...
>
> // close to what i usually do
> //   def show(xhtml: NodeSeq): NodeSeq = {
> // 
> //   Inital time :
> //   { text("Nil", (updateInitialTime _)) % ("size" -> "60") %
> ("id" -> "initialTimeField") }
> //   Final time :
> //   { text("Nil", (updateFinalTime _)) % ("size" -> "60") % ("id"
> -> "finalTimeField") }
> //   { {?("Go")} %
> //("onclick" ->
> ajaxCall(JsRaw("$('#initialTimeField').attr('value')"), s =>
> updateInitialTime(s))) }
> //   
> //   {whatNode(evalStr())}
> // 
> //   }
>
> // attempt to resolve the problem by putting in a call to bind
>   def show(xhtml: NodeSeq): NodeSeq = {
> {
>   bind( "hello", xhtml,
>"initialTimeField" --> text("Nil", (updateInitialTime _)) %
> ("size" -> "60") % ("id" -> "initialTimeField"),
>"finalTimeField" --> text("Nil", (updateFinalTime _)) % ("size"
> -> "60") % ("id" -> "finalTimeField"),
>"submit" --> {?("Go")} %
> ("onclick" -> ajaxCall(JsRaw("$('#initialTimeField').attr('value')"), s =>
> updateInitialTime(s)))
>   )
> }
> 

[Lift] Re: REST and CDATA

2009-04-29 Thread Channing Walton

ok thanks David

--~--~-~--~~~---~--~~
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: developing Scala/Lift using Eclipse

2009-04-29 Thread Channing Walton



On Apr 29, 1:55 pm, David Bernard  wrote:
> * if you set in your
>   
>     src/main/scala
>     src/test/scala

I seem to have that already but still have the problem after doing mvn
eclipse:eclipse

--~--~-~--~~~---~--~~
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 add object into session scope in lift

2009-04-29 Thread Andrew Scherpbier

I totally concur on the awesome explanation.  As a matter of fact, can a 
committer add some of this stuff (maybe not the scala stuff but the 
actual explanation of the SessionVar) to the scaladocs of the SessionVar 
class/object?  That would be a great place for this kind of documentation.


For me, the lack of usable scaladoc is really making it hard to learn 
lift.  I've been toying with the idea of submitting patches to add docs 
as soon as I figure out some stuff...  Problem is that it is going way 
too slow.  A specific example would be the quote from section 6.2.4 in 
the "Eploring Lift" draft that reads: "The CRUDify behavior is very 
flexible, with plenty of defs you can override to control the templates 
for pages..."  Then you go to the API docs for CRUDify and there are 
loads of cool defs, but no documentation what most of these do and what 
an override would get you.  For the ones that have docs it is just a 
single line that doesn't really help that much.
There is the source code.  That's great.  But unfortunately for me, 
Scala is still very much a write-only language since I'm still 
learning.  I know that's my problem, but I know I'm not the only one!  
(I'm learning (and liking!) Scala because of Lift, just like lots of 
people learned Ruby because of Rails.)


So, I want to help, because I think Lift is just about the coolest thing 
out there, but it is going to take a while for me to be able to 
contribute.  In the mean time, I would ask those in the know to try to 
add some docs to the code.

BTW, this mailing list of great.  The responses are *very* helpful.  
Keep them comin'!

--Andrew

Charles F. Munat wrote:
> Wow. This was super helpful even to a not-very-newbie. Thanks!
>
> Chas.
>
> David Pollak wrote:
>   
>> On Tue, Apr 28, 2009 at 11:07 PM, pravin karne > > wrote:
>>
>> hi,
>> i want some explanation for following code
>>
>>
>> object sessionObj extends SessionVar[HashMap[String, Int]](
>>new HashMap[String, Int]
>>  {
>>   override def default(key: String): Int = 0
>> }
>> )
>>
>>
>> Changing a few things that Tim said.
>>  
>>
>>
>> 1. how object extends class in scala.?
>>
>>
>> object creates a singleton... an instance of the class that can be 
>> shared within the scope that it was created.  If object is used at the 
>> top-level scope, then it is a singleton shared by all classes in that 
>> classloader (your Lift app.)
>>
>> In Scala everything is either an instance of an object or a method. 
>>  This means there are no statics, no primitives, etc.  In order to have 
>> a singleton instance shared within a classloader, use the object mechanism.
>>  
>>
>>
>> 2. are we going to create object of SessionVar class?
>>
>>
>> Yes, we create a singleton instance of the SessionVar class.  The 
>> SessionVar class uses a little machinery to access the backing store of 
>> your session.  So, the SessionVar doesn't actually store a value.  It is 
>> a proxy that gets the current session based on the context of your 
>> thread, it has a globally unique name and uses this name to look up the 
>> underlying value in a hashmap in the session and then casts it to the 
>> type of the specific SessionVar... in this case HashMap[String, Int]. 
>>  In this way, you have type-safe access to session data.  This is a 
>> material advance over the way session data is stored in a Java 
>> session... there's no casting on the user's part.
>>  
>>
>>
>> 3. are we calling constructor of given class?
>>
>>
>> Yes.  However, if you take a look at the SessionVar's constructor, it's 
>> as follows:
>>
>> class SessionVar[T](dflt: => T)
>>
>> This is a "call-by-name" parameter.  So, it's a function rather than a 
>> value.  Why do we do this?  This allows us to create a new instance of 
>> the default value of the SessionVar each time it's needed.  When you 
>> call the is method on the SessionVar, Lift looks to see if the SessioVar 
>> has been defined.  If it has not been defined, then the default value 
>> creator function is applied and we get a new default value, the 
>> SessionVar for the current session is set to that default value and the 
>> freshly minted value is returned.
>>  
>>
>>
>> 4. is it similar to java class which extends other class ,and then
>> create object of subclass?
>>
>>
>> Scala creates a subclass of SessionVar for your singleton.  If you do 
>> sessionObj.getClass.getName, it will not be SessionVar, but some 
>> compiler-generated name.   See the answer to #1.
>>
>>
>>
>>
>> I am beginner to scala and lift.
>>
>> Welcome to the community.
>>
>> Thanks,
>>
>> David
>>  
>>
>>
>> On Tue, Apr 28, 2009 at 7:28 PM, Timothy Perrett
>>  wrote:
>>
>>
>>
>> Try:
>>
>> // this gets you whatever is in the session object so add to it here
>> SessionObj.is
>>
>> Do you specifically need to use Java HashMap? If not, seems like

[Lift] Re: namespace problem again

2009-04-29 Thread Meredith Gregory
David,

Thanks, as always, for your responsiveness. i don't know if you saw my
earlier post, but i found and fixed the problem. However, now i'm running
into a more subtle problem related to how the JSRaw is handled. See below.

Best wishes,

--greg

Here's the error according to firebug

F507651869906K3V is not defined
onclick(click clientX=479, clientY=201)6FsTX8d6...J7Q%3D%3D (line 2)
(F507651869906K3V, lift_ajaxHand...TimeField").attr("value"), null, null));

function onclick(event) { (F507651869906K3V,
lift_ajaxHandler("F507651869906K3V=" + $("#initialTimeField").attr("value")
+ "--" + $("#finalTimeField").attr("value"), null, null));
 }

The code that causes this problem is the handler for the onclick event for
the button. As near as i can tell, my raw JS is fine. This seems to have to
do with how the JsRaw is generating the onclick code.

  def show(xhtml: NodeSeq): NodeSeq = {

  Inital time :
  { text("Now", (updateInitialTime _)) % ("size" -> "60") % ("id" ->
"initialTimeField") }

  Final time :
  { text("Now", (updateFinalTime _)) % ("size" -> "60") % ("id" ->
"finalTimeField") }

{ {?("Go")} %
   ("onclick" ->
ajaxCall(JsRaw("$('#initialTimeField').attr('value')+'--'+$('#finalTimeField').attr('value')"),
s => updateChart(s))) }
  
  {whatNode()}

  }


On Wed, Apr 29, 2009 at 11:44 AM, David Pollak <
feeder.of.the.be...@gmail.com> wrote:

>
>
> On Wed, Apr 29, 2009 at 11:17 AM, Meredith Gregory <
> lgreg.mered...@gmail.com> wrote:
>
>> David,
>>
>> Thanks for the suggestion, but no joy. The error is the same. BTW, the
>> only difference i could spot between your proposal and mine was changing the
>> "-->" to "->".
>>
>
> Yeah... that was the difference.
>
> Can you send me breaking code and I'll fix it?
>
>
>>
>>
>> Best wishes,
>>
>> --greg
>>
>> XML Parsing Error: prefix not bound to a namespace
>> Location: http://localhost:8080/AJAXREPLForm
>> Line Number 78, Column 58:Initial time
>> :
>> -^
>>
>> On Wed, Apr 29, 2009 at 11:00 AM, David Pollak <
>> feeder.of.the.be...@gmail.com> wrote:
>>
>>> Try:
>>>
>>>   def show(xhtml: NodeSeq): NodeSeq = {
>>> {
>>>   bind( "hello", xhtml,
>>>"initialTimeField" -> text("Nil", (updateInitialTime _)) % ("size"
>>> -> "60") % ("id" -> "initialTimeField"),
>>>"finalTimeField" -> text("Nil", (updateFinalTime _)) % ("size" ->
>>> "60") % ("id" -> "finalTimeField"),
>>>"submit" -> {?("Go")} % ("onclick"
>>> -> ajaxCall(JsRaw("$('#initialTimeField').attr('value')"), s =>
>>> updateInitialTime(s)))
>>>)
>>> }
>>>   
>>>   {whatNode(evalStr())}
>>> 
>>>   }
>>> }
>>>
>>>
>>> On Wed, Apr 29, 2009 at 10:51 AM, Meredith Gregory <
>>> lgreg.mered...@gmail.com> wrote:
>>>
 Lifted,

 i'm getting the following error. i've run into this before and resolved
 it, but i can't for the life of me remember what i did. All my other lift
 sites are constructed pretty much isomorphic to this one. Any help would be
 greatly appreciated.

 Best wishes,

 --greg

 XML Parsing Error: prefix not bound to a namespace
 Location: http://localhost:8080/AJAXREPLForm
 Line Number 78, Column 58:Initial
 time :
 -^

 
 R-E-P-L
 
 Initial time
 :
 Final time
 :
 
 Result: 
 
 

 class REPLForm {
  // ...

 // close to what i usually do
 //   def show(xhtml: NodeSeq): NodeSeq = {
 // 
 //   Inital time :
 //   { text("Nil", (updateInitialTime _)) % ("size" -> "60") % ("id"
 -> "initialTimeField") }
 //   Final time :
 //   { text("Nil", (updateFinalTime _)) % ("size" -> "60") % ("id"
 -> "finalTimeField") }
 //   { {?("Go")} %
 //("onclick" ->
 ajaxCall(JsRaw("$('#initialTimeField').attr('value')"), s =>
 updateInitialTime(s))) }
 //   
 //   {whatNode(evalStr())}
 // 
 //   }

 // attempt to resolve the problem by putting in a call to bind
   def show(xhtml: NodeSeq): NodeSeq = {
 {
   bind( "hello", xhtml,
"initialTimeField" --> text("Nil", (updateInitialTime _)) %
 ("size" -> "60") % ("id" -> "initialTimeField"),
"finalTimeField" --> text("Nil", (updateFinalTime _)) % ("size"
 -> "60") % ("id" -> "finalTimeField"),
"submit" --> {?("Go")} %
 ("onclick" -> ajaxCall(JsRaw("$('#initialTimeField').attr('value')"), s =>
 updateInitialTime(s)))
   )
 }
   
   {whatNode(evalStr())}
 
   }
 }

 --
 L.G. Meredith
 Managing Partner
 Biosimilarity LLC
 1219 NW 83rd St
 Seattle, WA 98117

 +1 206.650.3740

 http://biosimilarity.bl

[Lift] Re: Java Object Persistence

2009-04-29 Thread Viktor Klang
Ah! Thanks Charles! ^_^

On Wed, Apr 29, 2009 at 8:52 PM, Charles F. Munat  wrote:

>
> And I guess it is LGPL (I thought I saw something else, but maybe I'm
> confusing it with one of the other fifty solutions I looked at).
>
> Good enough.
>
> Chas.
>
> Viktor Klang wrote:
> > Hi guys,
> >
> > it seems that my dementia keeps reminding itself. (the irony of it...)
> > Charles, what was the name of that persistence framework you were
> > mentioning on the conf-call?
> >
> >
> > Cheers!
> > --
> > Viktor Klang
> > Senior Systems Analyst
> >
> > >
>
> >
>


-- 
Viktor Klang
Senior Systems Analyst

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



[Lift] Re: Java Object Persistence

2009-04-29 Thread Charles F. Munat

And I guess it is LGPL (I thought I saw something else, but maybe I'm 
confusing it with one of the other fifty solutions I looked at).

Good enough.

Chas.

Viktor Klang wrote:
> Hi guys,
> 
> it seems that my dementia keeps reminding itself. (the irony of it...)
> Charles, what was the name of that persistence framework you were 
> mentioning on the conf-call?
> 
> 
> Cheers!
> -- 
> Viktor Klang
> Senior Systems Analyst
> 
> > 

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



[Lift] Re: Java Object Persistence

2009-04-29 Thread Charles F. Munat

NeoDatis

http://www.neodatis.org/

So far, it rocks.

Chas.

Viktor Klang wrote:
> Hi guys,
> 
> it seems that my dementia keeps reminding itself. (the irony of it...)
> Charles, what was the name of that persistence framework you were 
> mentioning on the conf-call?
> 
> 
> Cheers!
> -- 
> Viktor Klang
> Senior Systems Analyst
> 
> > 

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



[Lift] Re: namespace problem again

2009-04-29 Thread David Pollak
On Wed, Apr 29, 2009 at 11:17 AM, Meredith Gregory  wrote:

> David,
>
> Thanks for the suggestion, but no joy. The error is the same. BTW, the only
> difference i could spot between your proposal and mine was changing the
> "-->" to "->".
>

Yeah... that was the difference.

Can you send me breaking code and I'll fix it?


>
>
> Best wishes,
>
> --greg
>
> XML Parsing Error: prefix not bound to a namespace
> Location: http://localhost:8080/AJAXREPLForm
> Line Number 78, Column 58:Initial time
> :
> -^
>
> On Wed, Apr 29, 2009 at 11:00 AM, David Pollak <
> feeder.of.the.be...@gmail.com> wrote:
>
>> Try:
>>
>>   def show(xhtml: NodeSeq): NodeSeq = {
>> {
>>   bind( "hello", xhtml,
>>"initialTimeField" -> text("Nil", (updateInitialTime _)) % ("size"
>> -> "60") % ("id" -> "initialTimeField"),
>>"finalTimeField" -> text("Nil", (updateFinalTime _)) % ("size" ->
>> "60") % ("id" -> "finalTimeField"),
>>"submit" -> {?("Go")} % ("onclick"
>> -> ajaxCall(JsRaw("$('#initialTimeField').attr('value')"), s =>
>> updateInitialTime(s)))
>>)
>> }
>>   
>>   {whatNode(evalStr())}
>> 
>>   }
>> }
>>
>>
>> On Wed, Apr 29, 2009 at 10:51 AM, Meredith Gregory <
>> lgreg.mered...@gmail.com> wrote:
>>
>>> Lifted,
>>>
>>> i'm getting the following error. i've run into this before and resolved
>>> it, but i can't for the life of me remember what i did. All my other lift
>>> sites are constructed pretty much isomorphic to this one. Any help would be
>>> greatly appreciated.
>>>
>>> Best wishes,
>>>
>>> --greg
>>>
>>> XML Parsing Error: prefix not bound to a namespace
>>> Location: http://localhost:8080/AJAXREPLForm
>>> Line Number 78, Column 58:Initial time
>>> :
>>> -^
>>>
>>> 
>>> R-E-P-L
>>> 
>>> Initial time
>>> :
>>> Final time
>>> :
>>> 
>>> Result: 
>>> 
>>> 
>>>
>>> class REPLForm {
>>>  // ...
>>>
>>> // close to what i usually do
>>> //   def show(xhtml: NodeSeq): NodeSeq = {
>>> // 
>>> //   Inital time :
>>> //   { text("Nil", (updateInitialTime _)) % ("size" -> "60") % ("id"
>>> -> "initialTimeField") }
>>> //   Final time :
>>> //   { text("Nil", (updateFinalTime _)) % ("size" -> "60") % ("id" ->
>>> "finalTimeField") }
>>> //   { {?("Go")} %
>>> //("onclick" ->
>>> ajaxCall(JsRaw("$('#initialTimeField').attr('value')"), s =>
>>> updateInitialTime(s))) }
>>> //   
>>> //   {whatNode(evalStr())}
>>> // 
>>> //   }
>>>
>>> // attempt to resolve the problem by putting in a call to bind
>>>   def show(xhtml: NodeSeq): NodeSeq = {
>>> {
>>>   bind( "hello", xhtml,
>>>"initialTimeField" --> text("Nil", (updateInitialTime _)) %
>>> ("size" -> "60") % ("id" -> "initialTimeField"),
>>>"finalTimeField" --> text("Nil", (updateFinalTime _)) % ("size" ->
>>> "60") % ("id" -> "finalTimeField"),
>>>"submit" --> {?("Go")} % ("onclick"
>>> -> ajaxCall(JsRaw("$('#initialTimeField').attr('value')"), s =>
>>> updateInitialTime(s)))
>>>   )
>>> }
>>>   
>>>   {whatNode(evalStr())}
>>> 
>>>   }
>>> }
>>>
>>> --
>>> L.G. Meredith
>>> Managing Partner
>>> Biosimilarity LLC
>>> 1219 NW 83rd St
>>> Seattle, WA 98117
>>>
>>> +1 206.650.3740
>>>
>>> http://biosimilarity.blogspot.com
>>>
>>>
>>>
>>
>>
>> --
>> Lift, the simply functional web framework http://liftweb.net
>> Beginning Scala http://www.apress.com/book/view/1430219890
>> Follow me: http://twitter.com/dpp
>> Git some: http://github.com/dpp
>>
>>
>>
>
>
> --
> L.G. Meredith
> Managing Partner
> Biosimilarity LLC
> 1219 NW 83rd St
> Seattle, WA 98117
>
> +1 206.650.3740
>
> http://biosimilarity.blogspot.com
>
> >
>


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

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



[Lift] Java Object Persistence

2009-04-29 Thread Viktor Klang
Hi guys,

it seems that my dementia keeps reminding itself. (the irony of it...)
Charles, what was the name of that persistence framework you were mentioning
on the conf-call?


Cheers!
-- 
Viktor Klang
Senior Systems Analyst

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



[Lift] Re: namespace problem again

2009-04-29 Thread Meredith Gregory
Lifted,

Sorry for the sound and fury. i found the soln again: the following call had
gotten mangled in boot

LiftRules.addToPackages("com.biosimilarity.weather")

That's a nasty one to get wrong. No help from the compiler. Error message
completely misleading.

Best wishes,

--greg

On Wed, Apr 29, 2009 at 11:27 AM, Meredith Gregory  wrote:

> Lifted,
>
> It appears that the interface for binding a namespace is side-effecting.
> That's fine. But, i can't seem to understand the semantics. For example,
>
>- if one puts a call to bind at the beginning of a block for a method
>that handles a post, and yet returns a different nodeseq, the desired 
> effect
>is not present.
>- If one nests the bind call inside the construction of a nodeseq, the
>effect is not present.
>- On the other hand, if one puts a call to bind on a completely
>different form, the desired effect is present in the post handler.
>
> i find that a little confusing. Is there a clean, simple model that will
> help me understand how to use bind?
>
> Best wishes,
>
> --greg
>
>
> On Wed, Apr 29, 2009 at 11:17 AM, Meredith Gregory <
> lgreg.mered...@gmail.com> wrote:
>
>> David,
>>
>> Thanks for the suggestion, but no joy. The error is the same. BTW, the
>> only difference i could spot between your proposal and mine was changing the
>> "-->" to "->".
>>
>> Best wishes,
>>
>> --greg
>>
>> XML Parsing Error: prefix not bound to a namespace
>> Location: http://localhost:8080/AJAXREPLForm
>> Line Number 78, Column 58:Initial time
>> :
>> -^
>>
>> On Wed, Apr 29, 2009 at 11:00 AM, David Pollak <
>> feeder.of.the.be...@gmail.com> wrote:
>>
>>> Try:
>>>
>>>   def show(xhtml: NodeSeq): NodeSeq = {
>>> {
>>>   bind( "hello", xhtml,
>>>"initialTimeField" -> text("Nil", (updateInitialTime _)) % ("size"
>>> -> "60") % ("id" -> "initialTimeField"),
>>>"finalTimeField" -> text("Nil", (updateFinalTime _)) % ("size" ->
>>> "60") % ("id" -> "finalTimeField"),
>>>"submit" -> {?("Go")} % ("onclick"
>>> -> ajaxCall(JsRaw("$('#initialTimeField').attr('value')"), s =>
>>> updateInitialTime(s)))
>>>)
>>> }
>>>   
>>>   {whatNode(evalStr())}
>>> 
>>>   }
>>> }
>>>
>>>
>>> On Wed, Apr 29, 2009 at 10:51 AM, Meredith Gregory <
>>> lgreg.mered...@gmail.com> wrote:
>>>
 Lifted,

 i'm getting the following error. i've run into this before and resolved
 it, but i can't for the life of me remember what i did. All my other lift
 sites are constructed pretty much isomorphic to this one. Any help would be
 greatly appreciated.

 Best wishes,

 --greg

 XML Parsing Error: prefix not bound to a namespace
 Location: http://localhost:8080/AJAXREPLForm
 Line Number 78, Column 58:Initial
 time :
 -^

 
 R-E-P-L
 
 Initial time
 :
 Final time
 :
 
 Result: 
 
 

 class REPLForm {
  // ...

 // close to what i usually do
 //   def show(xhtml: NodeSeq): NodeSeq = {
 // 
 //   Inital time :
 //   { text("Nil", (updateInitialTime _)) % ("size" -> "60") % ("id"
 -> "initialTimeField") }
 //   Final time :
 //   { text("Nil", (updateFinalTime _)) % ("size" -> "60") % ("id"
 -> "finalTimeField") }
 //   { {?("Go")} %
 //("onclick" ->
 ajaxCall(JsRaw("$('#initialTimeField').attr('value')"), s =>
 updateInitialTime(s))) }
 //   
 //   {whatNode(evalStr())}
 // 
 //   }

 // attempt to resolve the problem by putting in a call to bind
   def show(xhtml: NodeSeq): NodeSeq = {
 {
   bind( "hello", xhtml,
"initialTimeField" --> text("Nil", (updateInitialTime _)) %
 ("size" -> "60") % ("id" -> "initialTimeField"),
"finalTimeField" --> text("Nil", (updateFinalTime _)) % ("size"
 -> "60") % ("id" -> "finalTimeField"),
"submit" --> {?("Go")} %
 ("onclick" -> ajaxCall(JsRaw("$('#initialTimeField').attr('value')"), s =>
 updateInitialTime(s)))
   )
 }
   
   {whatNode(evalStr())}
 
   }
 }

 --
 L.G. Meredith
 Managing Partner
 Biosimilarity LLC
 1219 NW 83rd St
 Seattle, WA 98117

 +1 206.650.3740

 http://biosimilarity.blogspot.com



>>>
>>>
>>> --
>>> Lift, the simply functional web framework http://liftweb.net
>>> Beginning Scala http://www.apress.com/book/view/1430219890
>>> Follow me: http://twitter.com/dpp
>>> Git some: http://github.com/dpp
>>>
>>> >>>
>>>
>>
>>
>> --
>> L.G. Meredith
>> Managing Partner
>> Biosimilarity LLC
>> 1219 NW 83rd St
>> Seattle, WA 98117
>>
>> +1 206.650.3740
>>
>> http://biosimilarity.blogspot.com
>>
>
>
>
> -

[Lift] Re: namespace problem again

2009-04-29 Thread Meredith Gregory
Lifted,

It appears that the interface for binding a namespace is side-effecting.
That's fine. But, i can't seem to understand the semantics. For example,

   - if one puts a call to bind at the beginning of a block for a method
   that handles a post, and yet returns a different nodeseq, the desired effect
   is not present.
   - If one nests the bind call inside the construction of a nodeseq, the
   effect is not present.
   - On the other hand, if one puts a call to bind on a completely different
   form, the desired effect is present in the post handler.

i find that a little confusing. Is there a clean, simple model that will
help me understand how to use bind?

Best wishes,

--greg

On Wed, Apr 29, 2009 at 11:17 AM, Meredith Gregory  wrote:

> David,
>
> Thanks for the suggestion, but no joy. The error is the same. BTW, the only
> difference i could spot between your proposal and mine was changing the
> "-->" to "->".
>
> Best wishes,
>
> --greg
>
> XML Parsing Error: prefix not bound to a namespace
> Location: http://localhost:8080/AJAXREPLForm
> Line Number 78, Column 58:Initial time
> :
> -^
>
> On Wed, Apr 29, 2009 at 11:00 AM, David Pollak <
> feeder.of.the.be...@gmail.com> wrote:
>
>> Try:
>>
>>   def show(xhtml: NodeSeq): NodeSeq = {
>> {
>>   bind( "hello", xhtml,
>>"initialTimeField" -> text("Nil", (updateInitialTime _)) % ("size"
>> -> "60") % ("id" -> "initialTimeField"),
>>"finalTimeField" -> text("Nil", (updateFinalTime _)) % ("size" ->
>> "60") % ("id" -> "finalTimeField"),
>>"submit" -> {?("Go")} % ("onclick"
>> -> ajaxCall(JsRaw("$('#initialTimeField').attr('value')"), s =>
>> updateInitialTime(s)))
>>)
>> }
>>   
>>   {whatNode(evalStr())}
>> 
>>   }
>> }
>>
>>
>> On Wed, Apr 29, 2009 at 10:51 AM, Meredith Gregory <
>> lgreg.mered...@gmail.com> wrote:
>>
>>> Lifted,
>>>
>>> i'm getting the following error. i've run into this before and resolved
>>> it, but i can't for the life of me remember what i did. All my other lift
>>> sites are constructed pretty much isomorphic to this one. Any help would be
>>> greatly appreciated.
>>>
>>> Best wishes,
>>>
>>> --greg
>>>
>>> XML Parsing Error: prefix not bound to a namespace
>>> Location: http://localhost:8080/AJAXREPLForm
>>> Line Number 78, Column 58:Initial time
>>> :
>>> -^
>>>
>>> 
>>> R-E-P-L
>>> 
>>> Initial time
>>> :
>>> Final time
>>> :
>>> 
>>> Result: 
>>> 
>>> 
>>>
>>> class REPLForm {
>>>  // ...
>>>
>>> // close to what i usually do
>>> //   def show(xhtml: NodeSeq): NodeSeq = {
>>> // 
>>> //   Inital time :
>>> //   { text("Nil", (updateInitialTime _)) % ("size" -> "60") % ("id"
>>> -> "initialTimeField") }
>>> //   Final time :
>>> //   { text("Nil", (updateFinalTime _)) % ("size" -> "60") % ("id" ->
>>> "finalTimeField") }
>>> //   { {?("Go")} %
>>> //("onclick" ->
>>> ajaxCall(JsRaw("$('#initialTimeField').attr('value')"), s =>
>>> updateInitialTime(s))) }
>>> //   
>>> //   {whatNode(evalStr())}
>>> // 
>>> //   }
>>>
>>> // attempt to resolve the problem by putting in a call to bind
>>>   def show(xhtml: NodeSeq): NodeSeq = {
>>> {
>>>   bind( "hello", xhtml,
>>>"initialTimeField" --> text("Nil", (updateInitialTime _)) %
>>> ("size" -> "60") % ("id" -> "initialTimeField"),
>>>"finalTimeField" --> text("Nil", (updateFinalTime _)) % ("size" ->
>>> "60") % ("id" -> "finalTimeField"),
>>>"submit" --> {?("Go")} % ("onclick"
>>> -> ajaxCall(JsRaw("$('#initialTimeField').attr('value')"), s =>
>>> updateInitialTime(s)))
>>>   )
>>> }
>>>   
>>>   {whatNode(evalStr())}
>>> 
>>>   }
>>> }
>>>
>>> --
>>> L.G. Meredith
>>> Managing Partner
>>> Biosimilarity LLC
>>> 1219 NW 83rd St
>>> Seattle, WA 98117
>>>
>>> +1 206.650.3740
>>>
>>> http://biosimilarity.blogspot.com
>>>
>>>
>>>
>>
>>
>> --
>> Lift, the simply functional web framework http://liftweb.net
>> Beginning Scala http://www.apress.com/book/view/1430219890
>> Follow me: http://twitter.com/dpp
>> Git some: http://github.com/dpp
>>
>> >>
>>
>
>
> --
> L.G. Meredith
> Managing Partner
> Biosimilarity LLC
> 1219 NW 83rd St
> Seattle, WA 98117
>
> +1 206.650.3740
>
> http://biosimilarity.blogspot.com
>



-- 
L.G. Meredith
Managing Partner
Biosimilarity LLC
1219 NW 83rd St
Seattle, WA 98117

+1 206.650.3740

http://biosimilarity.blogspot.com

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



[Lift] Re: namespace problem again

2009-04-29 Thread Meredith Gregory
David,

Thanks for the suggestion, but no joy. The error is the same. BTW, the only
difference i could spot between your proposal and mine was changing the
"-->" to "->".

Best wishes,

--greg

XML Parsing Error: prefix not bound to a namespace
Location: http://localhost:8080/AJAXREPLForm
Line Number 78, Column 58:Initial time
:
-^

On Wed, Apr 29, 2009 at 11:00 AM, David Pollak <
feeder.of.the.be...@gmail.com> wrote:

> Try:
>
>   def show(xhtml: NodeSeq): NodeSeq = {
> {
>   bind( "hello", xhtml,
>"initialTimeField" -> text("Nil", (updateInitialTime _)) % ("size"
> -> "60") % ("id" -> "initialTimeField"),
>"finalTimeField" -> text("Nil", (updateFinalTime _)) % ("size" ->
> "60") % ("id" -> "finalTimeField"),
>"submit" -> {?("Go")} % ("onclick" ->
> ajaxCall(JsRaw("$('#initialTimeField').attr('value')"), s =>
> updateInitialTime(s)))
>)
> }
>   
>   {whatNode(evalStr())}
> 
>   }
> }
>
>
> On Wed, Apr 29, 2009 at 10:51 AM, Meredith Gregory <
> lgreg.mered...@gmail.com> wrote:
>
>> Lifted,
>>
>> i'm getting the following error. i've run into this before and resolved
>> it, but i can't for the life of me remember what i did. All my other lift
>> sites are constructed pretty much isomorphic to this one. Any help would be
>> greatly appreciated.
>>
>> Best wishes,
>>
>> --greg
>>
>> XML Parsing Error: prefix not bound to a namespace
>> Location: http://localhost:8080/AJAXREPLForm
>> Line Number 78, Column 58:Initial time
>> :
>> -^
>>
>> 
>> R-E-P-L
>> 
>> Initial time
>> :
>> Final time
>> :
>> 
>> Result: 
>> 
>> 
>>
>> class REPLForm {
>>  // ...
>>
>> // close to what i usually do
>> //   def show(xhtml: NodeSeq): NodeSeq = {
>> // 
>> //   Inital time :
>> //   { text("Nil", (updateInitialTime _)) % ("size" -> "60") % ("id"
>> -> "initialTimeField") }
>> //   Final time :
>> //   { text("Nil", (updateFinalTime _)) % ("size" -> "60") % ("id" ->
>> "finalTimeField") }
>> //   { {?("Go")} %
>> //("onclick" ->
>> ajaxCall(JsRaw("$('#initialTimeField').attr('value')"), s =>
>> updateInitialTime(s))) }
>> //   
>> //   {whatNode(evalStr())}
>> // 
>> //   }
>>
>> // attempt to resolve the problem by putting in a call to bind
>>   def show(xhtml: NodeSeq): NodeSeq = {
>> {
>>   bind( "hello", xhtml,
>>"initialTimeField" --> text("Nil", (updateInitialTime _)) % ("size"
>> -> "60") % ("id" -> "initialTimeField"),
>>"finalTimeField" --> text("Nil", (updateFinalTime _)) % ("size" ->
>> "60") % ("id" -> "finalTimeField"),
>>"submit" --> {?("Go")} % ("onclick"
>> -> ajaxCall(JsRaw("$('#initialTimeField').attr('value')"), s =>
>> updateInitialTime(s)))
>>   )
>> }
>>   
>>   {whatNode(evalStr())}
>> 
>>   }
>> }
>>
>> --
>> L.G. Meredith
>> Managing Partner
>> Biosimilarity LLC
>> 1219 NW 83rd St
>> Seattle, WA 98117
>>
>> +1 206.650.3740
>>
>> http://biosimilarity.blogspot.com
>>
>>
>>
>
>
> --
> Lift, the simply functional web framework http://liftweb.net
> Beginning Scala http://www.apress.com/book/view/1430219890
> Follow me: http://twitter.com/dpp
> Git some: http://github.com/dpp
>
> >
>


-- 
L.G. Meredith
Managing Partner
Biosimilarity LLC
1219 NW 83rd St
Seattle, WA 98117

+1 206.650.3740

http://biosimilarity.blogspot.com

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



[Lift] Re: how to add object into session scope in lift

2009-04-29 Thread Charles F. Munat

Wow. This was super helpful even to a not-very-newbie. Thanks!

Chas.

David Pollak wrote:
> 
> 
> On Tue, Apr 28, 2009 at 11:07 PM, pravin karne  > wrote:
> 
> hi,
> i want some explanation for following code
> 
> 
> object sessionObj extends SessionVar[HashMap[String, Int]](
>new HashMap[String, Int]
>  {
>   override def default(key: String): Int = 0
> }
> )
> 
> 
> Changing a few things that Tim said.
>  
> 
> 
> 1. how object extends class in scala.?
> 
> 
> object creates a singleton... an instance of the class that can be 
> shared within the scope that it was created.  If object is used at the 
> top-level scope, then it is a singleton shared by all classes in that 
> classloader (your Lift app.)
> 
> In Scala everything is either an instance of an object or a method. 
>  This means there are no statics, no primitives, etc.  In order to have 
> a singleton instance shared within a classloader, use the object mechanism.
>  
> 
> 
> 2. are we going to create object of SessionVar class?
> 
> 
> Yes, we create a singleton instance of the SessionVar class.  The 
> SessionVar class uses a little machinery to access the backing store of 
> your session.  So, the SessionVar doesn't actually store a value.  It is 
> a proxy that gets the current session based on the context of your 
> thread, it has a globally unique name and uses this name to look up the 
> underlying value in a hashmap in the session and then casts it to the 
> type of the specific SessionVar... in this case HashMap[String, Int]. 
>  In this way, you have type-safe access to session data.  This is a 
> material advance over the way session data is stored in a Java 
> session... there's no casting on the user's part.
>  
> 
> 
> 3. are we calling constructor of given class?
> 
> 
> Yes.  However, if you take a look at the SessionVar's constructor, it's 
> as follows:
> 
> class SessionVar[T](dflt: => T)
> 
> This is a "call-by-name" parameter.  So, it's a function rather than a 
> value.  Why do we do this?  This allows us to create a new instance of 
> the default value of the SessionVar each time it's needed.  When you 
> call the is method on the SessionVar, Lift looks to see if the SessioVar 
> has been defined.  If it has not been defined, then the default value 
> creator function is applied and we get a new default value, the 
> SessionVar for the current session is set to that default value and the 
> freshly minted value is returned.
>  
> 
> 
> 4. is it similar to java class which extends other class ,and then
> create object of subclass?
> 
> 
> Scala creates a subclass of SessionVar for your singleton.  If you do 
> sessionObj.getClass.getName, it will not be SessionVar, but some 
> compiler-generated name.   See the answer to #1.
> 
> 
> 
> 
> I am beginner to scala and lift.
> 
> Welcome to the community.
> 
> Thanks,
> 
> David
>  
> 
> 
> On Tue, Apr 28, 2009 at 7:28 PM, Timothy Perrett
>  wrote:
> 
> 
> 
> Try:
> 
> // this gets you whatever is in the session object so add to it here
> SessionObj.is
> 
> Do you specifically need to use Java HashMap? If not, seems like
> List[(String,Int)] would be more lift-esq.
> 
> Cheers, Tim
> 
> On 28/04/2009 13:30, "pravin"  > wrote:
> 
>  >
>  > Hi guys,
>  > I want to add objects into session scope.
>  >
>  > i am using following code :
>  >
>  > object sessionObj extends SessionVar[HashMap[String, Int]](
>  > new HashMap[String, Int]
>  >   {
>  >override def default(key: String): Int = 0
>  >  }
>  > )
>  >
>  > So as per my understanding :-
>  >
>  > 1. Session object is of HashMap[String, Int] type.
>  > 2. I want to add no of string object into above map so i can
>  > access them during my session
>  >
>  > correct me if i am wrong
>  >
>  >
>  >So please let me know how can i add/remove  different
> String object
>  > from session scope with above code snippet
>  >
>  > Thanks in advance
>  >
>  > >
>  >
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> -- 
> Lift, the simply functional web framework http://liftweb.net
> Beginning Scala http://www.apress.com/book/view/1430219890
> Follow me: http://twitter.com/dpp
> Git some: http://github.com/dpp
> 
> > 

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

[Lift] Re: timestamp versioning for javascript includes

2009-04-29 Thread David Pollak
On Wed, Apr 29, 2009 at 10:58 AM, Lee Mighdoll  wrote:

>
> I think the browsers cache urls with params... a quick glance at the rails
>>> docs suggest they expect these requests to be cached, though I haven't
>>> tested it mysolf.
>>>
>>> I'd imagine this also needs to work for non-/classpath served files.
>>> Does that push us back to the params style?
>>>
>>
>> No, because you can rewrite the incoming URLs back to what they should be.
>>
>
> So if I understand you correctly, "/date_{date_format}" will become magic
> anywhere in url request paths.  so these work too:
> classpath/js/date_2009_04_29_18_20/json.s   or
> /foo/bar/date_2009_04_29_18_20/json.s.
>
> That's ok with me, though it's a bit more aggressive to mess with the
> segments of the mapping of the url path to file system path.
>
> Potentially could use dates on directories then too, although I'm not quite
> sure why.  e.g.  foo/date_2009_04_29_18_20/bar/json.js would check the
> modification date of the bar directory..
>

or:

/classpath/date_2009_04_29_18_20/classpath.js -> /classpath/classpath.js

/dated_resource/date_2009_04_29_18_20/my_resource_dir/my_resource.js ->
/my_resource_dir/my_resource.js



>
>
> Lee
>
>
>
>
> >
>


-- 
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: namespace problem again

2009-04-29 Thread David Pollak
Try:

  def show(xhtml: NodeSeq): NodeSeq = {
{
  bind( "hello", xhtml,
   "initialTimeField" -> text("Nil", (updateInitialTime _)) % ("size" ->
"60") % ("id" -> "initialTimeField"),
   "finalTimeField" -> text("Nil", (updateFinalTime _)) % ("size" ->
"60") % ("id" -> "finalTimeField"),
   "submit" -> {?("Go")} % ("onclick" ->
ajaxCall(JsRaw("$('#initialTimeField').attr('value')"), s =>
updateInitialTime(s)))
  )
}
  
  {whatNode(evalStr())}

  }
}


On Wed, Apr 29, 2009 at 10:51 AM, Meredith Gregory  wrote:

> Lifted,
>
> i'm getting the following error. i've run into this before and resolved it,
> but i can't for the life of me remember what i did. All my other lift sites
> are constructed pretty much isomorphic to this one. Any help would be
> greatly appreciated.
>
> Best wishes,
>
> --greg
>
> XML Parsing Error: prefix not bound to a namespace
> Location: http://localhost:8080/AJAXREPLForm
> Line Number 78, Column 58:Initial time
> :
> -^
>
> 
> R-E-P-L
> 
> Initial time
> :
> Final time
> :
> 
> Result: 
> 
> 
>
> class REPLForm {
>  // ...
>
> // close to what i usually do
> //   def show(xhtml: NodeSeq): NodeSeq = {
> // 
> //   Inital time :
> //   { text("Nil", (updateInitialTime _)) % ("size" -> "60") % ("id" ->
> "initialTimeField") }
> //   Final time :
> //   { text("Nil", (updateFinalTime _)) % ("size" -> "60") % ("id" ->
> "finalTimeField") }
> //   { {?("Go")} %
> //("onclick" ->
> ajaxCall(JsRaw("$('#initialTimeField').attr('value')"), s =>
> updateInitialTime(s))) }
> //   
> //   {whatNode(evalStr())}
> // 
> //   }
>
> // attempt to resolve the problem by putting in a call to bind
>   def show(xhtml: NodeSeq): NodeSeq = {
> {
>   bind( "hello", xhtml,
>"initialTimeField" --> text("Nil", (updateInitialTime _)) % ("size"
> -> "60") % ("id" -> "initialTimeField"),
>"finalTimeField" --> text("Nil", (updateFinalTime _)) % ("size" ->
> "60") % ("id" -> "finalTimeField"),
>"submit" --> {?("Go")} % ("onclick"
> -> ajaxCall(JsRaw("$('#initialTimeField').attr('value')"), s =>
> updateInitialTime(s)))
>   )
> }
>   
>   {whatNode(evalStr())}
> 
>   }
> }
>
> --
> L.G. Meredith
> Managing Partner
> Biosimilarity LLC
> 1219 NW 83rd St
> Seattle, WA 98117
>
> +1 206.650.3740
>
> http://biosimilarity.blogspot.com
>
> >
>


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

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



[Lift] Re: timestamp versioning for javascript includes

2009-04-29 Thread Lee Mighdoll
> I think the browsers cache urls with params... a quick glance at the rails
>> docs suggest they expect these requests to be cached, though I haven't
>> tested it mysolf.
>>
>> I'd imagine this also needs to work for non-/classpath served files.  Does
>> that push us back to the params style?
>>
>
> No, because you can rewrite the incoming URLs back to what they should be.
>

So if I understand you correctly, "/date_{date_format}" will become magic
anywhere in url request paths.  so these work too:
classpath/js/date_2009_04_29_18_20/json.s   or
/foo/bar/date_2009_04_29_18_20/json.s.

That's ok with me, though it's a bit more aggressive to mess with the
segments of the mapping of the url path to file system path.

Potentially could use dates on directories then too, although I'm not quite
sure why.  e.g.  foo/date_2009_04_29_18_20/bar/json.js would check the
modification date of the bar directory..

Lee

--~--~-~--~~~---~--~~
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] namespace problem again

2009-04-29 Thread Meredith Gregory
Lifted,

i'm getting the following error. i've run into this before and resolved it,
but i can't for the life of me remember what i did. All my other lift sites
are constructed pretty much isomorphic to this one. Any help would be
greatly appreciated.

Best wishes,

--greg

XML Parsing Error: prefix not bound to a namespace
Location: http://localhost:8080/AJAXREPLForm
Line Number 78, Column 58:Initial time
:
-^


R-E-P-L

Initial time
:
Final time
:

Result: 



class REPLForm {
 // ...

// close to what i usually do
//   def show(xhtml: NodeSeq): NodeSeq = {
// 
//   Inital time :
//   { text("Nil", (updateInitialTime _)) % ("size" -> "60") % ("id" ->
"initialTimeField") }
//   Final time :
//   { text("Nil", (updateFinalTime _)) % ("size" -> "60") % ("id" ->
"finalTimeField") }
//   { {?("Go")} %
//("onclick" ->
ajaxCall(JsRaw("$('#initialTimeField').attr('value')"), s =>
updateInitialTime(s))) }
//   
//   {whatNode(evalStr())}
// 
//   }

// attempt to resolve the problem by putting in a call to bind
  def show(xhtml: NodeSeq): NodeSeq = {
{
  bind( "hello", xhtml,
   "initialTimeField" --> text("Nil", (updateInitialTime _)) % ("size"
-> "60") % ("id" -> "initialTimeField"),
   "finalTimeField" --> text("Nil", (updateFinalTime _)) % ("size" ->
"60") % ("id" -> "finalTimeField"),
   "submit" --> {?("Go")} % ("onclick" ->
ajaxCall(JsRaw("$('#initialTimeField').attr('value')"), s =>
updateInitialTime(s)))
  )
}
  
  {whatNode(evalStr())}

  }
}

-- 
L.G. Meredith
Managing Partner
Biosimilarity LLC
1219 NW 83rd St
Seattle, WA 98117

+1 206.650.3740

http://biosimilarity.blogspot.com

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



[Lift] Re: timestamp versioning for javascript includes

2009-04-29 Thread David Pollak
On Wed, Apr 29, 2009 at 10:03 AM, Lee Mighdoll  wrote:

>
>
>
>>
>> I'd rather have something like:
>>
>> /classpath/date_2009_04_29_18_20/json.js
>>
>
>>
>> There are a couple of advantages:
>>
>>- It's human readable
>>
>> Readable is worth a few bytes, I agree.   I like the date_ prefix too, it
> leaves room for using a hash approach at some future date.
>
>>
>>-
>>- It's better for caching as the browser can continue to cache the
>>file rather than making an HTTP request because of the params
>>
>> I think the browsers cache urls with params... a quick glance at the rails
> docs suggest they expect these requests to be cached, though I haven't
> tested it mysolf.
>
> I'd imagine this also needs to work for non-/classpath served files.  Does
> that push us back to the params style?
>

No, because you can rewrite the incoming URLs back to what they should be.


>
>
> Happy to try and make a snippet for this if it's useful for others.
>>
>>
>> Sure.
>>
>
> Glad to have a way to help.  Heading on vacation now, I'll give it a try
> next week.
>

Have a fun vacation.


>
>
>
>
> >
>


-- 
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: timestamp versioning for javascript includes

2009-04-29 Thread Lee Mighdoll
>
> I'd rather have something like:
>
> /classpath/date_2009_04_29_18_20/json.js
>

>
> There are a couple of advantages:
>
>- It's human readable
>
> Readable is worth a few bytes, I agree.   I like the date_ prefix too, it
leaves room for using a hash approach at some future date.

>
>-
>- It's better for caching as the browser can continue to cache the file
>rather than making an HTTP request because of the params
>
> I think the browsers cache urls with params... a quick glance at the rails
docs suggest they expect these requests to be cached, though I haven't
tested it mysolf.

I'd imagine this also needs to work for non-/classpath served files.  Does
that push us back to the params style?

Happy to try and make a snippet for this if it's useful for others.
>
>
> Sure.
>

Glad to have a way to help.  Heading on vacation now, I'll give it a try
next week.

--~--~-~--~~~---~--~~
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: timestamp versioning for javascript includes

2009-04-29 Thread David Pollak
On Wed, Apr 29, 2009 at 9:19 AM, Lee Mighdoll  wrote:

> I'm trying to avoid having to clear the browser cache when I change a
> javascript file.
>
> One approach is to append a timestamp to the script src tag in the html
> file.
>
>   
>
> becomes:
>
>   

[Lift] Re: Javascript "confirm(..)" dialog with ajaxButton

2009-04-29 Thread David Pollak
On Tue, Apr 28, 2009 at 10:39 PM, marius d.  wrote:

>
> Still there might be situations when users do not use blockUI (I
> encountered such situation when having a really fancy dialog) and
> blockUI was screwing it up a bit. So for more complex cases where the
> dialog function is much more complex I tend to think that we need
> something more generic.
>
> Oh and Dave's example could probably be simplified by using
> JqJsCmds.ModalDialog object


D'oh!  You're right!


>
>
> Br's,
> Marius
>
> On Apr 29, 2:43 am, David Pollak 
> wrote:
> > Here's an example of a confirm dialog box.  Hope it helps.
> >
> > PS -- I grew up in Rhode Island.
> >
> > On Tue, Apr 28, 2009 at 1:15 PM, Derek Chen-Becker <
> dchenbec...@gmail.com>wrote:
> >
> >
> >
> > > I agree. Allowing for a "guard" JavaScript expression to be called
> before
> > > the Ajax call is made would be nice.
> >
> > > Derek
> >
> > > On Tue, Apr 28, 2009 at 3:02 PM, marius d.  >wrote:
> >
> > >> Pretty much all SHtml function related to Ajax invokes the ajax call
> > >> as to click the link, button, etc. SHtml.ajaxCall function allow you
> > >> to provide a JsExp (which could be any JavScript expression) who's
> > >> result would be passed to the ajax call. But I don't think this will
> > >> help your case a whole lot.
> >
> > >> Maybe we can do another SHtml helper that would help your case. Such
> > >> as:
> >
> > >> 1. On click, we are calling a user defined Ajax function and pass to
> > >> it a function that does the actual Ajax call
> > >> 2 In your JS function (which would be the confirm function) you can
> > >> choose to call the function passed whenever you want, so you'd have
> > >> the liberty to actually do the ajax request or not.
> >
> > >> Of course you could implement this yourself quite easily but I think
> > >> it worth having something like that in SHtml for a simpler use.
> >
> > >> Looks to me that this would be a nice addition to SHtml.
> >
> > >> Br's,
> > >> Marius
> >
> > >> On Apr 28, 3:48 am, Chris  wrote:
> > >> > Hi Tim,
> > >> > just one addition. Wicket has something called an ajaxcall decorator
> > >> > (IAjaxCallDecorator) that allows you to modify the script and more
> > >> > specifically the "decorateScript" method allows you to prepend a
> char-
> > >> > sequence to the script. This would allow me to do exactly what I
> want.
> > >> > Is there any way in Lift to achieve the same thing? I'd really like
> to
> > >> > avoid dealing with JavaScript directly apart from something as
> trivial
> > >> > as the "confirm(...)" dialog or similar.
> > >> > Cheers, Chris.
> >
> > >> > On Apr 28, 9:56 am, Chris  wrote:
> >
> > >> > > Hi Tim,
> > >> > > not sure if I really got across what I need. I need the AJAX
> > >> > > functionality in this case as I'm displaying a large amount of
> data in
> > >> > > a table and would like to allow the user to delete individual
> records
> > >> > > without the refresh problem of having the button cause a POST. I
> also
> > >> > > need to make sure the user hasn't "accidentally" pressed "delete",
> > >> > > hence the "confirm(..)" dialog. Does option (1) above prevent the
> > >> > > subsequent call of the ajaxButton if the user presses "cancel" on
> the
> > >> > > JS "confirm" dialog, but allow it if he presses "OK"? Option (2)
> is
> > >> > > just a slightly different way of doing what I've already tried (I
> > >> > > added the "onclick" attribute to the ajaxButton call itself) and
> this
> > >> > > subsequently removes the actual AJAX call itself.
> > >> > > Thanks, Chris.
> >
> > >> > > On Apr 28, 9:22 am, Timothy Perrett 
> wrote:
> >
> > >> > > > Hey,
> >
> > >> > > > Seems like you have a couple of options...
> >
> > >> > > > 1. you could just write normal javascript irrespective of lift
> and
> > >> > > > just put that in a JS file like normal. Something like:
> >
> > >> > > > $('#mybutton').click(function(e){
> > >> > > >   confirm... //blah blah code here
> >
> > >> > > > });
> >
> > >> > > > 2. If you *really* want to use the on-click handler (personally
> I
> > >> > > > wouldn't) then you could do somethig like this in your snippet:
> >
> > >> > > > SHtml.ajaxButton("submit", () => println("badger")) % ("onclick"
> ->
> > >> > > > "confirm();")
> >
> > >> > > > I would highly recommend using option one as the functionality
> is
> > >> > > > purely a client side concern in that sense and nothing to do
> with
> > >> > > > lift. Does that help?
> >
> > >> > > > Cheers, Tim
> >
> > >> > > > On Apr 27, 11:29 pm, Chris  wrote:
> >
> > >> > > > > Hi there,
> > >> > > > > I'm pretty new to Lift and Scala for that matter, but have
> long
> > >> been
> > >> > > > > on the lookout for something like seaside running on the JVM
> and
> > >> this
> > >> > > > > is just great! Now to my issue...
> > >> > > > > I've hit a brick-wall in the attempt to get a confirmation
> dialog
> > >> > > > > working before executing an ajaxButton. I've tried adding an
> > >> "onclick"
> > >> > > > > attribute 

[Lift] Re: Javascript "confirm(..)" dialog with ajaxButton

2009-04-29 Thread David Pollak
On Wed, Apr 29, 2009 at 12:16 AM, marius d.  wrote:

>
> Ok,
>
> Here is what I'm thinking of:
>
>  def ajaxButton(text: NodeSeq, jsFunc: Call, func: () => JsCmd,
> attrs: (String, String)*): Elem = {
>
>val params = (name: String) => jsFunc.params ++ List(AnonFunc
> (makeAjaxCall(Str(name+"=true"
>
>attrs.foldLeft(fmapFunc(func)(name =>
> (name):_*)).toJsCmd + "; return false;"}>{text}))(_ % _)
>  }
>
>
> jsFunc impersonates a JavaScript function call. We are appending to
> the parameters list specified by the user the actual function that
> does the Ajax call.
>
> For exemplification here is a snippet function:
>
>  def button(xml: NodeSeq): NodeSeq = {
>  bind("f", xml,
>   "show" -> ajaxButton(Text("Press me"), Call("dialog", Str
> ("a param")), () => {println("pressed"); Noop})
>  )
>  }
>
> ... and here is the JavaScript function declaration:
>
>
>function dialog(name, theCall) {
>alert("Got " + name);
>theCall();
>}
>
>
> .. it could be any JS function from a .js file etc.
>
> In this example the actaul Ajax call is made after clicking OK button
> of the alert dialog.


Sounds good.  Please add it.


>
>
> Br's,
> Marius
> >
>


-- 
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] timestamp versioning for javascript includes

2009-04-29 Thread Lee Mighdoll
I'm trying to avoid having to clear the browser cache when I change a
javascript file.

One approach is to append a timestamp to the script src tag in the html
file.

  

becomes:

  

I'm told rails uses this approach.  Is there already a handy way to do this
in lift?  Or is there a better way?

Happy to try and make a snippet for this if it's useful for others.

Lee

--~--~-~--~~~---~--~~
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: developing Scala/Lift using Eclipse

2009-04-29 Thread Josh Suereth
Good catch!

Also if you just place your scala files in src/main/java (with your java
files) you would be ok.

On Wed, Apr 29, 2009 at 8:55 AM, David Bernard
wrote:

> Quick note :
>
> * You need to use build-helper-maven-plugin (like Josh shown) only for
> mixed project.
> * if you set in your
>   
> src/main/scala
> src/test/scala
>
> then the maven-eclipse-plugin use the right directory (archetype use this
> setup)
>
> my 2c
>
> /davidB
>
>
> On Wed, Apr 29, 2009 at 14:46, Josh Suereth wrote:
>
>> It should be innocuous.  (Assuming no typing errors).  It will also fix
>> some of your mvn eclipse:eclipse woes.
>>
>> Remember though, using mvn eclipse:eclipse does *not* give the "Scala IDE
>> for Eclipse" any chance to fix/edit its configuration.   Most eclipse
>> plugins assume they have full control over *their* configuration and when
>> doing things through eclipse APIs, they have a chance to respond and tweak
>> the project settings appropriately.   This means that any bugs you run into
>> in eclispe should be reproduced without using mvn eclipse:eclipse.  This is
>> why you should prefer eclipse plugins, rather than maven plugins, to do
>> integration between Scala + Maven + Eclipse.
>>
>> - Josh
>>
>>
>>
>>
>> On Wed, Apr 29, 2009 at 5:29 AM, Channing Walton 
>> wrote:
>>
>>>
>>> Can we fix our existing Lift project poms by adding the lump of xml
>>> you just posted, or will that break things?
>>>
>>>
>>>
>>
>>
>>
>
> >
>

--~--~-~--~~~---~--~~
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: developing Scala/Lift using Eclipse

2009-04-29 Thread David Bernard
Quick note :

* You need to use build-helper-maven-plugin (like Josh shown) only for mixed
project.
* if you set in your
  
src/main/scala
src/test/scala

then the maven-eclipse-plugin use the right directory (archetype use this
setup)

my 2c

/davidB

On Wed, Apr 29, 2009 at 14:46, Josh Suereth wrote:

> It should be innocuous.  (Assuming no typing errors).  It will also fix
> some of your mvn eclipse:eclipse woes.
>
> Remember though, using mvn eclipse:eclipse does *not* give the "Scala IDE
> for Eclipse" any chance to fix/edit its configuration.   Most eclipse
> plugins assume they have full control over *their* configuration and when
> doing things through eclipse APIs, they have a chance to respond and tweak
> the project settings appropriately.   This means that any bugs you run into
> in eclispe should be reproduced without using mvn eclipse:eclipse.  This is
> why you should prefer eclipse plugins, rather than maven plugins, to do
> integration between Scala + Maven + Eclipse.
>
> - Josh
>
>
>
>
> On Wed, Apr 29, 2009 at 5:29 AM, Channing Walton 
> wrote:
>
>>
>> Can we fix our existing Lift project poms by adding the lump of xml
>> you just posted, or will that break things?
>>
>>
>>
>
> >
>

--~--~-~--~~~---~--~~
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: Move common dependencies into parent POM?

2009-04-29 Thread David Pollak
On Wed, Apr 29, 2009 at 2:20 AM, Heiko Seeberger <
heiko.seeber...@googlemail.com> wrote:

> Hi,
> For my work on OSGi-fying Lift I took a closer look at the POMs. I noticed,
> that dependencies are duplicated across the modules, e.g. lift-util and
> lift-webkit both declare almost the same dependencies.
>
> What's the reason for that? Wouldn't it be better to move the common
> dependencies into the parent POM / multiple parent POMs?
>

Sure... if you can make that happen, wicked cool.

Note that some Lift modules (e.g., lift-textile) should not depend on
anything other than the base Scala distribution.


>
>
> Heiko
> --
> www.heikoseeberger.name
> OSGi on Scala: www.scalamodules.org
> Lift, the simply functional web framework: http://liftweb.net
>
> >
>


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

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



[Lift] Re: how to add object into session scope in lift

2009-04-29 Thread David Pollak
On Tue, Apr 28, 2009 at 11:07 PM, pravin karne wrote:

> hi,
> i want some explanation for following code
>
> object sessionObj extends SessionVar[HashMap[String, Int]](
>new HashMap[String, Int]
>  {
>   override def default(key: String): Int = 0
> }
> )
>

Changing a few things that Tim said.


>
> 1. how object extends class in scala.?


object creates a singleton... an instance of the class that can be shared
within the scope that it was created.  If object is used at the top-level
scope, then it is a singleton shared by all classes in that classloader
(your Lift app.)

In Scala everything is either an instance of an object or a method.  This
means there are no statics, no primitives, etc.  In order to have a
singleton instance shared within a classloader, use the object mechanism.


>
> 2. are we going to create object of SessionVar class?


Yes, we create a singleton instance of the SessionVar class.  The SessionVar
class uses a little machinery to access the backing store of your session.
 So, the SessionVar doesn't actually store a value.  It is a proxy that gets
the current session based on the context of your thread, it has a globally
unique name and uses this name to look up the underlying value in a hashmap
in the session and then casts it to the type of the specific SessionVar...
in this case HashMap[String, Int].  In this way, you have type-safe access
to session data.  This is a material advance over the way session data is
stored in a Java session... there's no casting on the user's part.


>
> 3. are we calling constructor of given class?


Yes.  However, if you take a look at the SessionVar's constructor, it's as
follows:

class SessionVar[T](dflt: => T)

This is a "call-by-name" parameter.  So, it's a function rather than a
value.  Why do we do this?  This allows us to create a new instance of the
default value of the SessionVar each time it's needed.  When you call the is
method on the SessionVar, Lift looks to see if the SessioVar has been
defined.  If it has not been defined, then the default value creator
function is applied and we get a new default value, the SessionVar for the
current session is set to that default value and the freshly minted value is
returned.


>
> 4. is it similar to java class which extends other class ,and then create
> object of subclass?


Scala creates a subclass of SessionVar for your singleton.  If you do
sessionObj.getClass.getName, it will not be SessionVar, but some
compiler-generated name.   See the answer to #1.



>
> I am beginner to scala and lift.
>
> Welcome to the community.

Thanks,

David


>
> On Tue, Apr 28, 2009 at 7:28 PM, Timothy Perrett 
> wrote:
>
>>
>>
>> Try:
>>
>> // this gets you whatever is in the session object so add to it here
>> SessionObj.is
>>
>> Do you specifically need to use Java HashMap? If not, seems like
>> List[(String,Int)] would be more lift-esq.
>>
>> Cheers, Tim
>>
>> On 28/04/2009 13:30, "pravin"  wrote:
>>
>> >
>> > Hi guys,
>> > I want to add objects into session scope.
>> >
>> > i am using following code :
>> >
>> > object sessionObj extends SessionVar[HashMap[String, Int]](
>> > new HashMap[String, Int]
>> >   {
>> >override def default(key: String): Int = 0
>> >  }
>> > )
>> >
>> > So as per my understanding :-
>> >
>> > 1. Session object is of HashMap[String, Int] type.
>> > 2. I want to add no of string object into above map so i can
>> > access them during my session
>> >
>> > correct me if i am wrong
>> >
>> >
>> >So please let me know how can i add/remove  different String object
>> > from session scope with above code snippet
>> >
>> > Thanks in advance
>> >
>> > >
>> >
>>
>>
>>
>>
>>
>
> >
>


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

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



[Lift] Re: developing Scala/Lift using Eclipse

2009-04-29 Thread Josh Suereth
It should be innocuous.  (Assuming no typing errors).  It will also fix some
of your mvn eclipse:eclipse woes.

Remember though, using mvn eclipse:eclipse does *not* give the "Scala IDE
for Eclipse" any chance to fix/edit its configuration.   Most eclipse
plugins assume they have full control over *their* configuration and when
doing things through eclipse APIs, they have a chance to respond and tweak
the project settings appropriately.   This means that any bugs you run into
in eclispe should be reproduced without using mvn eclipse:eclipse.  This is
why you should prefer eclipse plugins, rather than maven plugins, to do
integration between Scala + Maven + Eclipse.

- Josh



On Wed, Apr 29, 2009 at 5:29 AM, Channing Walton wrote:

>
> Can we fix our existing Lift project poms by adding the lump of xml
> you just posted, or will that break things?
>
> >
>

--~--~-~--~~~---~--~~
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 add object into session scope in lift

2009-04-29 Thread David Pollak
On Tue, Apr 28, 2009 at 10:57 PM, pravin karne wrote:

> what is the is+ method
>  sessionObj.is+ ("foo" -> 1)


sessionObj.is gets the contained object from the SessionVar.  In this case,
that object is a HashMap.

The + method is on HashMap:

http://www.scala-lang.org/docu/files/api/scala/collection/mutable/HashMap.html


>
> how it differ from sessionObj.is("foo" -> 1)
>

HashMap does not have an apply(p: Pair[??,??]) method, so this would not
compile.



>
> On Tue, Apr 28, 2009 at 8:33 PM, David Pollak <
> feeder.of.the.be...@gmail.com> wrote:
>
>>
>>
>> On Tue, Apr 28, 2009 at 5:30 AM, pravin  wrote:
>>
>>>
>>> Hi guys,
>>> I want to add objects into session scope.
>>>
>>> i am using following code :
>>>
>>> object sessionObj extends SessionVar[HashMap[String, Int]](
>>>new HashMap[String, Int]
>>>  {
>>>   override def default(key: String): Int = 0
>>> }
>>> )
>>>
>>> So as per my understanding :-
>>>
>>>1. Session object is of HashMap[String, Int] type.
>>>2. I want to add no of string object into above map so i can
>>> access them during my session
>>
>>
>> to add an object to this session var:
>>
>> sessionObj.is+ ("foo" -> 1)
>> sessionObj.is+ ("bar" -> 88)
>>
>> if (sessionObj.is.contains("bar")) println("yes, it works")
>>
>> The only caveat is that HashMap is not thread-safe and you might be
>> accessing this object from multiple threads at the same time.
>>
>>
>>
>>>
>>>
>>>correct me if i am wrong
>>>
>>>
>>>   So please let me know how can i add/remove  different String object
>>> from session scope with above code snippet
>>>
>>> Thanks in advance
>>>
>>>
>>>
>>
>>
>> --
>> Lift, the simply functional web framework http://liftweb.net
>> Beginning Scala http://www.apress.com/book/view/1430219890
>> Follow me: http://twitter.com/dpp
>> Git some: http://github.com/dpp
>>
>>
>>
>>
>
> >
>


-- 
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: REST and CDATA

2009-04-29 Thread David Pollak
On Wed, Apr 29, 2009 at 1:21 AM, Channing Walton wrote:

>
> Hi,
> I am building a rest service and running into trouble with cdata which
> is not a Lift issue but I was wondering what Lift had to support it.


It's the Scala parser.  It converts the contents of  blocks to
escaped XML.  For example:

scala> 

res5: scala.xml.Elem = dog & foo

If you absolutely need the CDATA in your XML (for example, this is necessary
in the browser when sending down JavaScript and CSS), you can use:


scala> {PCData("dogs & cats")}
{PCData("dogs & cats")}
res6: scala.xml.Elem = 

Thanks,

David

>
>
> I am trying to do something like this:
>
> def toXml() = {
>  
>
>  
>   }
>
> which comes out like this:
>
> { content.toString }
>
> Any help is appreciated.
>
> Channing
>
> >
>


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

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



[Lift] Re: how to add object into session scope in lift

2009-04-29 Thread Timothy Perrett


1. Object is like a static class in Java ­ but better.
2. Its not instantionation in that sense, so by proxy not "creation"
3. Scala objects have an apply method, of which, MyObject() is a shortcut
to. Think of it as being the same as MyObject.apply(...) etc.
4. It is indeed a subtype similar to subclassing in Java.

Does that help?

Cheers, Tim

On 29/04/2009 07:07, "pravin karne"  wrote:

> 1. how object extends class in scala.?
> 2. are we going to create object of SessionVar class?
> 3. are we calling constructor of given class?
> 4. is it similar to java class which extends other class ,and then create
> object of subclass?
> 
> I am beginner to scala and lift.



--~--~-~--~~~---~--~~
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: developing Scala/Lift using Eclipse

2009-04-29 Thread Channing Walton

Can we fix our existing Lift project poms by adding the lump of xml
you just posted, or will that break things?

--~--~-~--~~~---~--~~
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] REST and CDATA

2009-04-29 Thread Channing Walton

Hi,
I am building a rest service and running into trouble with cdata which
is not a Lift issue but I was wondering what Lift had to support it.

I am trying to do something like this:

def toXml() = {
  

  
   }

which comes out like this:

{ content.toString }

Any help is appreciated.

Channing

--~--~-~--~~~---~--~~
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 add object into session scope in lift

2009-04-29 Thread pravin karne
hi,
i want some explanation for following code

object sessionObj extends SessionVar[HashMap[String, Int]](
   new HashMap[String, Int]
 {
  override def default(key: String): Int = 0
}
)

1. how object extends class in scala.?
2. are we going to create object of SessionVar class?
3. are we calling constructor of given class?
4. is it similar to java class which extends other class ,and then create
object of subclass?

I am beginner to scala and lift.

On Tue, Apr 28, 2009 at 7:28 PM, Timothy Perrett wrote:

>
>
> Try:
>
> // this gets you whatever is in the session object so add to it here
> SessionObj.is
>
> Do you specifically need to use Java HashMap? If not, seems like
> List[(String,Int)] would be more lift-esq.
>
> Cheers, Tim
>
> On 28/04/2009 13:30, "pravin"  wrote:
>
> >
> > Hi guys,
> > I want to add objects into session scope.
> >
> > i am using following code :
> >
> > object sessionObj extends SessionVar[HashMap[String, Int]](
> > new HashMap[String, Int]
> >   {
> >override def default(key: String): Int = 0
> >  }
> > )
> >
> > So as per my understanding :-
> >
> > 1. Session object is of HashMap[String, Int] type.
> > 2. I want to add no of string object into above map so i can
> > access them during my session
> >
> > correct me if i am wrong
> >
> >
> >So please let me know how can i add/remove  different String object
> > from session scope with above code snippet
> >
> > Thanks in advance
> >
> > >
> >
>
>
>
> >
>

--~--~-~--~~~---~--~~
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 add object into session scope in lift

2009-04-29 Thread pravin karne
what is the is+ method
 sessionObj.is+ ("foo" -> 1)
how it differ from sessionObj.is("foo" -> 1)

On Tue, Apr 28, 2009 at 8:33 PM, David Pollak  wrote:

>
>
> On Tue, Apr 28, 2009 at 5:30 AM, pravin  wrote:
>
>>
>> Hi guys,
>> I want to add objects into session scope.
>>
>> i am using following code :
>>
>> object sessionObj extends SessionVar[HashMap[String, Int]](
>>new HashMap[String, Int]
>>  {
>>   override def default(key: String): Int = 0
>> }
>> )
>>
>> So as per my understanding :-
>>
>>1. Session object is of HashMap[String, Int] type.
>>2. I want to add no of string object into above map so i can
>> access them during my session
>
>
> to add an object to this session var:
>
> sessionObj.is+ ("foo" -> 1)
> sessionObj.is+ ("bar" -> 88)
>
> if (sessionObj.is.contains("bar")) println("yes, it works")
>
> The only caveat is that HashMap is not thread-safe and you might be
> accessing this object from multiple threads at the same time.
>
>
>
>>
>>
>>correct me if i am wrong
>>
>>
>>   So please let me know how can i add/remove  different String object
>> from session scope with above code snippet
>>
>> Thanks in advance
>>
>>
>>
>
>
> --
> Lift, the simply functional web framework http://liftweb.net
> Beginning Scala http://www.apress.com/book/view/1430219890
> Follow me: http://twitter.com/dpp
> Git some: http://github.com/dpp
>
>
> >
>

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



[Lift] Move common dependencies into parent POM?

2009-04-29 Thread Heiko Seeberger
Hi,
For my work on OSGi-fying Lift I took a closer look at the POMs. I noticed,
that dependencies are duplicated across the modules, e.g. lift-util and
lift-webkit both declare almost the same dependencies.

What's the reason for that? Wouldn't it be better to move the common
dependencies into the parent POM / multiple parent POMs?

Heiko
-- 
www.heikoseeberger.name
OSGi on Scala: www.scalamodules.org
Lift, the simply functional web framework: http://liftweb.net

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



[Lift] Re: Javascript "confirm(..)" dialog with ajaxButton

2009-04-29 Thread marius d.

Ok,

Here is what I'm thinking of:

  def ajaxButton(text: NodeSeq, jsFunc: Call, func: () => JsCmd,
attrs: (String, String)*): Elem = {

val params = (name: String) => jsFunc.params ++ List(AnonFunc
(makeAjaxCall(Str(name+"=true"

attrs.foldLeft(fmapFunc(func)(name =>
{text}))(_ % _)
  }


jsFunc impersonates a JavaScript function call. We are appending to
the parameters list specified by the user the actual function that
does the Ajax call.

For exemplification here is a snippet function:

  def button(xml: NodeSeq): NodeSeq = {
  bind("f", xml,
   "show" -> ajaxButton(Text("Press me"), Call("dialog", Str
("a param")), () => {println("pressed"); Noop})
  )
  }

... and here is the JavaScript function declaration:


function dialog(name, theCall) {
alert("Got " + name);
theCall();
}


.. it could be any JS function from a .js file etc.

In this example the actaul Ajax call is made after clicking OK button
of the alert dialog.

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